@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@600;800&display=swap');

/* Niu — "A new way to answer."
   Dark "neon dashboard" theme with a violet → pink neon accent.
   Plain CSS, no build step. Class names are stable (HTML/JS unchanged). */

:root {
  --bg: #0a0710;
  --surface: #16111f;
  --surface-2: #100b18;
  --border: #271d38;
  --border-soft: #1d1529;
  --text: #efe9f7;
  --muted: #9b8fb5;

  --neon: #d946ef;           /* fuchsia */
  --violet: #a855f7;
  --pink: #ec4899;
  --accent: var(--neon);
  --accent-ink: #ef9bff;     /* bright text/icon on dark */
  --accent-weak: rgba(217,70,239,.14);
  --neon-grad: linear-gradient(135deg, #a855f7 0%, #d946ef 50%, #ec4899 100%);
  --glow: 0 0 24px rgba(217,70,239,.38);
  --glow-strong: 0 0 10px rgba(236,72,153,.6), 0 0 26px rgba(168,85,247,.45);

  --indigo: #a855f7;
  --indigo-weak: rgba(168,85,247,.16);
  --amber: #fbbf24;
  --amber-weak: rgba(251,191,36,.14);
  --rose: #fb7185;
  --rose-weak: rgba(251,113,133,.15);
  --green: #34d399;
  --green-weak: rgba(52,211,153,.15);
  --slate-weak: rgba(255,255,255,.04);

  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 34px rgba(0,0,0,.45);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 560px at 78% -8%, rgba(168,85,247,.20), transparent 60%),
    radial-gradient(900px 520px at 12% 4%, rgba(236,72,153,.12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }

.demo-ribbon {
  background: linear-gradient(90deg, rgba(168,85,247,.14), rgba(236,72,153,.14));
  border-bottom: 1px solid var(--border);
  color: var(--accent-ink);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  text-align: center; padding: 7px 12px;
}

/* ---------- Launcher ---------- */
.launch-wrap { max-width: 1000px; margin: 0 auto; padding: 48px 20px 80px; }
.brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.logo-dot {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--neon-grad);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: var(--glow);
}
.launch-wrap h1 { font-size: 31px; margin: 0; letter-spacing: -.02em; }
.launch-wrap .lede { color: var(--muted); font-size: 17px; max-width: 680px; margin: 10px 0 36px; }
.launch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px){ .launch-grid { grid-template-columns: 1fr; } }
.launch-card {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.launch-card:hover { transform: translateY(-2px); border-color: var(--neon); box-shadow: var(--shadow), var(--glow); }
.launch-card .pill { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-weak); display: inline-block; padding: 3px 10px; border-radius: 999px; }
.launch-card h2 { margin: 14px 0 6px; font-size: 20px; }
.launch-card p { margin: 0; color: var(--muted); font-size: 14px; }
.note { margin-top: 36px; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }

/* ---------- App shell (admin) ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

/* Mobile navigation: the sidebar becomes a slide-in menu, opened from a top bar. */
.mobile-bar { display: none; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface-2); z-index: 40; }
.menu-btn { font: inherit; font-size: 23px; line-height: 1; background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.menu-btn:hover { background: var(--slate-weak); }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 45; }
@media (max-width: 860px){
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .22s ease; z-index: 50; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-bar { display: flex; }
  .scrim.open { display: block; }
}

