/* Ziku — "Liquid Glass Dark", the Scar Glass style for internal phone tools.
   Tokens come from CRM/DESIGN_STYLE.md §2. No fonts or icons are loaded from another website:
   the system font stands in for Inter and Outfit, and icons are inline SVG. */

:root {
    --bg-color: #05060a;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.12);
    --card-border: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;

    --accent-blue: #60a5fa;
    --accent-purple: #a78bfa;
    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;

    --space-xs: 4px;  --space-sm: 8px;  --space-md: 16px;
    --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;

    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px;

    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);

    --spring: cubic-bezier(.34, 1.56, .64, 1);
    --smooth: cubic-bezier(.16, 1, .3, 1);

    --tab-bar-height: 64px;
    --ring: var(--accent-blue);          /* the talk button's ring; set per state below */
    --talk-size: min(46vw, 190px);

    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-color);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, p { margin: 0; }

.muted { color: var(--text-muted); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.center-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--space-lg) var(--space-md);
}

/* The name, in Ziku Red's own colours (read from his Bot Rush picture): red armour plates on top
   with a panel line across them, white and steel armour below, a thin steel edge, and the
   blue-white glow of his eyes behind it. */
.wordmark {
    --ziku-red-light: #f08a82;
    --ziku-red: #cd4b45;
    --ziku-red-mid: #a8322f;
    --ziku-red-deep: #892b29;
    --ziku-white: #e5e8ed;
    --ziku-steel: #818389;
    --ziku-glow: 107, 196, 225;      /* #6bc4e1, his eyes */
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(180deg,
        var(--ziku-red-light) 0%,
        var(--ziku-red) 18%,
        var(--ziku-red-mid) 45%,
        var(--ziku-red-deep) 46%,     /* the panel line */
        var(--ziku-red-mid) 60%,
        var(--ziku-white) 61%,        /* white armour starts */
        #c3c8d0 82%,
        var(--ziku-steel) 100%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    -webkit-text-stroke: 1px rgba(229, 232, 237, .55);
    paint-order: stroke fill;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .65)) drop-shadow(0 0 16px rgba(var(--ziku-glow), .5));
}

/* ── Surfaces ─────────────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
}

.field-label {
    display: block;
    font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;   /* 13px: nothing smaller in this app */
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

/* ── Controls ─────────────────────────────────────────────── */
.std-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-md);
    color: #fff;
    font: 400 1rem var(--font-body);   /* 16px: smaller makes phones zoom in on focus */
    outline: none; appearance: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3), inset 0 -1px 0 rgba(255, 255, 255, .04);
    transition: border-color .3s var(--smooth), box-shadow .3s var(--smooth);
}
.std-input::placeholder { color: rgba(255, 255, 255, .3); font-weight: 300; }
.std-input:focus {
    border-color: rgba(96, 165, 250, .5);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .35), 0 0 0 3px rgba(96, 165, 250, .12);
}
textarea.std-input { resize: vertical; min-height: 120px; line-height: 1.4; }

.primary-btn {
    min-height: 48px;
    padding: 14px 28px;
    font: 600 1rem var(--font-body); letter-spacing: .3px;
    border: none; border-radius: var(--radius-md);
    color: #fff; cursor: pointer;
    background: linear-gradient(135deg, rgba(96, 165, 250, .9), rgba(167, 139, 250, .85));
    box-shadow: 0 4px 12px rgba(96, 165, 250, .25), inset 0 1px 0 rgba(255, 255, 255, .15);
    transition: transform .15s var(--spring), box-shadow .3s var(--smooth);
}
.primary-btn:active { transform: translateY(1px) scale(.98); }
.primary-btn:disabled { opacity: .6; cursor: default; }

.secondary-btn {
    min-height: 48px;
    padding: 12px 24px;
    font: 500 .95rem var(--font-body);
    border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-md);
    color: var(--text-secondary); background: rgba(255, 255, 255, .03); cursor: pointer;
    transition: transform .15s var(--spring);
}
.secondary-btn:active { transform: scale(.97); }
.secondary-btn.danger { color: var(--accent-red); border-color: rgba(239, 68, 68, .4); }
.secondary-btn.wide { width: 100%; }

:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }

.form-error {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .4);
    color: var(--accent-red);
    font-size: .9rem;
}

