/* =========================================================
   Aspire Sage App, onboarding + dashboard
   Extends the design tokens from ../styles.css
   ========================================================= */

body { overflow-x: hidden; }

/* ---------- Shared auth/onboarding ---------- */
.auth-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  position: relative;
  isolation: isolate;
}
.auth-stage .aurora { z-index: -1; }

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 36px;
  position: relative;
  overflow: hidden;
}

.auth-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.02em;
  margin-bottom: 26px;
}

.auth-steps {
  display: flex; gap: 8px; margin-bottom: 26px;
}
.auth-steps .dot {
  flex: 1; height: 5px; border-radius: 999px; background: var(--line-2);
  transition: background .3s;
}
.auth-steps .dot.on { background: linear-gradient(90deg, var(--accent), var(--amber)); }

.auth-eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.auth-card h1 { font-size: 26px; letter-spacing: -0.025em; margin: 8px 0 6px; font-weight: 600; }
.auth-card .sub { color: var(--ink-3); font-size: 14.5px; margin: 0 0 22px; }

.field { margin-bottom: 14px; }
.field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 12px 13px;
  font: inherit; font-size: 14.5px;
  background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.55 0.22 285 / 0.14);
}

.auth-actions { margin-top: 22px; display: flex; gap: 10px; }
.auth-actions .btn { flex: 1; justify-content: center; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--ink-4); text-align: center; }
.auth-foot a { color: var(--accent); }

/* OTP */
.otp { display: flex; gap: 10px; justify-content: space-between; margin: 8px 0 4px; }
.otp input {
  width: 100%; aspect-ratio: 1; text-align: center;
  font-size: 22px; font-weight: 700;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: #fff; color: var(--ink);
}
.otp input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.55 0.22 285 / 0.14); }
.hint-note {
  font-size: 12px; color: var(--ink-4); background: var(--bg-2);
  border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 10px; margin-top: 12px;
}
.hint-note.err { color: oklch(0.45 0.16 25); background: oklch(0.96 0.03 25); border: 1px solid oklch(0.7 0.16 25 / 0.45); border-style: solid; }
.hint-note.ok { color: oklch(0.4 0.1 165); background: oklch(0.95 0.05 165); border: 1px solid oklch(0.6 0.12 165 / 0.45); border-style: solid; }
.link-btn { display: inline-block; margin-top: 14px; background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--ink-4); font-size: 12px; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.btn-block { width: 100%; justify-content: center; }

/* business-type chips */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fff;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all .15s; text-align: left;
}
.type-chip .ic { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.type-chip:hover { border-color: oklch(0.7 0.05 285); }
.type-chip.sel {
  border-color: var(--accent);
  background: oklch(0.55 0.22 285 / 0.06);
  color: var(--ink); font-weight: 600;
}
.type-chip.sel .ic { color: var(--accent); }

/* =========================================================
   DASHBOARD
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
@media (max-width: 920px) { .app { grid-template-columns: 1fr; } }

.app-side {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
  padding: 20px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
@media (max-width: 920px) { .app-side { display: none; } }

.app-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
  padding: 4px 8px 18px;
}
.side-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-4); font-weight: 600; margin: 16px 10px 6px; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  font-size: 14px; color: var(--ink-2); cursor: pointer;
  margin-bottom: 1px; transition: background .12s, color .12s;
  position: relative;
}
.side-item .ic { width: 17px; height: 17px; opacity: 0.85; }
.side-item:hover { background: oklch(1 0 0 / 0.7); color: var(--ink); }
.side-item.active { background: var(--ink); color: var(--bg); }
.side-item.active .ic { opacity: 1; }
.side-item .lock { margin-left: auto; font-size: 10px; color: var(--ink-4); }
.side-item .badge-soon {
  margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-4);
  padding: 2px 6px; border-radius: 999px; font-weight: 700;
}

.side-foot { margin-top: auto; padding: 10px; }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}
.side-user .av {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--amber));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.side-user .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.side-user .ro { font-size: 11px; color: var(--ink-4); }

/* main */
.app-main { min-width: 0; }
.app-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: oklch(0.985 0.006 80 / 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-top .crumb { font-size: 14px; color: var(--ink-3); }
.app-top .crumb b { color: var(--ink); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.app-top .pill { white-space: nowrap; }
.token-top { align-items: flex-start; }
.token-top .token-pool { white-space: nowrap; }

.app-body { padding: 28px; max-width: 1200px; }
@media (max-width: 600px) { .app-body, .app-top { padding-left: 18px; padding-right: 18px; } }

.app-h1 { font-size: 26px; letter-spacing: -0.025em; margin: 0 0 4px; font-weight: 600; }
.app-h1 .serif { color: var(--accent); }
.app-lede { color: var(--ink-3); font-size: 15px; margin: 0 0 24px; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; font-weight: 600; }
.card-h .ic-pill {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: oklch(0.55 0.22 285 / 0.08); color: var(--accent);
}

/* ---------- AI assistant ---------- */
.assistant {
  display: flex; flex-direction: column;
  min-height: 460px;
  overflow: hidden;
  position: relative;
}
.assistant-head {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 0% 0%, oklch(0.78 0.16 65 / 0.1), transparent 60%),
    radial-gradient(120% 100% at 100% 0%, oklch(0.55 0.22 285 / 0.1), transparent 60%),
    var(--surface);
}
.assistant-head .ai-orb {
  width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(from 180deg, var(--accent), var(--amber), var(--accent));
  box-shadow: 0 0 16px oklch(0.55 0.22 285 / 0.5);
  animation: orb 4s ease-in-out infinite;
  flex-shrink: 0;
}
.assistant-head .nm { font-weight: 600; font-size: 15px; }
.assistant-head .st { font-size: 11.5px; color: var(--ink-4); display: flex; align-items: center; gap: 5px; }
.assistant-head .st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 6px var(--mint); }

.chat {
  flex: 1; overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  background:
    repeating-linear-gradient(45deg, oklch(0.97 0.006 80) 0 2px, transparent 2px 9px),
    var(--bg-2);
}
.msg { max-width: 86%; display: flex; gap: 9px; align-items: flex-end; }
.msg .av {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.msg.ai .av { background: var(--ink); color: #fff; }
.msg .bubble {
  font-size: 13.5px; line-height: 1.5;
  padding: 10px 13px; border-radius: 14px;
}
.msg.ai { align-self: flex-start; }
.msg.ai .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink); }
.msg.ai .bubble b { color: var(--accent); }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .av { background: linear-gradient(135deg, var(--accent), var(--amber)); color: #fff; }
.msg.me .bubble { background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: typing 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-foot {
  border-top: 1px solid var(--line);
  padding: 14px;
  background: var(--surface);
}
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button {
  font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  cursor: pointer; transition: all .14s;
}
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.quick button.primary { background: var(--ink); color: #fff; border-color: transparent; }
.quick button.primary:hover { color: #fff; }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 13px;
  font: inherit; font-size: 14px; background: #fff;
}
.inline-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.55 0.22 285 / 0.14); }
.inline-form button {
  border: 0; border-radius: 11px; padding: 0 16px; background: var(--ink); color: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer;
}

/* ---------- Setup checklist ---------- */
.checklist { display: flex; flex-direction: column; gap: 4px; }
.check-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 8px; border-radius: 10px;
}
.check-row + .check-row { border-top: 1px solid var(--line); }
.check-row .box {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  border: 2px solid var(--line-2); display: grid; place-items: center;
  color: #fff; transition: all .2s;
}
.check-row.done .box { background: var(--mint); border-color: transparent; }
.check-row.active .box { border-color: var(--accent); box-shadow: 0 0 0 4px oklch(0.55 0.22 285 / 0.12); }
.check-row .tx { font-size: 14px; color: var(--ink-2); }
.check-row.done .tx { color: var(--ink-4); text-decoration: line-through; }
.check-row .meta { margin-left: auto; font-size: 11px; color: var(--ink-4); }

/* progress ring header */
.setup-prog { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
.setup-prog .bar { width: 80px; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.setup-prog .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--amber)); transition: width .4s; }

