/* Admeshio Design System v2 — Dense, professional, B2B */

/* ================================================================
   Reset & Base
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0e1117;
  --bg-card: #161b22;
  --bg-elevated: #1c2128;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-light: #21262d;

  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --green-bg: rgba(63,185,80,0.12);
  --yellow: #d29922;
  --yellow-bg: rgba(210,153,34,0.12);
  --red: #f85149;
  --red-bg: rgba(248,81,73,0.12);

  --radius: 6px;
  --radius-lg: 8px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;

  --header-h: 48px;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  font-size: 1.0625rem;  /* 17px — slightly larger than browser default 16px */
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ================================================================
   Typography — compact
   ================================================================ */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }

/* Lists — reset removed default padding; restore with inside bullets */
ul, ol { padding-left: 1.5em; }
ul { list-style-position: outside; }
ol { list-style-position: outside; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-secondary); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.8rem; }

/* ================================================================
   Layout
   ================================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ================================================================
   Header
   ================================================================ */
.site-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-header .brand-text { white-space: nowrap; }
.site-header .brand-accent { color: var(--accent); }
.site-header .brand-logo {
  width: 24px;
  height: 24px;
  display: block;
}
.site-header nav { display: flex; align-items: center; gap: 24px; }
.site-header nav a {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.15s;
}
.site-header nav a:hover { color: var(--text); }
.site-header nav .lang-toggle {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 4px;
  border: none;
  color: var(--text-muted);
  opacity: 0.7;
  transition: color 0.15s, opacity 0.15s;
}
.site-header nav .lang-toggle:hover { color: var(--accent); opacity: 1; }

/* ---- Mobile nav (hamburger + drawer) ---- */
/* Hamburger button: 3 horizontal bars. Hidden on desktop, shown <= 820px.
   Three transform rules turn the bars into an X when .nav-open is set. */
.site-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 40px;
  height: 36px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.site-nav-toggle-bar {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .site-nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .site-nav-toggle-bar:nth-child(2) { opacity: 0; }
body.nav-open .site-nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer slides in from the right. Fixed so it overlays page content. */
.site-nav-mobile {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(86vw, 320px);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
  overflow-y: auto;
  padding: 72px 20px 32px;
}
.site-nav-mobile-inner { display: flex; flex-direction: column; gap: 18px; }
.site-nav-mobile a {
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  padding: 4px 0;
}
.site-nav-mobile a:hover { color: var(--accent); }
.site-nav-mobile .lang-toggle-mobile {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.site-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.2s;
}
body.nav-open .site-nav-mobile { transform: translateX(0); }
body.nav-open .site-nav-backdrop { opacity: 1; }
body.nav-open { overflow: hidden; }

/* Backdrop only blocks clicks when drawer is actually open. CSS was
   showing it as display:block on mobile at all times, catching taps
   on the hamburger button. Gate on body.nav-open. */
.site-nav-backdrop { pointer-events: none; }
body.nav-open .site-nav-backdrop { pointer-events: auto; }

/* Breakpoint: desktop nav hides, hamburger + drawer take over. 820px
   matches the content-page container width so tablets in landscape
   (iPad ~1024) stay on desktop layout. Selectors use .site-header
   prefix to outrank the base .site-header nav rule above (which sets
   display:flex with equal-or-higher specificity otherwise). */
@media (max-width: 820px) {
  .site-header .site-nav-desktop { display: none; }
  .site-header .site-nav-toggle { display: flex; }
  .site-nav-mobile { display: block; }
  .site-nav-backdrop { display: block; }
}

/* ================================================================
   Buttons
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-elevated); border-color: var(--text-muted); color: var(--text); }
.btn-primary {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
  font-weight: 600;
}
.btn-primary:hover { background: #388bfd; border-color: #388bfd; color: #fff; }
.btn-lg { padding: 10px 20px; font-size: 0.9375rem; }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }

/* ================================================================
   Cards
   ================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card-compact { padding: 12px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ================================================================
   Status badges
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-pass { background: var(--green-bg); color: var(--green); }
.badge-warn { background: var(--yellow-bg); color: var(--yellow); }
.badge-fail { background: var(--red-bg); color: var(--red); }
.badge-info { background: rgba(88,166,255,0.12); color: var(--accent); }

.nfp-banner {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.nfp-banner strong { color: var(--yellow); }

/* ================================================================
   Diagnosis result — DENSE, at-a-glance
   ================================================================ */
.diagnosis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.diagnosis-grid .cell {
  background: var(--bg-card);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.diagnosis-grid .cell-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.diagnosis-grid .cell-value {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.diagnosis-grid .cell-full {
  grid-column: 1 / -1;
}

/* Score bar */
.score-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.score-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.score-ring.warn { border-color: var(--yellow); color: var(--yellow); }
.score-ring.fail { border-color: var(--red); color: var(--red); }

/* Issue list — compact rows */
.issue-list { list-style: none; padding-left: 0; }
.issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}
.issue-row:last-child { border-bottom: none; }
.issue-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
}
.issue-icon.pass { background: var(--green-bg); color: var(--green); }
.issue-icon.warn { background: var(--yellow-bg); color: var(--yellow); }
.issue-icon.fail { background: var(--red-bg); color: var(--red); }
.issue-label { flex: 1; }
.issue-value { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); }
.issue-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); min-width: 2em; text-align: right; }

