/* ==========================================================================
   modern.css : the third styling layer (after main.css and polish.css).
   Floating panels, tonal tiles, animated hero, button motion, reveals.
   Everything here is presentation only. Motion respects reduced-motion.
   ========================================================================== */

:root {
    --float-gap: 14px;
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --tint-1: #EEEBFF; --tint-1-fg: #5B4BD6;
    --tint-2: #FFEFE0; --tint-2-fg: #C2610F;
    --tint-3: #DDF6EA; --tint-3-fg: #137A4E;
    --tint-4: #E0F0FF; --tint-4-fg: #1565B8;
    --tint-5: #FFE6EE; --tint-5-fg: #C0285A;
    --glow: 0 10px 28px -8px rgba(108, 92, 231, .55);
}
:root[data-theme="dark"] {
    --tint-1: #25214F; --tint-1-fg: #BDB3FF;
    --tint-2: #3A2A1B; --tint-2-fg: #FFB772;
    --tint-3: #143528; --tint-3-fg: #6FE0AB;
    --tint-4: #15304A; --tint-4-fg: #7FC2FF;
    --tint-5: #3C1D2B; --tint-5-fg: #FF8DB3;
    --glow: 0 10px 28px -8px rgba(140, 124, 255, .5);
}

/* ---------- Ambient canvas ---------- */
body { background-attachment: fixed; }
.app-main { position: relative; isolation: isolate; }
.app-main::before, .app-main::after {
    content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%;
    filter: blur(90px); opacity: .55;
}
.app-main::before { width: 460px; height: 460px; right: -120px; top: -140px; background: rgba(108, 92, 231, .22); animation: blobA 22s ease-in-out infinite alternate; }
.app-main::after { width: 380px; height: 380px; left: 30%; bottom: -160px; background: rgba(255, 159, 90, .16); animation: blobB 26s ease-in-out infinite alternate; }
:root[data-theme="dark"] .app-main::before { background: rgba(120, 100, 255, .28); }
:root[data-theme="dark"] .app-main::after { background: rgba(255, 130, 90, .10); }
@keyframes blobA { to { transform: translate(-90px, 70px) scale(1.15); } }
@keyframes blobB { to { transform: translate(110px, -60px) scale(1.2); } }

/* ---------- Floating sidebar (desktop) ---------- */
@media (min-width: 901px) {
    .sidebar {
        left: var(--float-gap); top: var(--float-gap); bottom: var(--float-gap);
        height: auto; border-radius: 28px; border: 1px solid var(--sb-border);
        box-shadow: 0 18px 50px -20px rgba(40, 36, 100, .28), 0 2px 6px rgba(40, 36, 100, .05);
        background: var(--sb-bg-from);
    }
    :root[data-theme="dark"] .sidebar { box-shadow: 0 18px 50px -18px rgba(0, 0, 0, .7); background: var(--sb-bg-from); }
    .sidebar-scroll { border-radius: 0; }
    .sidebar-brand { border-top-left-radius: 28px; border-top-right-radius: 28px; }
    .app-main { margin-left: calc(var(--sidebar-width) + var(--float-gap) * 2); }
    body.sidebar-collapsed .app-main { margin-left: calc(var(--sidebar-rail) + var(--float-gap) * 2); }
}
.sidebar a.nav-item { position: relative; transition: background .2s, color .2s, transform .25s var(--ease-spring); }
.sidebar a.nav-item:hover { transform: translateX(3px); }
.sidebar a.nav-item.active::before {
    content: ""; position: absolute; left: -6px; top: 22%; bottom: 22%; width: 4px; border-radius: 4px;
    background: linear-gradient(180deg, #8C7CFF, #6C5CE7);
}
.sidebar a.nav-item .icon { transition: transform .3s var(--ease-spring); }
.sidebar a.nav-item:hover .icon { transform: scale(1.15) rotate(-6deg); }

/* ---------- Floating glass top bar ---------- */
@media (min-width: 901px) {
    .navbar {
        top: var(--float-gap); margin: var(--float-gap) var(--content-pad) 0;
        border: 1px solid var(--color-border); border-radius: 22px; height: 62px;
        background: color-mix(in srgb, var(--color-surface) 78%, transparent);
        -webkit-backdrop-filter: blur(18px) saturate(1.8); backdrop-filter: blur(18px) saturate(1.8);
        box-shadow: 0 10px 30px -16px rgba(40, 36, 100, .25);
        padding: 0 18px;
    }
}

/* ---------- Page header ---------- */
.page-header h1, .page-title { letter-spacing: -.02em; }
.page-header h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 700; }

/* ---------- Hero with live clock ---------- */
.dash-hero {
    position: relative; overflow: hidden; border-radius: 32px; padding: 34px 36px;
    background: linear-gradient(120deg, #4F3FD0, #7B5CF0, #B05CE8, #E2689A, #F08A5D, #7B5CF0, #4F3FD0);
    background-size: 300% 100%; animation: heroFlow 18s linear infinite;
    box-shadow: 0 24px 60px -24px rgba(108, 92, 231, .65);
}
.dash-hero::before, .dash-hero::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, .13);
}
.dash-hero::before { width: 320px; height: 320px; right: -80px; top: -140px; animation: floaty 9s ease-in-out infinite alternate; }
.dash-hero::after { width: 200px; height: 200px; left: 38%; bottom: -120px; animation: floaty 12s ease-in-out infinite alternate-reverse; }
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero h1 { font-size: clamp(28px, 3.6vw, 42px); font-weight: 700; letter-spacing: -.03em; }
@keyframes heroFlow { to { background-position: 300% 0; } }
@keyframes floaty { to { transform: translate(-30px, 24px) scale(1.12); } }
.dash-clock { text-align: right; color: #fff; }
.dash-clock-time { font-size: clamp(34px, 4.4vw, 54px); font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.dash-clock-time .colon { display: inline-block; animation: blink 1s steps(2, start) infinite; opacity: .9; }
.dash-clock-sec { font-size: .42em; font-weight: 600; opacity: .8; margin-left: 4px; }
.dash-clock-date { margin-top: 6px; font-size: 13px; font-weight: 500; opacity: .85; }
@keyframes blink { 50% { opacity: .25; } }
@media (max-width: 640px) {
    .dash-hero { padding: 24px 20px; border-radius: 26px; }
    .dash-clock { text-align: left; }
}
.dash-meta-chip { backdrop-filter: blur(10px); background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; transition: transform .25s var(--ease-spring), background .2s; }
.dash-meta-chip:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .28); }

