* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #0d6efd;
  --primary-dark: #0a4fb8;
  --teal: #14b8a6;
  --dark: #0f172a;
  --gray: #64748b;
  --light: #f8fafc;
  --border: #e2e8f0;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Sarabun', -apple-system, sans-serif;
  color: var(--dark);
  line-height: 1.6;
  background: #fff;
}

/* Navbar */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-container {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
}
.logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.25rem; color: var(--primary);
  text-decoration: none;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700;
}
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--dark); text-decoration: none; font-weight: 400;
  transition: color .2s;
}
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* Hero */
.hero {
  min-height: 100vh;
  padding: 8rem 2rem 4rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -50%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(20,184,166,0.15), transparent 70%);
  border-radius: 50%;
}
.hero-container {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 4rem; align-items: center;
  position: relative; z-index: 1;
}
.hero-badge {
  display: inline-block;
  background: white; color: var(--primary);
  padding: .4rem 1rem; border-radius: 999px;
  font-size: .875rem; font-weight: 600;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: 3rem; font-weight: 700; line-height: 1.2;
  margin-bottom: 1.5rem;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 1.15rem; color: var(--gray);
  margin-bottom: 2rem; max-width: 540px;
}
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn {
  padding: .85rem 1.75rem; border-radius: 8px;
  font-weight: 600; text-decoration: none;
  transition: all .2s; display: inline-block;
  cursor: pointer; border: none; font-size: 1rem;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary); color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-outline {
  background: white; color: var(--primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); }

/* Hero visual */
.hero-visual {
  position: relative;
  height: 400px;
}
.visual-card {
  position: absolute;
  background: white;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 40px rgba(15,23,42,0.1);
  border: 1px solid var(--border);
}
.card-1 { top: 0; left: 0; width: 240px; animation: float 6s ease-in-out infinite; }
.card-2 { top: 130px; right: 0; width: 260px; animation: float 6s ease-in-out infinite .8s; }
.card-3 { bottom: 0; left: 40px; width: 250px; animation: float 6s ease-in-out infinite 1.6s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.card-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; margin-bottom: .75rem;
}
.card-title { font-weight: 600; margin-bottom: .25rem; font-size: .95rem; }
.card-desc { font-size: .8rem; color: var(--gray); }

/* Sections */
section { padding: 5rem 2rem; }
.container { max-width: 1200px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3.5rem; }
.section-tag {
  color: var(--teal); font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  font-size: .85rem; margin-bottom: .75rem;
}
.section-header h2 {
  font-size: 2.25rem; font-weight: 700; margin-bottom: 1rem;
}
.section-header p {
  color: var(--gray); max-width: 640px; margin: 0 auto;
  font-size: 1.05rem;
}

/* Services */
#services { background: var(--light); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.service-card {
  background: white; border-radius: 16px;
  padding: 2.5rem 2rem; border: 1px solid var(--border);
  transition: transform .3s, box-shadow .3s;
  position: relative; overflow: hidden;
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(15,23,42,0.08);
}
.service-number {
  position: absolute; top: 1rem; right: 1.5rem;
  font-size: 4rem; font-weight: 700;
  color: var(--light);
  line-height: 1;
}
.service-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.75rem;
  margin-bottom: 1.5rem;
  position: relative; z-index: 1;
}
.service-card h3 {
  font-size: 1.35rem; margin-bottom: .75rem;
  position: relative; z-index: 1;
}
.service-card p {
  color: var(--gray); font-size: .98rem;
  position: relative; z-index: 1;
}
.service-card ul {
  list-style: none; margin-top: 1rem;
  position: relative; z-index: 1;
}
.service-card li {
  color: var(--gray); font-size: .9rem;
  padding: .35rem 0; padding-left: 1.25rem;
  position: relative;
}
.service-card li::before {
  content: '✓'; position: absolute; left: 0;
  color: var(--teal); font-weight: 700;
}

/* How it works */
#how { background: white; }
.flow-diagram {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center; gap: 1rem;
  margin-top: 3rem;
}
.flow-node {
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  text-align: center;
}
.flow-node-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.flow-node h4 { margin-bottom: .5rem; font-size: 1.1rem; }
.flow-node p { font-size: .85rem; color: var(--gray); }
.flow-arrow { font-size: 1.75rem; color: var(--teal); font-weight: 700; }

