/*
 * Boost console — warm monochrome design system with a single live accent.
 * Rule: at any moment the screen shows neutrals + the one color of the
 * current boost state. Color always means status, never decoration.
 */

:root {
  color-scheme: light;

  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #fbfbfa;
  --border: #e9e7e2;
  --border-strong: #dcd9d2;

  --ink: #1c1b19;
  --muted: #78756e;
  --faint: #a8a49b;

  --ink-btn: #1c1b19;
  --ink-btn-hover: #343128;

  /* semantic state tones (washed pastels) */
  --blue-bg: #e7f0f7;   --blue-fg: #2c6587;
  --amber-bg: #f7eed4;  --amber-fg: #8a5a00;
  --green-bg: #e8f1e9;  --green-fg: #2e6b3f;
  --violet-bg: #ece9f8; --violet-fg: #4a40a8;
  --red-bg: #fbeae8;    --red-fg: #a33327;
  --neutral-bg: #f0efec;--neutral-fg: #78756e;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.05), 0 8px 24px rgba(28, 27, 25, 0.04);
  --shadow-pop: 0 12px 40px rgba(28, 27, 25, 0.16);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ambient layer intentionally flat — no gradients */
.ambient { display: none; }

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
input { font: inherit; }

.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 18px 96px;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-logo {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  display: grid; place-items: center;
  padding: 5px;
  flex: 0 0 auto;
}
.brand-logo img { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 680; letter-spacing: -0.02em; }

.spacer { flex: 1 1 auto; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 6px 12px 6px 14px;
  font-weight: 620;
  transition: border-color 160ms var(--ease), transform 120ms var(--ease), box-shadow 200ms var(--ease);
}
.balance-pill:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.balance-pill:active { transform: scale(0.98); }
.balance-pill .pv { letter-spacing: -0.01em; }
.balance-pill .unit { color: var(--muted); font-weight: 560; font-size: 13px; }
.balance-pill .plus {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: var(--radius-pill);
  background: var(--ink); color: #fff;
  font-size: 15px; line-height: 1;
}
.balance-pill.low { border-color: color-mix(in srgb, var(--amber-fg) 40%, var(--border)); }

.iconbtn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  color: var(--muted);
  transition: color 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
}
.iconbtn:hover { color: var(--ink); border-color: var(--border-strong); }
.iconbtn:active { transform: scale(0.96); }

/* ---------- generic surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.pad { padding: 18px; }

.eyebrow {
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.h-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title { font-size: 17px; font-weight: 680; letter-spacing: -0.02em; margin: 2px 0 0; }
.stack { display: grid; gap: 14px; }

/* ---------- chips ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px; font-weight: 680;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--neutral-bg); color: var(--neutral-fg);
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.is-pulse .dot { animation: pulse 1.4s var(--ease) infinite; }
.tone-blue   { background: var(--blue-bg);   color: var(--blue-fg); }
.tone-amber  { background: var(--amber-bg);  color: var(--amber-fg); }
.tone-green  { background: var(--green-bg);  color: var(--green-fg); }
.tone-violet { background: var(--violet-bg); color: var(--violet-fg); }
.tone-red    { background: var(--red-bg);    color: var(--red-fg); }
.tone-neutral{ background: var(--neutral-bg);color: var(--neutral-fg); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- inputs ---------- */

.field { display: grid; gap: 7px; }
.label { font-size: 12px; font-weight: 640; color: var(--muted); }

.input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--ink);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 27, 25, 0.08);
}
.input.lg { padding: 13px 14px; font-size: 16px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-weight: 640;
  transition: background 150ms var(--ease), border-color 150ms var(--ease),
              color 150ms var(--ease), transform 110ms var(--ease), opacity 150ms var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 18px; font-size: 16px; }
.btn.sm { padding: 8px 12px; font-size: 13px; }

.btn-primary { background: var(--ink-btn); color: #fff; }
.btn-primary:hover { background: var(--ink-btn-hover); }

.btn-pay { background: var(--green-fg); color: #fff; }
.btn-pay:hover { background: #275a35; }

.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink); }

.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--red-fg) 28%, var(--border)); color: var(--red-fg); }
.btn-danger:hover { background: var(--red-bg); }

.btn-link { background: none; border: none; color: var(--muted); padding: 6px; }
.btn-link:hover { color: var(--ink); text-decoration: underline; }

.spin {
  width: 15px; height: 15px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- stepper (circular − / + with a centered value) ---------- */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.stepper.fill {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.step-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: background 140ms var(--ease), border-color 140ms var(--ease),
              color 140ms var(--ease), transform 110ms var(--ease);
}
.step-btn:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-btn:active:not(:disabled) { transform: scale(0.92); }
.step-btn:disabled { opacity: 0.3; pointer-events: none; }
.stepper .val {
  display: inline-flex; align-items: baseline; justify-content: center; gap: 4px;
}
.stepper.fill .val { flex: 1; }
.val-num { font-size: 24px; font-weight: 680; line-height: 1; color: var(--ink); }
.val-unit { font-size: 13px; font-weight: 560; color: var(--muted); }

/* segmented multiplier control — selected segment is a solid dark pill */
.seg {
  display: flex;
  width: 100%;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.seg-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  transition: background 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.seg-btn:hover:not(.on):not(:disabled) { color: var(--ink); background: var(--surface); }
.seg-btn.on {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 1px 3px rgba(28, 27, 25, 0.18);
}
.seg-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.seg.sm { gap: 4px; padding: 4px; }
.seg.sm .seg-btn { padding: 6px 11px; font-size: 13px; }

.adv-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 2px 0;
  color: var(--muted); font-size: 13px; font-weight: 560;
}
.adv-toggle:hover:not(:disabled) { color: var(--ink); }
.adv-toggle:disabled { cursor: not-allowed; opacity: 0.5; }
.adv-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px;
}