/* ---------- Tonal KPI tiles ---------- */
.kpi-grid { gap: 16px; }
.kpi-tile {
    border-radius: 28px; border: 0; padding: 22px; position: relative; overflow: hidden;
    background: var(--tint-1); color: var(--tint-1-fg); --tile-fg: var(--tint-1-fg);
    box-shadow: none; transition: transform .35s var(--ease-spring), box-shadow .35s;
}
.kpi-grid > .kpi-tile:nth-child(5n+2) { background: var(--tint-2); --tile-fg: var(--tint-2-fg); }
.kpi-grid > .kpi-tile:nth-child(5n+3) { background: var(--tint-3); --tile-fg: var(--tint-3-fg); }
.kpi-grid > .kpi-tile:nth-child(5n+4) { background: var(--tint-4); --tile-fg: var(--tint-4-fg); }
.kpi-grid > .kpi-tile:nth-child(5n+5) { background: var(--tint-5); --tile-fg: var(--tint-5-fg); }
.kpi-tile::after {
    content: ""; position: absolute; right: -36px; bottom: -36px; width: 120px; height: 120px; border-radius: 50%;
    background: currentColor; opacity: .08; transition: transform .5s var(--ease-spring);
}
.kpi-tile { color: var(--tile-fg, var(--tint-1-fg)); }
.kpi-tile:hover { transform: translateY(-6px) scale(1.015); box-shadow: 0 22px 40px -18px color-mix(in srgb, var(--tile-fg) 55%, transparent); }
.kpi-tile:hover::after { transform: scale(1.5); }
.kpi-tile .kpi-value { color: var(--color-text); font-size: clamp(32px, 3.2vw, 44px); font-weight: 700; letter-spacing: -.04em; }
.kpi-tile .kpi-label { color: var(--tile-fg); font-weight: 600; opacity: .9; }
.kpi-tile .kpi-icon-badge { background: #fff; color: var(--tile-fg); border-radius: 16px; width: 40px; height: 40px; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--tile-fg) 60%, transparent); }
:root[data-theme="dark"] .kpi-tile .kpi-icon-badge { background: rgba(255, 255, 255, .10); }
.kpi-tile .kpi-tile-link { color: var(--tile-fg); font-weight: 600; }
.kpi-tile .kpi-tile-link .icon { transition: transform .25s var(--ease-spring); }
.kpi-tile:hover .kpi-tile-link .icon { transform: translateX(5px); }

/* ---------- Cards ---------- */
.card { border-radius: 26px; transition: transform .3s var(--ease-spring), box-shadow .3s, border-color .3s; }
.card:hover { box-shadow: 0 18px 40px -22px rgba(40, 36, 100, .28); }
.card-header h2, .card-header h3 { letter-spacing: -.01em; }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; border-radius: 999px; font-weight: 600; transition: transform .25s var(--ease-spring), box-shadow .25s, background .2s, border-color .2s, color .2s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.95); transition-duration: .08s; }
.btn-primary {
    background: linear-gradient(135deg, #7B6BF2 0%, #6C5CE7 45%, #5546D6 100%);
    box-shadow: 0 8px 20px -8px rgba(108, 92, 231, .7); border-color: transparent; color: #fff;
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow); }
.btn-primary::after, .btn-danger::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: -80%; width: 50%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: skewX(-20deg); pointer-events: none;
}
.btn-primary:hover::after, .btn-danger:hover::after { left: 140%; transition: left .7s ease; }
.btn .ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .28; transform: scale(0); animation: rip .65s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }
.btn .icon { transition: transform .3s var(--ease-spring); }
.btn:hover .icon { transform: scale(1.12); }
.icon-btn, .navbar .icon-btn { transition: transform .25s var(--ease-spring), background .2s; }
.icon-btn:active { transform: scale(.88); }

/* ---------- Form focus ---------- */
.form-control:focus, input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px rgba(108, 92, 231, .16); }
.form-control, input, select, textarea { transition: box-shadow .25s, border-color .2s, background .2s; }

/* ---------- Tables, badges ---------- */
.data-table tbody tr { transition: background .15s, transform .2s; }
.badge { transition: transform .2s var(--ease-spring); }
.badge:hover { transform: scale(1.06); }

