/* ══════════════════════════════════════════════════════════════════════════
   ANKORA design system (2026-10 redesign)
   One accent (Harbor), ink-navy neutrals, no borders: surfaces separate by
   fill and spacing. Sora for titles and big numbers, Manrope for UI.
   Reference canvas: "ANKORA Redesign" artifact.

   Page rules
   - Every page starts with .ph (page header): big title + at most 2 actions.
   - Sub-views use .seg (segmented) or .chips, never unlabeled icon buttons.
   - Solid Harbor only on small things (primary buttons, active tab, badges);
     big surfaces use .hero (tinted glass).
   - Green / orange / red only to mean done, due soon, missed, income, expense.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Ink neutrals */
    --ink-0: #0a0d13;      /* page */
    --ink-1: #10141c;      /* cards, bars */
    --ink-2: #171c26;      /* raised: inputs, tiles inside cards */
    --ink-3: #202633;      /* selected segment, hover on raised */
    --ink-4: #2a3242;      /* rings, switch track off */
    --glass: rgba(255,255,255,0.05);

    /* Text */
    --text:   #edf1f7;
    --text-2: #a3acbe;
    --text-3: #687287;

    /* Harbor accent */
    --accent:      #4cc9f0;
    --accent-rgb:  76, 201, 240;
    --accent-hi:   #84dcf6;     /* hover */
    --accent-lo:   #1789b0;     /* pressed */
    --accent-soft: rgba(76,201,240,0.14);
    --on-accent:   #0a0d13;

    /* Status (meaning only) */
    --success: #3ddc97; --success-soft: rgba(61,220,151,0.14);
    --warning: #ff9f43; --warning-soft: rgba(255,159,67,0.14);
    --danger:  #ff6b6b; --danger-soft:  rgba(255,107,107,0.14);

    /* Shape + type */
    --r-sm: 12px; --r-md: 18px; --r-lg: 22px; --r-sheet: 28px;
    --f-display: 'Sora', 'Avenir Next', system-ui, sans-serif;
    --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Chrome sizes */
    --tabbar-h: 68px;
    --sidebar-w: 248px;
    --safe-b: env(safe-area-inset-bottom, 0px);

    /* Legacy aliases — older markup and JS still reference these names. */
    --white1: var(--ink-1); --white2: var(--glass); --white3: rgba(255,255,255,0.08);
    --white4: var(--ink-0); --white4-5: var(--ink-1); --white5: #ffffff;
    --black1: var(--text); --black2: #d3dae5; --black3: var(--text-2);
    --grey-dark: var(--text-3); --grey: var(--ink-2);
    --green: var(--accent); --green-dark: var(--accent-lo); --green-lite: var(--accent-soft);
    --light-green: var(--accent-hi);
    --blue: var(--accent); --blue-lite: var(--accent-soft);
    --purple: var(--accent-hi); --purple-lite: var(--accent-soft);
    --red: var(--danger); --red-lite: var(--danger-soft); --red-dark: #e5484d;
    --orange: var(--warning); --orange-lite: var(--warning-soft);
    --yellow: #f5c451; --yellow-lite: rgba(245,196,81,0.14);
    --success-lite: var(--success-soft);
    --accent-2: var(--accent-hi);
    --glass-blur: 12px;
    color-scheme: dark;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; background: var(--ink-0); color: var(--text);
    font: 500 15px/1.5 var(--f-body);
    -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[x-cloak] { display: none !important; }