/* ── Sign-in ──────────────────────────────────────────────── */
.signin-card {
    width: 100%; max-width: 380px;
    display: grid; gap: var(--space-md);
}
.signin-card .field-label { margin-bottom: calc(var(--space-sm) * -1); }

/* ── App frame ────────────────────────────────────────────── */
#app main {
    max-width: 640px;
    margin: 0 auto;
    padding: calc(var(--space-md) + env(safe-area-inset-top)) var(--space-md)
             calc(var(--tab-bar-height) + var(--space-lg) + env(safe-area-inset-bottom));
}

.screen { display: grid; gap: var(--space-md); align-content: start; }

.screen-title {
    font-family: var(--font-display);
    font-weight: 600; font-size: 1.4rem;
    margin-top: var(--space-sm);
}

.tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10, 10, 15, .92);
    border-top: 1px solid var(--card-border);
}
.tab {
    display: grid; justify-items: center; align-content: center; gap: 2px;
    min-height: 44px;
    margin: 6px 4px;
    border: none; border-radius: var(--radius-md);
    background: transparent; color: var(--text-muted);
    font: 500 .8125rem var(--font-body);   /* 13px */
    cursor: pointer;
    transition: transform .15s var(--spring);
}
.tab svg { width: 22px; height: 22px; fill: currentColor; }
.tab:active { transform: scale(.94); }
.tab[aria-current="page"] { background: rgba(102, 153, 255, .14); color: var(--accent-blue); }

/* ── Talk screen ──────────────────────────────────────────── */
.stage {
    height: 26dvh; min-height: 120px;      /* the top third, kept for a body later */
    display: grid; place-items: center;
}
.stage-mark { font-size: 3.2rem; }

.talk-zone { display: grid; justify-items: center; gap: var(--space-md); }

.talk-button {
    position: relative;
    width: var(--talk-size); height: var(--talk-size);
    display: grid; place-items: center;
    border: none; border-radius: 50%;
    color: #fff; cursor: pointer;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 60%);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .12);
    transition: transform .15s var(--spring);
}
.talk-button:active { transform: scale(.96); }
.talk-icon { width: 42%; height: 42%; fill: currentColor; }

.talk-ring {
    position: absolute; inset: -10px;
    border-radius: 50%;
    border: 5px solid var(--ring);
    box-shadow: 0 0 28px color-mix(in srgb, var(--ring) 45%, transparent);
    transition: border-color .3s var(--smooth), box-shadow .3s var(--smooth);
}

/* One signal, eleven states, five colours. The same signal will drive a body later. */
.talk-button[data-state="waiting"]   { --ring: var(--accent-blue); }
.talk-button[data-state="listening"] { --ring: #ffffff; }
.talk-button[data-state="thinking"],
.talk-button[data-state="looking"],
.talk-button[data-state="booking"],
.talk-button[data-state="saving"],
.talk-button[data-state="answering"],
.talk-button[data-state="sending"],
.talk-button[data-state="needs_yes"] { --ring: var(--accent-amber); }
.talk-button[data-state="done"]      { --ring: var(--accent-green); }
.talk-button[data-state="failed"]    { --ring: var(--accent-red); }

.talk-button[data-state="listening"] .talk-ring,
.talk-button[data-state="thinking"] .talk-ring,
.talk-button[data-state="looking"] .talk-ring,
.talk-button[data-state="booking"] .talk-ring,
.talk-button[data-state="saving"] .talk-ring,
.talk-button[data-state="answering"] .talk-ring,
.talk-button[data-state="sending"] .talk-ring { animation: ring-pulse 1.4s ease-in-out infinite; }

@keyframes ring-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.06); opacity: .7; }
}

.talk-status {
    min-height: 1.5em;
    font: 600 1.15rem var(--font-display);
    color: var(--text-secondary);
    text-align: center;
}

.waiting-note {
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    background: rgba(245, 158, 11, .1);
    border: 1px solid rgba(245, 158, 11, .45);
    color: var(--accent-amber);
    font-size: .9rem; font-weight: 600;
    text-align: center;
}
body.driving .waiting-note { font-size: 1.1rem; }

.composer { display: grid; grid-template-columns: 1fr auto; gap: var(--space-sm); align-items: end; }
.composer textarea { min-height: 52px; max-height: 40dvh; resize: none; }
.composer .primary-btn { min-height: 52px; padding: 14px 20px; }