/* Clickable issue rows */
.issue-clickable { cursor: pointer; border-radius: 4px; padding: 6px 4px; transition: background 0.1s; }
.issue-clickable:hover { background: var(--bg-hover); }
.issue-clickable.active { background: #1a2a3a; }
.issue-action { justify-content: center; margin-top: 4px; }

/* Color legend */
.color-legend { display: flex; gap: 12px; margin-bottom: 8px; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* X-ray button active state */
.viewer-toolbar .btn.active { background: var(--accent); color: var(--bg); }

/* Badge variant for info severity */
.badge-info { background: rgba(96,165,250,0.12); color: #60a5fa; }

/* Deep Analysis tag in issue list */
.deep-analysis-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  padding: 6px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(88,166,255,0.2);
}

/* Collapsible section (Quick Check) */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  user-select: none;
}
.collapsible-header:hover { color: var(--text-secondary); }
.collapsible-arrow {
  font-size: 0.5rem;
  transition: transform 0.15s;
}
.collapsible-body {
  transition: none;
}

/* ================================================================
   Repair tab
   ================================================================ */

/* Clean status */
.repair-status-card { text-align: center; padding: 24px 16px; border-radius: 6px; border: 1px solid var(--border-light); }
.repair-status-card.clean { border-color: rgba(63,185,80,0.2); background: rgba(63,185,80,0.04); }
.repair-status-icon { font-size: 1.5rem; margin-bottom: 6px; }
.repair-status-title { font-weight: 600; margin-bottom: 4px; }
.repair-status-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* Fix list */
.repair-fixes { margin-bottom: 12px; }
.repair-fix-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}
.repair-fix-row:last-child { border-bottom: none; }
.repair-fix-icon { flex-shrink: 0; font-size: 0.75rem; }
.repair-fix-label { flex: 1; }
.repair-fix-meta { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }
.repair-estimate {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; margin-top: 4px; font-size: 0.8125rem; color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
}

/* Repair CTA button */
.repair-cta { width: 100%; justify-content: center; margin-bottom: 16px; }

/* Upsell section */
.repair-upsell { margin-top: 4px; }
.upsell-divider {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; font-size: 0.6875rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.upsell-divider::before, .upsell-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-light);
}
.upsell-text { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }

/* Tier cards */
.upsell-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.upsell-tier {
  display: block; padding: 12px; border-radius: 6px; text-align: center; text-decoration: none;
  border: 1px solid var(--border); background: var(--bg-card); transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.upsell-tier:hover { border-color: var(--accent); background: var(--bg-elevated); }
.upsell-tier.recommended { border-color: var(--accent); }
.upsell-tier-badge {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--bg); font-size: 0.5625rem; font-weight: 700;
  padding: 1px 8px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.upsell-tier-name { font-weight: 600; font-size: 0.875rem; color: var(--text); margin-bottom: 2px; }
.upsell-tier-price { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.upsell-tier-price span { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.upsell-tier-detail { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Links */
.upsell-links { text-align: center; font-size: 0.8125rem; }
.upsell-link { color: var(--accent); text-decoration: none; }
.upsell-link:hover { text-decoration: underline; }
.upsell-sep { color: var(--text-muted); margin: 0 6px; }

/* Spinner */
.spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Repair balance row */
.repair-balance {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; margin-top: 8px; font-size: 0.8125rem; color: var(--text-secondary);
}
.repair-balance .balance-ok { color: var(--green); }
.repair-balance .balance-low { color: var(--red); }

/* Credits needed card */
.credits-needed {
  background: var(--bg-elevated); border-radius: var(--radius); padding: 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.875rem;
}
.credits-needed .needed { color: var(--red); font-weight: 600; }
.credits-needed .have { color: var(--text-muted); }

@keyframes upsell-pulse {
  0% { opacity: 1; }
  30% { opacity: 0.6; box-shadow: 0 0 0 2px var(--accent); border-radius: 6px; }
  100% { opacity: 1; }
}

/* ================================================================
   Auth Modal
   ================================================================ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: modal-fadein 0.2s ease;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; margin: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  animation: modal-slidein 0.25s ease;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.25rem; cursor: pointer; padding: 4px 8px; border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }
.modal-header { text-align: center; margin-bottom: 16px; }
.modal-brand { font-size: 1.125rem; font-weight: 700; color: var(--text); }
.modal-brand span { color: var(--accent); }
.modal-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }

/* Form inputs */
.form-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.9375rem;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.auth-error {
  background: var(--red-bg); color: var(--red);
  font-size: 0.8125rem; padding: 8px 12px; border-radius: var(--radius);
}
.auth-alt { text-align: center; margin-top: 4px; }

@keyframes modal-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-slidein { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ================================================================
   Drop zone
   ================================================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(88,166,255,0.05);
}
.drop-zone h3 { margin-bottom: 6px; }
.drop-zone p { color: var(--text-secondary); font-size: 0.8125rem; }

/* ================================================================
   3D Viewer
   ================================================================ */
.viewer-container {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  flex: 1;
  min-height: 300px;
}
.viewer-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.viewer-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

/* ================================================================
   Landing — Hero
   ================================================================ */
.hero {
  padding: 48px 0 32px;
}
.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.hero h1 { margin-bottom: 8px; }
.hero .tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.hero-bullets {
  list-style: none;
  padding-left: 0;
  margin-bottom: 24px;
}
.hero-bullets li {
  padding: 4px 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.hero-bullets li::before {
  content: "\2713 ";
  color: var(--green);
  font-weight: 700;
}
.hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}
.hero-stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.hero-stat .label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* Certificate preview */
.cert-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-size: 0.8125rem;
}
.cert-preview .cert-header {
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.cert-preview .cert-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.cert-preview .cert-verdict {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0;
}
/* PASS/FAIL explainer block */
.pass-fail-explainer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 600px) { .pass-fail-explainer { grid-template-columns: 1fr; } }
.pf-card {
  padding: 16px; border-radius: 6px;
  border: 1px solid var(--border-light); background: var(--bg-card);
}
.pf-badge { font-size: 0.875rem; font-weight: 700; margin-bottom: 6px; }
.pf-text { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; }

.cert-scope {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
  cursor: help;
}
.cert-scope-icon {
  font-size: 0.75rem;
  opacity: 0.6;
}
.cert-checks .cert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
}
.cert-checks .cert-row:last-child { border-bottom: none; }
.cert-bar {
  width: 80px;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}
.cert-bar .fill { height: 100%; border-radius: 2px; }

/* ================================================================
   Landing — Sections
   ================================================================ */
.section { padding: 32px 0; }
.section + .section { border-top: 1px solid var(--border-light); }
.section-title { margin-bottom: 24px; }

/* Comparison table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.compare-table th, .compare-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.compare-table th {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Feature grid */
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.feature-card h3 { font-size: 0.9375rem; margin-bottom: 6px; }
.feature-card p { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; }

/* Pricing cards */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.pricing-card.featured { border-color: var(--accent); }
.pricing-card .tier {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 600;
}
.pricing-card .price {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 6px 0 4px;
}
.pricing-card .price span {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.pricing-card .features { list-style: none; padding-left: 0; margin: 12px 0; }
.pricing-card .features li {
  font-size: 0.8125rem;
  padding: 3px 0;
  color: var(--text-secondary);
}
.pricing-card .features li::before { content: "\2713 "; color: var(--green); font-weight: 700; }

/* ================================================================
   App — Legacy 2-col layout (kept for compatibility)
   ================================================================ */
.app-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  height: calc(100vh - var(--header-h));
}

/* ================================================================
   App — 3-column layout (profiles | viewer | sidebar)
   ================================================================ */
.app-layout-3col {
  display: grid !important;
  grid-template-columns: 220px 1fr 380px;
  grid-template-rows: 1fr;
  gap: 0;
  height: calc(100vh - var(--header-h));
  width: 100%;
  min-height: 0;
}
.app-layout-3col > .app-profiles {
  grid-column: 1;
  min-width: 0;
  min-height: 0;
}
.app-layout-3col > .app-viewer {
  grid-column: 2;
  min-width: 0;
  min-height: 0;
}
.app-layout-3col > .app-sidebar {
  grid-column: 3;
  min-width: 0;
  min-height: 0;
}
.app-viewer {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.app-sidebar {
  border-left: 1px solid var(--border);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================================================================
   Profile Panel (left)
   ================================================================ */
.app-profiles {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}
.profile-header h4 {
  margin-bottom: 8px;
}
.profile-group {
  margin-bottom: 8px;
}
.profile-group-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px 4px;
}
.profile-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s;
}
.profile-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.profile-item.active {
  background: rgba(88,166,255,0.08);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 500;
}
.profile-upload-btn {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  border: 1px dashed var(--border);
  border-radius: 4px;
  transition: border-color 0.15s;
}
.profile-upload-btn:hover { border-color: var(--accent); }

/* Profile info bar (in sidebar) */
.profile-info-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 4px;
}

/* ================================================================
   Stats bar (bottom of viewer)
   ================================================================ */
.stats-bar {
  display: flex;
  gap: 12px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-icon {
  font-size: 0.625rem;
  opacity: 0.5;
}

/* ================================================================
   Action Cards (sidebar)
   ================================================================ */
.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.action-card-accent {
  border-color: var(--accent);
  background: rgba(88,166,255,0.04);
}
.action-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.action-card-icon {
  font-size: 1.125rem;
}
.action-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
}
.action-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.action-card-btn {
  width: 100%;
  justify-content: center;
}

/* Repair issue list (per-issue credits) */
.repair-issue-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.repair-issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}
.repair-issue-row:last-child { border-bottom: none; }
.repair-issue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.repair-issue-label { flex: 1; }
.repair-issue-credits {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.repair-issue-badge {
  font-size: 0.625rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}
.repair-issue-badge.fixable { background: var(--green-bg); color: var(--green); }
.repair-issue-badge.cosmetic { background: rgba(88,166,255,0.12); color: var(--accent); }

/* Action tabs (Certify | Pipeline) */
.action-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.action-tab {
  flex: 1;
  padding: 8px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}
.action-tab:hover { color: var(--text); }
.action-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Pipeline step list */
.pipeline-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}
.pipeline-step:last-child { border-bottom: none; }
.pipeline-step input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.pipeline-step-label { flex: 1; }
.pipeline-step-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-left: 23px;
  margin-top: -2px;
  margin-bottom: 2px;
}
.pipeline-step-cost {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.pipeline-step.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.pipeline-step.always-on input[type="checkbox"] {
  pointer-events: none;
  opacity: 0.6;
}
.pipeline-balance {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Repair total row */
.repair-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-top: 4px;
  border-top: 2px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
}
.repair-total-credits {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1rem;
}

/* Upsell lock card */
.action-upsell-card {
  text-align: center;
  border-style: dashed;
}
.upsell-lock-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* ================================================================
   Split View (before/after)
   ================================================================ */
.split-view {
  flex: 1;
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 300px;
}
.split-pane {
  flex: 1;
  position: relative;
  background: #0d1117;
}
.split-pane canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.split-divider {
  width: 2px;
  background: var(--accent);
  flex-shrink: 0;
  cursor: col-resize;
  opacity: 0.6;
}
.split-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 2;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(248,81,73,0.7);
  color: #fff;
  pointer-events: none;
}
.split-label-after {
  background: rgba(63,185,80,0.7);
  left: auto;
  right: 8px;
}
/* Split view toolbar — centered top */
.split-view > .viewer-toolbar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  z-index: 3;
  background: rgba(14,17,23,0.85);
  border-radius: var(--radius);
  padding: 2px 4px;
}
.split-view-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Download items */
.download-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 6px;
}
.download-item:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}
.download-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.download-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.download-name {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.download-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 12px;
}
.sidebar-tab {
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.sidebar-tab:hover { color: var(--text-secondary); }
.sidebar-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer nav a { color: var(--text-muted); font-size: 0.75rem; }
.site-footer nav a:hover { color: var(--text-secondary); }

/* Subscribe form in footer */
.footer-subscribe {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.footer-subscribe-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.footer-subscribe-form { display: flex; gap: 6px; }
.footer-subscribe-form input {
  padding: 4px 10px; font-size: 0.75rem; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); border-radius: 4px; width: 200px;
}
.footer-subscribe-form button {
  padding: 4px 12px; font-size: 0.75rem; font-weight: 600; border: none;
  background: var(--accent); color: #fff; border-radius: 4px; cursor: pointer;
}
.footer-subscribe-form button:hover { background: var(--accent-hover); }
.footer-subscribe-msg { font-size: 0.7rem; }

/* Business registration block — required by VN e-commerce decrees
   52/2013/NĐ-CP Điều 29 + 85/2021/NĐ-CP. Visible on every page. */
.footer-business {
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.footer-business-name { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.footer-business a { color: var(--text-muted); text-decoration: underline; }
.footer-business a:hover { color: var(--text-secondary); }

/* Corporate identity card on /contact + /vi/contact (Điều 29) */
.legal-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.legal-table td { padding: 6px 8px; vertical-align: top; }
.legal-table tr td:first-child { width: 38%; color: var(--text-secondary); white-space: nowrap; }
.legal-table tr:nth-child(even) { background: var(--bg-elevated); }
@media (max-width: 600px) {
  .legal-table tr td:first-child { white-space: normal; }
}

/* ================================================================
   Responsive
   ================================================================ */
/* Hamburger menu toggle (hidden on desktop) */
.hamburger-menu { display: none; background: none; border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: var(--radius); cursor: pointer; font-size: 1.125rem; line-height: 1; }
/* Tablet: hide profile panel, 2-col */
@media (max-width: 1199px) {
  .app-layout-3col { grid-template-columns: 1fr 360px !important; }
  .app-layout-3col > .app-profiles { display: none !important; }
  .app-layout-3col > .app-viewer { grid-column: 1; }
  .app-layout-3col > .app-sidebar { grid-column: 2; }
  .hamburger-menu { display: inline-block; }
  /* Profile panel as mobile overlay when toggled open */
  .app-profiles.mobile-open { display: flex !important; position: fixed; top: 44px; left: 0; bottom: 0; width: 220px; z-index: 100; background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; padding-bottom: 24px; }
}
/* Mobile: single column stack */
@media (max-width: 768px) {
  .app-layout-3col { grid-template-columns: 1fr !important; height: auto !important; }
  .app-layout-3col > .app-sidebar { grid-column: 1; border-left: none; border-top: 1px solid var(--border); min-height: 50vh; }
  .split-view { flex-direction: column; }
  .split-divider { width: auto; height: 2px; }
  .drop-zone { padding: 16px; }
  #btn-browse-files { display: inline-block !important; }
}
@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .app-layout { grid-template-columns: 1fr; height: auto; }
}
@media (max-width: 600px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  /* Section padding trimmed so content isn't strangled on narrow viewports. */
  .section { padding: 32px 0; }
  .container { padding: 0 16px; }
  /* Compare-tables (pricing page) and long-form h1 were overflowing horizontally. */
  .compare-table { font-size: 0.78rem; }
  .compare-table th, .compare-table td { padding: 6px 4px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  .page-hero-inner h1, .hero h1 { font-size: 1.6rem; line-height: 1.25; }
  /* Preformatted JSON/CLI blocks were pushing the page width on mobile. */
  pre { font-size: 0.7rem !important; }
}

/* ─── Batch mode ─────────────────────────────────────── */
.batch-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.batch-table th { text-align: left; padding: 6px 8px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-primary); }
.batch-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.batch-table tr:hover td { background: var(--bg-secondary); }
.batch-table tr.batch-row-pass td { }
.batch-table tr.batch-row-fail td { background: rgba(239,68,68,0.05); }
.batch-table .batch-file-name { cursor: pointer; color: var(--accent); }
.batch-table .batch-file-name:hover { text-decoration: underline; }
.batch-table .batch-status { display: inline-flex; align-items: center; gap: 4px; }
.batch-table .batch-status .spinner { width: 14px; height: 14px; }
.batch-progress-bar { height: 4px; background: var(--bg-tertiary); border-radius: 2px; overflow: hidden; flex: 1; }
.batch-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; border-radius: 2px; }
.batch-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.batch-footer { border: 1px solid var(--border); }

/* Select dropdown fix for dark theme */
select.input-sm option { background: var(--bg-primary); color: var(--text-primary); }

/* Profile cert badges */
.profile-item { display: flex; align-items: center; }
.profile-cert-badge { pointer-events: none; }