::selection { background: rgba(var(--accent-rgb),0.32); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.no-scrollbar { scrollbar-width: none; } .no-scrollbar::-webkit-scrollbar { display: none; }

/* ── Icons (Material Symbols Rounded, variable) ── */
.material-symbols-rounded, .ms {
    font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal;
    font-size: 22px; line-height: 1; display: inline-block; white-space: nowrap;
    letter-spacing: normal; text-transform: none; direction: ltr; flex: none;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
    user-select: none;
}
.ms-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.ms-sm { font-size: 18px; } .ms-lg { font-size: 28px; }

/* ── Type ── */
.t-display { font: 700 28px/1.2 var(--f-display); letter-spacing: -0.02em; }
.t-title   { font: 700 22px/1.25 var(--f-display); letter-spacing: -0.01em; }
.t-h3      { font: 700 17px/1.3 var(--f-body); }
.t-body    { font-size: 15px; }
.t-small   { font-size: 13px; }
.t-micro   { font-size: 12px; }
.t-num     { font-variant-numeric: tabular-nums; }
.t-big     { font: 700 30px/1.15 var(--f-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.t-2 { color: var(--text-2); } .t-3 { color: var(--text-3); }
.t-accent { color: var(--accent); } .t-success { color: var(--success); }
.t-warning { color: var(--warning); } .t-danger { color: var(--danger); }
.t-bold { font-weight: 700; } .t-semi { font-weight: 600; }
.t-center { text-align: center; }
.t-clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.eyebrow { font: 600 12px/1.4 var(--f-body); letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }

/* ── Layout helpers ── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: none; }

/* ══ App shell ══════════════════════════════════════════════════════════ */
.app-main {
    min-height: 100vh;
    padding: 0 0 calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
.page {
    max-width: 760px; margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 20px) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}
.page-wide { max-width: 1120px; }
body.no-tabs .app-main { padding-bottom: 0; }
body.no-tabs .tabbar { display: none; }

/* Bottom tab bar (phone) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding: 6px 6px calc(6px + var(--safe-b));
    background: rgba(16,20,28,0.92);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    display: grid; grid-template-columns: repeat(5, minmax(0,1fr));
}
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; font-weight: 600; color: var(--text-3);
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text-2); }
.tab .tab-pill { width: 54px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.tab.active { color: var(--accent); }
.tab.active .tab-pill { background: var(--accent-soft); }
.tab.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* Sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 1024px) {
    .tabbar { display: none; }
    .app-main { margin-left: var(--sidebar-w); padding-bottom: 40px; }
    body.no-tabs .app-main { padding-bottom: 0; }
    .page { padding-top: 32px; padding-left: 40px; padding-right: 40px; }
    .sidebar {
        display: flex; flex-direction: column; gap: 24px;
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; width: var(--sidebar-w);
        padding: 24px 16px; background: var(--ink-1); overflow-y: auto;
    }
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); }
.sb-brand:hover { color: var(--text); }
.sb-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--ink-2); display: flex; align-items: center; justify-content: center; }
.sb-word { font: 700 18px var(--f-display); letter-spacing: .04em; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.sb-item {
    display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 600; font-size: 15px; background: none; border: 0; width: 100%; text-align: left;
}
.sb-item:hover { background: var(--ink-2); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--accent); }
.sb-item.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.sb-item .sb-count { margin-left: auto; }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.sb-user { height: 56px; }

/* Page header */
.ph { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; min-height: 44px; }
.ph-main { flex: 1; min-width: 0; }
.ph-title { font: 700 28px/1.2 var(--f-display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ph-sub { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.ph-kicker { font-size: 14px; color: var(--text-2); margin-bottom: 2px; }
.ph-actions { display: flex; align-items: center; gap: 8px; flex: none; }
/* Sub-page header: back button + smaller title */
.ph.sub .ph-title { font-size: 22px; }

/* ══ Controls ═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 18px; border-radius: var(--r-sm); border: 0;
    font: 700 15px/1 var(--f-body); white-space: nowrap; text-decoration: none;
    transition: background .15s, color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-lo); }
.btn-secondary { background: var(--ink-2); color: var(--text); }
.btn-secondary:hover { background: var(--ink-3); color: var(--text); }
.card .btn-secondary, .sheet .btn-secondary, .modal-box .btn-secondary { background: var(--ink-3); }
.card .btn-secondary:hover, .modal-box .btn-secondary:hover { background: var(--ink-4); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--ink-2); color: var(--text); }
.btn-tonal { background: var(--accent-soft); color: var(--accent); }
.btn-tonal:hover { background: rgba(var(--accent-rgb),0.22); color: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: rgba(255,107,107,0.22); color: var(--danger); }
.btn-success { background: var(--success-soft); color: var(--success); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 54px; font-size: 16px; border-radius: 15px; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
    position: relative; width: 44px; height: 44px; flex: none; border-radius: var(--r-sm); border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ink-1); color: var(--text); transition: background .15s;
}
.icon-btn:hover { background: var(--ink-2); color: var(--text); }
.icon-btn.primary { background: var(--accent); color: var(--on-accent); }
.icon-btn.primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.icon-btn.plain { background: none; }
.icon-btn.plain:hover { background: var(--ink-2); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.card .icon-btn, .modal-box .icon-btn { background: var(--ink-2); }
.card .icon-btn.plain, .modal-box .icon-btn.plain { background: none; }
.dot-badge { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--ink-1); }

/* Segmented control (2–4 views) */
.seg { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 14px; background: var(--ink-1); }
.seg-item {
    height: 36px; border: 0; border-radius: 10px; background: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font: 600 14px var(--f-body); color: var(--text-2); white-space: nowrap; padding: 0 6px;
}
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--ink-3); color: var(--text); }
.card .seg, .modal-box .seg { background: var(--ink-2); }
.card .seg-item.active, .modal-box .seg-item.active { background: var(--ink-4); }

/* Chip row (5+ options, filters) */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
    flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 0;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--ink-1); color: var(--text-2); font: 600 14px var(--f-body); white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--ink-0); }
.chip.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.card .chip, .modal-box .chip { background: var(--ink-2); }
.card .chip.active, .modal-box .chip.active { background: var(--text); }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px;
    font: 700 12px/1 var(--f-body); white-space: nowrap; background: var(--ink-3); color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.badge .ms { font-size: 14px; }
.badge-accent  { background: var(--accent-soft);  color: var(--accent); }
.badge-solid   { background: var(--accent); color: var(--on-accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-neutral { background: var(--ink-3); color: var(--text-2); }
/* legacy names */
.badge-green { background: var(--accent-soft); color: var(--accent); }
.badge-blue, .badge-purple { background: var(--accent-soft); color: var(--accent); }
.badge-orange, .badge-yellow { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-grey { background: var(--ink-3); color: var(--text-2); }
.count {
    min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: var(--on-accent); font: 800 12px/1 var(--f-body); font-variant-numeric: tabular-nums;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 0; }
.label, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 13px; color: var(--danger); }
.input, .field-input, .select, .textarea {
    width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 0; outline: 0;
    background: var(--ink-2); color: var(--text); font: 500 15px var(--f-body);
    transition: box-shadow .15s, background .15s;
}
.modal-box .input, .modal-box .field-input, .modal-box .select, .modal-box .textarea,
.card .input, .card .field-input, .card .select, .card .textarea { background: var(--ink-3); }
.textarea, textarea.field-input { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .field-input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .field-input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 2px rgba(var(--accent-rgb),0.6); }
.select, select.field-input {
    appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3acbe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
input[type="date"].input, input[type="datetime-local"].input, input[type="time"].input,
input[type="date"].field-input, input[type="datetime-local"].field-input { color-scheme: dark; }
.input-group {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 14px;
    background: var(--ink-2); color: var(--text-3); transition: box-shadow .15s;
}
.modal-box .input-group, .card .input-group { background: var(--ink-3); }
.input-group:focus-within { box-shadow: 0 0 0 2px rgba(var(--accent-rgb),0.6); }
.input-group input { flex: 1; min-width: 0; height: 46px; background: none; border: 0; outline: 0; color: var(--text); font: 500 15px var(--f-body); }
.input-group input::placeholder { color: var(--text-3); }
.input-group .prefix { color: var(--text-2); font-weight: 700; }
.search { min-height: 46px; background: var(--ink-1); }
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (max-width: 380px) { .form-row { grid-template-columns: minmax(0,1fr); } }

/* Option picker (choose one of several as buttons) */
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.option {
    height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--ink-2); color: var(--text-2);
    font: 600 14px var(--f-body); display: inline-flex; align-items: center; gap: 6px;
}
.modal-box .option, .card .option { background: var(--ink-3); }
.option:hover { color: var(--text); }
.option.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px rgba(var(--accent-rgb),0.5); }

/* Switch: <label class="switch"><input type="checkbox"><span></span></label> */
.switch { position: relative; width: 50px; height: 30px; flex: none; display: inline-block; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--ink-4); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--on-accent); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.toggle-row .grow > :first-child { font-weight: 600; }

/* Checkbox (round or square) */
.check { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; cursor: pointer; }

/* ══ Surfaces ═══════════════════════════════════════════════════════════ */
.card { background: var(--ink-1); border-radius: var(--r-md); padding: 16px; min-width: 0; }
.card.pad-lg { padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
a.card { display: block; color: var(--text); }
a.card:hover, .card.hoverable:hover { background: var(--ink-2); color: var(--text); }
.tile { background: var(--ink-2); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
.card .tile { background: var(--ink-2); }
.tile .tile-label { font-size: 12px; color: var(--text-3); }
.tile .tile-value { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero {
    border-radius: var(--r-lg); padding: 20px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.16), rgba(var(--accent-rgb),0.04)), var(--ink-0);
    display: flex; flex-direction: column; gap: 16px;
}
.hero .tile { background: rgba(10,13,19,0.45); }
.hero-value { font: 700 32px/1.12 var(--f-display); letter-spacing: -0.01em; color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a, .section-head button.link { font-size: 13px; font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; }
.link:hover { color: var(--accent-hi); }

/* List rows: <a|div class="list-row"> <span class="row-icon"> <span class="row-main"> <span class="row-title"><span class="row-sub"> <span class="row-end"> */
.list { display: flex; flex-direction: column; gap: 8px; }
.list.tight { gap: 2px; }
.list-row {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px;
    background: var(--ink-1); color: var(--text); min-width: 0; width: 100%; border: 0; text-align: left;
}
a.list-row:hover, button.list-row:hover { background: var(--ink-2); color: var(--text); }
.card .list-row { background: var(--ink-2); }
.card a.list-row:hover, .card button.list-row:hover { background: var(--ink-3); }
.list-row.plain { background: none; padding: 10px 0; border-radius: 0; }
.list-row.plain:hover { background: none; }
.row-icon {
    width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--ink-2); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.card .row-icon, .list-row .row-icon { background: var(--ink-2); }
.card .list-row .row-icon { background: var(--ink-3); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.row-end { flex: none; display: flex; align-items: center; gap: 8px; }
.chev { color: var(--text-3); font-size: 20px; }

/* Grouped settings-style list */
.group { display: flex; flex-direction: column; gap: 2px; border-radius: var(--r-md); overflow: hidden; }
.group > * { border-radius: 0 !important; }
.group-item {
    display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px;
    background: var(--ink-1); color: var(--text); border: 0; width: 100%; text-align: left; font: 500 15px var(--f-body);
}
a.group-item:hover, button.group-item:hover { background: var(--ink-2); color: var(--text); }

/* Avatar */
.avatar {
    width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden;
    background: var(--ink-3); color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    font: 700 15px var(--f-display);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 14px; }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 52px; height: 52px; font-size: 19px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar.tint { background: var(--accent-soft); color: var(--accent); }
.avatar-ring { display: inline-block; padding: 6px; border-radius: 50%; background: var(--accent); }
.avatar-ring .avatar { box-shadow: 0 0 0 3px var(--ink-0); }

/* Progress */
.progress { height: 6px; border-radius: 3px; background: var(--ink-2); overflow: hidden; }
.card .progress { background: var(--ink-3); }
.progress > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s cubic-bezier(.4,0,.2,1); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }
.progress.success > span { background: var(--success); }

/* Stats row */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 8px; }
.stat { background: var(--ink-2); border-radius: 14px; padding: 12px; min-width: 0; }
.hero .stat { background: rgba(10,13,19,0.45); }
.stat-value { font: 700 20px/1.2 var(--f-display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Empty + loading */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--ink-1); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty .empty-icon .ms { font-size: 30px; }
.empty .empty-title { font: 700 17px var(--f-body); color: var(--text); }
.empty .empty-text { font-size: 14px; max-width: 34ch; }
.empty .btn { margin-top: 8px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty-state .ms, .empty-state .material-symbols-rounded { font-size: 36px; color: var(--text-3); }
.skel, .ank-skel {
    border-radius: var(--r-md); min-height: 16px;
    background: linear-gradient(90deg, var(--ink-1) 0%, var(--ink-2) 50%, var(--ink-1) 100%);
    background-size: 200% 100%; animation: skel 1.3s ease-in-out infinite;
}
@keyframes skel { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ink-4); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Notice (inline message) */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.notice .ms { color: var(--accent); font-size: 20px; }
.notice.warning { background: var(--warning-soft); } .notice.warning .ms { color: var(--warning); }
.notice.danger { background: var(--danger-soft); } .notice.danger .ms { color: var(--danger); }

/* ══ Sheets / modals ════════════════════════════════════════════════════
   Markup (unchanged class names so the shell's scroll-lock + drag-to-dismiss work):
   <div class="modal-overlay" x-show="open" @click.self="open=false" x-transition.opacity>
     <div class="modal-box" x-show="open" x-transition:enter="modal-anim-enter" ...>
       <div class="modal-header"><span class="modal-title">Title</span><button class="icon-btn plain sm" @click="open=false">…close…</button></div>
       <div class="modal-scroll">…</div>
       <div class="modal-footer">…buttons…</div>
     </div>
   </div>
   Always x-teleport="body" the overlay. */
.modal-overlay {
    position: fixed; inset: 0; z-index: 300; background: rgba(5,7,11,0.72);
    display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
    position: relative; width: 100%; max-height: 92vh; max-height: 92dvh;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--ink-1); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    box-shadow: 0 -20px 60px -20px rgba(0,0,0,0.6);
}
.modal-box::before {
    content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 5px; border-radius: 3px; background: var(--ink-4); z-index: 1;
}
.modal-header {
    flex: none; display: flex; align-items: center; gap: 10px;
    padding: 24px 20px 12px; font: 700 20px/1.25 var(--f-display); letter-spacing: -0.01em;
    cursor: grab; touch-action: none;
}
.modal-header > :first-child { flex: 1; min-width: 0; }
.modal-header:active { cursor: grabbing; }
.modal-title { flex: 1; min-width: 0; }
.modal-scroll { overflow-y: auto; min-height: 0; padding: 8px 20px 20px; }
.modal-footer {
    flex: none; display: flex; gap: 8px; flex-wrap: wrap;
    padding: 12px 20px calc(16px + var(--safe-b)); background: var(--ink-1);
}
.modal-footer > .btn { flex: 1; }
@media (min-width: 768px) {
    .modal-overlay { align-items: center; padding: 24px; }
    .modal-box { max-width: 540px; border-radius: var(--r-sheet); max-height: 86vh; }
    .modal-box::before { display: none; }
    .modal-header { padding-top: 22px; cursor: default; }
    .modal-footer { padding-bottom: 20px; }
}
.modal-anim-enter { transition: opacity .38s cubic-bezier(.16,1,.3,1), transform .38s cubic-bezier(.16,1,.3,1); }
.modal-anim-leave { transition: opacity .22s cubic-bezier(.32,0,.67,0), transform .22s cubic-bezier(.32,0,.67,0); }
.modal-anim-enter-start, .modal-anim-leave-end { opacity: 0; transform: translateY(100%); }
.modal-anim-enter-end, .modal-anim-leave-start { opacity: 1; transform: translateY(0); }
@media (min-width: 768px) {
    .modal-anim-enter-start, .modal-anim-leave-end { transform: translateY(12px) scale(.97); }
    .modal-anim-enter-end, .modal-anim-leave-start { transform: none; }
}

/* Action grid inside sheets (Note / Proof / Move / Skip) */
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.action {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; border: 0;
    background: var(--ink-2); color: var(--text); font: 600 12px var(--f-body);
}
.action:hover { background: var(--ink-3); }
.action.active { background: var(--accent-soft); color: var(--accent); }
.action.danger { color: var(--danger); }

/* ══ Toasts + confirm (provided by the shell) ═══════════════════════════ */
.toasts {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 500;
    bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
    width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 1024px) { .toasts { bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); } }
body.no-tabs .toasts { bottom: calc(var(--safe-b) + 88px); }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px;
    background: var(--ink-3); color: var(--text); font-size: 14px; font-weight: 600;
    box-shadow: 0 12px 32px -10px rgba(0,0,0,0.6); pointer-events: auto;
}
.toast .ms { font-size: 20px; color: var(--accent); }
.toast.success .ms { color: var(--success); }
.toast.error .ms { color: var(--danger); }
.toast.warning .ms { color: var(--warning); }

/* ══ Motion ═════════════════════════════════════════════════════════════ */
.spa-content.spa-in { animation: spaIn .22s ease both; }
.spa-content.spa-out { opacity: 0; transition: opacity .12s ease; }
@keyframes spaIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
#spa-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 1000; opacity: 0;
    background: var(--accent); pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ══ Desktop niceties ═══════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    .ph { margin-bottom: 24px; }
    .ph-title { font-size: 30px; }
    .hscroll, .chips { margin: 0; padding: 0; }
}