/* About */
#about { background: var(--light); }
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4rem; align-items: center;
}
.about-text h2 { font-size: 2.25rem; margin-bottom: 1.5rem; }
.about-text p { color: var(--gray); margin-bottom: 1rem; font-size: 1.05rem; }
.stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem; margin-top: 2rem;
}
.stat {
  background: white; padding: 1.5rem;
  border-radius: 12px; border: 1px solid var(--border);
}
.stat-num {
  font-size: 2rem; font-weight: 700;
  color: var(--primary); line-height: 1;
}
.stat-label { color: var(--gray); font-size: .9rem; margin-top: .5rem; }
.about-visual {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  border-radius: 20px; padding: 3rem;
  color: white;
  box-shadow: 0 20px 50px rgba(13,110,253,0.2);
}
.about-visual h3 { font-size: 1.5rem; margin-bottom: 1rem; }
.tech-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: .75rem; margin-top: 1.5rem;
}
.tech-item {
  background: rgba(255,255,255,0.15);
  padding: .65rem 1rem; border-radius: 8px;
  font-size: .9rem; backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: .5rem;
}

/* Contact */
#contact { background: var(--dark); color: white; text-align: center; }
#contact h2 { font-size: 2.25rem; margin-bottom: 1rem; }
#contact p { color: #94a3b8; margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.contact-info {
  display: flex; justify-content: center; gap: 3rem;
  flex-wrap: wrap; margin-top: 2rem;
}
.contact-item { color: #cbd5e1; }
.contact-item strong { color: white; display: block; margin-bottom: .25rem; }

/* Footer */
footer {
  background: #020617; color: #94a3b8;
  padding: 2rem; text-align: center;
  font-size: .9rem;
}

/* API page */
.page-header {
  padding: 8rem 2rem 4rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
  text-align: center;
  position: relative; overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute; top: -30%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(20,184,166,0.12), transparent 70%);
  border-radius: 50%;
}
.page-header-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.page-header h1 {
  font-size: 2.75rem; font-weight: 700; margin-bottom: 1rem;
}
.page-header h1 .accent {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-header p { color: var(--gray); font-size: 1.1rem; }
.breadcrumb {
  display: inline-flex; gap: .5rem; align-items: center;
  font-size: .9rem; color: var(--gray); margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* API Customer Selection */
#api-select { background: var(--light); padding-top: 4rem; padding-bottom: 5rem; }
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 2rem;
}
.customer-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  border: 2px solid var(--border);
  text-decoration: none;
  color: var(--dark);
  display: block;
  transition: all .3s;
  position: relative; overflow: hidden;
}
.customer-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  transform: scaleX(0); transform-origin: left;
  transition: transform .35s ease;
}
.customer-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px);
  box-shadow: 0 25px 60px rgba(13,110,253,0.15);
}
.customer-card:hover::before { transform: scaleX(1); }
.customer-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: white;
  margin-bottom: 1.25rem;
}
.customer-logo.lab-plus {
  background: linear-gradient(135deg, var(--primary), var(--teal));
}
.customer-logo.firmer {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
}
.customer-card h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: .35rem; }
.customer-card .customer-sub {
  font-size: .85rem; color: var(--gray);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 1rem;
}
.customer-card .customer-desc {
  color: var(--gray); font-size: .95rem;
  margin-bottom: 1.5rem; line-height: 1.6;
}
.customer-tags {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-bottom: 1.5rem;
}
.customer-tag {
  background: var(--light); color: var(--dark);
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .78rem; border: 1px solid var(--border);
}
.customer-cta {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--primary); font-weight: 600;
  font-size: .95rem;
}
.customer-card:hover .customer-cta { gap: .85rem; }