/* ---------- Token governance widget ---------- */
.token-card { position: relative; overflow: hidden; }
.token-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.token-used { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.token-pool { font-size: 14px; color: var(--ink-4); }
.token-zone-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  color: #fff;
}
.token-gauge {
  position: relative; height: 12px; border-radius: 999px; margin: 16px 0 8px;
  background: var(--line-2); overflow: hidden;
}
.token-gauge .fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  background: var(--zone-color, var(--accent));
  transition: width .5s ease, background .3s;
}
.token-gauge .tick {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: oklch(0.4 0.02 270 / 0.35);
}
.token-gauge .tick::after {
  content: attr(data-l); position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--ink-4); white-space: nowrap;
}
.zone-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 4px; font-size: 11.5px; color: var(--ink-3); }
.zone-legend .z { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.zone-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.token-desc { font-size: 13px; color: var(--ink-2); margin: 14px 0 0; padding: 12px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); }
.token-desc b { color: var(--ink); }

.token-banner {
  display: none;
  align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
  font-size: 13.5px; font-weight: 500;
}
.token-banner.show { display: flex; }
.token-banner .ic { flex-shrink: 0; }
.token-banner.watch  { background: oklch(0.92 0.07 75 / 0.5);  border: 1px solid oklch(0.78 0.13 75 / 0.5);  color: oklch(0.42 0.12 60); }
.token-banner.unsafe { background: oklch(0.92 0.08 45 / 0.5);  border: 1px solid oklch(0.78 0.15 45 / 0.5);  color: oklch(0.45 0.16 40); }
.token-banner.cutoff { background: oklch(0.92 0.08 25 / 0.5);  border: 1px solid oklch(0.72 0.18 25 / 0.5);  color: oklch(0.45 0.19 25); }

/* KPI row */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .kpi-row { grid-template-columns: 1fr 1fr; } }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.kpi-card .l { font-size: 12px; color: var(--ink-4); display: flex; align-items: center; gap: 7px; }
.kpi-card .v { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; margin-top: 6px; }
.kpi-card .d { font-size: 11px; margin-top: 2px; color: var(--ink-4); }

/* empty states */
.empty {
  text-align: center; padding: 30px 18px; color: var(--ink-4);
}
.empty .ico {
  width: 44px; height: 44px; border-radius: 13px; margin: 0 auto 12px;
  background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3);
}
.empty p { margin: 0; font-size: 13.5px; }

/* small helper button row */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* toast */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 12px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); max-width: 320px;
  display: flex; gap: 10px; align-items: flex-start;
  animation: toastin .3s ease;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* mobile top brand */
.mobile-brand { display: none; }
@media (max-width: 920px) {
  .mobile-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -0.02em; }
}
