:root {
  --navy: #0b1b33;
  --navy-2: #10264a;
  --blue: #2f6bff;
  --cyan: #19c3e6;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fc;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #245ae0; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: #eef2f9; }

/* Busy state (set by app.js on submit) */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
  animation: dv-spin .7s linear infinite;
}
.btn-ghost.is-loading::after, .btn-danger.is-loading::after { border-color: rgba(15,23,42,.2); border-top-color: var(--ink); }
@keyframes dv-spin { to { transform: rotate(360deg); } }

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.input:focus-visible { outline: none; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff; font-weight: 700; display: grid; place-items: center;
}
.brand-name { font-weight: 700; letter-spacing: .06em; font-size: 14px; color: var(--navy); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; }

/* Landing */
.landing-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 32px; background: #fff; border-bottom: 1px solid var(--line);
}
.landing-nav nav { display: flex; gap: 16px; align-items: center; }
.hero {
  max-width: 900px; margin: 0 auto; padding: 80px 24px; text-align: center;
}
.hero h1 { font-size: 48px; line-height: 1.1; margin: 0 0 16px; color: var(--navy); }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 40px; }
.workflow {
  display: inline-flex; gap: 12px; padding: 12px 20px; border-radius: 999px;
  background: #fff; box-shadow: var(--shadow); font-size: 13px;
  font-weight: 600; letter-spacing: .08em; color: var(--navy);
}
.landing-foot {
  text-align: center; padding: 24px; color: var(--muted); font-size: 13px;
}

