/* Alabaster & Deep Verdant — Modern Editorial Analytics Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  --bg-canvas: #F6F5F1;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #EFECE6;
  --bg-rail: #0B1311;
  --border: rgba(13, 25, 22, 0.08);
  --border-strong: rgba(13, 25, 22, 0.15);
  --text-primary: #0D1916;
  --text-secondary: #43534E;
  --text-muted: #6A7A75;
  --brand: #0D736B;
  --brand-hover: #0A5C56;
  --brand-soft: rgba(13, 115, 107, 0.09);
  --emerald: #0E9F6E;
  --emerald-soft: rgba(14, 159, 110, 0.11);
  --emerald-text: #067647;
  --amber: #C27803;
  --amber-soft: rgba(194, 120, 3, 0.12);
  --amber-text: #92400E;
  --rose: #D93848;
  --rose-soft: rgba(217, 56, 72, 0.11);
  --rose-text: #B42318;
  --sky: #0284C7;
  --sky-soft: rgba(2, 132, 199, 0.11);
  --sky-text: #0369A1;
  --shadow-sm: 0 1px 2px rgba(13, 25, 22, 0.04);
  --shadow-card: 0 1px 2px rgba(13, 25, 22, 0.04), 0 10px 26px -14px rgba(13, 25, 22, 0.08);
  --shadow-hover: 0 4px 14px rgba(13, 25, 22, 0.06), 0 14px 30px -12px rgba(13, 115, 107, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg-canvas: #090E0D;
  --bg-surface: #101816;
  --bg-card: #101816;
  --bg-elevated: #15211E;
  --bg-subtle: #1A2724;
  --bg-rail: #060A09;
  --border: rgba(244, 247, 246, 0.08);
  --border-strong: rgba(244, 247, 246, 0.16);
  --text-primary: #F4F7F6;
  --text-secondary: #BDD0CA;
  --text-muted: #849B94;
  --brand: #2DD4BF;
  --brand-hover: #5EEAD4;
  --brand-soft: rgba(45, 212, 191, 0.14);
  --emerald: #34D399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --emerald-text: #34D399;
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --amber-text: #FBBF24;
  --rose: #FB7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --rose-text: #FDA4AF;
  --sky: #38BDF8;
  --sky-soft: rgba(56, 189, 248, 0.14);
  --sky-text: #7DD3FC;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.38);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name, .price-amt, .kpi-val {
  font-family: var(--font-display);
}

/* === Shell Layout === */
.app-shell { display: grid; grid-template-columns: 68px 236px 1fr; min-height: 100vh; }

