/* =========================================================================
   domain.status.lt — "night watch"
   Dark-first warm charcoal instrument · paper-ledger light theme
   Instrument Serif (display) · Instrument Sans (UI) · Spline Sans Mono (data)
   ========================================================================= */

/* ---- reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--go); outline-offset: 3px; }

/* ---- tokens: night watch (default) -------------------------------------- */
:root {
    /* ground */
    --bg:        oklch(0.165 0.012 70);   /* smoked charcoal, warm */
    --bg-2:      oklch(0.145 0.011 70);
    --raised:    oklch(0.20 0.014 72);
    --hairline:  oklch(0.28 0.014 72);
    --rule:      oklch(0.34 0.016 75);

    /* ink */
    --ink:       oklch(0.92 0.022 85);    /* warm cream */
    --ink-2:     oklch(0.72 0.020 80);
    --faint:     oklch(0.55 0.016 75);

    /* the tricolor, tuned for dark ground */
    --hold:      oklch(0.79 0.115 80);    /* quarantine — amber      */
    --go:        oklch(0.78 0.135 150);   /* available  — green      */
    --live:      oklch(0.70 0.170 28);    /* release    — red        */

    --hold-dim:  oklch(0.79 0.115 80  / 0.14);
    --go-dim:    oklch(0.78 0.135 150 / 0.13);
    --live-dim:  oklch(0.70 0.170 28  / 0.14);

    /* buttons: ink inversion, not color */
    --btn-ink:      var(--ink);
    --btn-ink-text: oklch(0.17 0.012 70);

    --shadow-sheet: 0 -18px 50px oklch(0 0 0 / 0.45);
    --shadow-float: 0 22px 60px -20px oklch(0 0 0 / 0.65);

    --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
    --sans:  "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
    --mono:  "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --out:   cubic-bezier(0.16, 1, 0.3, 1); /* ease-out-expo-ish */

    --pad:   clamp(16px, 4vw, 28px);
}

/* ---- tokens: paper ledger (light) ---------------------------------------- */
@media (prefers-color-scheme: light) {
    :root {
        --bg:        oklch(0.965 0.012 85);  /* warm paper */
        --bg-2:      oklch(0.935 0.014 85);
        --raised:    oklch(0.985 0.008 90);
        --hairline:  oklch(0.87 0.015 85);
        --rule:      oklch(0.78 0.018 82);

        --ink:       oklch(0.25 0.022 60);   /* warm ink */
        --ink-2:     oklch(0.45 0.020 65);
        --faint:     oklch(0.60 0.016 70);

        --hold:      oklch(0.58 0.115 75);
        --go:        oklch(0.52 0.125 150);
        --live:      oklch(0.52 0.180 28);

        --hold-dim:  oklch(0.58 0.115 75  / 0.13);
        --go-dim:    oklch(0.52 0.125 150 / 0.12);
        --live-dim:  oklch(0.52 0.180 28  / 0.11);

        --btn-ink:      var(--ink);
        --btn-ink-text: oklch(0.97 0.01 90);

        --shadow-sheet: 0 -18px 50px oklch(0.3 0.02 60 / 0.25);
        --shadow-float: 0 22px 60px -24px oklch(0.3 0.02 60 / 0.45);
    }
}

body {
    font-family: var(--sans);
    font-size: 15px;
    letter-spacing: 0.005em;
    background: var(--bg);
    color: var(--ink);
}

/* ---- type ---------------------------------------------------------------- */
h1, h2, h3 { font-weight: 400; line-height: 1.05; }
.display { font-family: var(--serif); letter-spacing: 0; }
.mono, code { font-family: var(--mono); letter-spacing: -0.01em; }

/* small-caps utility label */
.tag {
    font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--faint);
}

/* =========================================================================
   Brand — the name is a domain, typeset as one
   ========================================================================= */
.brand { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--mono); }
.brand-name { font-size: 1rem; font-weight: 500; color: var(--ink); }
.brand-name em { font-style: normal; color: var(--go); }
.pulse-dot { position: relative; width: 8px; height: 8px; align-self: center; flex: none; }
.pulse-dot::before,
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--go); }
.pulse-dot::after { animation: ping 2.6s var(--out) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.55; } 70%, 100% { transform: scale(2.4); opacity: 0; } }