/* ---------- Toasts and flash ---------- */
.flash { animation: flashIn .5s var(--ease-spring); border-radius: 18px; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Scroll reveal (only when JS marks the page) ---------- */
html.js-reveal .rv { opacity: 0; transform: translateY(8px); }
html.js-reveal .rv.rv-in { opacity: 1; transform: none; transition: opacity .22s ease, transform .26s ease; transition-delay: var(--rv-d, 0ms); }

/* ---------- Skeleton shimmer ---------- */
.skeleton, .is-skeleton { background: linear-gradient(90deg, var(--color-surface-2, #eef0f7) 25%, rgba(255,255,255,.7) 50%, var(--color-surface-2, #eef0f7) 75%); background-size: 200% 100%; animation: shim 1.4s infinite; border-radius: 12px; }
@keyframes shim { to { background-position: -200% 0; } }

/* ---------- Smooth page changes ----------
   Cross-page view transitions were removed in 2026.10.15-10: Safari and DuckDuckGo (WebKit) can leave the page
   unresponsive to clicks (drop-downs, tick boxes) while a transition snapshot sits on top of it. A plain, instant
   page change is used everywhere instead. */

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
    .kpi-tile { border-radius: 24px; padding: 18px; }
    .card { border-radius: 22px; }
    .app-main::before, .app-main::after { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    .app-main::before, .app-main::after, .dash-hero, .dash-hero::before, .dash-hero::after, .dash-clock-time .colon { animation: none !important; }
    html.js-reveal .rv { opacity: 1; transform: none; }
    .btn:hover:not(:disabled), .kpi-tile:hover { transform: none; }
}
@media print {
    .app-main::before, .app-main::after { display: none; }
    html.js-reveal .rv { opacity: 1; transform: none; }
}

/* ---------- Tuning ---------- */
.kpi-tile .kpi-value, .kpi-grid > .kpi-tile .kpi-value { color: var(--color-text) !important; }
.dash-clock-date { display: none; }
.dash-meta-chip .icon, .dash-meta-chip svg { color: #fff; stroke: currentColor; }
@media (max-width: 640px) {
    .dash-hero { flex-direction: column; align-items: flex-start; }
    .dash-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
    .dash-clock-time { font-size: 30px; }
}

/* ==========================================================================
   Ask assistant
   ========================================================================== */
.ask { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 260px); }
.ask-thread { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.ask-welcome { text-align: center; padding: 38px 16px 10px; }
.ask-welcome h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.03em; margin: 18px 0 6px; }
.ask-welcome p { color: var(--color-text-muted, #6b6f8d); }
.ask-welcome-orb {
    width: 64px; height: 64px; border-radius: 22px; margin: 0 auto; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #7B6BF2, #E2689A, #F08A5D); background-size: 200% 200%; animation: heroFlow 8s linear infinite alternate;
    box-shadow: 0 16px 36px -12px rgba(108, 92, 231, .7);
}
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.ask-bot .ask-chips, .ask-block .ask-chips { justify-content: flex-start; margin-top: 8px; }
.ask-chip {
    border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
    border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
    transition: transform .25s var(--ease-spring), background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.ask-chip:hover { transform: translateY(-2px); border-color: var(--color-accent); color: var(--color-accent); background: var(--tint-1); box-shadow: 0 8px 18px -10px rgba(108, 92, 231, .6); }
.ask-chip:active { transform: scale(.95); }
.ask-msg { display: flex; gap: 10px; animation: flashIn .45s var(--ease-spring); }
.ask-me { justify-content: flex-end; }
.ask-me .ask-bubble { background: linear-gradient(135deg, #7B6BF2, #5546D6); color: #fff; border-radius: 22px 22px 6px 22px; padding: 12px 18px; max-width: 80%; box-shadow: 0 10px 22px -12px rgba(108, 92, 231, .8); }
.ask-avatar { flex: none; width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--tint-1); color: var(--tint-1-fg); }
.ask-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px 24px 24px 24px; padding: 18px 20px; min-width: 0; flex: 1; box-shadow: 0 14px 34px -24px rgba(40, 36, 100, .35); }
.ask-title { font-size: 17px; letter-spacing: -.01em; margin: 0 0 4px; }
.ask-text { margin: 0 0 12px; color: var(--color-text-muted, #5b5f7d); }
.ask-block { margin-top: 10px; }
.ask-block-title { font-size: 13px; margin: 12px 0 6px; color: var(--color-text-muted, #6b6f8d); font-weight: 600; }
.ask-table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 16px; }
.ask-table { margin: 0; font-size: 13.5px; }
.ask-note { margin: 6px 2px 0; font-size: 12.5px; }
.ask-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ask-bars { display: flex; flex-direction: column; gap: 10px; }
.ask-bar-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr 44px; align-items: center; gap: 12px; font-size: 13.5px; }
.ask-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ask-bar-track { height: 14px; border-radius: 999px; background: var(--color-surface-2, #eef0f7); overflow: hidden; }
.ask-bar-fill { display: block; height: 100%; width: var(--w); border-radius: 999px; transform-origin: left; animation: barIn .8s var(--ease-spring) both; background: var(--tint-1-fg); }
.ask-bar-fill.tone-1 { background: var(--tint-2-fg); } .ask-bar-fill.tone-2 { background: var(--tint-3-fg); }
.ask-bar-fill.tone-3 { background: var(--tint-4-fg); } .ask-bar-fill.tone-4 { background: var(--tint-5-fg); }
@keyframes barIn { from { transform: scaleX(0); } }
.ask-bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ask-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ask-stat { border-radius: 22px; padding: 16px 18px; background: var(--tint-1); color: var(--tint-1-fg); }
.ask-stat.tone-1 { background: var(--tint-2); color: var(--tint-2-fg); } .ask-stat.tone-2 { background: var(--tint-3); color: var(--tint-3-fg); }
.ask-stat.tone-3 { background: var(--tint-4); color: var(--tint-4-fg); } .ask-stat.tone-4 { background: var(--tint-5); color: var(--tint-5-fg); }
.ask-stat-value { font-size: 34px; font-weight: 700; letter-spacing: -.04em; color: var(--color-text); }
.ask-stat-label { font-weight: 600; } .ask-stat-note { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.ask-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.ask-kv dt { color: var(--color-text-muted, #6b6f8d); font-weight: 600; } .ask-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ask-typing { display: flex; gap: 5px; padding: 14px 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px 22px 22px 22px; }
.ask-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--tint-1-fg); animation: dot 1s infinite ease-in-out; }
.ask-typing i:nth-child(2) { animation-delay: .15s; } .ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.ask-composer {
    position: sticky; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px;
    background: color-mix(in srgb, var(--color-surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid var(--color-border-strong, var(--color-border)); border-radius: 999px;
    box-shadow: 0 18px 44px -18px rgba(40, 36, 100, .4); transition: box-shadow .25s, border-color .25s;
}
.ask-composer:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 4px rgba(108, 92, 231, .14), 0 18px 44px -18px rgba(40, 36, 100, .4); }
.ask-input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; font: inherit; font-size: 15.5px; padding: 10px 6px; color: var(--color-text); outline: none; }
.ask-send, .ask-mic { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; transition: transform .25s var(--ease-spring), box-shadow .25s; }
.ask-send { background: linear-gradient(135deg, #7B6BF2, #5546D6); color: #fff; box-shadow: 0 8px 18px -8px rgba(108, 92, 231, .8); }
.ask-send:hover { transform: scale(1.08) rotate(-8deg); } .ask-send:active { transform: scale(.9); }
.ask-mic { background: var(--tint-1); color: var(--tint-1-fg); position: relative; }
.ask-mic:hover { transform: scale(1.08); }
.ask-mic.is-listening { background: #E5484D; color: #fff; }
.ask-mic.is-listening::before, .ask-mic.is-listening::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #E5484D; animation: ping 1.4s ease-out infinite; }
.ask-mic.is-listening::after { animation-delay: .5s; }
@keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(1.9); opacity: 0; } }
.ask-composer.is-listening { border-color: #E5484D; }
.ask-foot { text-align: center; font-size: 12.5px; margin: 10px 0 0; }
#askSpeakToggle.is-on { background: var(--tint-1); color: var(--tint-1-fg); border-color: var(--tint-1-fg); }
@media (max-width: 640px) {
    .ask-bar-row { grid-template-columns: 80px 1fr 34px; gap: 8px; }
    .ask-kv { grid-template-columns: 1fr; gap: 2px; } .ask-kv dd { margin-bottom: 8px; }
    .ask-card { padding: 14px; border-radius: 8px 20px 20px 20px; } .ask-avatar { display: none; }
    .ask-me .ask-bubble { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { .ask-welcome-orb, .ask-mic.is-listening::before, .ask-mic.is-listening::after, .ask-typing i, .ask-bar-fill { animation: none !important; } }

.ask-bar-note { color: var(--tint-3-fg); font-weight: 600; font-size: 11.5px; }
.ask-bar-label { white-space: normal; }

.ask-table thead th { position: static !important; top: auto !important; }

/* ==========================================================================
   Floating widget: Ask and Messages (bottom right). Fixed position, sits below
   dialogs, toasts and the command palette, so it never blocks them.
   ========================================================================== */
.cw { position: fixed; right: 22px; bottom: 22px; z-index: 58; font-size: 14px; }
.cw.cw-lift { bottom: 92px; }
body.has-cw .toast-stack { bottom: 96px; }
.cw-fab {
    position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #8C7CFF 0%, #6C5CE7 50%, #E2689A 130%); background-size: 160% 160%;
    box-shadow: 0 16px 34px -10px rgba(108, 92, 231, .8), 0 0 0 0 rgba(108, 92, 231, .45);
    transition: transform .3s var(--ease-spring), box-shadow .3s; animation: fabBreathe 4s ease-in-out infinite;
}
.cw-fab:hover { transform: scale(1.08) rotate(-4deg); }
.cw-fab:active { transform: scale(.92); }
.cw-fab-icon { position: absolute; display: grid; place-items: center; transition: transform .35s var(--ease-spring), opacity .2s; }
.cw-fab-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
.cw.is-open .cw-fab-chat { opacity: 0; transform: rotate(90deg) scale(.5); }
.cw.is-open .cw-fab-close { opacity: 1; transform: none; }
.cw.is-open .cw-fab { animation: none; }
@keyframes fabBreathe { 50% { box-shadow: 0 16px 34px -10px rgba(108, 92, 231, .8), 0 0 0 10px rgba(108, 92, 231, 0); } 0% { box-shadow: 0 16px 34px -10px rgba(108, 92, 231, .8), 0 0 0 0 rgba(108, 92, 231, .35); } }
.cw-badge, .cw-tab-badge, .cw-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #E5484D; color: #fff; font-size: 11.5px; font-weight: 700;
    display: inline-grid; place-items: center; line-height: 1;
}
.cw-badge { position: absolute; top: -3px; right: -3px; box-shadow: 0 0 0 3px var(--color-bg, #fff); animation: flashIn .4s var(--ease-spring); }
.cw-badge[hidden], .cw-tab-badge[hidden] { display: none; }
.cw.has-unread:not(.is-open) .cw-fab { animation: fabShake 2.4s ease-in-out infinite; }
@keyframes fabShake { 0%, 86%, 100% { transform: none; } 90% { transform: rotate(-10deg); } 94% { transform: rotate(8deg); } 97% { transform: rotate(-4deg); } }

.cw-panel {
    position: absolute; right: 0; bottom: 74px; width: 400px; height: min(620px, calc(100vh - 120px)); display: flex; flex-direction: column; overflow: hidden;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 28px;
    box-shadow: 0 30px 70px -20px rgba(40, 36, 100, .5), 0 4px 14px rgba(40, 36, 100, .08);
    transform-origin: bottom right; animation: cwIn .32s var(--ease-spring);
}
.cw:not(.is-open) .cw-panel { animation: cwOut .2s ease forwards; pointer-events: none; }
@keyframes cwIn { from { opacity: 0; transform: translateY(18px) scale(.92); } }
@keyframes cwOut { to { opacity: 0; transform: translateY(12px) scale(.95); } }
.cw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--color-border); background: linear-gradient(180deg, var(--tint-1), transparent); }
.cw-tabs { display: flex; gap: 6px; padding: 4px; background: var(--color-surface-2, #eef0f7); border-radius: 999px; }
.cw-tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--color-text-muted, #6b6f8d); font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s, transform .2s var(--ease-spring); }
.cw-tab:hover { color: var(--color-text); }
.cw-tab.is-on { background: var(--color-surface); color: var(--color-accent); box-shadow: 0 4px 12px -6px rgba(40, 36, 100, .4); }
.cw-tab:active { transform: scale(.95); }
.cw-tab-badge { height: 17px; min-width: 17px; font-size: 10.5px; }
.cw-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; display: grid; place-items: center; transition: background .2s, transform .25s var(--ease-spring); }
.cw-x:hover { background: var(--color-surface-2, #eef0f7); transform: rotate(90deg); }
.cw-pane, .cw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cw-pane[hidden], .cw-view[hidden] { display: none; }
.cw-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scroll-behavior: smooth; }

.cw-hello { text-align: center; padding: 18px 6px 4px; }
.cw-hello h3 { margin: 12px 0 2px; font-size: 18px; letter-spacing: -.02em; }
.cw-hello p { margin: 0; color: var(--color-text-muted); }
.cw-orb { width: 48px; height: 48px; margin: 0 auto; border-radius: 17px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7B6BF2, #E2689A, #F08A5D); box-shadow: 0 12px 26px -10px rgba(108, 92, 231, .7); }
.cw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center; }
.cw-card .cw-chips, .cw-block .cw-chips { justify-content: flex-start; }
.cw-chip { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: transform .25s var(--ease-spring), border-color .2s, color .2s, background .2s; }
.cw-chip:hover { transform: translateY(-2px); border-color: var(--color-accent); color: var(--color-accent); background: var(--tint-1); }
.cw-chip:active { transform: scale(.94); }

.cw-msg { display: flex; flex-direction: column; animation: flashIn .35s var(--ease-spring); max-width: 100%; }
.cw-me { align-items: flex-end; } .cw-them, .cw-bot { align-items: flex-start; }
.cw-bubble { max-width: 86%; padding: 9px 14px; border-radius: 18px; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.4; }
.cw-me .cw-bubble { background: linear-gradient(135deg, #7B6BF2, #5546D6); color: #fff; border-bottom-right-radius: 6px; }
.cw-them .cw-bubble { background: var(--color-surface-2, #eef0f7); border-bottom-left-radius: 6px; }
.cw-bubble.is-deleted { background: transparent !important; color: var(--color-text-muted) !important; border: 1px dashed var(--color-border-strong, var(--color-border)); font-style: italic; }
.cw-meta { display: flex; gap: 10px; justify-content: flex-end; font-size: 11px; opacity: .75; margin-top: 3px; }
.cw-them .cw-meta { justify-content: flex-start; }
.cw-unsend { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; opacity: 0; transition: opacity .2s; }
.cw-me .cw-bubble:hover .cw-unsend, .cw-unsend:focus-visible { opacity: 1; }
@media (hover: none) { .cw-unsend { opacity: .8; } }
.cw-seen { font-size: 11px; color: var(--color-text-muted); margin: 2px 4px 0; }
.cw-error { align-self: center; color: var(--color-danger); font-size: 12.5px; margin: 0; }
.cw-empty { text-align: center; color: var(--color-text-muted); padding: 22px 14px; margin: 0; }
.cw-empty strong { display: block; color: var(--color-text); margin-bottom: 2px; }
.cw-sub { margin: 8px 4px 0; font-size: 12px; color: var(--color-text-muted); font-weight: 600; }

.cw-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px 20px 20px 20px; padding: 12px 14px; max-width: 100%; box-shadow: 0 10px 24px -20px rgba(40, 36, 100, .5); }
.cw-card h4 { margin: 0 0 2px; font-size: 14.5px; letter-spacing: -.01em; } .cw-card p { margin: 0 0 8px; color: var(--color-text-muted); font-size: 13px; }
.cw-block h5 { margin: 10px 0 4px; font-size: 12px; color: var(--color-text-muted); }
.cw-rows { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: 14px; overflow: hidden; }
.cw-row { padding: 8px 10px; border-top: 1px solid var(--color-border); } .cw-row:first-child { border-top: 0; }
.cw-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .cw-row-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cw-row-sub { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; }
.cw-note { font-size: 12px; margin: 6px 2px 0; }
.cw-bar { margin-bottom: 9px; } .cw-bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 3px; }
.cw-bar-track { height: 10px; border-radius: 999px; background: var(--color-surface-2, #eef0f7); overflow: hidden; }
.cw-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--tint-1-fg); animation: barIn .8s var(--ease-spring) both; transform-origin: left; }
.cw-bar-fill.tone-1 { background: var(--tint-2-fg); } .cw-bar-fill.tone-2 { background: var(--tint-3-fg); } .cw-bar-fill.tone-3 { background: var(--tint-4-fg); } .cw-bar-fill.tone-4 { background: var(--tint-5-fg); }
.cw-bar small { color: var(--tint-3-fg); font-weight: 600; font-size: 11px; }
.cw-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cw-stat { border-radius: 16px; padding: 10px 12px; background: var(--tint-1); color: var(--tint-1-fg); display: flex; flex-direction: column; }
.cw-stat.tone-1 { background: var(--tint-2); color: var(--tint-2-fg); } .cw-stat.tone-2 { background: var(--tint-3); color: var(--tint-3-fg); } .cw-stat.tone-3 { background: var(--tint-4); color: var(--tint-4-fg); } .cw-stat.tone-4 { background: var(--tint-5); color: var(--tint-5-fg); }
.cw-stat b { font-size: 24px; letter-spacing: -.03em; color: var(--color-text); } .cw-stat span { font-weight: 600; font-size: 12.5px; } .cw-stat small { font-size: 11.5px; opacity: .85; }
.cw-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 12.5px; } .cw-kv dt { color: var(--color-text-muted); font-weight: 600; } .cw-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cw-link { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 13px; }
.cw-typing { display: flex; gap: 4px; padding: 12px 14px; background: var(--color-surface-2, #eef0f7); border-radius: 6px 18px 18px 18px; }
.cw-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--tint-1-fg); animation: dot 1s infinite ease-in-out; } .cw-typing i:nth-child(2) { animation-delay: .15s; } .cw-typing i:nth-child(3) { animation-delay: .3s; }

.cw-composer { display: flex; align-items: center; gap: 6px; margin: 0 12px 12px; padding: 5px 5px 5px 8px; border: 1px solid var(--color-border-strong, var(--color-border)); border-radius: 999px; background: var(--color-surface); transition: border-color .2s, box-shadow .2s; }
.cw-composer:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 4px rgba(108, 92, 231, .14); }
.cw-composer.is-listening { border-color: #E5484D; }
.cw-input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; font: inherit; color: var(--color-text); padding: 8px 6px; }
.cw-send, .cw-mic { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; transition: transform .25s var(--ease-spring); }
.cw-send { background: linear-gradient(135deg, #7B6BF2, #5546D6); color: #fff; } .cw-send:hover { transform: scale(1.08) rotate(-8deg); } .cw-send:active { transform: scale(.88); }
.cw-mic { background: var(--tint-1); color: var(--tint-1-fg); position: relative; } .cw-mic:hover { transform: scale(1.08); }
.cw-mic.is-listening { background: #E5484D; color: #fff; }
.cw-mic.is-listening::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #E5484D; animation: ping 1.4s ease-out infinite; }

.cw-search { display: flex; align-items: center; gap: 8px; margin: 12px 12px 0; padding: 4px 14px; border: 1px solid var(--color-border-strong, var(--color-border)); border-radius: 999px; color: var(--color-text-muted); }
.cw-search:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 4px rgba(108, 92, 231, .14); }
.cw-search input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; font: inherit; color: var(--color-text); padding: 8px 0; }
.cw-person { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; color: inherit; padding: 9px 10px; border-radius: 18px; cursor: pointer; transition: background .2s, transform .25s var(--ease-spring); }
.cw-person:hover { background: var(--tint-1); transform: translateX(3px); }
.cw-avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.cw-person-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; } .cw-person-mid strong { font-size: 14px; }
.cw-person-mid span { color: var(--color-text-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-person-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; } .cw-person-right small { color: var(--color-text-muted); font-size: 11px; }
.cw-thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
.cw-thread-who { display: flex; flex-direction: column; min-width: 0; } .cw-thread-who span { color: var(--color-text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-back { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--color-text); cursor: pointer; display: grid; place-items: center; transition: background .2s, transform .25s var(--ease-spring); } .cw-back:hover { background: var(--color-surface-2, #eef0f7); transform: translateX(-2px); }

/* Phone: the panel becomes a bottom sheet and the launcher steps aside when the menu is open. */
@media (max-width: 640px) {
    .cw { right: 14px; bottom: 14px; }
    .cw.cw-lift { bottom: 84px; }
    .cw-fab { width: 54px; height: 54px; }
    .cw-panel { position: fixed; right: 0; left: 0; bottom: 0; width: auto; height: min(86vh, 640px); border-radius: 26px 26px 0 0; border-bottom: 0; transform-origin: bottom center; padding-bottom: env(safe-area-inset-bottom); }
    .cw.is-open .cw-fab { display: none; }
    body.sidebar-open .cw { display: none; }
    body.has-cw .toast-stack { bottom: 84px; }
}
@media (max-width: 900px) { body.sidebar-open .cw { display: none; } }
@media (prefers-reduced-motion: reduce) { .cw-fab, .cw-panel, .cw-badge { animation: none !important; } .cw.has-unread:not(.is-open) .cw-fab { animation: none; } }
@media print { .cw { display: none !important; } }
.cw-panel[hidden], .cw-pane[hidden] { display: none !important; }
.ask-understood{margin:-2px 0 8px;font-size:12.5px}
.ask-ai-note{margin:10px 0 0;padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--color-accent) 7%,var(--color-surface));font-size:13.5px}
.cw-avatar.is-online { box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-success); }
.cw-fulllink { display: block; padding: 10px 14px; text-align: center; font-size: 13px; font-weight: 600; color: var(--color-accent); border-top: 1px solid var(--color-border-soft); text-decoration: none; }
.cw-fulllink:hover { background: var(--color-hover); }
.cw-attach { display: block; margin-top: 4px; font-size: 12px; text-decoration: underline; color: inherit; }

/* Spacing fix: stacked blocks never touch (2026.10.15-8) */
.content > :where(.card, .dep-note, .kpi-grid, .dep-kpis, .chart-card, .two-col, .three-col) + :where(script, style) + :where(.card, .two-col, .three-col, .kpi-grid) { margin-top: 20px; }
.content > :where(.card, .two-col, .three-col, .kpi-grid) + :where(.card, .two-col, .three-col) { margin-top: 20px; }
.content > :where(.two-col, .three-col) + :where(.card, .kpi-grid) { margin-top: 20px; }
/* inside a card: a table that has something after it keeps a gap, and sub headings get air above */
.card > .table-scroll:not(:last-child) { margin-bottom: 24px; }
.card > :where(.kpi-grid, .chart-wrap, .bar-chart, .pie-wrap, svg, .chart):not(:last-child) { margin-bottom: 8px; }
.card > h4.card-title, .card > .card-title.b2-mt { margin-top: 28px; margin-bottom: 12px; }
.card > .card-header + h4.card-title { margin-top: 20px; }
.card > .kpi-grid + h4.card-title { margin-top: 28px; }

/* Home: the Customise sidebar chip is a link */
a.dash-meta-link { text-decoration: none; color: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s; }
a.dash-meta-link:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(108,92,231,.25); }

/* ---------- Safari / DuckDuckGo (WebKit) hardening (2026.10.15-10) ----------
   Drop-downs, tick boxes and "Select all" must work in every browser. WebKit can let a hidden full-screen layer
   (a closed dialog or palette with a blur behind it) or an animated blurred blob sit over the page and swallow clicks.
   So: closed overlays take no clicks and carry no blur, decorative layers never take clicks, and tick boxes and drop-downs keep a normal tap behaviour. */
.modal-overlay:not(.open), .palette-overlay:not(.open) { pointer-events: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.app-main::before, .app-main::after, .app-main > .ambient { pointer-events: none; }
.content :where(input[type="checkbox"], input[type="radio"], select, label, button) { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@supports (font: -apple-system-body) {
    /* Safari only: the big blurred blobs behind the page are a known cause of lost clicks, so they are switched off there */
    .app-main::before, .app-main::after { display: none; }
    body { background-attachment: scroll; }
    .modal-overlay, .palette-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; }
    .modal-overlay:not(.open), .palette-overlay:not(.open), .toast-stack:empty { display: none; }
    .form-actions-sticky, .form-actions { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Optional download watermark (Security options). Faint, never blocks clicks, shows in print. */
.sec-wm { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; background-repeat: repeat; background-size: 360px 200px; }
@media print { .sec-wm { position: fixed; } }

/* One-row filter bar with removable chips (exceptions list). Same filters as before; the rarely used ones sit under "More". */
.exc-filters.exc-bar { padding: 12px 14px; gap: 10px; position: relative; }
.exc-bar .exc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exc-bar .exc-search { flex: 1 1 180px; min-width: 150px; margin: 0; }
.exc-bar .exc-row > select { flex: 0 1 auto; width: auto; min-width: 96px; max-width: 170px; height: 38px; font-size: 13px; padding: 0 28px 0 10px; }
.exc-bar .exc-row > .btn { height: 38px; }
.exc-bar { position: relative; z-index: 20; }
.exc-bar { position: relative; z-index: 25; overflow: visible; }
.exc-bar .exc-pop { position: relative; }
.exc-bar .exc-pop > summary { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md, 12px); background: var(--color-surface, #fff); }
.exc-bar .exc-pop[open] > summary { border-color: var(--color-accent); }
.exc-bar .exc-pop-panel { position: absolute; z-index: 30; right: 0; top: calc(100% + 6px); width: min(560px, 92vw); padding: 14px; background: var(--color-surface, #fff); border: 1px solid var(--color-border); border-radius: var(--radius-lg, 16px); box-shadow: 0 18px 40px rgba(40, 30, 80, .18); }
.exc-bar .exc-pop-panel .exc-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.exc-bar .exc-pop-panel .exc-filter-grid + .exc-filter-grid { margin-top: 10px; }
.exc-bar .exc-chips { gap: 6px; }
.exc-chip-clear { background: transparent; border: 1px dashed var(--color-border); color: var(--color-text-muted, #6b6b80); }
@media (max-width: 640px) { .exc-bar .exc-row > select { flex: 1 1 calc(50% - 8px); max-width: none; } .exc-bar .exc-pop-panel { position: static; width: auto; margin-top: 8px; } .exc-bar .exc-pop { flex: 1 1 100%; } .exc-bar .exc-pop-panel .exc-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.exc-bar .exc-row > select { padding-top: 0; padding-bottom: 0; line-height: 36px; background-position: right 10px center; max-width: 140px; min-width: 88px; }
.exc-bar .exc-search { flex: 1 1 130px; min-width: 120px; }
.exc-bar .exc-search input { min-width: 0; }
.exc-bar .exc-row > .btn { padding: 0 14px; }

/* Phone tables: two key columns per card, the rest in a details sheet (tap the card). */
@media (max-width: 640px) {
    table.data-table.m-sheet tbody td[data-label]:not(.m-key) { display: none; }
    table.data-table.m-sheet tbody tr { cursor: pointer; position: relative; }
    table.data-table.m-sheet tbody td.m-key { grid-column: 1 / -1; }
    table.data-table.m-sheet tbody tr::after { content: "Details"; grid-column: 1 / -1; justify-self: start; margin: 4px 12px 10px; font-size: 12px; font-weight: 600; color: var(--color-accent); }
}
.m-sheet-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; }
.m-sheet-bg { position: absolute; inset: 0; background: rgba(20, 16, 40, .45); }
.m-sheet-panel { position: relative; width: 100%; max-height: 80vh; overflow: auto; background: var(--color-surface, #fff); border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(20, 16, 40, .25); }
.m-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.m-sheet-x { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 4px 10px; cursor: pointer; color: inherit; }
.m-sheet-panel dl { margin: 0; }
.m-sheet-row { display: grid; grid-template-columns: 38% 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--color-border); font-size: 14px; }
.m-sheet-row dt { color: var(--color-text-muted, #6b6b80); font-weight: 600; }
.m-sheet-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Heat map: empty cells are quiet so the populated ones stand out; the colour legend sits above the grid. */
.heatmap-cell.is-empty { opacity: .38; }
.heatmap-legend-top { margin: 0 0 12px; }

.doc-tabs a.doc-tab-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* Task board and timeline */
.tb-switch { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-pill, 999px); overflow: hidden; }
.tb-switch a { padding: 8px 16px; font-size: 13px; font-weight: 600; color: inherit; text-decoration: none; }
.tb-switch a.is-on { background: var(--color-accent); color: #fff; }
.tb-board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.tb-col { background: var(--color-surface-2, rgba(120, 110, 180, .06)); border-radius: 18px; padding: 10px; min-width: 0; }
.tb-col > header { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-size: 13.5px; }
.tb-count { background: var(--color-surface, #fff); border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; }
.tb-drop { display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 14px; transition: background .12s; }
.tb-drop.is-over { background: rgba(108, 92, 231, .12); outline: 2px dashed var(--color-accent); }
.tb-card { background: var(--color-surface, #fff); border: 1px solid var(--color-border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tb-card[draggable] { cursor: grab; }
.tb-card.is-drag { opacity: .45; }
.tb-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; text-decoration: none; overflow-wrap: anywhere; }
.tb-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--color-text-muted, #6b6b80); }
.tb-due { font-size: 12px; font-weight: 600; }
.tb-due.is-late { color: #c0392b; }
.tb-empty { font-size: 12.5px; color: var(--color-text-muted, #6b6b80); padding: 6px 8px; margin: 0; }
.tb-col.tb-overdue { background: rgba(231, 76, 60, .07); }
.tb-col.tb-closed { background: rgba(46, 204, 113, .07); }
.tb-timeline { padding: 12px 16px; overflow-x: auto; }
.tb-tl-head, .tb-tl-row { display: grid; grid-template-columns: 240px minmax(560px, 1fr); gap: 12px; align-items: center; }
.tb-tl-head { border-bottom: 1px solid var(--color-border); padding-bottom: 6px; font-size: 12px; font-weight: 700; }
.tb-tl-grid { position: relative; height: 18px; }
.tb-tl-grid span { position: absolute; transform: translateX(-2px); font-weight: 600; color: var(--color-text-muted, #6b6b80); }
.tb-tl-row { padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.tb-tl-label { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.tb-tl-label a { text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-tl-label small { color: var(--color-text-muted, #6b6b80); }
.tb-tl-track { position: relative; height: 18px; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 12 - 1px), rgba(120, 110, 180, .12) calc(100% / 12 - 1px) calc(100% / 12)); border-radius: 9px; }
.tb-bar { position: absolute; top: 3px; height: 12px; border-radius: 6px; background: #6c5ce7; }
.tb-bar.tb-todo { background: #a29bfe; } .tb-bar.tb-progress { background: #6c5ce7; } .tb-bar.tb-overdue { background: #e74c3c; } .tb-bar.tb-grading { background: #f39c12; }
.tb-today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #e17055; }
@media (max-width: 900px) { .tb-board { grid-template-columns: repeat(5, 78vw); scroll-snap-type: x mandatory; } .tb-col { scroll-snap-align: start; } .tb-tl-head, .tb-tl-row { grid-template-columns: 150px minmax(480px, 1fr); } }

/* My Work: grouped focus list */
.mw-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 4px 2px 8px; }
.mw-group h4 { margin: 0 0 8px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.mw-n { background: var(--color-accent-soft, #ece9ff); color: var(--color-accent); border-radius: 999px; padding: 0 9px; font-size: 12px; }
.mw-late h4 { color: #c0392b; } .mw-late .mw-n { background: #fdecea; color: #c0392b; }
.mw-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mw-group li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; font-size: 13px; }
.mw-kind { font-size: 11px; font-weight: 700; color: var(--color-text-muted, #6b6b80); min-width: 66px; }
.mw-due { font-size: 12px; font-weight: 600; color: var(--color-text-muted, #6b6b80); }
.mw-group a { overflow-wrap: anywhere; }

/* Report builder (Board Report) */
.rb-row { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; margin-bottom: 12px; }
.rb-inline { display: flex; flex-direction: column; gap: 4px; }
.rb-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; margin: 10px 0 14px; max-height: 220px; overflow: auto; }
.req-remind { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req-remind li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
@media (max-width: 640px) { .rb-row > * { flex: 1 1 100%; } }

/* Timeline lists (cases, special audits) */
.tl-list { list-style: none; margin: 0; padding: 0 0 0 6px; }
.tl-item { display: flex; gap: 12px; padding: 0 0 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--color-border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--color-accent); margin-top: 4px; flex: none; position: relative; z-index: 1; }
.tl-decision .tl-dot, .tl-status .tl-dot { background: #DB8A2E; }
.tl-file .tl-dot, .tl-access .tl-dot { background: #8B879E; }
.tl-alert .tl-dot { background: #E1493F; }
.tl-when { font-size: 12px; }

/* Audit plan by quarter */
.ap-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ap-col { background: var(--color-surface-2, rgba(120,110,200,.06)); border-radius: 20px; padding: 12px; min-width: 0; }
.ap-col.is-now { outline: 2px solid var(--color-accent); }
.ap-col > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; }
.ap-drop { display: grid; gap: 10px; min-height: 80px; border-radius: 14px; }
.ap-drop.is-over { background: rgba(120,110,200,.12); }
@media (max-width: 1000px) { .ap-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ap-board { grid-template-columns: 1fr; } }
.pv-list { line-height: 1.6; margin: 0 0 6px; }
.tpl-list { margin: 0 0 6px; padding-left: 20px; line-height: 1.6; }

/* Sign-in alternatives (passkey, single sign-on) */
.auth-alt { margin-top: 14px; display: grid; gap: 8px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--color-muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }

/* Short how-to inside a settings card */
.set-help { border: 1px solid var(--color-border, #E8E7F4); border-radius: 16px; padding: 10px 14px; margin: 8px 0 12px; background: var(--color-surface-2, rgba(108, 92, 231, .04)); }
.set-help > summary { cursor: pointer; font-weight: 600; }
.set-help .set-steps { margin: 10px 0 8px 20px; padding: 0; display: grid; gap: 6px; }

/* ---- Overview cards on the dashboard (2026.10.15-14) ---- */
.kpi-grid.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stat-card { gap: 12px; padding-bottom: 18px; justify-content: space-between; }
.stat-card .sc-foot { margin-top: auto; padding-top: 4px; border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent); padding-top: 12px; }
.stat-card .kpi-value { font-size: 44px; line-height: 1.05; letter-spacing: -.03em; margin-top: 2px; }
.stat-card .sc-label { font-size: 13.5px; font-weight: 700; }
.stat-card .sc-caption { font-size: 13px; opacity: .8; margin-top: 2px; }
.sc-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .55); }
:root[data-theme="dark"] .sc-bar { background: rgba(255, 255, 255, .10); }
.sc-bar span { display: block; height: 100%; }
.sc-minis { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sc-mini { display: inline-flex; align-items: baseline; gap: 6px; color: inherit; text-decoration: none; font-size: 13px; }
.sc-mini b { font-size: 16px; color: var(--color-text); }
.sc-mini:hover { text-decoration: underline; }
.sc-dot { width: 9px; height: 9px; border-radius: 50%; align-self: center; flex: 0 0 auto; }
.sc-foot { display: flex; align-items: center; gap: 12px; }
.sc-foot-text { display: grid; font-size: 13px; line-height: 1.3; }
.sc-foot-text b { font-size: 16px; color: var(--color-text); }
.sc-up { color: #137A4A; } .sc-down { color: #B3261E; }
.sc-spark { flex: 0 0 auto; }
.sc-note { font-size: 13px; font-weight: 600; color: inherit; }
.dash-charts-grid.dash-charts-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-wide-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 1100px) { .kpi-grid.stat-grid, .dash-charts-grid.dash-charts-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kpi-grid.stat-grid, .dash-charts-grid.dash-charts-grid-3, .dash-wide-grid { grid-template-columns: minmax(0, 1fr); } .stat-card .kpi-value { font-size: 38px; } }
/* Wider cards: spread the columns across the card instead of bunching them on the left */
.dash-wide-grid .gcol-chart { gap: 6px; }
.dash-wide-grid .gcol-group { flex: 1 1 0; }
.dash-wide-grid .gcol-bar { width: clamp(14px, 2.6vw, 34px); }
.dash-wide-grid .chart-legend { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }

/* ---------- Hero clock polish: smooth colon, flipping seconds, minute sweep ---------- */
.dash-clock { display: inline-block; min-width: 0; }
.dash-clock-time .colon { animation: clockPulse 2s ease-in-out infinite; opacity: 1; margin: 0 1px; }
@keyframes clockPulse { 0%, 100% { opacity: .95; } 50% { opacity: .3; } }
.dash-clock-sec { display: inline-block; }
.dash-clock-sec.flip { animation: secFlip .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes secFlip { from { opacity: 0; transform: translateY(-.35em); } to { opacity: .8; transform: none; } }
.dash-clock-track { height: 3px; margin-top: 10px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.dash-clock-track i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, rgba(255, 255, 255, .55), #fff); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; box-shadow: 0 0 10px rgba(255, 255, 255, .6); }
@media (prefers-reduced-motion: reduce) {
    .dash-clock-time .colon, .dash-clock-sec.flip { animation: none !important; }
    .dash-clock-track i { transition: none; }
}

/* ---------- Home charts: rings, area, bars ---------- */
.dash-charts-grid .card.chart-card, .dash-wide-grid .card.chart-card { border-radius: 22px; padding: 20px 22px 22px; }
.chart-card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.dc-donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; width: 100%; }
.dc-ring-wrap { position: relative; width: 150px; height: 150px; flex: 0 0 auto; }
.dc-ring { width: 100%; height: 100%; display: block; overflow: visible; }
.dc-ring-track { stroke: var(--color-surface-2); }
.dc-seg { transition: filter .2s, stroke-width .2s; animation: dcDraw .9s cubic-bezier(.3, .7, .2, 1) both; }
.dc-seg:hover { stroke-width: 18; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .18)); }
@keyframes dcDraw { from { stroke-dasharray: 0 999; } }
.dc-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dc-ring-center strong { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.03em; color: var(--color-ink); line-height: 1; }
.dc-ring-center strong.is-long { font-size: 22px; }
.dc-ring-center span { font-size: 11.5px; color: var(--color-text-muted); margin-top: 4px; }
.dc-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 140px; min-width: 140px; display: flex; flex-direction: column; gap: 4px; }
.dc-legend li { display: grid; grid-template-columns: 10px 1fr auto 38px; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; font-size: 13px; transition: background .15s; }
.dc-legend li:hover { background: var(--color-surface-2); }
.dc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dc-leg-label { color: var(--color-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-leg-val { font-weight: 650; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.dc-leg-pct { color: var(--color-text-muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

.dc-area-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.dc-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--color-surface-2); font-size: 12.5px; color: var(--color-text); }
.dc-pill b { color: var(--color-ink); font-weight: 650; margin-left: 2px; }
.dc-area { position: relative; width: 100%; }
.dc-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.dc-grid i { display: block; border-top: 1px dashed var(--color-border); opacity: .9; }
.dc-grid i:last-child { border-top-style: solid; }
.dc-area-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dc-area-svg { animation: dcWipe 1.2s .1s cubic-bezier(.4, .1, .2, 1) both; }
.dc-fill { opacity: 1; }
@keyframes dcWipe { from { clip-path: inset(-10% 100% -10% 0); } to { clip-path: inset(-10% -2% -10% 0); } }
@keyframes dcFade { to { opacity: 1; } }
.dc-pt { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--color-surface); border: 2.5px solid var(--c); box-sizing: border-box; pointer-events: none; opacity: 0; animation: dcFade .4s 1s ease forwards; transition: transform .15s; }
.dc-zones { position: absolute; inset: 0; display: flex; }
.dc-zone { flex: 1; position: relative; outline: none; border-radius: 12px; }
.dc-zone:hover, .dc-zone:focus-visible { background: linear-gradient(180deg, transparent, rgba(108, 92, 231, .07)); }
.dc-tip { position: absolute; left: 50%; top: 4px; transform: translate(-50%, -4px); min-width: 120px; padding: 9px 12px; border-radius: 14px; background: var(--color-ink); color: #fff; font-size: 12px; line-height: 1.5; box-shadow: 0 10px 28px rgba(20, 20, 50, .28); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 3; white-space: nowrap; display: flex; flex-direction: column; }
:root[data-theme="dark"] .dc-tip { background: #2C2D4A; }
.dc-tip em { font-style: normal; opacity: .7; font-size: 11px; margin-bottom: 2px; }
.dc-tip span { display: flex; align-items: center; gap: 6px; }
.dc-tip b { margin-left: auto; padding-left: 12px; }
.dc-zone:hover .dc-tip, .dc-zone:focus-visible .dc-tip { opacity: 1; transform: translate(-50%, 0); }
.dc-zone:first-child .dc-tip { left: 0; transform: translate(0, -4px); }
.dc-zone:first-child:hover .dc-tip, .dc-zone:first-child:focus-visible .dc-tip { transform: none; }
.dc-zone:last-child .dc-tip { left: auto; right: 0; transform: translate(0, -4px); }
.dc-zone:last-child:hover .dc-tip, .dc-zone:last-child:focus-visible .dc-tip { transform: none; }
.dc-xlabels { display: flex; margin-top: 10px; }
.dc-xlabels span { flex: 1; text-align: center; font-size: 12px; color: var(--color-text-muted); }

.dc-bars { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.dc-bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; font-size: 13px; }
.dc-bar-label { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text); }
.dc-bar-val { font-weight: 650; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.dc-bar-val small { font-weight: 500; color: var(--color-text-muted); margin-left: 8px; font-size: 12px; }
.dc-bar-track { height: 10px; border-radius: 10px; background: var(--color-surface-2); overflow: hidden; }
.dc-bar-fill { height: 100%; border-radius: 10px; transform-origin: left; animation: dcGrow .9s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes dcGrow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
    .dc-seg, .dc-area-svg, .dc-pt, .dc-bar-fill { animation: none !important; }
    .dc-pt { opacity: 1; }
}
@media (max-width: 520px) {
    .dc-donut { flex-direction: column; align-items: stretch; }
    .dc-ring-wrap { align-self: center; }
    .dc-tip { min-width: 108px; }
}

/* ---------- Quick links ---------- */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.quick-link-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 18px; border-radius: 22px; background: var(--color-surface); border: 1px solid var(--color-border); text-decoration: none; overflow: hidden; isolation: isolate; transition: transform .22s var(--ease-spring, ease), box-shadow .22s, border-color .22s; min-height: 148px; --ql-bg: var(--tint-1); --ql-fg: var(--tint-1-fg); }
.quick-links > .quick-link-card:nth-child(5n+2) { --ql-bg: var(--tint-2); --ql-fg: var(--tint-2-fg); }
.quick-links > .quick-link-card:nth-child(5n+3) { --ql-bg: var(--tint-3); --ql-fg: var(--tint-3-fg); }
.quick-links > .quick-link-card:nth-child(5n+4) { --ql-bg: var(--tint-4); --ql-fg: var(--tint-4-fg); }
.quick-links > .quick-link-card:nth-child(5n+5) { --ql-bg: var(--tint-5); --ql-fg: var(--tint-5-fg); }
.quick-link-card::before { content: ""; position: absolute; z-index: -1; right: -46px; top: -46px; width: 140px; height: 140px; border-radius: 50%; background: var(--ql-bg); opacity: .75; transition: transform .35s ease, opacity .25s; }
.quick-link-card:hover { transform: translateY(-3px); border-color: transparent; box-shadow: 0 16px 36px rgba(60, 50, 140, .14); text-decoration: none; }
.quick-link-card:hover::before { transform: scale(1.5); opacity: 1; }
.quick-link-card:focus-visible { outline: 2px solid var(--ql-fg); outline-offset: 2px; }
.quick-link-card .qlc-icon { position: static; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--ql-bg); color: var(--ql-fg); margin-bottom: 12px; box-shadow: 0 0 0 4px var(--color-surface); }
.quick-link-card .qlc-arrow { position: absolute; right: 16px; top: 16px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface); color: var(--ql-fg); box-shadow: 0 2px 8px rgba(60, 50, 140, .12); transform: translate(0, 0) rotate(-45deg); transition: transform .25s var(--ease-spring, ease); }
.quick-link-card:hover .qlc-arrow { transform: translate(0, 0) rotate(0); color: var(--ql-fg); }
.quick-link-card .qlc-title { font-size: 15.5px; padding-right: 36px; }
.quick-link-card .qlc-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
    .quick-links { grid-template-columns: 1fr; gap: 10px; }
    .quick-link-card { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 14px; padding: 14px 16px; }
    .quick-link-card .qlc-icon { margin: 0; }
    .quick-link-card .qlc-title { flex: 1; padding-right: 0; }
    .quick-link-card .qlc-desc { flex-basis: 100%; margin-top: 4px; }
    .quick-link-card .qlc-arrow { display: none; }
    .quick-link-card::before { display: none; }
}

.chart-card > .dc-donut, .chart-card > .chart-card-body { margin-top: auto; margin-bottom: auto; }
.chart-card > .dc-bars { margin-top: 6px; }

/* ---------- Fold cards: a calm collapsible section, used for long lists and forms ---------- */
.fold { padding: 0; overflow: hidden; }
.fold-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; list-style: none; user-select: none; }
.fold-head::-webkit-details-marker { display: none; }
.fold-head::marker { content: ""; }
.fold-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--tint-1); color: var(--tint-1-fg); flex: 0 0 auto; }
.fold-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; gap: 2px; }
.fold-title strong { font-family: var(--font-display); font-size: 16px; font-weight: 650; color: var(--color-ink); letter-spacing: -.01em; }
.fold-title small { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.4; }
.fold-stats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fold-chip { padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--color-surface-2); color: var(--color-text-muted); white-space: nowrap; }
.fold-chip.is-planned { background: var(--tint-1); color: var(--tint-1-fg); }
.fold-chip.is-active { background: var(--tint-2); color: var(--tint-2-fg); }
.fold-chip.is-done { background: var(--tint-3); color: var(--tint-3-fg); }
.fold-chev { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface-2); color: var(--color-text-muted); flex: 0 0 auto; transition: transform .25s, background .15s; }
.fold-head:hover .fold-chev { background: var(--tint-1); color: var(--tint-1-fg); }
details[open] > .fold-head .fold-chev { transform: rotate(180deg); }
.fold-head:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; border-radius: 22px; }
.fold-bar { height: 3px; background: var(--color-surface-2); }
.fold-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--tint-3-fg), #17A673); border-radius: 0 3px 3px 0; }
.fold-body { padding: 4px 20px 20px; }
details.fold > .fold-body:first-of-type { border-top: 1px solid var(--color-border); padding-top: 16px; }
details.fold > .fold-bar + .fold-body { border-top: 0; padding: 0; }
.fold-empty .fold-head { cursor: default; }
.fold-empty .fold-icon { background: var(--color-surface-2); color: var(--color-text-muted); }
.fold .table-scroll.fold-body { padding: 0; }
.fold-body .data-table { margin: 0; }
@media (max-width: 760px) {
    .fold-head { flex-wrap: wrap; padding: 14px 16px; gap: 10px 12px; }
    .fold-title { flex-basis: calc(100% - 100px); }
    .fold-stats { order: 5; flex-basis: 100%; justify-content: flex-start; }
    .fold-body { padding: 4px 16px 16px; }
}

/* ---------- Audit plan entries ---------- */
.plan-table { table-layout: fixed; width: 100%; }
.plan-table th:nth-child(1) { width: 34%; }
.plan-table th:nth-child(2) { width: 13%; }
.plan-table th:nth-child(3) { width: 14%; }
.plan-table th:nth-child(4) { width: 15%; }
.plan-table th:nth-child(5) { width: 11%; }
.plan-table th:nth-child(6) { width: 13%; }
.plan-table td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; overflow-wrap: anywhere; }
.plan-table .b4-title-cell strong { display: block; margin-bottom: 6px; line-height: 1.35; }
.pl-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.pl-chip { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--color-surface-2); color: var(--color-text-muted); }
.pl-note { margin-top: 7px; font-size: 12.5px; line-height: 1.45; color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-table .b4-nowrap { white-space: normal; }
.plan-table .b4-num-wide { width: 100%; max-width: 100px; }
@media (max-width: 960px) and (min-width: 641px) {
    .plan-table { min-width: 780px; }
}
.fold .table-scroll, .fold .table-scroll.fold-body { margin: 0; }
.fold > .table-scroll.fold-body { border-top: 0; }
.fold-wrap { padding: 0; overflow: hidden; }
.fold-wrap > details > summary.tp-add-summary { display: flex; align-items: center; gap: 14px; padding: 16px 20px; list-style: none; cursor: pointer; font-size: inherit; }
.fold-wrap > details > summary::-webkit-details-marker { display: none; }
.fold-wrap > details[open] > summary .fold-chev { transform: rotate(180deg); }
.fold-wrap > details > *:not(summary) { margin-left: 20px; margin-right: 20px; }
.fold-wrap > details > *:last-child { margin-bottom: 20px; }

/* Deposit quick views: one tidy scrolling line instead of a wrapped block of chips */
@media (min-width: 821px) { .dep-views { flex-wrap: nowrap; overflow-x: auto; -webkit-mask-image: linear-gradient(90deg, #000 94%, transparent); mask-image: linear-gradient(90deg, #000 94%, transparent); padding-right: 24px; } }
.dep-views .dep-view { flex: 0 0 auto; }
.kpi-tile .kpi-value.kpi-value-name, .kpi-grid > .kpi-tile .kpi-value.kpi-value-name { font-size: clamp(20px, 2.1vw, 26px); line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }

/* Deposit Records on tablets and phones: the card rows must fit the screen (they were as wide as the desktop table) */
@media (max-width: 820px) {
    .dep-list-scroll { overflow-x: visible; }
    .dep-list, .dep-list tbody { display: block; width: 100%; min-width: 0 !important; }
    .dep-list tbody tr { width: 100%; box-sizing: border-box; border-radius: 0; }
    .dep-list td { white-space: normal !important; max-width: none !important; min-width: 0 !important; overflow: visible !important; }
    .dep-list td.c-branch, .dep-list td.c-prod { text-align: right; flex-wrap: wrap; }
    .dep-list td.c-branch::before, .dep-list td.c-prod::before, .dep-list td.c-used::before, .dep-list td.c-status::before, .dep-list td.c-flags::before { text-align: left; }
    .dep-list td .dep-sub { white-space: normal; }
}
@media (max-width: 820px) { .dep-list td .dep-sub { flex-basis: 100%; text-align: right; } }
.dc-endval { position: absolute; transform: translate(-50%, -165%); font-style: normal; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--color-surface); box-shadow: 0 2px 8px rgba(60, 50, 140, .14); white-space: nowrap; pointer-events: none; opacity: 0; animation: dcFade .4s 1.1s ease forwards; }
.dc-endval:not(.is-first) { transform: translate(-80%, -165%); }
.dc-endval.is-first { transform: translate(-20%, -165%); }
@media (prefers-reduced-motion: reduce) { .dc-endval { animation: none; opacity: 1; } }

/* ---------- Deposit story ---------- */
.story-controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 4px 0 16px; }
.story-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--color-text-muted); font-weight: 600; }
.story-controls select { min-width: 190px; }
.story-doc { max-width: 880px; margin: 0 auto 28px; padding: 32px 36px 28px; border-radius: 26px; }
.story-kicker { font-size: 12.5px; font-weight: 650; color: var(--color-accent); margin-bottom: 6px; }
.story-head h2 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; }
.story-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 22px 0 6px; }
.story-figures > div { background: var(--tint-1); color: var(--tint-1-fg); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.story-figures > div:nth-child(2) { background: var(--tint-2); color: var(--tint-2-fg); }
.story-figures > div:nth-child(3) { background: var(--tint-3); color: var(--tint-3-fg); }
.story-figures > div:nth-child(4) { background: var(--tint-4); color: var(--tint-4-fg); }
.story-figures span { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: var(--color-ink); }
.story-figures small { font-size: 12.5px; font-weight: 600; }
.story-sec { margin-top: 26px; }
.story-sec h3 { font-size: 17px; margin: 0 0 8px; letter-spacing: -.01em; }
.story-sec p { font-size: 15px; line-height: 1.7; margin: 0 0 10px; max-width: 70ch; }
.st-up { color: #0E8A5F; } .st-down { color: #C23B33; }
.story-leads { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.story-leads li { padding: 10px 14px; border-radius: 14px; background: var(--color-surface-2); font-size: 14px; line-height: 1.5; }
.story-chart { margin: 6px 0 16px; }
.story-timeline { list-style: none; margin: 0; padding: 0 0 0 8px; position: relative; }
.story-timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--color-border); }
.story-timeline li { position: relative; display: flex; gap: 16px; padding: 8px 0; }
.tl-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--color-surface); border: 3px solid var(--color-accent); flex: 0 0 auto; margin-top: 3px; position: relative; z-index: 1; }
.story-timeline li.is-current .tl-dot { background: var(--color-accent); box-shadow: 0 0 0 5px var(--color-accent-soft); }
.tl-date { font-size: 15px; }
.tl-tag { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--color-accent-soft); color: var(--color-accent-strong); margin-left: 6px; }
.tl-nums { font-size: 14px; margin-top: 2px; } .tl-nums span { margin-left: 8px; font-weight: 650; }
.tl-meta { font-size: 12.5px; margin-top: 2px; }
.story-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--color-border); font-size: 12.5px; }
@media (max-width: 640px) { .story-doc { padding: 22px 18px; border-radius: 22px; } .story-controls select { min-width: 0; width: 100%; } .story-controls label { flex: 1 1 100%; } .story-controls .btn { width: 100%; justify-content: center; } }
@media print {
    body * { visibility: hidden; }
    #storyDoc, #storyDoc * { visibility: visible; }
    #storyDoc { position: absolute; left: 0; top: 0; width: 100%; max-width: none; box-shadow: none; border: 0; padding: 0; background: #fff; }
    .story-figures > div { background: #f3f2fb !important; color: #222 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .story-sec { break-inside: avoid; }
    .story-timeline li { break-inside: avoid; }
    .dc-area-svg, .dc-pt, .dc-endval { animation: none !important; opacity: 1 !important; clip-path: none !important; }
}
