/* Maliaz app: app-only styles on top of shared/brand.css. 8-point spacing, brand tokens only. */
:root { --tab-h: 64px; --dock-h: 88px; --safe-t: env(safe-area-inset-top, 0px); --pad: 16px; }
html { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body { font-size: 1rem; touch-action: manipulation; background: var(--bg); }
a, button { touch-action: manipulation; }
.input, .select, .textarea, input, select, textarea { font-size: 16px; } /* no zoom on focus in iPhone Safari */

/* Static gradient instead of the 3D scene: battery and 60 fps on phones. */
.app-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 60% at 85% -10%, rgba(159, 214, 255, 0.10), transparent 60%),
              radial-gradient(90% 50% at -10% 10%, rgba(205, 184, 143, 0.10), transparent 60%), var(--bg); }

/* ---------- Shell ---------- */
.app-shell { min-height: 100dvh; }
.app-shell .view { display: block; animation: none; max-width: 680px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) var(--pad) calc(var(--tab-h) + var(--dock-h) + var(--safe-b) + 24px); outline: none; overflow-x: clip; }
.app-shell .view > * { min-width: 0; }
.app-shell .view.enter { animation: viewIn 200ms var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.demo-chip { position: fixed; top: calc(var(--safe-t) + 8px); right: 12px; z-index: 30; }

.app-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; height: calc(var(--tab-h) + var(--safe-b)); padding: 6px 8px var(--safe-b); border-radius: 22px 22px 0 0; border-bottom: 0; }
.app-tabs a { flex: 1; min-width: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; border-radius: 14px; }
.app-tabs a svg { width: 24px; height: 24px; }
.app-tabs a.on { color: var(--champagne-hi); }
.app-tabs a:active { background: rgba(255, 255, 255, 0.05); }
@media (min-width: 760px) { .app-tabs { left: 50%; right: auto; transform: translateX(-50%); width: 520px; bottom: 16px; border-radius: 22px; height: var(--tab-h); padding: 6px 8px; border-bottom: 1px solid var(--glass-edge); } }