/* =========================================================================
   Buttons — ink, hairline, quiet
   ========================================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px;
    border-radius: 3px;
    font-weight: 500; font-size: 0.92rem;
    transition: opacity 0.15s var(--out), background 0.2s var(--out),
                border-color 0.2s var(--out), transform 0.12s var(--out);
    user-select: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--btn-ink); color: var(--btn-ink-text); }
.btn-primary:hover { opacity: 0.88; }

.btn-ghost { border: 1px solid var(--rule); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-2); background: var(--raised); }

.btn-icon {
    width: 40px; height: 40px; display: grid; place-items: center;
    border-radius: 3px; color: var(--faint);
    transition: color 0.15s var(--out), background 0.15s var(--out);
}
.btn-icon:hover { color: var(--ink); background: var(--raised); }
.btn-icon--danger:hover { color: var(--live); background: var(--live-dim); }

/* =========================================================================
   Forms
   ========================================================================= */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.field-aside { font-weight: 400; color: var(--faint); font-size: 0.74rem; letter-spacing: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"] {
    min-height: 46px; padding: 0 14px; width: 100%;
    background: var(--raised); color: var(--ink);
    border: 1px solid var(--rule); border-radius: 3px;
    transition: border-color 0.15s var(--out);
}
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: var(--go); }
input[type="date"] { font-family: var(--mono); font-size: 0.9rem; color: var(--ink-2); }
::-webkit-calendar-picker-indicator { opacity: 0.5; cursor: pointer; }
@media (prefers-color-scheme: dark) { ::-webkit-calendar-picker-indicator { filter: invert(1); } }

.input-affix { position: relative; }
.input-affix input { padding-right: 48px; }
.affix-btn {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; display: grid; place-items: center;
    color: var(--faint); border-radius: 3px;
}
.affix-btn:hover { color: var(--ink); }
.affix-btn[aria-pressed="true"] { color: var(--go); }

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: 3px;
    font-size: 0.87rem; margin-bottom: 16px; line-height: 1.45;
}
.alert svg { flex: none; margin-top: 2px; }
.alert-error { background: var(--live-dim); color: var(--live); }

/* =========================================================================
   Login — the vigil begins
   ========================================================================= */
.auth { display: grid; min-height: 100dvh; grid-template-columns: 1fr; }

.auth-stage {
    position: relative; overflow: hidden;
    background: var(--bg-2);
    padding: var(--pad);
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: 38dvh;
    border-bottom: 1px solid var(--hairline);
}
.auth-stage-copy { position: relative; z-index: 1; max-width: 34rem; }
.auth-stage-copy h1 {
    font-family: var(--serif);
    font-size: clamp(2.1rem, 6.5vw, 3.6rem);
    line-height: 1.04; margin: 18px 0 14px;
}
.auth-stage-copy h1 .mono { font-size: 0.82em; color: var(--go); }
.auth-stage-copy p { color: var(--ink-2); font-size: 0.95rem; max-width: 30rem; }
.auth-live {
    display: inline-flex; align-items: center; gap: 9px; margin-top: 22px;
    font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2);
}

/* the horizon — a slow scan across the stage */
.horizon {
    position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
    background: var(--hairline);
}
.horizon::after {
    content: ""; position: absolute; top: -1px; height: 3px; width: 22%;
    background: linear-gradient(90deg, transparent, var(--go), transparent);
    animation: scan 7s var(--out) infinite;
    opacity: 0.9;
}
@keyframes scan { 0% { left: -25%; } 60%, 100% { left: 105%; } }

.auth-form-wrap { display: grid; place-items: center; padding: clamp(24px, 6vw, 56px) var(--pad); }
.auth-form { width: 100%; max-width: 22rem; }
.brand--compact { margin-bottom: 30px; }
.auth-head { margin-bottom: 22px; }
.auth-head h2 { font-family: var(--serif); font-size: 1.9rem; }
.auth-head p { color: var(--ink-2); margin-top: 6px; font-size: 0.9rem; }
.auth-foot {
    display: flex; align-items: center; gap: 7px; justify-content: center;
    margin-top: 24px; color: var(--faint); font-size: 0.76rem;
}

@media (min-width: 880px) {
    .auth { grid-template-columns: 1.1fr 0.9fr; }
    .auth-stage { min-height: 100dvh; border-bottom: 0; border-right: 1px solid var(--hairline); }
}

/* =========================================================================
   App shell
   ========================================================================= */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in oklab, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 var(--pad);
    height: 56px; display: flex; align-items: center; gap: 14px;
}
.topbar-status {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--mono); font-size: 0.76rem; color: var(--ink-2);
    min-width: 0;
}
.topbar-status[data-state="idle"] .pulse-dot::before,
.topbar-status[data-state="idle"] .pulse-dot::after { background: var(--faint); }
.topbar-status[data-state="checking"] .pulse-dot::before,
.topbar-status[data-state="checking"] .pulse-dot::after { background: var(--hold); }
#live-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-email { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); }
@media (max-width: 700px) { .topbar-email { display: none; } }