.icon-rail {
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 8px;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.rail-logo {
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border-radius: 11px;
  box-shadow: 0 4px 16px rgba(13, 115, 107, 0.45);
}
.rail-btn {
  width: 52px;
  padding: 9px 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #8A9E98;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.16s ease;
}
.rail-btn:hover { background: rgba(255, 255, 255, 0.06); color: #F4F7F6; }
.rail-btn.active {
  background: rgba(45, 212, 191, 0.15);
  border-color: rgba(45, 212, 191, 0.35);
  color: #5EEAD4;
}
.rail-btn svg { width: 18px; height: 18px; stroke-width: 1.85; }

.sub-nav {
  background: #FCFBF8;
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
[data-theme="dark"] .sub-nav { background: #0C1311; }

.brand-lockup { padding: 2px 8px 16px; border-bottom: 1px solid var(--border); }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 7px; }
.brand-tag { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.38; }
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.14s ease;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-item.active {
  background: var(--brand-soft);
  border-color: rgba(13, 115, 107, 0.18);
  color: var(--brand);
  font-weight: 700;
}
.badge-chip {
  font-size: 9.5px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 999px;
}

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px;
  background: rgba(246, 245, 241, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
[data-theme="dark"] .topbar { background: rgba(9, 14, 13, 0.85); }

.omnibox {
  display: flex;
  flex: 1;
  max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.omnibox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.omnibox input {
  flex: 1;
  height: 34px;
  border: none;
  background: transparent;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}
.omnibox button {
  height: 34px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s;
}
[data-theme="dark"] .omnibox button { color: #06211F; font-weight: 700; }
.omnibox button:hover { background: var(--brand-hover); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
.theme-btn:hover { color: var(--text-primary); background: var(--bg-subtle); }

.content-area { padding: 28px 34px 60px; max-width: 1340px; width: 100%; margin: 0 auto; flex: 1; }
.breadcrumb { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; letter-spacing: 0.01em; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 25px; font-weight: 800; letter-spacing: -0.03em; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Cards & Interactive Controls === */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}
.card-title {
  margin: 0 0 14px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn {
  height: 36px;
  padding: 0 15px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.14s ease;
}
.btn:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(13, 115, 107, 0.24);
}
[data-theme="dark"] .btn-primary { color: #06211F; font-weight: 700; }
.btn-primary:hover { background: var(--brand-hover); transform: translateY(-0.5px); }
.btn-dark { background: #0D1916; color: #FFFFFF; border-color: transparent; }
[data-theme="dark"] .btn-dark { background: #F4F7F6; color: #0D1916; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 130px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }

/* === Grids & Bento Widgets === */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.hero-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.hero-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(13, 115, 107, 0.38);
}
.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-weight: 800;
  font-size: 15px;
}

.kpi-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-val { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 5px; letter-spacing: -0.03em; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Charts */
.bar-row { display: grid; grid-template-columns: 118px 1fr 48px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
.bar-track { height: 8px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.progress-wrap { background: var(--bg-subtle); border-radius: 999px; height: 8px; overflow: hidden; margin: 10px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--emerald)); transition: width 0.3s ease; }

/* Pills & Tables */
.pill { display: inline-flex; align-items: center; padding: 2.5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.error { background: var(--rose-soft); color: var(--rose-text); }
.pill.warning { background: var(--amber-soft); color: var(--amber-text); }
.pill.notice { background: var(--sky-soft); color: var(--sky-text); }
.pill.ok { background: var(--emerald-soft); color: var(--emerald-text); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th, table.data-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
table.data-table th {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-canvas);
}
table.data-table tbody tr:hover { background: rgba(13, 115, 107, 0.03); }
.mono { font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Accordions */
.issue-item { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: var(--bg-surface); }
.issue-summary { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.issue-summary:hover { background: var(--bg-canvas); }
.issue-body { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--bg-canvas); }
.issue-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; font-size: 12.5px; }
.issue-guide div { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }

/* Pricing Cards */
.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pricing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.pricing-card.featured {
  border: 2px solid var(--brand);
  box-shadow: var(--shadow-hover);
  position: relative;
}
.price-amt { font-size: 34px; font-weight: 800; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.price-list { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.price-list li::before { content: '✓ '; color: var(--emerald); font-weight: 800; }

.url-guard {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.subtab {
  border: none;
  background: transparent;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.14s ease;
}
.subtab:hover { color: var(--text-primary); }
.subtab.active { color: var(--brand); border-bottom-color: var(--brand); }
pre.code-block {
  background: #0B1311;
  color: #D1E7E2;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.view { display: none; }
.view.active { display: block; }
.legal-footer {
  border-top: 1px solid var(--border);
  padding: 16px 28px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-surface);
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 64px 1fr; }
  .sub-nav { display: none; }
  .grid-4, .grid-3, .grid-2, .issue-guide { grid-template-columns: 1fr; }
}

/* === Sign-in (hosted app) === */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg-canvas); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-logo { width: 40px; height: 40px; }
.auth-card h1 { font-family: var(--font-display); font-size: 24px; margin: 0; color: var(--text-primary); }
.auth-sub { margin: -6px 0 4px; color: var(--text-secondary); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field { min-width: 0; }
.auth-hint { font-size: 12px; color: var(--text-muted); }
.auth-error { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--rose-soft); color: var(--rose-text); font-size: 13px; }
.auth-submit, .auth-google { width: 100%; justify-content: center; height: 40px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.auth-switch { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.auth-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-ws { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.user-email { font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 640px) { .user-meta { display: none; } }