/* ---------- Common ---------- */
.t-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.t-title { font-family: var(--serif); font-size: 2.5rem; line-height: 1; letter-spacing: -0.01em; }
.t-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn { width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.link { background: none; border: 0; padding: 8px 4px; min-height: 44px; color: var(--champagne); font-weight: 600; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.link svg { width: 18px; height: 18px; }
.label { font-size: var(--fs-cap); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 16px 0 8px; display: block; }
.banner { border-radius: var(--r-md); padding: 12px 14px; font-size: 0.875rem; line-height: 1.45; margin: 0 0 16px; border: 1px solid var(--line-2); }
.banner .link { min-height: 0; padding: 0 2px; }
.banner.warn { background: var(--warn-soft); border-color: rgba(231, 189, 117, 0.35); color: var(--ink); }
.banner.crit { background: var(--crit-soft); border-color: rgba(234, 143, 123, 0.35); color: var(--ink); }
.banner.ice { background: var(--ice-soft); border-color: rgba(159, 214, 255, 0.3); }
.chip-sm { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-sm svg { width: 14px; height: 14px; }
.chip-sm.accent { background: var(--champagne-soft); color: var(--champagne-hi); border-color: rgba(205, 184, 143, 0.3); }
.chip-sm.out { background: var(--ice-soft); color: var(--ice-hi); border-color: rgba(159, 214, 255, 0.28); }
.chip-sm.tone-good { background: var(--good-soft); color: var(--good); border-color: rgba(156, 214, 168, 0.3); }
.chip-sm.tone-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(231, 189, 117, 0.3); }
.chip-sm.tone-dim { color: var(--muted); }
.chip-sm.tone-ice { background: var(--ice-soft); color: var(--ice-hi); }
.chip-sm.grade { min-width: 24px; justify-content: center; padding: 0 7px; }
.grade-a { background: var(--good-soft); color: var(--good); }
.grade-b { background: var(--ice-soft); color: var(--ice-hi); }
.grade-c, .grade-d { color: var(--muted); }
.grade-check { color: var(--warn); }
.empty { padding: 40px 16px; }
.empty-big { font-size: 1.75rem; color: var(--ink); margin-bottom: 8px; line-height: 1.15; }
.empty-ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: rgba(255, 255, 255, 0.05); color: var(--champagne); margin-bottom: 12px; }
.empty-ico svg { width: 28px; height: 28px; }

/* ---------- Today ---------- */
.t-score { display: flex; align-items: center; gap: 20px; padding: 16px; border-radius: var(--r-lg); background: linear-gradient(180deg, var(--glass-top), var(--glass-bot)); border: 1px solid var(--line); margin-bottom: 16px; }
.ring { flex: none; }
.ring-bar { transition: stroke-dashoffset 600ms var(--ease); }
.ring-num { font: 700 30px var(--sans); fill: var(--ink); font-variant-numeric: tabular-nums; }
.ring-of { font: 600 12px var(--sans); fill: var(--muted); }
.t-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; flex: 1; min-width: 0; }
.t-stats b { display: block; font-size: 1.5rem; line-height: 1.1; color: var(--ice-hi); font-weight: 700; }
.t-stats span { font-size: 0.75rem; color: var(--muted); }
.t-next { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 0.8125rem; color: var(--ink-2); padding-top: 10px; border-top: 1px solid var(--line); }
.t-next svg { width: 16px; height: 16px; color: var(--champagne); flex: none; }
.zones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.zone { border-radius: 14px; padding: 8px 6px; text-align: center; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); line-height: 1.25; }
.zone b { display: block; font-size: 0.75rem; letter-spacing: 0.08em; color: var(--champagne); }
.zone span { display: block; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.zone em { display: block; font-style: normal; font-size: 0.6875rem; color: var(--muted); }
.zone.is-closed { opacity: 0.45; }
.zone.is-closed b { color: var(--muted); }
.q-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.q-head { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: baseline; margin: 16px 0 8px; }
.q-bar .q-head { margin: 0; }
.q-head span { color: var(--faint); font-variant-numeric: tabular-nums; }
.q-bar .seg button { min-height: 36px; font-size: 0.8125rem; }
.queue { display: flex; flex-direction: column; }
.q-row { display: flex; align-items: center; gap: 8px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 72px; }
.q-row:active { background: rgba(255, 255, 255, 0.03); }
.q-row:hover { color: var(--ink); }
.q-main { flex: 1; min-width: 0; }
.q-top { display: flex; align-items: center; gap: 8px; }
.q-co { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-sub { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-time { margin-left: 8px; color: var(--ice); font-weight: 600; font-variant-numeric: tabular-nums; }
.q-time.is-closed { color: var(--faint); }
.q-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.q-chev { color: var(--faint); flex: none; }
.q-chev svg { width: 18px; height: 18px; }
.q-row.is-done .q-co { color: var(--ink-2); }
.q-skel { display: block; }
.done-sec { margin-top: 16px; }
.done-sec summary { list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 48px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--line); }
.done-sec summary::-webkit-details-marker { display: none; }
.done-sec summary > span:first-child { margin-right: auto; }
.done-sec summary .tnum { margin-right: 12px; }
.done-sec summary::after { content: "Show"; font-size: 0.75rem; letter-spacing: 0; text-transform: none; color: var(--champagne); }
.done-sec[open] summary::after { content: "Hide"; }

/* ---------- The dock (primary action in the thumb zone) ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 35; padding: 12px var(--pad) 8px; background: linear-gradient(180deg, transparent, rgba(7, 9, 11, 0.92) 30%); }
.dock > * { max-width: 648px; margin-left: auto; margin-right: auto; }
@media (min-width: 760px) { .dock { bottom: calc(var(--tab-h) + 24px); } }
.btn-call { width: 100%; min-height: 64px; font-size: 1.125rem; font-weight: 700; border-radius: 20px; gap: 10px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-call svg { width: 24px; height: 24px; }
.btn-call.is-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(231, 189, 117, 0.45); }
.btn-call.is-blocked { background: rgba(255, 255, 255, 0.04); color: var(--muted); border: 1px solid var(--line-2); cursor: not-allowed; }
.dock-sub { display: flex; justify-content: space-between; gap: 4px; margin-top: 4px; }
.dock-sub .link { color: var(--ink-2); font-weight: 600; flex: 1; justify-content: center; white-space: nowrap; font-size: 0.8125rem; gap: 4px; padding: 8px 2px; }

/* ---------- Focus ---------- */
body[data-route="focus"] .view { padding-bottom: calc(var(--tab-h) + 140px + var(--safe-b)); }
.f-top { display: flex; align-items: center; gap: 4px; margin: 0 -8px 8px; }
.f-pos { font-size: 0.8125rem; color: var(--muted); font-weight: 600; margin-right: auto; font-variant-numeric: tabular-nums; }
.f-status { display: flex; gap: 6px; }
.f-co { font-family: var(--sans); font-weight: 750; font-size: 1.625rem; line-height: 1.15; letter-spacing: -0.01em; }
.f-name { font-size: 1.0625rem; color: var(--ink-2); margin-top: 4px; }
.f-loc { font-size: 0.875rem; color: var(--muted); margin-top: 2px; }
.f-loc b { color: var(--ice-hi); font-variant-numeric: tabular-nums; }
.f-why { margin: 12px 0 16px; font-size: 0.9375rem; line-height: 1.5; color: var(--ink); padding-left: 12px; border-left: 2px solid var(--champagne); }
.qfacts { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)) 16px; padding: 0 var(--pad); }
.qfacts::-webkit-scrollbar { display: none; }
.qfact { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 72px; min-height: 64px; padding: 8px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: 0.75rem; font-weight: 600; }
.qfact svg { width: 20px; height: 20px; color: var(--ice); }
.qfact.is-off { opacity: 0.5; }
.qfact.is-off svg { color: var(--muted); }
.script { border-radius: var(--r-lg); background: linear-gradient(180deg, var(--glass-top), var(--glass-bot)); border: 1px solid var(--line); overflow: hidden; }
.script-tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); padding: 0 6px; }
.script-tabs::-webkit-scrollbar { display: none; }
.script-tabs button { flex: none; background: none; border: 0; min-height: 48px; padding: 0 12px; color: var(--muted); font-weight: 600; font-size: 0.875rem; border-bottom: 2px solid transparent; }
.script-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--champagne); }
.script-body { padding: 16px; font-size: 1.125rem; line-height: 1.6; }
.script-body p + p { margin-top: 12px; }
.cue { background: var(--champagne-soft); color: var(--champagne-hi); border-radius: 6px; padding: 0 6px; font-weight: 600; white-space: nowrap; }
.obj-q { margin-bottom: 8px; }
.obj { border-bottom: 1px solid var(--line); }
.obj summary { list-style: none; min-height: 48px; display: flex; align-items: center; font-weight: 700; font-size: 1rem; cursor: pointer; }
.obj summary::-webkit-details-marker { display: none; }
.obj[open] summary { color: var(--champagne-hi); }
.obj p { padding-bottom: 12px; }
.f-last { margin-top: 16px; font-size: 0.875rem; color: var(--ink-2); }
.f-last .label { margin-top: 0; }
.tip { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--ice-soft); font-size: 0.875rem; line-height: 1.5; }
.tip .link { min-height: 36px; padding-left: 0; }
.focus-empty { text-align: center; }