.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4.5vw, 40px) var(--pad) 96px; }

/* masthead — serif headline, actions beneath on mobile */
.masthead { margin-bottom: clamp(18px, 4vw, 30px); }
.masthead h1 { font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 3.2rem); }
.masthead-sub { color: var(--ink-2); margin-top: 6px; font-size: 0.92rem; }
.masthead-sub .mono { color: var(--go); }
.masthead-actions {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 16px;
}
.chan-status { gap: 8px; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); }
.chan-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.chan-status.is-live { color: var(--go); border-color: color-mix(in oklab, var(--go) 45%, var(--rule)); }
.chan-status.is-live .dot { background: var(--go); }

@media (min-width: 880px) {
    .masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
    .masthead-actions { margin-top: 0; }
}

/* add bar */
.add-bar { margin-bottom: clamp(20px, 4vw, 30px); }
.add-field { display: flex; flex-direction: column; gap: 10px; }
.add-field input[type="text"] {
    min-height: 52px; font-family: var(--mono); font-size: 1rem;
    padding-left: 44px;
}
.add-field { position: relative; }
.add-icon { position: absolute; left: 14px; top: 15px; color: var(--faint); pointer-events: none; }
.add-field .add-date { flex: none; }
.add-field .btn { min-height: 48px; }
.add-hint { color: var(--faint); font-size: 0.8rem; margin-top: 8px; }
.add-hint.is-error { color: var(--live); }

@media (min-width: 700px) {
    .add-field { flex-direction: row; align-items: stretch; }
    .add-field input[type="text"] { flex: 1; }
    .add-field .add-date { width: 175px; }
    .add-icon { top: 17px; }
}

/* =========================================================================
   Stats — a typographic line, not tiles
   ========================================================================= */
.stats {
    display: flex; flex-wrap: wrap; column-gap: clamp(20px, 5vw, 44px); row-gap: 10px;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--hairline);
    margin-bottom: clamp(20px, 4vw, 28px);
}
.stat { display: flex; align-items: baseline; gap: 9px; position: relative; }
.stat-value {
    font-family: var(--mono); font-size: clamp(1.5rem, 4.5vw, 1.9rem);
    font-weight: 500; line-height: 1; color: var(--ink);
}
.stat-label { order: 2; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint); }
.stat--accent .stat-value { color: var(--go); }
.stat-flare { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--go); margin-left: 6px; animation: ping 2s var(--out) infinite; }
.stat--skeleton { width: 110px; height: 30px; background: var(--raised); border-radius: 3px; overflow: hidden; position: relative; }

/* =========================================================================
   Board — ledger + side rail
   ========================================================================= */
.board { display: grid; grid-template-columns: 1fr; gap: clamp(28px, 6vw, 40px); align-items: start; }
@media (min-width: 980px) {
    .board { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
    .panel--activity { border-left: 1px solid var(--hairline); padding-left: clamp(20px, 3vw, 32px); }
}

.panel-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
.panel-head h2 { font-family: var(--serif); font-size: 1.35rem; }
.panel-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

/* tabs — underline, not pills */
.tabs { display: flex; gap: 22px; }
.tab {
    font-family: var(--serif); font-size: 1.35rem; color: var(--faint);
    padding-bottom: 0; position: relative;
    transition: color 0.15s var(--out);
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -11px;
    height: 2px; background: var(--ink);
}

/* =========================================================================
   The ledger — domain rows
   ========================================================================= */
.domain-list { display: flex; flex-direction: column; }
.domain-row {
    position: relative;
    padding: 16px 0 16px 16px;
    border-bottom: 1px solid var(--hairline);
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    animation: rise 0.5s var(--out) both;
}
.domain-row::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px;
    background: var(--rule); transition: background 0.3s var(--out);
}
.domain-row.is-available { background: linear-gradient(90deg, var(--go-dim), transparent 70%); }
.domain-row.is-available::before { background: var(--go); }
.domain-row.is-live::before { background: var(--live); animation: breathe 1.6s var(--out) infinite; }
.domain-row.just-caught { animation: caught 1.4s var(--out); }
@keyframes caught { 0% { background: color-mix(in oklab, var(--go) 30%, transparent); } 100% { background: transparent; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.domain-main { min-width: 0; }
.domain-name {
    font-family: var(--mono); font-weight: 500;
    font-size: clamp(1.05rem, 3.6vw, 1.25rem);
    color: var(--ink); display: inline-flex; align-items: center; gap: 10px;
    word-break: break-all;
}
.is-available .domain-name { color: var(--go); }
.domain-sub {
    margin-top: 6px; font-size: 0.8rem; color: var(--ink-2);
    display: flex; flex-wrap: wrap; gap: 3px 14px;
}
.domain-sub .live-chip { color: var(--live); font-weight: 500; }
.domain-sub .warn { color: var(--live); }

.live-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.64rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--live);
}
.live-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: breathe 1.2s var(--out) infinite; }

