:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; transition: 0.15s ease; text-decoration: none !important; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* Alerts & Badges */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-draft, .badge-open { background: var(--warning-bg); color: #92400e; }
.badge-submitted { background: #dbeafe; color: #1e40af; }
.badge-posted, .badge-applied { background: var(--success-bg); color: #166534; }
.badge-low { background: var(--danger-bg); color: #991b1b; }
.badge-ok { background: var(--success-bg); color: #166534; }

/* Cards & Tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #f8fafc; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }

/* Public Layout & Landing Page */
body.public-body {
  background:
    radial-gradient(900px 420px at 82% -60px, rgba(37, 99, 235, 0.08), transparent 65%),
    var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  color: #fff;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: #fff !important; display: inline-flex; align-items: center; gap: 9px; text-decoration: none !important; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #2563eb, #0ea5e9); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35); }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: #38bdf8; display: inline-block; }
.topbar-links { display: flex; align-items: center; gap: 22px; }
.topbar-links a { color: #cbd5e1; font-size: 14px; font-weight: 500; text-decoration: none; transition: color 0.15s ease; }
.topbar-links a:hover { color: #fff; text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-ghost-dark { background: rgba(255, 255, 255, 0.07); color: #f8fafc; border-color: rgba(148, 163, 184, 0.25); }
.btn-ghost-dark:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

.container { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; }
.auth-card { max-width: 440px; margin: 40px auto; }

/* Landing Hero */
.lp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 40px;
  align-items: center;
  padding: 28px 0 44px;
}
.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}
.lp-eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }
.lp-hero-copy h1 {
  font-size: clamp(32px, 4.4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.032em;
  margin: 0 0 16px;
  color: #0f172a;
}
.lp-subtitle { font-size: 17px; line-height: 1.6; color: #475569; margin: 0 0 24px; max-width: 540px; }
.lp-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.lp-trust-row { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: #64748b; font-weight: 500; }

/* Product Mockup */
.lp-hero-visual { position: relative; padding-bottom: 36px; }
.mock-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.mock-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.mock-dots { display: flex; gap: 5px; }
.mock-dots span { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.mock-kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 14px; border-bottom: 1px solid #f1f5f9; }
.mock-kpi { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; }
.mock-kpi-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; color: #64748b; }
.mock-kpi-val { font-size: 18px; font-weight: 800; color: #0f172a; margin-top: 2px; }
.mock-rows { padding: 6px 14px 12px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.mock-row:last-child { border-bottom: none; }

.mock-phone {
  position: absolute;
  right: -8px;
  bottom: 0;
  width: 248px;
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.32);
}
.mock-phone-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mock-phone-pill { font-size: 9px; font-weight: 700; color: #38bdf8; background: rgba(56, 189, 248, 0.14); padding: 2px 7px; border-radius: 999px; }
.mock-scan-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; background: #020617; border: 1px solid #1e293b; border-left: 3px solid #22c55e; border-radius: 8px; margin-bottom: 8px; }
.mock-scan-next { background: #2563eb; color: #fff; font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.mock-result { background: #1e293b; border: 1px solid #22c55e; border-radius: 10px; padding: 10px; }

/* Stats Strip */
.lp-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 52px;
}
.lp-stat { padding: 4px 8px; border-right: 1px solid #f1f5f9; }
.lp-stat:last-child { border-right: none; }
.lp-stat-num { font-size: 17px; font-weight: 800; color: #0f172a; letter-spacing: -0.02em; }
.lp-stat-desc { font-size: 12px; color: #64748b; margin-top: 2px; }

/* Sections */
.lp-section { margin-bottom: 56px; }
.lp-section-head { max-width: 640px; margin-bottom: 24px; }
.lp-kicker { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #2563eb; margin-bottom: 6px; }
.lp-section-head h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.028em; line-height: 1.15; margin: 0 0 8px; color: #0f172a; }
.lp-section-head p { margin: 0; font-size: 15px; }

.lp-modes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.lp-feature-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.lp-feature-card:hover { transform: translateY(-2px); border-color: #cbd5e1; }
.lp-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.lp-feature-card h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.015em; }
.lp-feature-card p { margin: 0; font-size: 14px; line-height: 1.55; }

/* Steps */
.lp-steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-step-card { background: #ffffff; border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.lp-step-num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 800; color: #2563eb; background: #eff6ff; display: inline-block; padding: 3px 9px; border-radius: 6px; margin-bottom: 12px; }
.lp-step-card h3 { margin: 0 0 6px; font-size: 16px; }
.lp-step-card p { margin: 0; font-size: 14px; }

/* AI & MCP Showcase */
.lp-mcp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 36px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.lp-eyebrow-dark {
  background: #0f172a;
  border-color: #1e293b;
  color: #38bdf8;
}
.lp-mcp-copy h2 {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 12px;
  color: #0f172a;
}
.lp-mcp-lead {
  font-size: 15px;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 18px;
}
.lp-mcp-points {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lp-mcp-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
}
.lp-mcp-point-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Dark-Slate ChatGPT / Claude MCP Conversation Mockup */
.mock-chat {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
  color: #f8fafc;
}
.mock-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: #0b1120;
  border-bottom: 1px solid #1e293b;
}
.mock-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  min-width: 0;
  flex-wrap: wrap;
}
.mock-chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
  flex-shrink: 0;
}
.mock-chat-sep { color: #64748b; }
.mock-chat-badge {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mock-chat-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mock-msg-user {
  align-self: flex-end;
  max-width: 88%;
  background: #2563eb;
  color: #ffffff;
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px;
}
.mock-msg-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bfdbfe;
  margin-bottom: 3px;
}
.mock-msg-user p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}
.mock-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  overflow-x: auto;
}
.mock-tool-pill .mono { font-size: 12px; color: #e2e8f0; }
.mock-tool-ok {
  font-size: 10px;
  font-weight: 700;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.28);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.mock-msg-ai {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px 12px 12px 4px;
  padding: 14px;
}
.mock-msg-ai-lead {
  font-size: 13px;
  line-height: 1.5;
  color: #e2e8f0;
  margin-bottom: 10px;
}
.mock-msg-ai-lead strong { color: #ffffff; }
.mock-variant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mock-variant-row {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
}
.mock-variant-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.mock-variant-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}
.mock-variant-price {
  font-size: 13px;
  font-weight: 800;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
}
.mock-variant-whs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mock-wh-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}
.mock-wh-chip.is-ok {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.28);
  color: #cbd5e1;
}
.mock-wh-chip.is-ok strong { color: #4ade80; }
.mock-wh-chip.is-zero {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #cbd5e1;
}
.mock-wh-chip.is-zero strong { color: #fca5a5; }
.mock-chat-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: #0b1120;
  border-top: 1px solid #1e293b;
  font-size: 11px;
  color: #94a3b8;
}
.mock-chat-foot svg { flex-shrink: 0; color: #38bdf8; }

/* Developer Docs Portal Helpers (/docs) */
.docs-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: 76px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.docs-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 10px;
}
.docs-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.docs-sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.docs-sidebar a:hover {
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
}
.docs-sidebar a.active {
  background: #eff6ff;
  color: #1d4ed8;
}
.docs-code {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 12px 0;
}
.docs-code code {
  font-family: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
}

body.public-body :is(a, button):focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Demo Banner */
.lp-demo-banner {
  background: radial-gradient(600px 260px at 90% 10%, rgba(56, 189, 248, 0.16), transparent 65%), #0f172a;
  color: #f8fafc;
  border-radius: 18px;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.lp-demo-copy { max-width: 580px; }
.lp-demo-copy h2 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.025em; color: #fff; }
.lp-demo-copy p { margin: 0 0 14px; color: #cbd5e1; font-size: 15px; }
.lp-demo-creds { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: #94a3b8; }
.lp-demo-creds strong { color: #f8fafc; background: rgba(255, 255, 255, 0.08); padding: 2px 7px; border-radius: 5px; }
.lp-demo-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: #ffffff; margin-top: 24px; }
.site-footer-inner { max-width: 1120px; margin: 0 auto; padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.footer-brand { display: flex; align-items: center; gap: 8px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: #475569; font-weight: 500; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 800; margin-top: 6px; }

/* Control Panel Shell */
.panel-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column; padding: 18px 14px; flex-shrink: 0; }
.sidebar .brand { margin-bottom: 18px; padding: 4px 8px; }
.acct-box { background: #1e293b; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; }
.acct-name { font-weight: 700; font-size: 14px; color: #fff; }
.acct-slug { font-size: 12px; color: #94a3b8; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #cbd5e1 !important; font-size: 14px; font-weight: 500; margin-bottom: 4px; text-decoration: none !important; }
.nav-link:hover { background: #1e293b; color: #fff !important; }
.nav-link.active { background: #2563eb; color: #fff !important; }
.nav-divider { height: 1px; background: #1e293b; margin: 12px 0; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid #1e293b; font-size: 13px; color: #94a3b8; }
.panel-main { flex: 1; padding: 24px 28px; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-header h1 { margin: 0; font-size: 24px; }

/* PWA Dark Mobile-First Scanner UI */
body.pwa-body {
  background: #0b1120;
  color: #f8fafc;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

body.pwa-body :is(button, a, input, select, summary):focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* Sticky Top Header */
.pwa-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1e293b;
  padding-top: env(safe-area-inset-top, 0px);
}
.pwa-header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pwa-header-brand {
  min-width: 0;
  flex: 1;
}
.pwa-account-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pwa-account-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pwa-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  flex-shrink: 0;
}
.pwa-status-dot.is-offline {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28);
}
.pwa-status-dot.is-syncing {
  background: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.32);
}
.pwa-sync-meta {
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pwa-sync-btn {
  padding: 0 10px;
  font-size: 12px;
}
.pwa-sync-btn.is-offline {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
}
.pwa-sync-btn.is-syncing {
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}
.pwa-sync-btn.has-pending {
  border-color: rgba(245, 158, 11, 0.55);
}
.pwa-sync-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pwa-sync-badge[hidden] { display: none !important; }
.pwa-offline-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.pwa-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* PWA Buttons (thumb-friendly >= 38px) */
.pwa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}
.pwa-btn:active { transform: scale(0.97); }
.pwa-btn-primary { background: #2563eb; color: #fff; }
.pwa-btn-primary:hover { background: #1d4ed8; }
.pwa-btn-primary.is-active { background: #dc2626; }
.pwa-btn-primary.is-active:hover { background: #b91c1c; }
.pwa-btn-success { background: #16a34a; color: #fff; }
.pwa-btn-success:hover { background: #15803d; }
.pwa-btn-ghost {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
.pwa-btn-ghost:hover { background: #334155; color: #fff; }
.pwa-btn-accent {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.32);
}
.pwa-btn-accent:hover { background: rgba(56, 189, 248, 0.2); }
.pwa-btn-icon {
  width: 38px;
  min-width: 38px;
  padding: 0;
}
.pwa-btn-lg {
  min-height: 46px;
  padding: 0 18px;
  font-size: 15px;
  border-radius: 11px;
}
.pwa-btn-block { width: 100%; }

/* Main Container & Cards */
.pwa-container { max-width: 640px; margin: 0 auto; padding: 14px 14px 18px; }
.pwa-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(2, 6, 23, 0.28);
}
.pwa-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pwa-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #f8fafc;
  min-width: 0;
}
.pwa-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}

/* Dark-mode Inputs & Select */
.pwa-card input[type="text"],
.pwa-card input[type="number"],
.pwa-card select {
  min-height: 44px;
  padding: 10px 12px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 10px;
  font-size: 15px;
}
.pwa-card input::placeholder { color: #64748b; }
.pwa-card input:focus,
.pwa-card select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}
.pwa-card select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Scan Input Row (aligned 44px controls, zero overflow) */
.pwa-scan-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.pwa-scan-row input[data-scan-input="true"] {
  flex: 1;
  min-width: 0;
}
.pwa-qty-input {
  width: 64px !important;
  flex-shrink: 0;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.pwa-scan-submit {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
}

/* Sub-form Drawer inside Card */
.pwa-subform {
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid #334155;
  border-radius: 12px;
}
.pwa-subform[hidden] { display: none !important; }
.pwa-subform .form-group { margin-bottom: 10px; }
.pwa-subform .form-group label { color: #cbd5e1; font-size: 12px; }

/* Dark-mode Alerts & Badges */
body.pwa-body .alert {
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}
body.pwa-body .alert-success {
  background: rgba(22, 163, 74, 0.16);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}
body.pwa-body .alert-error {
  background: rgba(220, 38, 38, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
}
body.pwa-body .alert-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
body.pwa-body .badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
body.pwa-body .badge-draft,
body.pwa-body .badge-open { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.28); }
body.pwa-body .badge-submitted { background: rgba(56, 189, 248, 0.16); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
body.pwa-body .badge-posted,
body.pwa-body .badge-applied,
body.pwa-body .badge-ok { background: rgba(34, 197, 94, 0.16); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
body.pwa-body .badge-low { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.32); }
body.pwa-body .text-danger { color: #f87171; }
body.pwa-body .text-success { color: #4ade80; }

/* Price Result & Empty State */
.pwa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 22px 16px;
  color: #94a3b8;
  font-size: 13px;
}
.pwa-empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pwa-price-card { border-color: rgba(34, 197, 94, 0.55); }
.pwa-price-big {
  font-size: 34px;
  font-weight: 800;
  color: #4ade80;
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.pwa-price-cost {
  font-size: 18px;
  font-weight: 700;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

/* Live Camera Scanner Box */
.scanner-box {
  position: relative;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
}
.scanner-video-wrap { position: relative; width: 100%; background: #020617; }
.scanner-video-wrap[hidden],
.scanner-video[hidden],
#html5qr-reader[hidden] { display: none !important; }
.scanner-video { width: 100%; height: 200px; object-fit: cover; display: block; background: #020617; }
#html5qr-reader {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
  background: #020617;
}
#html5qr-reader video {
  width: 100% !important;
  height: 200px !important;
  object-fit: cover !important;
  display: block !important;
}
.scanner-guide {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.scanner-reticle {
  width: 82%;
  height: 56%;
  border: 2px solid rgba(56, 189, 248, 0.92);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.48), inset 0 0 0 1px rgba(56, 189, 248, 0.25);
  position: relative;
}
.scanner-laser {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8 20%, #38bdf8 80%, transparent);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.75);
}
.scanner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #0f172a;
  border-top: 1px solid #1e293b;
}
.scanner-status {
  font-size: 12px;
  color: #94a3b8;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scanner-toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.scanner-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.scanner-pill:hover { background: #334155; }
.scanner-pill.active {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border-color: #38bdf8;
}
.scanner-paused-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #0f172a;
  border-left: 3px solid #22c55e;
}
.scanner-paused-bar[hidden] { display: none !important; }
.scanner-paused-info { min-width: 0; flex: 1; }
.scanner-paused-label {
  font-size: 11px;
  color: #4ade80;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scanner-paused-code {
  font-size: 13px;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scanner-paused-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Quick Test Chips */
.sample-details { margin-top: 12px; padding-top: 10px; border-top: 1px solid #273549; }
.sample-details summary {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}
.sample-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.chip:hover { border-color: #38bdf8; color: #fff; background: rgba(56, 189, 248, 0.1); }

/* Scanned Document / Count Line Items & Segmented Stepper */
.pwa-doc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid #334155;
}
.pwa-doc-summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.pwa-doc-total {
  font-weight: 800;
  font-size: 15px;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.pwa-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.75);
}
.pwa-line:last-child { border-bottom: none; }
.pwa-line-info { min-width: 0; flex: 1; }
.pwa-line-name {
  font-weight: 600;
  font-size: 14px;
  color: #f8fafc;
  line-height: 1.3;
  word-break: break-word;
}
.pwa-line-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
.qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  flex-shrink: 0;
}
.qty-ctrl-readonly {
  background: transparent;
  border: none;
  padding: 0;
  font-weight: 700;
  font-size: 14px;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #1e293b;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qty-btn:hover { background: #334155; }
.qty-btn:active { background: #2563eb; color: #fff; }
.qty-val {
  min-width: 30px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}
.pwa-card-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #334155;
}

/* Product Size & Color Variants (Control Panel + PWA Price Check) */
.variant-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.variant-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.pwa-variant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pwa-variant-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(56, 189, 248, 0.14);
  color: #e2e8f0;
  border: 1px solid rgba(56, 189, 248, 0.32);
}
.pwa-variant-chip strong { color: #ffffff; }
.pwa-variants-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #334155;
}
.pwa-variants-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 10px;
}
.pwa-variants-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.pwa-variant-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  min-height: 54px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pwa-variant-btn:hover {
  border-color: #38bdf8;
  background: #172554;
}
.pwa-variant-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
.pwa-variant-btn.is-current {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
}
.pwa-variant-btn.is-oos {
  opacity: 0.72;
}
.pwa-variant-label {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}
.pwa-variant-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  font-size: 11px;
}
.pwa-variant-stock { font-weight: 700; }
.pwa-variant-stock.is-ok { color: #4ade80; }
.pwa-variant-stock.is-low { color: #fbbf24; }
.pwa-variant-stock.is-zero { color: #f87171; }
.pwa-variant-price { color: #cbd5e1; font-size: 11px; }

/* Bottom Tab Bar */
.pwa-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #1e293b;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.pwa-nav-inner {
  max-width: 640px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.pwa-tab {
  position: relative;
  background: none;
  border: none;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pwa-tab:hover { color: #e2e8f0; }
.pwa-tab.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}
.pwa-tab .tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

@media (max-width: 390px) {
  .pwa-header-inner { padding: 10px 12px; gap: 8px; }
  .pwa-btn { padding: 0 10px; font-size: 12px; }
  .pwa-container { padding: 12px 12px 16px; }
  .pwa-card { padding: 14px; }
  .pwa-tab { font-size: 10px; }
}

@media (max-width: 860px) {
  .panel-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .panel-main { padding: 16px; }
  .topbar-links { display: none; }
  .lp-hero { grid-template-columns: 1fr; gap: 28px; padding: 14px 0 28px; }
  .lp-hero-visual { padding-bottom: 16px; }
  .mock-phone { position: relative; right: auto; bottom: auto; width: 100%; margin-top: 12px; }
  .lp-stats-strip { grid-template-columns: repeat(2, 1fr); }
  .lp-stat { border-right: none; border-bottom: 1px solid #f1f5f9; padding: 8px 4px; }
  .lp-stat:nth-last-child(-n+2) { border-bottom: none; }
  .lp-modes-grid, .lp-steps-grid { grid-template-columns: 1fr; }
  .lp-mcp-grid { grid-template-columns: 1fr; gap: 24px; padding: 22px 18px; }
  .docs-layout { grid-template-columns: 1fr; gap: 20px; }
  .docs-sidebar { position: static; }
  .lp-demo-banner { padding: 24px 20px; }
}

@media (max-width: 420px) {
  .lp-mcp-grid { padding: 18px 14px; }
  .mock-chat-body { padding: 12px; }
  .mock-msg-user { max-width: 100%; }
  .mock-tool-pill { font-size: 11px; padding: 5px 9px; }
}