/* App shell */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--navy); color: #e6edf7; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand-name, .sidebar .brand-sub { color: #fff; }
.sidebar .brand-sub { color: #8fa3bf; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.brand-link:hover { text-decoration: none; }
.nav-toggle { display: none; }
.sidebar-body { display: flex; flex-direction: column; flex: 1; gap: 24px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  color: #b7c4d8; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
}
.nav a svg { opacity: .75; flex-shrink: 0; }
.nav a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.nav a.active { box-shadow: inset 3px 0 0 var(--cyan); }
.nav a.active svg, .nav a:hover svg { opacity: 1; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

.upgrade-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(47,107,255,.25), rgba(25,195,230,.18));
  border: 1px solid rgba(255,255,255,.08);
  color: #fff; font-size: 12px;
}
.upgrade-card span { color: #c7d2e5; }
.upgrade-card:hover { text-decoration: none; border-color: rgba(255,255,255,.2); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center;
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-chip-name {
  color: #fff; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip-name:hover { text-decoration: none; color: var(--cyan); }
.user-chip-plan { color: #8fa3bf; font-size: 11px; }
.icon-btn.on-dark { color: #8fa3bf; }
.icon-btn.on-dark:hover { background: var(--navy-2); border-color: transparent; color: #fff; }

.main { padding: 28px 36px 48px; max-width: 1400px; width: 100%; }
.main:focus { outline: none; }
.topbar { margin-bottom: 20px; }
.page-title { font-size: 22px; margin: 0; color: var(--navy); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card-narrow { max-width: 720px; }
.card h2 { margin-top: 0; color: var(--navy); }

/* Errors */
.error-page { background: var(--bg); }
.error-wrap {
  max-width: 520px; margin: 120px auto; text-align: center; padding: 0 24px;
}
.error-code {
  font-size: 88px; font-weight: 700; color: var(--blue); line-height: 1;
}
.error-wrap h1 { color: var(--navy); margin: 8px 0 8px; }

/* Responsive */
@media (max-width: 820px) {
  /* minmax(0, …) lets wide tables scroll inside their box instead of widening the page */
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 40; height: auto; overflow: visible;
    padding: 12px 16px; gap: 0;
  }
  .nav-toggle {
    display: grid; place-items: center; width: 40px; height: 40px;
    background: transparent; border: 1px solid rgba(255,255,255,.15); border-radius: 9px;
    color: #fff; cursor: pointer;
  }
  .sidebar-body { display: none; padding-top: 16px; }
  .sidebar.is-open .sidebar-body { display: flex; }
  .main { padding: 20px 16px 40px; }
  .hero h1 { font-size: 34px; }
  .landing-nav { padding: 14px 18px; }
}


/* ===== Authentication pages ===== */
.auth-page { background: #fff; min-height: 100vh; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100vh; }
.auth-main { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-brand { align-self: flex-start; }
.auth-form-wrap { width: 100%; max-width: 400px; margin: auto; padding: 48px 0; }
.auth-title { margin: 0 0 8px; font-size: 30px; line-height: 1.15; letter-spacing: -.025em; color: var(--navy); }
.auth-sub { margin: 0 0 28px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.auth-form-wrap .btn-block { margin-top: 8px; }
.auth-footer-link { margin-top: 24px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-footer-link a { font-weight: 600; }
.auth-legal { margin: 0; text-align: center; font-size: 12px; color: #94a3b8; }
.auth-legal a { color: #94a3b8; }

.auth-aside {
  position: relative; overflow: hidden; color: #c7d2e5;
  background: #071122; display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.auth-aside-glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(500px 360px at 85% 10%, rgba(25,195,230,.28), transparent 70%),
    radial-gradient(600px 420px at 10% 100%, rgba(47,107,255,.38), transparent 70%);
}
.auth-aside-glow::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}
.auth-aside-inner { position: relative; max-width: 460px; }
.auth-aside-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan);
}
.auth-aside h2 { color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -.025em; margin: 0 0 28px; }
.auth-aside-points { list-style: none; margin: 0 0 36px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-aside-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.auth-aside-points svg {
  flex-shrink: 0; padding: 7px; width: 32px; height: 32px; border-radius: 9px;
  background: rgba(25,195,230,.12); color: var(--cyan);
}
.auth-aside-points b { color: #fff; font-weight: 600; }
.auth-preview {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 18px; backdrop-filter: blur(8px);
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.auth-preview-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-preview-kpis div { background: rgba(255,255,255,.06); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.auth-preview-kpis span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #8fa3bf; font-weight: 600; }
.auth-preview-kpis b { color: #fff; font-size: 22px; letter-spacing: -.02em; }
.auth-preview-kpis em { font-style: normal; font-size: 11px; color: #34d399; font-weight: 600; }
.auth-preview-chart { width: 100%; height: 80px; display: block; margin: 14px 0; }
.auth-preview-chat {
  background: #fff; color: var(--ink); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; line-height: 1.5;
}
.auth-preview-chat b { display: block; color: var(--navy); margin-bottom: 2px; }
.auth-preview-chat span { display: block; margin-top: 6px; font-size: 10px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 24px 20px; }
  .auth-form-wrap { padding: 40px 0; }
  .auth-title { font-size: 26px; }
}

/* Auth form controls */
.field-optional { font-style: normal; font-weight: 500; font-size: 11px; color: #94a3b8; margin-left: 6px; }
.field > .field-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.field-label-row label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-link { font-size: 13px; font-weight: 500; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: var(--bg); }
.pw-hide, .pw-toggle.is-shown .pw-show { display: none; }
.pw-toggle.is-shown .pw-hide { display: inline; }
.pw-meter { margin-top: 8px; }
.pw-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-bars i { height: 4px; border-radius: 2px; background: var(--line); transition: background-color .2s; }
.pw-meter[data-level="weak"] .pw-bars i:nth-child(-n+1) { background: #ef4444; }
.pw-meter[data-level="fair"] .pw-bars i:nth-child(-n+2) { background: #f59e0b; }
.pw-meter[data-level="good"] .pw-bars i:nth-child(-n+3) { background: #10b981; }
.pw-meter[data-level="strong"] .pw-bars i { background: #059669; }
.pw-label { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.pw-meter[data-level="weak"] .pw-label { color: #b91c1c; }

/* ===== Fields & inputs ===== */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.15);
}
.err { display: block; color: #b42318; font-size: 12px; margin-top: 4px; }

/* ===== Buttons ===== */
.btn-block { display: block; width: 100%; text-align: center; padding: 12px; }

/* ===== Flash messages ===== */
.flash {
  padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 14px;
  border: 1px solid transparent;
}
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ===== Sidebar user ===== */
.sidebar-user {
  display: block; color: #93a4bd; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 6px; text-decoration: none;
}
.sidebar-user:hover { color: #fff; text-decoration: none; }

/* ============================================================
   PREMIUM LANDING PAGE
   ============================================================ */

/* Utilities */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue);
  padding: 6px 12px; border-radius: 999px;
  background: rgba(47, 107, 255, .08);
  margin-bottom: 18px;
}
.grad-text {
  background: linear-gradient(120deg, var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Nav */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-links {
  display: flex; gap: 28px;
  font-size: 14px; color: var(--ink);
}
.nav-links a { color: var(--ink); font-weight: 500; }
.nav-links a:hover { color: var(--blue); text-decoration: none; }
.nav-actions { display: flex; gap: 10px; align-items: center; }

/* Hero */
.hero-premium {
  padding: 88px 0 72px;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(25,195,230,.10), transparent 60%),
    radial-gradient(900px 400px at 10% 10%, rgba(47,107,255,.10), transparent 60%),
    var(--bg);
}
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center;
}
.hero-premium h1 {
  font-size: 56px; line-height: 1.05; letter-spacing: -.02em;
  color: var(--navy); margin: 0 0 20px;
}
.hero-premium .lead {
  font-size: 17px; line-height: 1.65; color: var(--muted);
  max-width: 560px; margin: 0 0 28px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 18px;
  color: var(--muted); font-size: 13px;
}
.hero-meta span::before { content: ""; }

/* Hero visual */
.hero-visual {
  position: relative; height: 380px;
  display: flex; flex-direction: column; gap: 12px;
}
.viz-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .10);
  padding: 16px 18px;
}
.viz-kpi { width: 240px; align-self: flex-start; }
.viz-label { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.viz-value { font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.viz-delta { font-size: 13px; margin-top: 4px; }
.viz-delta.up { color: #047857; }

.viz-chart { width: 320px; align-self: flex-end; }
.viz-bars {
  display: flex; align-items: flex-end; gap: 8px; height: 100px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.viz-bars span {
  flex: 1; background: linear-gradient(180deg, var(--blue), var(--cyan));
  border-radius: 6px 6px 2px 2px; opacity: .85;
}
.viz-caption { font-size: 11px; color: var(--muted); margin-top: 8px; }

.viz-alert {
  width: 290px; align-self: flex-start;
  display: flex; gap: 10px; align-items: center;
}
.viz-alert-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: #fef3c7; color: #92400e;
  display: grid; place-items: center; font-weight: 700;
}
.viz-alert-title { font-size: 13px; font-weight: 600; color: var(--navy); }
.viz-alert-sub { font-size: 12px; color: var(--muted); }

/* Workflow band */
.workflow-band {
  padding: 44px 0; text-align: center;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.workflow-pill {
  display: inline-flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 14px 22px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 14px; color: var(--navy);
}
.wf-step { letter-spacing: .14em; }
.wf-arrow { color: var(--blue); font-weight: 700; }
.muted-arrow { color: var(--muted); font-size: 12px; margin-left: 4px; }
.workflow-note {
  max-width: 640px; margin: 18px auto 0;
  color: var(--muted); font-size: 14px; line-height: 1.6;
}

/* Section head */
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head h2 {
  font-size: 36px; line-height: 1.15; letter-spacing: -.02em;
  color: var(--navy); margin: 0 0 12px;
}
.section-sub { color: var(--muted); font-size: 16px; line-height: 1.65; }

/* Features */
.features { padding: 96px 0; background: var(--white); }
.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.feature {
  padding: 26px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.feature:hover {
  transform: translateY(-2px);
  border-color: #cbd6e6;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}
.feature-icon {
  font-size: 22px; width: 44px; height: 44px;
  display: grid; place-items: center;
  background: #fff; border-radius: 11px; border: 1px solid var(--line);
  margin-bottom: 14px;
}
.feature h3 { color: var(--navy); font-size: 17px; margin: 0 0 8px; }
.feature p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; }

/* How */
.how { padding: 96px 0; background: var(--bg); }
.steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.step {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; position: relative;
}
.step-num {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff; font-weight: 700; display: grid; place-items: center;
  margin-bottom: 14px;
}
.step h3 { color: var(--navy); margin: 0 0 8px; font-size: 18px; }
.step p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; }

/* Metrics */
.metrics {
  padding: 56px 0; background: var(--white);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.metrics-grid > div { text-align: center; }
.metric-num {
  font-size: 34px; font-weight: 700; letter-spacing: -.02em;
  color: var(--navy);
}
.metric-label {
  margin-top: 8px; font-size: 13px; color: var(--ink); line-height: 1.5;
}
.metric-label .muted { color: var(--muted); font-size: 12px; }

/* CTA band */
.cta-band {
  padding: 64px 0;
  background:
    radial-gradient(800px 300px at 20% 120%, rgba(25,195,230,.28), transparent 60%),
    radial-gradient(800px 300px at 90% -20%, rgba(47,107,255,.35), transparent 60%),
    var(--navy);
  color: #fff;
}
.cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  flex-wrap: wrap;
}
.cta-band h2 {
  font-size: 30px; letter-spacing: -.01em; margin: 0 0 8px;
}
.cta-band p { color: #c7d2e5; margin: 0; font-size: 15px; }
.cta-actions { display: flex; gap: 12px; }
.btn-ghost.on-dark {
  color: #fff; border-color: rgba(255,255,255,.35);
}
.btn-ghost.on-dark:hover { background: rgba(255,255,255,.10); }

/* Footer */
.site-footer { background: #0a1526; color: #c7d2e5; padding: 56px 0 24px; }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px;
  padding-bottom: 32px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.site-footer .brand-name { color: #fff; }
.site-footer .brand-sub { color: #8fa3bf; }
.foot-note { color: #8fa3bf; font-size: 13px; line-height: 1.7; margin: 14px 0 0; max-width: 320px; }
.foot-head { color: #fff; font-weight: 600; font-size: 13px; margin-bottom: 12px; letter-spacing: .04em; }
.foot-col { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.foot-col a { color: #c7d2e5; }
.foot-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  display: flex; justify-content: space-between;
  padding-top: 20px; font-size: 12px; color: #8fa3bf;
}

/* Responsive */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { height: auto; }
  .hero-premium h1 { font-size: 42px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 620px) {
  .hero-premium { padding: 56px 0 40px; }
  .hero-premium h1 { font-size: 34px; }
  .feature-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .cta-inner { flex-direction: column; text-align: center; }
  .nav-actions .btn-ghost { display: none; }
  .section-head h2 { font-size: 26px; }
}


/* ============================================================
   WORKSPACE PAGES (Milestone 3)
   ============================================================ */

/* Nav active state */
.nav a.active {
  background: var(--navy-2);
  color: #fff;
}

/* Page heads */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-h2 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.page-h3 { margin: 0 0 4px; font-size: 16px; color: var(--navy); }
.page-head p { margin: 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Workspace grid */
.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.workspace-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.workspace-card:hover {
  border-color: #cbd6e6;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}
.wc-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.wc-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 18px;
  flex-shrink: 0;
}
.wc-title {
  font-weight: 600; color: var(--navy); font-size: 16px;
  display: block; margin-bottom: 3px;
}
.wc-title:hover { color: var(--blue); text-decoration: none; }
.wc-date { font-size: 12px; color: var(--muted); }
.wc-desc {
  margin: 0 0 16px;
  font-size: 13px; line-height: 1.55; color: var(--ink);
  min-height: 40px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.wc-desc.muted { color: var(--muted); font-style: italic; }
.wc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost.danger { color: #991b1b; border-color: #fecaca; }
.btn-ghost.danger:hover { background: #fef2f2; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Empty state */
.empty-state {
  background: #fff; border: 1px dashed var(--line); border-radius: 14px;
  padding: 56px 24px; text-align: center;
}
.empty-state.small { padding: 36px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 8px; opacity: .6; }
.empty-state h3 { margin: 0 0 6px; color: var(--navy); font-size: 16px; }
.empty-state p { margin: 0 0 20px; font-size: 14px; }

/* Cards */
.card-head { margin-bottom: 20px; }
.card-head p { margin: 4px 0 0; font-size: 14px; }

/* Forms */
.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 8px;
}

/* Stats */
.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-top: 8px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Danger zone */
.danger-card { border-color: #fecaca; }
.danger-summary {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 20px; font-size: 13px; line-height: 1.7;
  color: #7f1d1d;
}
.danger-summary code { font-family: monospace; background: #fff; padding: 2px 6px; border-radius: 4px; }

/* Textarea sizing */
textarea.input { min-height: 76px; resize: vertical; }

/* Responsive */
@media (max-width: 720px) {
  .stat-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }
}
/* ============================================================
   DATA TABLE STYLES (Milestone 3 — workspaces as table)
   ============================================================ */

/* Top stats */
.table-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.table-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.table-stat-num {
  font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.2;
}
.table-stat-label {
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}

/* Toolbar */
.table-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; flex: 1; max-width: 340px;
  transition: border-color .15s, box-shadow .15s;
}
.table-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47,107,255,.12);
}
.table-search svg { color: var(--muted); flex-shrink: 0; }
.table-search input {
  border: none; outline: none; background: transparent;
  padding: 10px 0; font-size: 14px; font-family: inherit;
  width: 100%; color: var(--ink);
}
.table-toolbar-actions { display: flex; gap: 8px; }

/* Data table */
.data-table-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.data-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table thead {
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.data-table th.col-num  { text-align: center; width: 100px; }
.data-table th.col-date { width: 130px; }
.data-table th.col-actions { width: 130px; text-align: right; }

.data-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background-color .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafd; }

.data-table td {
  padding: 14px 16px; vertical-align: middle;
}
.data-table td.col-num { text-align: center; }
.data-table td.col-actions { text-align: right; }

/* Cell: name */
.cell-name { display: flex; align-items: center; gap: 12px; }
.cell-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 16px; flex-shrink: 0;
}
.cell-name-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-title {
  font-weight: 600; color: var(--navy); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 320px;
}
.cell-title:hover { color: var(--blue); text-decoration: none; }
.cell-sub {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 320px;
}
.cell-sub.muted { font-style: italic; }

/* Cell: date */
.cell-date { display: block; color: var(--ink); font-size: 13px; }
.cell-time { display: block; color: var(--muted); font-size: 11px; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; min-width: 24px; text-align: center;
}
.badge-blue { background: rgba(47,107,255,.10); color: var(--blue); }
.badge-muted { background: #eef2f7; color: var(--muted); }

/* Row actions */
.row-actions { display: inline-flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-grid; place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background-color .12s, color .12s, border-color .12s;
}
.icon-btn:hover {
  background: var(--bg); border-color: var(--line);
  color: var(--blue); text-decoration: none;
}
.icon-btn.danger:hover {
  background: #fef2f2; border-color: #fecaca; color: #b91c1c;
}

/* Empty results row */
.table-empty {
  padding: 40px 20px; text-align: center; border-top: 1px solid var(--line);
}
.table-empty p { margin: 0; }

/* Responsive — collapse table into stacked rows under 720px */
@media (max-width: 720px) {
  .table-stats { grid-template-columns: 1fr; }
  .table-search { max-width: 100%; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block; width: 100%;
  }
  .data-table tbody tr {
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .data-table tbody tr:last-child { border-bottom: none; }
  .data-table td {
    padding: 4px 0; text-align: left;
  }
  .data-table td.col-num, .data-table td.col-actions { text-align: left; }
  .data-table td.col-date { display: inline-block; width: 50%; }
  .cell-title, .cell-sub { max-width: 100%; white-space: normal; }
  .row-actions { margin-top: 8px; }
}
/* ============================================================
   DATASET STYLES (Milestone 4)
   ============================================================ */

.pill-link {
  display: inline-block; padding: 3px 10px;
  background: rgba(47,107,255,.08); color: var(--blue);
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.pill-link:hover { background: rgba(47,107,255,.16); text-decoration: none; }

.upload-hint {
  margin-top: 24px; padding: 16px 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px; color: var(--ink);
}
.upload-hint strong { color: var(--navy); }
.upload-hint ul { margin: 8px 0 0 0; padding-left: 20px; line-height: 1.7; }
.upload-hint li { color: var(--muted); }

/* Preview table — horizontal scroll for wide datasets */
.preview-table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
}
.preview-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.preview-table thead { background: #fafbfd; border-bottom: 1px solid var(--line); }
.preview-table th {
  text-align: left; padding: 10px 14px; vertical-align: top;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.preview-table th:last-child { border-right: none; }
.preview-col-name {
  font-size: 12px; font-weight: 700; color: var(--navy);
  font-family: "Inter", system-ui, sans-serif;
}
.preview-col-type {
  font-size: 10px; color: var(--muted); font-weight: 500;
  margin-top: 2px; letter-spacing: .04em;
}
.preview-table td {
  padding: 8px 14px; color: var(--ink);
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.preview-table td:last-child { border-right: none; }
.preview-table tbody tr:nth-child(even) { background: #fafbfd; }


/* ============================================================
   PROFILING STYLES (Milestone 5)
   ============================================================ */

.text-warn { color: #b45309; }
.text-info { color: var(--blue); }

.dtype-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; padding: 2px 6px; border-radius: 4px;
  background: #f1f5f9; color: var(--ink);
}

.col-kind-numeric { color: var(--blue); font-weight: 700; }
.col-kind-datetime { color: #7c3aed; font-weight: 700; }
.col-kind-categorical { color: #047857; }
.col-kind-text { color: var(--muted); }

.detail-line { display: block; font-size: 12px; color: var(--muted); line-height: 1.6; }
.detail-line .pill-link { margin: 2px 4px 2px 0; font-size: 11px; }

/* Warnings list */
.warn-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.warn-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; line-height: 1.5;
}
.warn-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.warn-warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.warn-info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.warn-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 4px;
  background: rgba(0,0,0,.08); flex-shrink: 0;
}
.warn-col {
  font-weight: 600; font-family: ui-monospace, monospace; font-size: 12px;
  padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.06);
}
.warn-msg { flex: 1; }

/* Quality chips on dataset detail */
.quality-badges {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.warn-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; max-width: 100%;
}
.warn-chip strong { font-weight: 600; }

/* ============================================================
   ANALYTICS STYLES (Milestone 6)
   ============================================================ */

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color .15s, box-shadow .15s;
}
.kpi-card:hover {
  border-color: #cbd6e6;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .06);
}
.kpi-label {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.kpi-value {
  font-size: 26px; font-weight: 700; color: var(--navy);
  margin: 6px 0 4px; letter-spacing: -.02em;
}
.kpi-source {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-source code {
  font-family: ui-monospace, monospace; font-size: 10px;
  background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
}

/* Distribution grid */
.dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

/* Trend deltas */
.delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.delta.up { color: #047857; }
.delta.down { color: #b91c1c; }

/* Limitations list */
.limit-list {
  margin: 0; padding: 0 0 0 20px;
  color: var(--muted); font-size: 13px; line-height: 1.8;
}
.limit-list li { margin-bottom: 4px; }

/* Detection transparency */
.detect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.detect-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.detect-found {
  border-color: rgba(4, 120, 87, .2);
  background: #f0fdf4;
}
.detect-missing {
  opacity: .75;
}
.detect-role {
  font-size: 12px; font-weight: 600; color: var(--navy);
  margin-bottom: 4px;
}
.detect-cols {
  font-size: 12px; color: var(--ink); line-height: 1.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.detect-cols code {
  font-family: ui-monospace, monospace; font-size: 11px;
  padding: 1px 6px; border-radius: 3px;
  background: rgba(0, 0, 0, .06); color: var(--ink);
}

/* Responsive */
@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 20px; }
  .dist-grid { grid-template-columns: 1fr; }
  .detect-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   CHARTS (Milestone 7)
   ============================================================ */

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .charts-grid { grid-template-columns: 1fr; }
  .charts-grid > :first-child { grid-column: auto; }
}

.chart-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
}
.chart-card .card-head { margin-bottom: 8px; }

.chart-box {
  width: 100%;
  min-height: 260px;
  flex: 1;
}
.chart-box .plotly {
  width: 100% !important;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg);
}

/* Dataset picker on dashboard */
.dataset-picker-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dataset-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px 0 14px;
  height: 40px;
}
.dataset-picker > span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.dataset-picker select {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 0;
  min-width: 180px;
  cursor: pointer;
}

/* ============================================================
   INSIGHTS (Milestone 9)
   ============================================================ */

/* Anomaly severities */
.sev {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.sev-critical { background: #fef2f2; color: #991b1b; }
.sev-warn     { background: #fffbeb; color: #92400e; }
.sev-info     { background: #eff6ff; color: #1e40af; }

.sev-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 4px;
}
.sev-badge.sev-critical { background: #fee2e2; color: #991b1b; }
.sev-badge.sev-warn     { background: #fef3c7; color: #92400e; }
.sev-badge.sev-info     { background: #dbeafe; color: #1e40af; }

.anomaly-summary {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}

.anomaly-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.anomaly-item {
  padding: 14px 16px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line);
  border-left-width: 4px;
  border-left-color: var(--line);
}
.anomaly-item.sev-critical { border-left-color: #dc2626; background: #fefefe; }
.anomaly-item.sev-warn     { border-left-color: #f59e0b; background: #fefefe; }
.anomaly-item.sev-info     { border-left-color: #3b82f6; background: #fefefe; }

.anomaly-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 6px;
}
.anomaly-method {
  font-family: ui-monospace, monospace; font-size: 11px;
  padding: 1px 6px; border-radius: 4px; background: #f1f5f9; color: var(--muted);
}
.anomaly-head strong { color: var(--navy); font-family: ui-monospace, monospace; }
.anomaly-dir { color: var(--muted); font-size: 12px; }
.anomaly-value {
  font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}
.anomaly-explain { font-size: 13px; color: var(--ink); line-height: 1.6; }
.anomaly-range { font-size: 12px; margin-top: 4px; }

/* Insight empty states */
.insight-empty {
  padding: 36px 20px; text-align: center;
}
.insight-empty .empty-icon {
  font-size: 32px; margin-bottom: 6px; opacity: .7;
  display: inline-block; width: 44px; height: 44px;
  border-radius: 50%; background: #f0fdf4; color: #047857;
  line-height: 44px;
}
.insight-empty h3 { color: var(--navy); margin: 0 0 4px; font-size: 15px; }
.insight-empty p { margin: 0; font-size: 13px; max-width: 520px; margin: 0 auto; }

/* Recommendations grid */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.rec-card {
  padding: 18px 20px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
}
.rec-card.rec-trend        { border-top-color: var(--blue); }
.rec-card.rec-concentration{ border-top-color: #8b5cf6; }
.rec-card.rec-data_quality { border-top-color: #ef4444; }
.rec-card.rec-capability   { border-top-color: #64748b; }

.rec-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.rec-cat {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.rec-conf {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eef2f7; color: var(--muted); font-weight: 600;
}
.rec-conf-high    { background: #ecfdf5; color: #065f46; }
.rec-conf-medium  { background: #eff6ff; color: #1e40af; }
.rec-conf-low     { background: #fffbeb; color: #92400e; }

.rec-finding {
  font-size: 15px; color: var(--navy); margin: 0 0 10px;
  line-height: 1.45; font-weight: 600;
}
.rec-card p {
  margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--ink);
}
.rec-card p strong { color: var(--navy); font-weight: 600; }
.rec-card .rec-limit { color: var(--muted); font-size: 12px; }

/* Responsive */
@media (max-width: 720px) {
  .rec-grid { grid-template-columns: 1fr; }
  .anomaly-head { gap: 6px; }
}
/* ============================================================
   REPORTS (Milestone 10)
   ============================================================ */

.gen-preview {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
}
.gen-row {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.55;
}
.gen-row:last-child { margin-bottom: 0; }
.gen-row strong { color: var(--navy); }
.gen-row code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.gen-contents {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--ink);
}
.gen-contents-title {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}
.gen-contents ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}
.gen-contents li { color: var(--muted); }


/* ============================================================
   BILLING (Milestone 12)
   ============================================================ */

.sidebar-plan {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 4px;
  text-decoration: none;
}
.sidebar-plan:hover { color: #fff; text-decoration: none; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.plan-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}
.plan-card.plan-current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.plan-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.plan-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}
.plan-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.plan-per {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.plan-features {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  flex: 1;
}
.plan-features li {
  font-size: 13px;
  color: var(--ink);
  padding: 6px 0 6px 22px;
  position: relative;
  line-height: 1.5;
}
.plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #047857;
  font-weight: 700;
  font-size: 12px;
}
.plan-action {
  margin-top: auto;
  display: flex;
  justify-content: center;
}
.plan-action .btn { width: 100%; text-align: center; }


/* ============================================================
   UX POLISH — shared components
   ============================================================ */

/* Accessibility helpers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 8px;
  font-weight: 600; font-size: 14px; transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* Flash messages */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash-stack .flash { margin-bottom: 0; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; line-height: 1.5; }
.flash.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
.flash-close {
  background: none; border: 0; color: inherit; opacity: .6; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 2px; font-family: inherit;
}
.flash-close:hover { opacity: 1; }

/* Inline notices */
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); font-size: 13px; line-height: 1.5;
}
.notice strong { color: var(--navy); margin-right: 6px; }
.notice-upgrade {
  background: linear-gradient(135deg, rgba(47,107,255,.06), rgba(25,195,230,.06));
  border-color: rgba(47,107,255,.25);
}

/* Page bits */
.back-link { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.back-link:hover { color: var(--blue); text-decoration: none; }
.section-lead { margin: 0 0 18px; font-size: 14px; }
.settings-stack { display: flex; flex-direction: column; gap: 20px; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }

/* Members role picker */
.role-form { margin: 0; }
.role-select {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  padding: 5px 28px 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none; cursor: pointer;
}
.role-select:hover { border-color: #cbd6e6; }

/* Upload dropzone */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 36px 20px; margin-bottom: 8px; text-align: center; cursor: pointer;
  border: 2px dashed #cbd6e6; border-radius: 14px; background: var(--bg); color: var(--muted);
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--blue); background: rgba(47,107,255,.04); color: var(--blue); }
.dropzone:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.dropzone-title u { color: var(--blue); text-decoration: none; }
.dropzone-sub { font-size: 12px; }
.dropzone-file { font-size: 13px; font-weight: 600; color: var(--navy); }
.dropzone.has-file { border-style: solid; border-color: #34d399; background: #f0fdf4; color: #047857; }
.dropzone.has-file .dropzone-file::before { content: "✓ "; color: #047857; }

/* ============================================================
   AI ANALYST CHAT
   ============================================================ */
.chat-shell {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
  height: calc(100vh - 240px); min-height: 460px;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.chat-welcome { margin: auto; text-align: center; max-width: 440px; padding: 20px; }
.chat-welcome-icon {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}
.chat-welcome h3 { margin: 0 0 6px; color: var(--navy); font-size: 17px; }
.chat-welcome p { margin: 0; font-size: 14px; line-height: 1.6; }

.chat-msg { display: flex; flex-direction: column; max-width: min(720px, 85%); }
.chat-msg-user { align-self: flex-end; align-items: flex-end; }
.chat-msg-assistant { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 11px 15px; border-radius: 14px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg-user .chat-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg-assistant .chat-bubble {
  background: #f1f5f9; color: var(--ink); border-bottom-left-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.chat-msg-error .chat-bubble { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.chat-meta { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; }

.chat-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: dv-bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dv-bounce { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-suggested {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 14px;
}
.suggest-chip {
  font-family: inherit; font-size: 13px; color: var(--navy);
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: #fff; border: 1px solid var(--line);
  transition: border-color .15s, background-color .15s, color .15s;
}
.suggest-chip:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); background: rgba(47,107,255,.04); }
.suggest-chip:disabled { opacity: .5; cursor: not-allowed; }

.chat-input-row {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 16px; border-top: 1px solid var(--line); background: #fff;
}
.chat-input { resize: none; min-height: 44px; max-height: 160px; line-height: 1.5; }
.chat-input-row .btn { height: 44px; min-width: 84px; }
.chat-hint {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 0 16px 12px; font-size: 11px; background: #fff;
}

@media (max-width: 720px) {
  .chat-shell { height: calc(100vh - 200px); }
  .chat-messages { padding: 16px; }
  .chat-msg { max-width: 92%; }
  .chat-suggested { padding: 0 16px 12px; }
  .chat-hint span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ============================================================
   PREMIUM REFINEMENT LAYER — overrides earlier component styles
   ============================================================ */
:root {
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.04);
  --shadow-lg: 0 1px 2px rgba(15,23,42,.04), 0 12px 32px rgba(15,23,42,.08);
  --line-strong: #d8e1ee;
  --radius: 14px;
}
body.app-shell { background: #f5f7fb; }
h1, h2, h3 { letter-spacing: -.015em; }

/* Page headers */
.page-head { margin-bottom: 28px; align-items: flex-end; }
.page-h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.025em; margin-bottom: 6px; }
.page-h3 { font-size: 16px; letter-spacing: -.01em; }
.page-head p { font-size: 15px; line-height: 1.5; }

/* Buttons */
.btn-primary { background: linear-gradient(180deg, #3b76ff, #2f6bff); box-shadow: 0 1px 2px rgba(47,107,255,.3), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #3069f0, #245ae0); }
.btn-ghost { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.btn-danger { box-shadow: 0 1px 2px rgba(220,38,38,.3); }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 11px; }

/* Inputs */
.input {
  min-height: 44px; padding: 11px 14px; border-color: var(--line-strong); border-radius: 10px;
  font-size: 15px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.input:hover:not(:focus):not(:disabled) { border-color: #c3cfe0; }
.input::placeholder { color: #9aa8bc; }
.input-error, .input-error:hover { border-color: #f87171 !important; }
.input-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
select.input {
  appearance: none; padding-right: 36px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.field { margin-bottom: 18px; }
.field > span { margin-bottom: 7px; }
.err { font-size: 12.5px; margin-top: 6px; }

/* Cards */
.card { border-radius: 16px; border-color: #e6ebf3; box-shadow: var(--shadow); }
.card-head { margin-bottom: 18px; }
.danger-card { border-color: #fecaca; box-shadow: 0 0 0 4px rgba(254,202,202,.25); }

/* Stat tiles & KPIs */
.stat-card, .table-stat, .kpi-card {
  border-radius: 14px; border-color: #e6ebf3; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card::before, .table-stat::before, .kpi-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan)); opacity: 0;
  transition: opacity .2s;
}
.stat-card:hover::before, .table-stat:hover::before, .kpi-card:hover::before { opacity: 1; }
.table-stat { padding: 18px 20px; }
.table-stat-num, .stat-value { font-size: 28px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-value { font-size: 28px; font-variant-numeric: tabular-nums; }
.stat-label, .table-stat-label, .kpi-label { font-size: 11.5px; letter-spacing: .07em; }

/* Tables */
.data-table-wrap { border-radius: 16px; border-color: #e6ebf3; box-shadow: var(--shadow); }
.data-table thead { background: #f8fafc; }
.data-table th { padding: 13px 18px; color: #7b8ba3; }
.data-table td { padding: 15px 18px; }
.data-table tbody tr:hover { background: #f8faff; }
.card .data-table-wrap { box-shadow: none; }
.cell-icon {
  width: 38px; height: 38px; border-radius: 10px; border: 0;
  background: linear-gradient(135deg, rgba(47,107,255,.10), rgba(25,195,230,.10));
  color: var(--blue);
}
.cell-title { font-size: 14.5px; }
.icon-btn { border-radius: 9px; }

/* Badges */
.badge { padding: 3px 10px; font-size: 12px; letter-spacing: .01em; }
.badge-blue { background: rgba(47,107,255,.10); color: #2459d6; box-shadow: inset 0 0 0 1px rgba(47,107,255,.15); }
.badge-muted { background: #f1f5f9; color: #64748b; box-shadow: inset 0 0 0 1px #e2e8f0; }

/* Empty states */
.empty-state {
  border: 1px solid #e6ebf3; border-radius: 18px; box-shadow: var(--shadow);
  padding: 64px 24px;
  background: radial-gradient(400px 200px at 50% 0%, rgba(47,107,255,.05), transparent 70%), #fff;
}
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; opacity: 1;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, rgba(47,107,255,.12), rgba(25,195,230,.12));
  color: var(--blue); box-shadow: inset 0 0 0 1px rgba(47,107,255,.12);
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { max-width: 420px; margin-left: auto; margin-right: auto; line-height: 1.6; }

/* Flashes */
.flash { border-radius: 11px; padding: 12px 16px; font-size: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }

/* Charts & misc */
.chart-card { border-radius: 16px; }
.upload-hint { border-radius: 14px; }
.plan-card { border-radius: 16px; box-shadow: var(--shadow); }
.plan-card.plan-current { box-shadow: 0 0 0 3px rgba(47,107,255,.12), var(--shadow-lg); }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.kpi-value { font-size: clamp(20px, 1.55vw, 28px); white-space: nowrap; }

/* ============================================================
   STATISTICS & EDA PAGE
   ============================================================ */
.st-section { margin-bottom: 24px; }
.st-head { margin-bottom: 16px; }
.st-head p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; max-width: 820px; }
.st-mt { margin-top: 16px; }
.st-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.st-col {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  background: #f1f5f9; padding: 2px 7px; border-radius: 5px; color: var(--navy); white-space: nowrap;
}
.st-table td, .st-table th { vertical-align: top; }
.st-dense td, .st-dense th { padding: 11px 14px; font-size: 13px; }
.st-table .col-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.st-scroll { overflow-x: auto; border: 1px solid #e6ebf3; border-radius: 14px; background: #fff; }
.st-scroll .data-table { min-width: 900px; }
.st-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.st-examples code { font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

.st-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 700; background: #f1f5f9; color: #64748b;
}
.st-badge-yes { background: #ecfdf5; color: #047857; box-shadow: inset 0 0 0 1px #a7f3d0; }

/* Findings */
.st-findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.st-finding {
  background: #fff; border: 1px solid #e6ebf3; border-left: 4px solid var(--blue);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
}
.st-finding p { margin: 6px 0 8px; font-size: 15px; font-weight: 600; color: var(--navy); line-height: 1.45; }
.st-finding small { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.st-finding-type { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); }
.st-finding-correlation { border-left-color: #8b5cf6; } .st-finding-correlation .st-finding-type { color: #7c3aed; }
.st-finding-association { border-left-color: #0ea5e9; } .st-finding-association .st-finding-type { color: #0284c7; }
.st-finding-trend, .st-finding-weekday, .st-finding-seasonal { border-left-color: #10b981; }
.st-finding-trend .st-finding-type, .st-finding-weekday .st-finding-type, .st-finding-seasonal .st-finding-type { color: #047857; }
.st-finding-quality { border-left-color: #f59e0b; } .st-finding-quality .st-finding-type { color: #b45309; }

/* Tiles */
.st-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.st-tile { background: #f8fafc; border: 1px solid #e6ebf3; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.st-tile span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.st-tile b { font-size: 22px; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.st-tile em { font-style: normal; font-size: 12px; color: var(--muted); }
.st-tile-warn { background: #fffbeb; border-color: #fde68a; }
.st-tile-wide b { font-size: 17px; }

/* Column kinds */
.st-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.st-kind { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: var(--ink); }
.st-kind em { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-left: 4px; opacity: .7; }
.st-kind-numeric { background: rgba(47,107,255,.08); color: #2459d6; }
.st-kind-datetime { background: rgba(124,58,237,.08); color: #6d28d9; }
.st-kind-categorical { background: rgba(16,185,129,.1); color: #047857; }

/* Heatmap */
.st-heatmap { border-collapse: separate; border-spacing: 3px; font-size: 12px; margin: 6px; }
.st-heatmap th { font-weight: 600; color: var(--muted); padding: 6px 8px; text-align: right; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.st-heatmap thead th { text-align: center; vertical-align: bottom; height: 110px; }
.st-heatmap thead th span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 100px; overflow: hidden; text-overflow: ellipsis; }
.st-heatmap td {
  min-width: 56px; height: 40px; text-align: center; border-radius: 6px;
  font-variant-numeric: tabular-nums; font-weight: 600;
}

/* Group details */
.st-details summary { cursor: pointer; font-size: 13px; color: var(--navy); }
.st-details summary:hover { color: var(--blue); }
.st-mini { margin-top: 8px; border-collapse: collapse; font-size: 12px; min-width: 260px; }
.st-mini th, .st-mini td { padding: 5px 10px 5px 0; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.st-mini th { color: var(--muted); font-weight: 600; }

/* Time */
.st-time { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.st-time li {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
  border: 1px solid #e6ebf3; border-radius: 12px; background: #fff;
}
.st-time li > div { flex: 1; font-size: 14px; }
.st-time li.is-sig { border-color: #a7f3d0; background: #f6fefb; }
.st-time-kind {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); min-width: 72px; padding-top: 2px;
}

/* Categorical bars */
.st-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.st-cat { border: 1px solid #e6ebf3; border-radius: 12px; padding: 14px 16px; }
.st-cat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.st-bar { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.st-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-bar i { display: block; height: 8px; border-radius: 4px; width: var(--w); background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.st-bar b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.st-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }

/* Guide */
.st-guide details { background: #fff; border: 1px solid #e6ebf3; border-radius: 14px; padding: 4px 20px; }
.st-guide summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--navy); }
.st-guide dl { margin: 0 0 16px; display: grid; grid-template-columns: 200px 1fr; gap: 10px 20px; font-size: 14px; }
.st-guide dt { font-weight: 600; color: var(--navy); }
.st-guide dd { margin: 0; color: var(--muted); line-height: 1.55; }
@media (max-width: 720px) {
  .st-guide dl { grid-template-columns: 1fr; gap: 4px; }
  .st-guide dd { margin-bottom: 10px; }
  .st-findings { grid-template-columns: 1fr; }
}

/* ============================================================
   PAGE POLISH — workspaces, datasets, analyst, reports, billing, settings
   ============================================================ */

/* Breadcrumbs */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); text-decoration: none; }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb span[aria-hidden] { color: #c3cfe0; }

/* Title with icon tile (dataset, workspace, report) */
.ds-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ds-title-icon {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(47,107,255,.12), rgba(25,195,230,.12)); color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(47,107,255,.12);
}
.ds-title .page-h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; word-break: break-word; }
.ds-title p { margin: 0; }
.ds-header { margin-bottom: 24px; }
.ds-title-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.ds-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: 13.5px; color: var(--muted); }
.ds-meta span + span::before { content: "·"; margin-right: 16px; color: #c3cfe0; }
.ds-meta span:empty { display: none; }
.ds-delete { width: 42px; height: 42px; border: 1px solid var(--line-strong); background: #fff; }
.page-actions { align-items: center; }
.page-actions .btn svg { flex-shrink: 0; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; margin-top: 22px; border-bottom: 1px solid #e2e8f0;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 11px 14px; margin-bottom: -1px; font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--navy); text-decoration: none; }
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* Next-step cards (dataset overview) */
.next-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.next-step {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 14px;
  background: #fff; border: 1px solid #e6ebf3; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.next-step:hover { text-decoration: none; border-color: rgba(47,107,255,.35); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.next-step-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff;
}
.next-step b { display: block; color: var(--navy); font-size: 14.5px; margin-bottom: 3px; }
.next-step em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
@media (max-width: 1100px) { .next-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .next-steps { grid-template-columns: 1fr; } }

.preview-col-type { text-transform: uppercase; font-size: 9.5px; letter-spacing: .06em; font-weight: 700; }
.preview-col-type.kind-numeric { color: #2459d6; }
.preview-col-type.kind-datetime { color: #6d28d9; }
.preview-col-type.kind-categorical { color: #047857; }

/* Role pill */
.role-pill {
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px;
  background: #f1f5f9; color: #475569; vertical-align: middle;
}
.role-owner { background: rgba(47,107,255,.1); color: #2459d6; }
.role-admin { background: rgba(124,58,237,.1); color: #6d28d9; }

/* Stats & tables */
.table-stats-4 { grid-template-columns: repeat(4, 1fr); }
.table-stat-text { font-size: 19px !important; padding-top: 5px; }
@media (max-width: 900px) { .table-stats-4 { grid-template-columns: repeat(2, 1fr); } }
.btn-xs { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.row-actions { align-items: center; gap: 6px; }
.data-table .col-actions { width: auto; white-space: nowrap; }
tr.row-link { cursor: pointer; }
.input-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; width: auto; }
select.input-sm { padding-right: 34px; }
.table-toolbar { margin-bottom: 14px; }
.table-search { max-width: 380px; min-height: 42px; }
.table-empty[hidden] { display: none; }

/* AI analyst layout */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.chat-aside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; }
.chat-aside-card { background: #fff; border: 1px solid #e6ebf3; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.chat-aside-head { display: flex; align-items: center; gap: 10px; color: var(--blue); margin-bottom: 14px; }
.chat-aside-head b { color: var(--navy); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-facts { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.chat-facts div { display: flex; justify-content: space-between; gap: 12px; }
.chat-facts dt { color: var(--muted); }
.chat-facts dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-aside-kpis { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-aside-kpis div { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.chat-aside-kpis span { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chat-aside-kpis b { font-size: 17px; color: var(--navy); font-variant-numeric: tabular-nums; }
.chat-aside-links { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-aside-links a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink); }
.chat-aside-links a:hover { background: #f1f5ff; color: var(--blue); text-decoration: none; }
.chat-aside-note { display: flex; gap: 8px; margin: 0; padding: 0 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.chat-aside-note svg { flex-shrink: 0; margin-top: 2px; color: #059669; }
textarea.chat-input { resize: none; }
@media (max-width: 1100px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-aside { position: static; }
}

/* Reports */
.report-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-picker select { max-width: 260px; }
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.report-preview { padding: 0; overflow: hidden; }
.report-preview iframe { display: block; width: 100%; height: calc(100vh - 210px); min-height: 560px; border: 0; background: #e2e8f0; }
.report-side { display: flex; flex-direction: column; gap: 16px; }
.report-side .card { padding: 20px; }
.report-contents { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; }
.report-contents li { display: flex; align-items: center; gap: 9px; }
.report-contents svg { color: #059669; flex-shrink: 0; }
.report-facts { margin: 12px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.report-facts div { display: flex; justify-content: space-between; gap: 12px; }
.report-facts dt { color: var(--muted); }
.report-facts dd { margin: 0; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.report-note { margin: 14px 0 0; font-size: 12px; line-height: 1.5; }
@media (max-width: 1000px) {
  .report-layout { grid-template-columns: 1fr; }
  .report-preview iframe { height: 70vh; }
}

/* Billing */
.plan-hero {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center;
  padding: 26px 28px; margin-bottom: 28px; border-radius: 18px; color: #c7d2e5;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(25,195,230,.25), transparent 70%),
    radial-gradient(500px 260px at 0% 100%, rgba(47,107,255,.35), transparent 70%),
    #0b1b33;
  box-shadow: var(--shadow-lg);
}
.plan-hero-label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.plan-hero-name { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; font-size: 30px; font-weight: 700; color: #fff; letter-spacing: -.02em; margin: 4px 0 6px; }
.plan-hero-price { font-size: 16px; font-weight: 600; color: #c7d2e5; }
.plan-hero-price small { font-size: 13px; font-weight: 500; }
.plan-hero .muted { color: #9fb0c8; margin: 0; font-size: 14px; }
.plan-hero-note {
  display: flex; gap: 12px; max-width: 420px; padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); font-size: 13px; line-height: 1.5;
}
.plan-hero-note svg { flex-shrink: 0; color: var(--cyan); margin-top: 2px; }
.plan-hero-note b { display: block; color: #fff; }
.plan-hero-note a { color: var(--cyan); font-weight: 600; }
.section-title { font-size: 15px; color: var(--navy); margin: 0 0 12px; }
.usage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px; }
.usage-card { background: #fff; border: 1px solid #e6ebf3; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.usage-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.usage-card b { font-size: 26px; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.usage-card b small { font-size: 15px; color: var(--muted); font-weight: 500; }
.usage-hint { font-size: 12px; color: var(--muted); }
.usage-bar { height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; margin: 4px 0 2px; }
.usage-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.usage-bar.is-high i { background: #f59e0b; }
.usage-bar.is-full i { background: #ef4444; }
@media (max-width: 900px) { .usage-grid { grid-template-columns: repeat(2, 1fr); } }
.plan-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 0; }
.plan-card { position: relative; padding: 26px 22px 22px; }
.plan-card.plan-featured { border-color: rgba(47,107,255,.35); }
.plan-flag {
  position: absolute; top: -11px; left: 22px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--navy); color: #fff;
}
.plan-flag-pop { background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.plan-card .plan-name { font-size: 17px; }
.plan-card .plan-price { font-size: 34px; letter-spacing: -.03em; margin: 6px 0 18px; }
.plan-features li.is-off { color: #94a3b8; }
.plan-features li.is-off::before { content: "–"; color: #cbd5e1; }
.plan-action .btn { width: 100%; }
.billing-foot { margin-top: 18px; font-size: 13px; }

/* Settings */
.account-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 24px; margin-bottom: 32px;
  background: #fff; border: 1px solid #e6ebf3; border-radius: 16px; box-shadow: var(--shadow);
}
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.account-card-text { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.account-card-text b { font-size: 17px; color: var(--navy); }
.account-card-text span { font-size: 14px; color: var(--muted); }
.account-facts { display: flex; gap: 28px; margin: 0; flex-wrap: wrap; }
.account-facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.account-facts dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; color: var(--ink); }
.settings-section {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px;
  padding: 28px 0; border-top: 1px solid #e2e8f0;
}
.settings-intro h3 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.settings-intro p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.settings-form { max-width: 720px; padding: 24px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.settings-actions { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 18px; }
.settings-inline { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.settings-inline b { display: block; color: var(--navy); margin-bottom: 4px; }
.settings-inline .muted { font-size: 13.5px; }
@media (max-width: 960px) {
  .settings-section { grid-template-columns: 1fr; gap: 14px; }
  .settings-grid { grid-template-columns: 1fr; }
}

.quality-badges .warn-chip { white-space: normal; }
.ds-title { min-width: 0; flex: 1 1 320px; }
.ds-title .page-h2 { overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .data-table td.col-num[data-label] { display: inline-block; width: auto; margin-right: 16px; font-size: 13px; }
  .data-table td.col-num[data-label]::before { content: attr(data-label); color: var(--muted); margin-right: 6px; font-size: 12px; }
  .data-table td.col-date { display: block; width: 100%; }
}
@media (max-width: 720px) {
  .table-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .table-stats-4 { grid-template-columns: repeat(2, 1fr); }
  .table-stat { padding: 12px; }
  .table-stat-num, .table-stat-text { font-size: 18px !important; }
  .table-stat-label { font-size: 10px; }
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-head { align-items: flex-end; }
.dash-context { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; font-size: 13.5px; color: var(--muted); }
.dash-context > * { display: inline-flex; align-items: center; gap: 6px; }
.dash-context a { color: var(--muted); }
.dash-context a:hover { color: var(--blue); text-decoration: none; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dash-actions .dataset-picker { height: 42px; }
.dash-actions .dataset-picker select { min-width: 160px; max-width: 240px; text-overflow: ellipsis; }

.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.dash-kpi {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 18px 20px; border-radius: 16px; background: #fff;
  border: 1px solid #e6ebf3; box-shadow: var(--shadow);
}
.dash-kpi-main {
  color: #c7d2e5; border-color: transparent;
  background:
    radial-gradient(260px 140px at 100% 0%, rgba(25,195,230,.28), transparent 70%),
    radial-gradient(260px 160px at 0% 100%, rgba(47,107,255,.35), transparent 70%),
    #0b1b33;
}
.dash-kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash-kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi-main .dash-kpi-label { color: #9fb0c8; }
.dash-kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.03em; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.dash-kpi-main .dash-kpi-value { color: #fff; }
.dash-kpi-foot { font-size: 12px; color: var(--muted); }
.dash-kpi-main .dash-kpi-foot { color: #8fa3bf; }
.dash-kpi-foot code { font-size: 11px; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.dash-spark { width: 100%; height: 34px; color: var(--cyan); margin-top: 2px; }
.delta-chip { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.delta-chip.up { background: rgba(16,185,129,.15); color: #059669; }
.delta-chip.down { background: rgba(239,68,68,.12); color: #dc2626; }
.dash-kpi-main .delta-chip.up { background: rgba(52,211,153,.18); color: #6ee7b7; }
.dash-kpi-main .delta-chip.down { background: rgba(248,113,113,.18); color: #fca5a5; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.dash-grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid > .card { margin: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-link { font-size: 13px; font-weight: 600; white-space: nowrap; }
.dash-trend .chart-box { min-height: 300px; }

.dash-findings { display: flex; flex-direction: column; }
.finding-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.finding-list li { display: flex; gap: 12px; }
.finding-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--blue); box-shadow: 0 0 0 4px rgba(47,107,255,.12); }
.finding-correlation .finding-dot { background: #8b5cf6; box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.finding-trend .finding-dot, .finding-weekday .finding-dot, .finding-seasonal .finding-dot { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.finding-quality .finding-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
.finding-list p { margin: 0 0 3px; font-size: 14px; font-weight: 600; color: var(--navy); line-height: 1.45; }
.finding-list small { font-size: 11.5px; color: var(--muted); line-height: 1.4; display: block; }
.dash-findings-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: #059669; padding: 20px 8px; }
.dash-findings-empty p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.dash-findings-cta { margin-top: auto; }

.metric-list { margin: 0; display: flex; flex-direction: column; }
.metric-list div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.metric-list div:last-child { border-bottom: 0; }
.metric-list dt { font-size: 13.5px; color: var(--ink); }
.metric-list dt code { font-size: 11px; color: var(--muted); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.metric-list dd { margin: 0; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

@media (max-width: 1200px) { .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .dash-grid, .dash-grid-even { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .dash-kpis { grid-template-columns: minmax(0, 1fr); }
  .dash-kpi-value { font-size: 28px; }
  .dash-actions { width: 100%; }
  .dash-actions .dataset-picker-form, .dash-actions .dataset-picker { width: 100%; }
}

/* ============================================================
   FORM PAGES (new / edit workspace)
   ============================================================ */
.form-page { display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 340px); gap: 28px; align-items: start; }
.form-page-single { grid-template-columns: minmax(0, 640px); }
.form-card { padding: 28px; }
.form-card-head { display: flex; gap: 14px; align-items: center; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-card-head .page-h2 { font-size: 22px; margin-bottom: 2px; }
.form-card-head p { margin: 0; font-size: 14px; }
.name-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -8px 0 20px; font-size: 12.5px; }
.suggest-chip-sm { padding: 4px 10px; font-size: 12px; }
.field > .field-label-row > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.char-count { font-size: 11.5px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.char-count.is-near { color: #b45309; }
.form-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 20px; margin-top: 6px; border-top: 1px solid var(--line); }
.form-footer-left { margin-right: auto; }
.form-aside { padding: 24px; border-radius: 16px; background: linear-gradient(170deg, #f1f5ff, #f8fafc); border: 1px solid #e3e9f5; }
.form-aside h3 { margin: 0 0 16px; font-size: 15px; color: var(--navy); }
.form-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.form-steps li { display: flex; gap: 12px; }
.form-steps li > span {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan));
}
.form-steps b { display: block; font-size: 14px; color: var(--navy); }
.form-steps em { font-style: normal; font-size: 13px; color: var(--muted); line-height: 1.5; }
.form-aside-note { display: flex; gap: 8px; margin: 0; padding-top: 16px; border-top: 1px solid #e3e9f5; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.form-aside-note svg { flex-shrink: 0; margin-top: 2px; color: #059669; }
@media (max-width: 1000px) { .form-page { grid-template-columns: minmax(0, 1fr); } }

.dash-span-2 { grid-column: 1 / -1; }
.partial-note { color: #b45309; }
@media (max-width: 560px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-kpi { padding: 14px; }
  .dash-kpi-main { grid-column: 1 / -1; }
  .dash-kpi:not(.dash-kpi-main) .dash-kpi-value { font-size: 22px; }
  .dash-kpi:not(.dash-kpi-main) .dash-kpi-foot { display: none; }
}

/* As many columns as there are headline KPIs (1–4); smaller screens override below. */
@media (min-width: 1201px) { .dash-kpis { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); } }

/* ============================================================
   LEGAL PAGES (/privacy, /terms, /dpa) — loaded with landing.css
   ============================================================ */
/* landing.css loads after app.css, so this needs the extra class to win */
.legal-page .lp-nav.lp-nav-solid { background: #071122; }
.legal-page { background: #fff; }
.legal-main { padding: 48px 0 80px; }
.legal-draft {
  margin-bottom: 28px; padding: 14px 18px; border-radius: 12px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px; line-height: 1.55;
}
.legal-draft code { background: #fff; padding: 1px 6px; border-radius: 4px; }
.legal-missing { background: #fef3c7; color: #92400e; padding: 0 4px; border-radius: 4px; font-weight: 600; }
.legal-hero { max-width: 780px; margin-bottom: 40px; }
.legal-hero h1 { font-size: clamp(32px, 4vw, 46px); color: var(--navy); margin: 0 0 10px; letter-spacing: -.03em; }
.legal-meta { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.legal-lead { margin: 0; font-size: 17px; line-height: 1.7; color: #334155; }
.legal-grid { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 56px; align-items: start; }
.legal-toc { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; border-left: 2px solid #e2e8f0; }
.legal-toc-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 0 10px 16px; }
.legal-toc a { padding: 6px 0 6px 16px; margin-left: -2px; border-left: 2px solid transparent; font-size: 13.5px; color: var(--muted); }
.legal-toc a:hover { color: var(--navy); border-left-color: var(--blue); text-decoration: none; }
.legal-doc { font-size: 15.5px; line-height: 1.75; color: #1e293b; }
.legal-doc section { padding-top: 8px; margin-bottom: 36px; scroll-margin-top: 90px; }
.legal-doc h2 { font-size: 21px; color: var(--navy); margin: 0 0 12px; letter-spacing: -.015em; }
.legal-doc p { margin: 0 0 12px; }
.legal-doc ul { margin: 0 0 12px; padding-left: 22px; }
.legal-doc li { margin-bottom: 8px; }
.legal-doc a { font-weight: 500; }
.legal-doc code { font-size: 13px; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.legal-dl { margin: 0; display: grid; gap: 14px; }
.legal-dl dt { font-weight: 600; color: var(--navy); }
.legal-dl dd { margin: 2px 0 0; }
.legal-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; margin: 8px 0 16px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.legal-table th, .legal-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid #e2e8f0; }
.legal-table tr:last-child th, .legal-table tr:last-child td { border-bottom: 0; }
.legal-table thead th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.legal-table tbody th { width: 180px; color: var(--navy); background: #fafbfd; }
.legal-foot-links { display: flex; gap: 18px; }
.legal-foot-links a { color: #8fa3bf; }
.legal-foot-links a:hover { color: #fff; text-decoration: none; }
.lp-links a[aria-current="page"] { color: #fff; }
@media (max-width: 960px) {
  .legal-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .legal-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; border-left: 0; }
  .legal-toc-title { width: 100%; padding: 0; }
  .legal-toc a { padding: 2px 0; margin: 0; border: 0; }
}

/* Consent + security links */
.auth-consent { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); text-align: center; }
.lp-security-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.lp-security-link { color: var(--cyan); font-weight: 600; font-size: 14px; }
.lp-form-note a { color: inherit; text-decoration: underline; }

/* ============================================================
   NAVIGATION + COLLABORATION UX (grouped sidebar, people, invite)
   ============================================================ */
.sidebar-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #fff;
  background: linear-gradient(180deg, #3b76ff, #2f6bff); box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.15);
}
.sidebar-cta:hover, .sidebar-cta.is-active { text-decoration: none; background: linear-gradient(180deg, #3069f0, #245ae0); color: #fff; }
.sidebar-cta:focus-visible, .nav a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.nav { gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
  padding: 0 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #6f84a3;
}

/* Dashboard: getting-started checklist + quick links */
.onboard { padding: 28px; }
.onboard-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.onboard-head .empty-icon { margin: 0; flex-shrink: 0; }
.onboard-head p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; max-width: 560px; }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.onboard-steps li {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.onboard-steps b { display: block; font-size: 14px; color: var(--navy); }
.onboard-steps em { font-style: normal; font-size: 13px; color: var(--muted); }
.onboard-num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--blue); background: rgba(47,107,255,.1);
}
.onboard-steps li.is-done { background: #f6fdf9; border-color: #bbf7d0; }
.onboard-steps li.is-done .onboard-num { color: #047857; background: #d1fae5; }
.btn.is-disabled { opacity: .5; pointer-events: none; }
@media (max-width: 620px) {
  .onboard-steps li { grid-template-columns: 32px minmax(0, 1fr); }
  .onboard-steps li > .btn { grid-column: 1 / -1; justify-self: start; }
}

.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 22px; }
.quick-links a {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--ink); background: #fff; border: 1px solid var(--line-strong);
}
.quick-links a:hover { text-decoration: none; border-color: var(--blue); color: var(--blue); }
.quick-links svg { color: var(--muted); }
.quick-links a:hover svg { color: var(--blue); }
.quick-links .quick-links-end { margin-left: auto; }
@media (max-width: 620px) { .quick-links .quick-links-end { margin-left: 0; } }

/* Workspace detail: datasets + people side panel */
.ws-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; margin-top: 24px; }
.ws-main .empty-state { margin: 0; }
@media (max-width: 1100px) { .ws-layout { grid-template-columns: minmax(0, 1fr); } }
.people-card { padding: 20px; position: sticky; top: 20px; }
@media (max-width: 1100px) { .people-card { position: static; } }
.people-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.people-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.people-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.people-list li:last-child { border-bottom: 0; }
.people-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.people-text b, .people-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people-text b { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.people-text small { font-size: 12px; color: var(--muted); }
.people-more { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 13px; }
.people-locked { padding: 14px; border-radius: 10px; background: #f8fafc; border: 1px dashed var(--line-strong); }
.people-locked p { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.people-locked svg { flex-shrink: 0; margin-top: 2px; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }

/* Members page: inline invite */
.invite-card { margin-bottom: 24px; border-color: #cddcff; background: linear-gradient(180deg, #f7faff, #fff 60%); }
.invite-card-head { margin-bottom: 16px; }
.invite-card-head h3 { display: flex; align-items: center; gap: 8px; }
.invite-card-head h3 svg { color: var(--blue); }
.invite-card-head p { margin: 4px 0 0; font-size: 14px; }
.invite-form { display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; gap: 12px; align-items: end; }
.invite-form .field { margin-bottom: 0; }
.invite-submit { height: 44px; white-space: nowrap; }
.invite-help { margin: 12px 0 0; font-size: 13px; }
@media (max-width: 760px) {
  .invite-form { grid-template-columns: minmax(0, 1fr); }
  .invite-submit { width: 100%; justify-content: center; }
}
.invite-locked { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.invite-locked > div { flex: 1; min-width: 220px; }
.invite-locked b { color: var(--navy); font-size: 14px; }
.invite-locked p { margin: 4px 0 0; font-size: 13.5px; }
.invite-locked-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--blue); background: rgba(47,107,255,.1);
}
.members-card { margin-bottom: 24px; }
.members-empty { margin: 14px 0 0; font-size: 14px; }

/* Upload + edit forms */
.field-hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.ws-fixed {
  display: flex !important; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 10px;
  background: #f8fafc; border: 1px solid var(--line); font-weight: 600 !important; color: var(--navy) !important;
}
.form-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: #fecaca; }
.danger-zone p { margin: 4px 0 0; font-size: 13.5px; max-width: 420px; }
.aside-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.aside-links a { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; color: var(--ink); }
.aside-links a:hover { background: #fff; text-decoration: none; box-shadow: var(--shadow); }
.aside-links svg { flex-shrink: 0; margin-top: 2px; color: var(--blue); }
.aside-links b { display: block; font-size: 14px; color: var(--navy); }
.aside-links em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.cell-owner { font-size: 12.5px; }