/* status — typographic, dot + small caps */
.badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
    white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.badge--available  { color: var(--go); }       .badge--available .dot  { background: var(--go); }
.badge--quarantine { color: var(--hold); }     .badge--quarantine .dot { background: var(--hold); }
.badge--pending_release { color: var(--live); }
.badge--pending_release .dot { background: var(--live); animation: breathe 1.1s var(--out) infinite; }
.badge--registered { color: var(--faint); }    .badge--registered .dot { background: var(--faint); }
.badge--reserved   { color: var(--faint); }    .badge--reserved .dot   { background: var(--faint); }
.badge--unknown    { color: var(--faint); }    .badge--unknown .dot    { background: var(--faint); }
.badge--error      { color: var(--live); }     .badge--error .dot      { background: var(--live); }
.badge--checking   { color: var(--hold); }     .badge--checking .dot   { background: var(--hold); animation: breathe 0.9s var(--out) infinite; }

/* row controls */
.domain-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.domain-right .badge { margin-right: auto; }
.domain-meta-checked { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

.domain-release { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.76rem; }
.domain-release label { color: var(--faint); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.64rem; }
.domain-release .row-date {
    min-height: 34px; width: 148px; padding: 0 8px;
    font-size: 0.78rem; background: transparent;
    border: 1px solid var(--hairline); border-radius: 3px;
}
.domain-release .row-date:focus { border-color: var(--go); }

@media (min-width: 700px) {
    .domain-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; }
    .domain-right { justify-content: flex-end; flex-wrap: nowrap; }
    .domain-right .badge { margin-right: 4px; }
}

/* notify toggle */
.toggle { position: relative; display: inline-flex; align-items: center; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle .track {
    width: 40px; height: 22px; border-radius: 20px;
    background: var(--rule); position: relative;
    transition: background 0.2s var(--out);
}
.toggle .track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: var(--bg);
    transition: transform 0.2s var(--out);
}
.toggle input:checked + .track { background: var(--go); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--go); outline-offset: 2px; }

/* skeletons */
.row-skel { height: 74px; border-bottom: 1px solid var(--hairline); position: relative; overflow: hidden; }
.row-skel::after { content: ""; position: absolute; left: 16px; top: 22px; width: min(46%, 260px); height: 16px; background: var(--raised); border-radius: 3px; }
.row-skel::before, .act-skel::before, .stat--skeleton::before {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--ink) 5%, transparent), transparent);
    transform: translateX(-100%); animation: shimmer 1.6s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* empty state */
.empty { padding: 56px 16px; }
.empty-glyph { display: none; }
.empty h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 8px; }
.empty p { color: var(--ink-2); font-size: 0.9rem; max-width: 34ch; }

/* =========================================================================
   Activity & cron — hairline journal
   ========================================================================= */
.activity { padding-top: 4px; max-height: 620px; overflow-y: auto; }
.act {
    display: grid; grid-template-columns: auto 1fr; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--hairline);
    animation: rise 0.4s var(--out) both;
}
.act:last-child { border-bottom: 0; }
.act-icon {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; flex: none; margin-top: 2px;
}
.act-icon svg { width: 13px; height: 13px; }
.act-available { background: var(--go-dim); color: var(--go); }
.act-notified  { background: var(--go-dim); color: var(--go); }
.act-status    { background: var(--raised); color: var(--ink-2); }
.act-created   { background: var(--raised); color: var(--faint); }
.act-error     { background: var(--live-dim); color: var(--live); }
.act-body { min-width: 0; }
.act-text { font-size: 0.85rem; line-height: 1.45; color: var(--ink-2); }
.act-text b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.act-time { font-family: var(--mono); font-size: 0.7rem; color: var(--faint); margin-top: 3px; }
.act-skel { height: 44px; margin: 10px 0; border-radius: 3px; background: var(--raised); position: relative; overflow: hidden; }