.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 13px; font-weight: 620; color: var(--muted);
  transition: all 140ms var(--ease);
}
.preset:hover { color: var(--ink); border-color: var(--ink); }
.preset.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- launcher meta ---------- */

.metrics-inline {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin-top: 2px;
}
.metric .mv { font-weight: 700; letter-spacing: -0.02em; }
.metric .ml { font-size: 12px; color: var(--muted); }

.hint { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- state card (active boost) ---------- */

.statecard { border-left: 3px solid var(--border); }
.statecard.tone-blue   { border-left-color: var(--blue-fg); }
.statecard.tone-amber  { border-left-color: var(--amber-fg); }
.statecard.tone-green  { border-left-color: var(--green-fg); }
.statecard.tone-violet { border-left-color: var(--violet-fg); }
.statecard.tone-neutral{ border-left-color: var(--border-strong); }

.room { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 2px; }
.room .big {
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 720; letter-spacing: -0.04em; line-height: 1;
}
.room .roomlbl { font-size: 13px; color: var(--muted); }
.breakdown { font-size: 13px; color: var(--muted); }
.breakdown b { color: var(--ink); font-weight: 640; }

.rampbar {
  height: 6px; border-radius: var(--radius-pill);
  background: var(--neutral-bg); overflow: hidden; margin-top: 12px;
}
.rampbar > i {
  display: block; height: 100%;
  border-radius: var(--radius-pill);
  background: var(--amber-fg);
  transition: width 600ms var(--ease);
}
.statecard.tone-green .rampbar > i { background: var(--green-fg); }
.statecard.tone-neutral .rampbar > i { background: var(--border-strong); }

.streamlink {
  display: inline-block; max-width: 100%;
  font-size: 13px; color: var(--muted);
  text-decoration: none;
}
.streamlink:hover { color: var(--ink); text-decoration: underline; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.foot-grp { display: flex; align-items: center; gap: 10px; }

.warn-inline {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px;
  background: var(--amber-bg); color: var(--amber-fg);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; font-weight: 560;
}
.warn-inline.red { background: var(--red-bg); color: var(--red-fg); }

/* ---------- collapsed launcher button ---------- */

.add-stream {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted); font-weight: 620;
  transition: all 160ms var(--ease);
}
.add-stream:hover { color: var(--ink); border-color: var(--ink); background: var(--surface-2); }

/* ---------- empty / activity ---------- */

.empty {
  display: grid; place-items: center; text-align: center;
  padding: 20px; color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.empty-rich {
  display: grid; justify-items: center; gap: 4px;
  text-align: center;
  padding: 26px 18px;
}
.empty-rich .glyph {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--faint);
  margin-bottom: 8px;
}
.empty-rich .et { font-weight: 620; color: var(--ink); }
.empty-rich .es { font-size: 13px; color: var(--muted); max-width: 34ch; }
.empty-rich .ecta { margin-top: 8px; }

.activity { border: none; box-shadow: none; background: none; }
.activity-head {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 6px 2px;
}
.ledger-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px;
  border-top: 1px solid var(--border);
}
.ledger-row:first-child { border-top: none; }
.ledger-row .lr { font-size: 12px; color: var(--muted); }
.delta { font-weight: 680; letter-spacing: -0.01em; }
.delta.pos { color: var(--green-fg); }
.delta.neg { color: var(--red-fg); }

/* ---------- toast ---------- */

.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 18px;
  display: flex; justify-content: center; z-index: 60;
  pointer-events: none; padding: 0 16px;
}
.toast {
  pointer-events: auto;
  max-width: 460px; width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--ink); color: #fff;
  border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-pop);
  font-size: 14px;
  animation: rise 280ms var(--ease);
}
.toast.ok    { background: #21402b; }
.toast.err   { background: #5a241f; }
.toast .x { margin-left: auto; opacity: 0.7; }
.toast .x:hover { opacity: 1; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* ---------- bottom sheet (draggable) ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: #1c1b19;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--surface);
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  box-shadow: var(--shadow-pop);
  max-width: 560px; margin: 0 auto;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  will-change: transform;
}

.sheet-handle {
  flex: 0 0 auto;
  padding: 10px 0 6px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.sheet-handle:active { cursor: grabbing; }
.grabber {
  width: 42px; height: 4px; border-radius: 99px;
  background: var(--border-strong);
  margin: 0 auto;
  transition: background 160ms var(--ease), width 160ms var(--ease);
}
.sheet-handle:hover .grabber { background: var(--faint); width: 52px; }

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 18px calc(20px + env(safe-area-inset-bottom)) 18px;
}

.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.pack {
  text-align: left;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: all 150ms var(--ease);
}
.pack:hover { border-color: var(--ink); }
.pack.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pack .pp { font-weight: 700; letter-spacing: -0.02em; }
.pack .pd { font-size: 12px; color: var(--muted); }
.pack.on .pd { color: rgba(255,255,255,0.72); }

.custom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }

.summary {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 14px;
}
.summary .sv { font-size: 20px; font-weight: 720; letter-spacing: -0.03em; }
.summary .sl { font-size: 12px; color: var(--muted); }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; position: relative; z-index: 1; }
.auth-card { width: min(100%, 384px); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.auth-err {
  background: var(--red-bg); color: var(--red-fg);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; font-weight: 560; margin-bottom: 12px;
}

/* ---------- entry motion ---------- */

.enter { animation: enter 460ms var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 560px) {
  .shell { padding: 12px 14px 96px; }
  .pad { padding: 15px; }
  .balance-pill .unit { display: none; }
  .custom-row { grid-template-columns: 1fr 1fr; }
  .card-foot { gap: 10px; }
}