/* API Endpoints */
#api-list { background: var(--light); }
.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 2rem;
}
.api-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15,23,42,0.04);
  transition: transform .3s, box-shadow .3s;
}
.api-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(15,23,42,0.08);
}
.api-header {
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}
.api-method {
  font-family: 'Courier New', monospace;
  font-weight: 700; font-size: .85rem;
  padding: .35rem .75rem; border-radius: 6px;
  color: white; min-width: 64px; text-align: center;
}
.method-post { background: #16a34a; }
.method-get { background: #2563eb; }
.api-path {
  font-family: 'Courier New', monospace;
  font-weight: 600; font-size: 1rem;
  color: var(--dark); flex: 1;
  word-break: break-all;
}
.api-body { padding: 1.5rem; }
.api-title { font-size: 1.15rem; font-weight: 600; margin-bottom: .5rem; }
.api-desc { color: var(--gray); font-size: .95rem; margin-bottom: 1.25rem; }
.api-section-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  color: var(--gray); letter-spacing: 1px;
  margin-bottom: .5rem; margin-top: 1rem;
}
.api-table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem; margin-bottom: .5rem;
}
.api-table th, .api-table td {
  text-align: left; padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
}
.api-table th {
  background: var(--light); font-weight: 600;
  color: var(--dark); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .5px;
}
.api-table code {
  font-family: 'Courier New', monospace;
  background: #eff6ff; color: var(--primary);
  padding: .15rem .4rem; border-radius: 4px;
  font-size: .85rem;
}
.code-block {
  background: #0f172a; color: #e2e8f0;
  padding: 1rem 1.25rem; border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: .85rem; line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.code-block .key { color: #7dd3fc; }
.code-block .str { color: #86efac; }
.code-block .num { color: #fbbf24; }
.code-block .cmt { color: #64748b; font-style: italic; }

/* Dashboard (embedded in firmer page) */
#dashboard { background: white; }
.dash-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.dash-head .meta { color: var(--gray); font-size: .9rem; }
.refresh-hint { display: inline-flex; align-items: center; gap: .35rem; color: var(--gray); font-size: .8rem; margin-left: .75rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; animation: pulse 1.6s ease-in-out infinite; display: inline-block; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.endpoint-info {
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: .9rem; line-height: 1.8;
}
.endpoint-info code {
  font-family: 'Courier New', monospace;
  background: white; padding: .15rem .4rem;
  border-radius: 4px; border: 1px solid var(--border);
  word-break: break-all;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--primary);
}
.stat-card.warn    { border-left-color: #f59e0b; }
.stat-card.fail    { border-left-color: #dc2626; }
.stat-card.success { border-left-color: #16a34a; }
.stat-card .lbl {
  font-size: .8rem; color: var(--gray);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.stat-card .num {
  font-size: 2.25rem; font-weight: 700;
  color: var(--dark); line-height: 1; margin-top: .35rem;
}

.panel-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }
.panel {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.panel-head {
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
  background: #f8fafc; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.panel-head .badge {
  background: var(--primary); color: white;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.panel-body { padding: 0; max-height: 380px; overflow-y: auto; }
.log-line {
  padding: .5rem 1.25rem;
  font-family: 'Courier New', monospace; font-size: .82rem;
  border-bottom: 1px solid #f1f5f9;
  word-break: break-all; line-height: 1.5;
}
.log-line:last-child { border-bottom: none; }
.log-line.ok   { background: #f0fdf4; color: #14532d; }
.log-line.fail { background: #fef2f2; color: #7f1d1d; }
.log-line.warn { background: #fffbeb; color: #78350f; }
.empty { padding: 2rem 1.25rem; text-align: center; color: var(--gray); }
.file-row {
  padding: .65rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; border-bottom: 1px solid #f1f5f9; font-size: .9rem;
}
.file-row:last-child { border-bottom: none; }
.file-row .name { font-family: 'Courier New', monospace; color: var(--dark); word-break: break-all; }
.file-row .meta-r { color: var(--gray); font-size: .8rem; white-space: nowrap; }

/* Status pills (queued, etc.) */
.status-pill {
  display: inline-block;
  font-family: 'Sarabun', sans-serif;
  font-size: .7rem; font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 999px;
  margin-left: .5rem;
  vertical-align: middle;
}
.status-queued { background: #fef3c7; color: #92400e; }
.status-sent   { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #991b1b; }

.countdown {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  margin-left: .35rem;
}

/* Mini buttons (Send All, Send per file) */
.btn-mini {
  padding: .25rem .65rem;
  font-size: .78rem; font-weight: 600;
  border: 1px solid var(--border);
  background: white; color: var(--dark);
  border-radius: 6px; cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-mini:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-mini-primary {
  background: var(--primary); color: white; border-color: var(--primary);
}
.btn-mini-primary:hover { background: var(--primary-dark); }

/* Flash messages */
.flash {
  padding: .85rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: .95rem;
  border-left: 4px solid;
}
.flash-ok   { background: #f0fdf4; color: #14532d; border-color: #16a34a; }
.flash-fail { background: #fef2f2; color: #7f1d1d; border-color: #dc2626; }
.flash-warn { background: #fffbeb; color: #78350f; border-color: #f59e0b; }

.dash-login {
  max-width: 420px; margin: 1rem auto 0;
  background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 2rem;
  text-align: center;
}
.dash-login h3 { margin-bottom: .5rem; }
.dash-login p { color: var(--gray); margin-bottom: 1.5rem; }
.dash-login form { display: flex; gap: .5rem; }
.dash-login input[type="password"] {
  flex: 1; padding: .7rem 1rem; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: 1rem;
}
.dash-login input[type="password"]:focus {
  outline: none; border-color: var(--primary);
}

/* Responsive */
@media (max-width: 900px) {
  .hero h1 { font-size: 2.25rem; }
  .hero-container, .about-grid { grid-template-columns: 1fr; gap: 3rem; }
  .hero-visual { height: 320px; }
  .flow-diagram { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); margin: .5rem auto; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: white; flex-direction: column; padding: 1rem 2rem; border-bottom: 1px solid var(--border); }
  .nav-links.active { display: flex; }
  .menu-toggle { display: block; }
  section { padding: 4rem 1.5rem; }
  .page-header h1 { font-size: 2rem; }
}
@media (max-width: 500px) {
  .hero { padding: 7rem 1.5rem 3rem; }
  .hero h1 { font-size: 1.85rem; }
  .section-header h2 { font-size: 1.75rem; }
}