.cron-warn .act-icon { background: var(--live-dim); color: var(--live); }
.cron-warn .act-text { color: var(--live); }
.cron-empty { color: var(--faint); }
.cron-cmd {
    display: block; margin-top: 8px; padding: 10px 12px;
    font-family: var(--mono); font-size: 0.68rem; line-height: 1.6;
    color: var(--ink-2); background: var(--raised);
    border: 1px solid var(--hairline); border-radius: 3px;
    word-break: break-all; user-select: all;
}
.cron-copy { margin-top: 10px; }

/* =========================================================================
   Settings — sheet on mobile, panel on desktop
   ========================================================================= */
.modal {
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--rule); border-radius: 6px;
    width: min(440px, calc(100vw - 24px));
    padding: 0; box-shadow: var(--shadow-float);
}
.modal::backdrop { background: oklch(0.1 0.01 70 / 0.6); backdrop-filter: blur(2px); }
.modal-inner { padding: clamp(20px, 5vw, 28px); }
.modal h2 { font-family: var(--serif); font-size: 1.6rem; margin-bottom: 8px; }
.modal-note { font-size: 0.85rem; color: var(--ink-2); line-height: 1.55; margin-bottom: 16px; }
.modal-note .mono { color: var(--ink); }
.modal-status {
    font-family: var(--mono); font-size: 0.76rem; line-height: 1.6;
    color: var(--ink-2); padding: 10px 12px;
    border: 1px dashed var(--rule); border-radius: 3px; margin-bottom: 14px;
}
.modal-status.is-live { color: var(--go); border-style: solid; border-color: color-mix(in oklab, var(--go) 40%, transparent); background: var(--go-dim); }
.modal-status--info { white-space: pre-line; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.modal-actions-gap { flex: 1; }
#tg-disconnect { color: var(--live); border-color: color-mix(in oklab, var(--live) 35%, var(--rule)); }

@media (max-width: 640px) {
    .modal {
        width: 100vw; max-width: 100vw;
        margin: auto 0 0 0; border-radius: 14px 14px 0 0;
        border-left: 0; border-right: 0; border-bottom: 0;
        box-shadow: var(--shadow-sheet);
        animation: sheet-up 0.4s var(--out);
    }
    .modal-actions { flex-wrap: wrap; }
    .modal-actions .btn { flex: 1; }
    .modal-actions-gap { display: none; }
}
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }

/* =========================================================================
   Toasts
   ========================================================================= */
.toast-stack {
    position: fixed; z-index: 60;
    right: 14px; bottom: 14px; left: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
@media (min-width: 640px) { .toast-stack { left: auto; width: 360px; } }
.toast {
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
    padding: 14px 15px; border-radius: 6px;
    background: var(--raised); border: 1px solid var(--rule);
    box-shadow: var(--shadow-float);
    animation: toast-in 0.45s var(--out) both;
}
.toast.out { animation: toast-out 0.3s var(--out) forwards; }
.toast-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.toast-icon svg { width: 15px; height: 15px; }
.toast--success .toast-icon { background: var(--go-dim); color: var(--go); }
.toast--error .toast-icon { background: var(--live-dim); color: var(--live); }
.toast--info .toast-icon { background: var(--bg-2); color: var(--ink-2); }
.toast-title { font-size: 0.9rem; font-weight: 600; }
.toast-msg { font-size: 0.83rem; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.toast-msg b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.toast-close { color: var(--faint); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 3px; }
.toast-close:hover { color: var(--ink); }
.toast--celebrate { border-color: color-mix(in oklab, var(--go) 50%, var(--rule)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* =========================================================================
   Error page
   ========================================================================= */
.error-shell { min-height: 100dvh; display: grid; place-items: center; padding: var(--pad); }
.error-card { max-width: 26rem; }
.error-code { font-family: var(--serif); font-size: 2.2rem; margin-bottom: 10px; }
.error-card p { color: var(--ink-2); margin-bottom: 22px; }

/* =========================================================================
   Motion
   ========================================================================= */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* staggered page reveal */
.reveal > * { animation: rise 0.55s var(--out) both; }
.reveal > *:nth-child(1) { animation-delay: 0.02s; }
.reveal > *:nth-child(2) { animation-delay: 0.08s; }
.reveal > *:nth-child(3) { animation-delay: 0.14s; }
.reveal > *:nth-child(4) { animation-delay: 0.20s; }
.reveal > *:nth-child(5) { animation-delay: 0.26s; }

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