.exchange { display: grid; gap: var(--space-xs); }
.exchange .field-label { margin: var(--space-sm) 0 0; }
.exchange .field-label:first-child { margin-top: 0; }
.exchange-text { font-size: 1.15rem; line-height: 1.4; overflow-wrap: anywhere; }
.exchange-text:not(.muted) { color: var(--text-primary); }

.draft-card { display: grid; gap: var(--space-md); border-color: rgba(96, 165, 250, .45); }
.draft-card .field-label { margin-bottom: 0; color: var(--accent-blue); }
.draft-card .exchange-text { white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
.careful-note {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(245, 158, 11, .1);
    border: 1px solid rgba(245, 158, 11, .45);
    color: var(--accent-amber);
    font-weight: 600;
}
.link-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
body.driving .draft-card { display: none; }   /* it waits until he is parked */

/* ── Notes ────────────────────────────────────────────────── */
.pill-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.pill {
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    background: var(--glass-bg); color: var(--text-secondary);
    font: 500 .9rem var(--font-body);
    cursor: pointer;
}
.pill[aria-pressed="true"] {
    color: var(--accent-blue);
    border-color: rgba(96, 165, 250, .45);
    background: rgba(96, 165, 250, .12);
}

.empty-state { display: grid; gap: var(--space-sm); text-align: center; padding: var(--space-xl) var(--space-lg); }

.card-list { display: grid; gap: var(--space-md); margin: 0; padding: 0; list-style: none; }
.card-list:empty { display: none; }

.note-card {
    display: grid; gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--accent-blue);
    border-radius: var(--radius-md);
}
.note-card[data-kind="idea"]     { border-left-color: var(--accent-purple); }
.note-card[data-kind="todo"]     { border-left-color: var(--accent-amber); }
.note-card[data-kind="customer"] { border-left-color: var(--accent-green); }
.note-card[data-kind="app"]      { border-left-color: var(--accent-blue); }
.note-card[data-kind="other"]    { border-left-color: var(--text-muted); }
.note-meta { display: flex; justify-content: space-between; gap: var(--space-sm); font-size: .8125rem; color: var(--text-muted); }
.note-kind { font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.note-text { font-size: 1.05rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.note-actions .secondary-btn { min-height: 44px; padding: 8px 16px; }
.note-edit { display: grid; gap: var(--space-sm); }
.note-edit select { min-height: 48px; }

.did-item {
    display: grid; gap: 2px;
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
}
.did-what { font-weight: 600; }
.did-detail { color: var(--text-secondary); overflow-wrap: anywhere; }
.did-when { font-size: .8125rem; color: var(--text-muted); }

.limit-row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-sm); align-items: end; }
.limit-row label { grid-column: 1 / -1; font-weight: 500; }

/* ── Settings ─────────────────────────────────────────────── */
.settings-card { display: grid; gap: var(--space-md); }
.settings-card .field-label { margin-bottom: 0; }

.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
    min-height: 48px; cursor: pointer;
}
.row-title { display: block; font-weight: 600; }
.row-note { display: block; font-size: .85rem; }

.switch {
    appearance: none; flex: none;
    width: 52px; height: 32px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid var(--glass-border);
    position: relative; cursor: pointer;
    transition: background .2s var(--smooth);
}
.switch::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff;
    transition: transform .2s var(--spring);
}
.switch:checked { background: var(--accent-blue); }
.switch:checked::after { transform: translateX(20px); }

.spend { font: 800 2rem var(--font-display); color: var(--accent-blue); }
.spend .muted { font: 500 1rem var(--font-body); }

/* ── Driving mode ─────────────────────────────────────────── */
/* The button fills most of the screen; the stage and the text give it room. */
body.driving { --talk-size: min(72vw, 52dvh, 340px); }
body.driving .stage { height: 6dvh; min-height: 0; }
body.driving .stage-mark { display: none; }
body.driving .talk-status { font-size: 1.5rem; }
body.driving .exchange { display: none; }
body.driving .composer { display: none; }   /* no typing while driving */

/* ── Toast ────────────────────────────────────────────────── */
.toast {
    position: fixed; z-index: 20;
    left: var(--space-md); right: var(--space-md);
    bottom: calc(var(--tab-bar-height) + var(--space-md) + env(safe-area-inset-bottom));
    max-width: 520px; margin: 0 auto;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(22, 26, 36, .97);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    text-align: center;
}

@media (min-width: 700px) {
    .stage { height: 22dvh; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