/* ---------- Outcome sheet ---------- */
.oc-head h2 { font-family: var(--sans); font-weight: 750; font-size: 1.375rem; margin-top: 4px; }
.oc-vm { display: inline-block; margin-top: 8px; font-size: 0.8125rem; font-weight: 700; color: var(--muted); }
.oc-vm.is-leave { color: var(--champagne-hi); }
.script-body .oc-vm { margin: 0 0 8px; }
.oc-note { margin: 16px 0 12px; width: 100%; }
.oc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.oc-btn { position: relative; min-height: 56px; border-radius: 16px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.05); color: var(--ink); font-weight: 700; font-size: 1rem; text-align: left; padding: 0 16px; }
.oc-btn:active { transform: scale(0.98); }
.oc-btn[aria-pressed="true"] { background: var(--champagne-soft); border-color: var(--champagne); color: var(--champagne-hi); }
.oc-btn:last-child { grid-column: 1 / -1; }
.oc-btn kbd { display: none; }
@media (pointer: fine) { .oc-btn kbd { display: inline-block; font: 600 0.6875rem var(--sans); color: var(--faint); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; margin-right: 8px; vertical-align: 1px; } }
.oc-more { margin-top: 8px; }
.oc-more .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.oc-more .chip { min-height: 44px; padding: 0 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.oc-more .chip[aria-pressed="true"] { background: var(--champagne-soft); border-color: var(--champagne); color: var(--champagne-hi); }
.btn-save { margin-top: 16px; min-height: 56px; font-size: 1.0625rem; }
.oc-cancel { width: 100%; justify-content: center; margin-top: 8px; color: var(--muted); }
.oc-switch { margin-top: 16px; align-items: flex-start; min-height: 44px; }
.oc-switch span small { display: block; font-weight: 500; color: var(--muted); }
.slots { display: flex; flex-direction: column; gap: 12px; }
.slot-d { font-size: 0.8125rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.slot-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.slot { flex-direction: column; min-height: 48px; min-width: 88px; line-height: 1.2; }
.chip.slot small { font-size: 0.6875rem; color: var(--muted); font-weight: 500; }

/* ---------- Undo toast ---------- */
.act-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 150px); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 16px; min-width: min(92vw, 340px); overflow: hidden; animation: toastIn 220ms var(--ease); }
.act-toast.out { opacity: 0; transition: opacity 200ms; }
.act-ico svg { width: 18px; height: 18px; color: var(--good); }
.act-msg { flex: 1; font-weight: 600; font-size: 0.9375rem; }
.act-btn { background: var(--champagne); color: var(--on-champagne); border: 0; border-radius: 12px; min-height: 44px; padding: 0 16px; font-weight: 700; }
.act-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--champagne); width: 100%; transform-origin: left; animation: bar linear forwards; }
@keyframes bar { to { transform: scaleX(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Pull to refresh ---------- */
.pull { position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; transform: translate(-50%, -40px); opacity: 0; z-index: 50; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); color: var(--champagne); pointer-events: none; }
.pull svg { width: 18px; height: 18px; }

/* ---------- More ---------- */
.m-card { border-radius: var(--r-lg); background: linear-gradient(180deg, var(--glass-top), var(--glass-bot)); border: 1px solid var(--line); padding: 8px 16px 16px; margin-bottom: 16px; }
.m-h { font-size: var(--fs-cap); letter-spacing: 0.14em; text-transform: uppercase; color: var(--champagne); font-weight: 700; margin: 12px 0 4px; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); font-weight: 600; }
.m-row .select, .m-row .input { width: auto; min-width: 120px; }
.m-num { width: 96px !important; text-align: right; }
.m-hint { font-size: 0.8125rem; color: var(--muted); margin-top: 12px; }
.m-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; text-align: left; text-decoration: none; padding: 0; }
.m-link span { flex: 1; }
.m-link svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.m-card .btn-block { margin-top: 16px; min-height: 48px; }

/* ---------- Sign-in ---------- */
.auth-app { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .wordmark { font-size: 48px; }
.auth-lede { margin: 8px 0 32px; font-size: 1.0625rem; }
.auth-box .field { margin-bottom: 16px; }
.auth-box .btn-lg { min-height: 56px; margin-top: 8px; }
.auth-box #au-demo { margin-top: 12px; min-height: 48px; }
.app-foot { margin-top: 24px; font-size: 0.8125rem; text-align: center; }

/* ---------- Desktop: more room, same app ---------- */
@media (min-width: 1000px) {
  .view { max-width: 760px; }
  .script-body { font-size: 1.1875rem; }
}
@media (prefers-reduced-motion: reduce) {
  .view.enter, .act-toast { animation: none; }
  .ring-bar { transition: none; }
}