.sidebar {
  background: linear-gradient(180deg, rgba(168,85,247,.06), transparent 40%), var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand-row { margin-bottom: 20px; }
.sidebar .logo-dot { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
.sidebar h1 { font-size: 15px; margin: 0; }
.sidebar .sub { font-size: 11px; color: var(--muted); }

.side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 8px 8px; opacity: .8; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer;
  padding: 9px 10px; border-radius: var(--radius-sm); font-size: 13.5px; text-decoration: none;
}
.nav-item:hover { background: var(--slate-weak); }
.nav-item.active {
  background: var(--accent-weak); color: #fff; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--neon), 0 0 16px rgba(217,70,239,.18);
}
.nav-item .ic { width: 18px; text-align: center; opacity: .95; }

.client-pick { width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; margin-top: 4px; }

.main { padding: 26px 30px 70px; max-width: 1140px; }
@media (max-width: 860px){ .main { padding: 20px 16px 60px; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.topbar .crumb { color: var(--muted); font-size: 13px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.badge.live { background: var(--green-weak); color: var(--green); box-shadow: 0 0 10px rgba(52,211,153,.25); }
.badge.shadow { background: var(--indigo-weak); color: #c4a6ff; }
.badge.neutral { background: var(--slate-weak); color: var(--muted); }
.badge.warn { background: var(--amber-weak); color: var(--amber); }
.badge.rose { background: var(--rose-weak); color: var(--rose); }
.badge.green { background: var(--green-weak); color: var(--green); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 24px; }
.tile { background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 29px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.tile .v.accent { color: #fff; text-shadow: var(--glow-strong); }
.tile .v.green { color: var(--green); text-shadow: 0 0 14px rgba(52,211,153,.5); }
.tile .v.rose { color: var(--rose); text-shadow: 0 0 14px rgba(251,113,133,.45); }

.card { background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card .card-h { padding: 15px 18px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card .card-h h3 { margin: 0; font-size: 15px; }
.card .card-h .hint { font-size: 12px; color: var(--muted); }
.card .card-b { padding: 16px 18px; }
.card .card-b.flush { padding: 0; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin: 0 0 10px; }
.callout:last-child { margin-bottom: 0; }
.callout.warn { background: var(--amber-weak); color: var(--amber); }
.callout.rose { background: var(--rose-weak); color: var(--rose); }
.callout.good { background: var(--green-weak); color: var(--green); }
.callout.info { background: var(--slate-weak); color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--slate-weak); }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }

.kv { display: grid; grid-template-columns: 210px 1fr; gap: 2px 18px; font-size: 14px; }
.kv dt { color: var(--muted); padding: 7px 0; }
.kv dd { margin: 0; padding: 7px 0; }
@media (max-width: 620px){ .kv { grid-template-columns: 1fr; } .kv dd { padding-top: 0; padding-bottom: 12px; } }

.method { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-size: 12.5px; background: var(--slate-weak); color: var(--text); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); }
.chip.off { color: var(--muted); opacity: .6; }
.chip.on { background: var(--accent-weak); color: var(--accent-ink); border-color: transparent; }

.footer-note { font-size: 12px; color: var(--muted); margin-top: 24px; }
.scope-note { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
@media (max-width: 640px){ .scope-note { white-space: normal; } }

/* Niu brand lockup (concept 1: wordmark + glowing full-stop) */
.niu { font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--text); display: inline-block; font-size: 26px; }
.niu .dot { color: var(--neon); text-shadow: 0 0 10px rgba(217,70,239,.85), 0 0 22px rgba(217,70,239,.5); }
.niu.lg { font-size: 42px; }
.niu.sm { font-size: 19px; }
.niu-slogan { color: var(--accent-ink); font-size: 13px; }
.powered { font-size: 11px; color: var(--muted); }
.powered .niu { font-size: 12px; }

/* neon chart */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: 190px; display: block; }
.chart-legend { position: absolute; top: 14px; left: 18px; font-size: 12px; color: var(--muted); }
.chart-legend b { color: #fff; font-size: 22px; font-weight: 750; display: block; text-shadow: var(--glow-strong); letter-spacing: -.02em; }

/* buttons */
.btn { font: inherit; font-size: 13px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); }
.btn:hover { border-color: var(--neon); }
.btn.primary { background: var(--neon-grad); color: #fff; border-color: transparent; font-weight: 600; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: var(--glow-strong); }
.btn.danger { background: var(--rose-weak); color: var(--rose); border-color: transparent; font-weight: 600; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-btn { text-transform: capitalize; }

/* masked personal data */
.mask { display: inline-flex; align-items: center; gap: 7px; }
.mask .mask-val { font-variant-numeric: tabular-nums; }
.mask.revealed .mask-val { background: var(--amber-weak); color: var(--amber); padding: 0 4px; border-radius: 4px; }
.mask-btn { font: inherit; font-size: 11px; cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px; }
.mask-btn:hover { border-color: var(--neon); }

/* cost bar */
.bar { height: 12px; background: var(--slate-weak); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-soft); }
.bar-fill { height: 100%; border-radius: 999px; background: var(--neon-grad); box-shadow: var(--glow); }
.bar-fill.ok { background: linear-gradient(90deg, #22c55e, #34d399); box-shadow: 0 0 16px rgba(52,211,153,.4); }
.bar-fill.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-fill.rose { background: linear-gradient(90deg, #e11d48, #fb7185); }

/* teach the AI */
.teach-draft { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.teach-input { width: 100%; min-height: 72px; font: inherit; font-size: 14px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); margin-bottom: 12px; resize: vertical; }
.teach-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* dsr search */
.dsr-bar { display: flex; gap: 8px; }
.dsr-bar input { flex: 1; font: inherit; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 390px; background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow), var(--glow); padding: 30px; }
.login-card h1 { font-size: 20px; margin: 14px 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; font: inherit; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.field input:focus, .teach-input:focus, .dsr-bar input:focus, .chat-input input:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 3px rgba(217,70,239,.18); }
.mfa { display: flex; gap: 8px; }
.mfa input { text-align: center; letter-spacing: .3em; }

/* client view */
.client-wrap { max-width: 940px; margin: 0 auto; padding: 32px 20px 72px; }
.brief-head { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
@media (max-width: 680px){ .grid-2 { grid-template-columns: 1fr; } }
.client-wrap .tabs { display: flex; gap: 8px; margin: 22px 0; flex-wrap: wrap; }
.client-wrap .tabs button { font: inherit; font-size: 14px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 15px; border-radius: 999px; }
.client-wrap .tabs button.active { background: var(--accent-weak); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 0 16px rgba(217,70,239,.2); }
.brief-pre { white-space: pre-wrap; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); line-height: 1.6; }

/* ---------- Web chat ---------- */
.chat-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.phone {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow), var(--glow); overflow: hidden; display: flex; flex-direction: column;
  height: min(760px, 90vh);
}
.chat-head { padding: 16px 18px; background: var(--neon-grad); color: #fff; }
.chat-head .co { font-weight: 700; font-size: 16px; }
.chat-head .who { font-size: 12px; opacity: .95; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: #d8ffe6; box-shadow: 0 0 8px #86efac; display: inline-block; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14px; }
.msg.bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: var(--neon-grad); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; box-shadow: var(--glow); }
.msg.sys { align-self: center; background: var(--amber-weak); color: var(--amber); font-size: 12px; text-align: center; border-radius: 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px 0; }
.quick button { font: inherit; font-size: 12.5px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); color: var(--accent-ink); padding: 6px 11px; border-radius: 999px; }
.quick button:hover { border-color: var(--neon); }
.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-input input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.chat-input button { font: inherit; cursor: pointer; border: 0; background: var(--neon-grad); color: #fff; padding: 0 16px; border-radius: 999px; font-weight: 600; box-shadow: var(--glow); }
.chat-foot { text-align: center; font-size: 11px; color: var(--muted); padding: 8px; background: var(--surface); }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin: 0 1px; animation: blink 1.2s infinite both; }
.typing span:nth-child(2){ animation-delay: .2s; } .typing span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{ opacity:.2 } 40%{ opacity:1 } }

/* ============================================================
   LIGHT THEME
   Applied when <html data-theme="light">. The neon violet→pink
   accent is kept (brand); surfaces become white, ink becomes dark.
   Higher specificity than :root, so it always wins the token values.
   ============================================================ */
:root[data-theme="light"] {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #f3eef9;
  --border: #e7e0f1;
  --border-soft: #efeaf7;
  --text: #1c1033;
  --muted: #6c5d88;

  --accent-ink: #a21caf;          /* readable fuchsia on white */
  --accent-weak: rgba(217,70,239,.12);

  --indigo-weak: rgba(168,85,247,.12);
  --amber: #b45309;
  --amber-weak: rgba(251,191,36,.18);
  --rose: #e11d48;
  --rose-weak: rgba(225,29,72,.12);
  --green: #15803d;
  --green-weak: rgba(21,128,61,.12);
  --slate-weak: rgba(28,16,51,.05);

  /* soften the neon shadows so they read as a gentle lift on white */
  --glow: 0 6px 20px rgba(217,70,239,.16);
  --glow-strong: 0 8px 26px rgba(168,85,247,.22);
  --shadow: 0 1px 2px rgba(80,60,120,.08), 0 10px 30px rgba(80,60,120,.10);
}

/* page background: light wash of the brand tints instead of the dark glow */
:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 560px at 78% -8%, rgba(168,85,247,.10), transparent 60%),
    radial-gradient(900px 520px at 12% 4%, rgba(236,72,153,.07), transparent 55%),
    var(--bg);
}

/* places that hard-code white text relied on a dark surface underneath;
   on light surfaces they need the dark ink instead. The gradient-filled
   elements (buttons, chat bubbles, logo dot) keep their white text. */
:root[data-theme="light"] .tile .v.accent { color: var(--text); text-shadow: none; }
:root[data-theme="light"] .tile .v.green  { text-shadow: none; }
:root[data-theme="light"] .tile .v.rose   { text-shadow: none; }
:root[data-theme="light"] .nav-item.active { color: var(--text); box-shadow: inset 2px 0 0 var(--neon); }
:root[data-theme="light"] .chart-legend b { color: var(--text); text-shadow: none; }
:root[data-theme="light"] .client-wrap .tabs button.active { color: var(--text); box-shadow: none; }
:root[data-theme="light"] .badge.shadow { color: #7c3aed; }
:root[data-theme="light"] .badge.live,
:root[data-theme="light"] .badge.green { box-shadow: none; }

/* ---------- theme toggle button ---------- */
.theme-toggle { margin-top: 6px; }
.theme-toggle .ic { font-size: 15px; }
.login-theme {
  position: fixed; top: 16px; right: 16px;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px;
  box-shadow: var(--shadow);
}
.login-theme:hover { border-color: var(--neon); }

/* ---------- forgot-password panel (login) ---------- */
.link-btn {
  font: inherit; font-size: 12.5px; background: none; border: 0; cursor: pointer;
  color: var(--accent-ink); padding: 0; text-decoration: underline;
}
.forgot-panel {
  margin-top: 14px; font-size: 13px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px;
}
.forgot-panel strong { color: var(--text); }
.forgot-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.forgot-form .field { margin: 0; }

/* ---------- attention badge on a sidebar nav item ---------- */
.nav-badge {
  display: inline-block; min-width: 18px; margin-left: 8px; padding: 1px 6px;
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center;
  color: #fff; background: var(--neon-grad); border-radius: 999px;
  box-shadow: var(--glow); vertical-align: middle;
}
