/* ==========================================================================
   TaskFlow — design system
   Sections: tokens · base · layout · sidebar · topbar · buttons · cards
             stats · tables · forms · autocomplete · timeline · charts
             toasts · modal · login · utilities · motion
   ========================================================================== */

/* ---------------------------------- tokens -------------------------------- */
:root {
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Inter", "Helvetica Neue", Arial, sans-serif;

    --brand-1: #6366f1;
    --brand-2: #8b5cf6;
    --brand-3: #06b6d4;
    --brand: #4f46e5;
    --brand-ink: #ffffff;

    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --blue: #3b82f6;
    --slate: #64748b;

    --bg: #eef1f8;
    --bg-2: #e3e8f3;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef2f9;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;

    --text: #17203a;
    --text-2: #4b5675;
    --text-3: #7c88a8;

    --ring: rgba(99, 102, 241, .35);
    --shadow-sm: 0 1px 2px rgba(23, 32, 58, .06), 0 1px 3px rgba(23, 32, 58, .05);
    --shadow: 0 4px 6px -2px rgba(23, 32, 58, .06), 0 12px 24px -8px rgba(23, 32, 58, .12);
    --shadow-lg: 0 18px 48px -12px rgba(23, 32, 58, .28);
    --glass: rgba(255, 255, 255, .72);

    --r-sm: 8px;
    --r: 14px;
    --r-lg: 20px;
    --r-xl: 26px;

    --sidebar-w: 264px;
    --ease: cubic-bezier(.22, .68, .3, 1);
    --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

html[data-theme="dark"] {
    --brand: #7c7ff5;
    --bg: #080c1a;
    --bg-2: #0d1326;
    --surface: #131a30;
    --surface-2: #182142;
    --surface-3: #1e2850;
    --line: #263258;
    --line-strong: #33427a;

    --text: #e7ecfa;
    --text-2: #a9b4d4;
    --text-3: #7b87ad;

    --glass: rgba(19, 26, 48, .72);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

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

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background .4s var(--ease), color .3s var(--ease);
}

/* The hidden attribute must win over any component `display` rule below
   (.modal is display:grid, .field is display:flex — without this they would
   stay on screen even when marked hidden). */
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }

.skip-link {
    position: fixed; top: -60px; left: 16px; z-index: 200;
    background: var(--brand); color: #fff; padding: 10px 16px;
    border-radius: 0 0 var(--r-sm) var(--r-sm); font-weight: 600;
    transition: top .25s var(--ease);
}
.skip-link:focus { top: 0; }

/* --------------------------------- aurora --------------------------------- */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(120% 90% at 50% 0%, transparent 40%, var(--bg) 100%);
}
.aurora__blob {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
    animation: drift 26s var(--ease) infinite alternate;
}
.aurora__blob--1 { width: 46vw; height: 46vw; left: -10vw; top: -12vw; background: var(--brand-1); }
.aurora__blob--2 { width: 40vw; height: 40vw; right: -8vw; top: 4vw; background: var(--brand-3); animation-delay: -8s; }
.aurora__blob--3 { width: 44vw; height: 44vw; left: 28vw; bottom: -22vw; background: var(--brand-2); animation-delay: -16s; }
html[data-theme="dark"] .aurora__blob { opacity: .32; }

@keyframes drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(4vw, 3vw, 0) scale(1.12); }
    100% { transform: translate3d(-3vw, 5vw, 0) scale(.95); }
}

/* --------------------------------- layout --------------------------------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.main {
    flex: 1;
    padding: 26px clamp(16px, 3vw, 34px) 40px;
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
}
.app--narrow .main { max-width: 880px; }
.main:focus { outline: none; }

.foot {
    display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding: 16px clamp(16px, 3vw, 34px) 26px;
    font-size: 12.5px; color: var(--text-3);
    max-width: 1480px; width: 100%; margin: 0 auto;
}

/* --------------------------------- sidebar -------------------------------- */
.sidebar {
    width: var(--sidebar-w); flex: none;
    display: flex; flex-direction: column;
    padding: 18px 14px;
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(140%);
    border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100vh;
    z-index: 60;
}

.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand__mark {
    width: 38px; height: 38px; flex: none; display: grid; place-items: center;
    border-radius: 12px; color: #fff;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
    box-shadow: 0 8px 18px -6px var(--brand-1);
    animation: pop .5s var(--ease-back) both;
}
.brand__mark .icon { width: 21px; height: 21px; stroke-width: 2.6; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__text strong { font-size: 16.5px; letter-spacing: -.02em; }
.brand__text small { font-size: 11px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

.sidebar__close { display: none; }

.sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }

.nav__section {
    font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--text-3); padding: 16px 12px 6px;
}

.nav__link {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 11px;
    color: var(--text-2); font-weight: 550; font-size: 14px;
    transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
    animation: navIn .5s var(--ease) both; animation-delay: var(--d, 0s);
}
.nav__link::before {
    content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 0;
    border-radius: 0 3px 3px 0; background: var(--brand);
    transform: translateY(-50%); transition: height .25s var(--ease-back);
}
.nav__link:hover { color: var(--text); background: var(--surface-3); transform: translateX(3px); }
.nav__link:hover::before { height: 40%; }
.nav__link.is-active {
    color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
    font-weight: 650;
}
.nav__link.is-active::before { height: 62%; }
.nav__icon { display: grid; place-items: center; width: 20px; }
.nav__link.is-active .nav__icon { animation: wiggle .5s var(--ease); }
.nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
    animation: pulseBadge 2.2s ease-in-out infinite;
}

.sidebar__user {
    display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px;
    border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line);
}
.sidebar__userinfo { display: flex; flex-direction: column; min-width: 0; }
.sidebar__userinfo strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__userinfo small { font-size: 11.5px; color: var(--text-3); }

.avatar {
    width: 32px; height: 32px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #fff;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 4px 10px -3px var(--brand-1);
}
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }

.scrim {
    position: fixed; inset: 0; z-index: 55; background: rgba(8, 12, 26, .55);
    backdrop-filter: blur(2px); animation: fade .25s var(--ease);
}

/* --------------------------------- topbar --------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 14px;
    padding: 14px clamp(16px, 3vw, 34px);
    background: var(--glass); backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--line);
}
.topbar__burger { display: none; }
.topbar__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__icon {
    width: 38px; height: 38px; flex: none; display: grid; place-items: center;
    border-radius: 12px; color: var(--brand);
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    animation: pop .45s var(--ease-back) both;
}
.topbar__title h1 { font-size: 19px; }
.topbar__title p { font-size: 12.5px; color: var(--text-3); }

.topbar__search { position: relative; margin-left: auto; }
.topbar__search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar__search input {
    width: 210px; padding: 9px 12px 9px 34px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--text);
    transition: width .3s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.topbar__search input:focus { width: 270px; outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.topbar__search input::placeholder { color: var(--text-3); }

.topbar__actions { display: flex; align-items: center; gap: 9px; }

.iconbtn {
    width: 38px; height: 38px; flex: none; display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 11px;
    background: var(--surface); color: var(--text-2); cursor: pointer;
    transition: transform .2s var(--ease-back), color .2s, border-color .2s, box-shadow .2s;
}
.iconbtn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle span { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .45s var(--ease-back), opacity .3s; }
.theme-toggle__moon { transform: translateY(120%) rotate(-40deg); opacity: 0; }
html[data-theme="dark"] .theme-toggle__sun { transform: translateY(-120%) rotate(40deg); opacity: 0; }
html[data-theme="dark"] .theme-toggle__moon { transform: none; opacity: 1; }

/* user menu */
.usermenu { position: relative; }
.usermenu__btn {
    display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease-back);
}
.usermenu__btn:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.usermenu__name { font-size: 13.5px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu__pop {
    position: absolute; right: 0; top: calc(100% + 10px); width: 250px; padding: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.97);
    transform-origin: top right;
    transition: opacity .2s var(--ease), transform .25s var(--ease-back), visibility .2s;
}
.usermenu.is-open .usermenu__pop { opacity: 1; visibility: visible; transform: none; }
.usermenu__head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.usermenu__head small { color: var(--text-3); font-size: 11.5px; }
.usermenu__meta { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--text-2); }
.usermenu__meta .icon { width: 15px; height: 15px; color: var(--text-3); }
.usermenu__pop a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
    color: var(--text-2); font-weight: 550; font-size: 13.5px; transition: background .18s, color .18s, padding-left .2s;
}
.usermenu__pop a:hover { background: var(--surface-3); color: var(--text); padding-left: 16px; }
.usermenu__pop a.is-danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

/* --------------------------------- buttons -------------------------------- */
.btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 17px; border: 1px solid transparent; border-radius: 11px;
    font-size: 13.8px; font-weight: 620; letter-spacing: .01em;
    cursor: pointer; white-space: nowrap;
    background: var(--surface-2); color: var(--text);
    transition: transform .18s var(--ease-back), box-shadow .22s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.985); }
.btn .icon { width: 16px; height: 16px; }

.btn--primary {
    color: #fff; border-color: transparent;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 60%, var(--brand-3));
    background-size: 180% 180%; background-position: 0% 50%;
    box-shadow: 0 8px 20px -8px var(--brand-1);
    transition: background-position .5s var(--ease), transform .18s var(--ease-back), box-shadow .22s;
}
.btn--primary:hover { background-position: 100% 50%; box-shadow: 0 14px 28px -10px var(--brand-1); }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

.btn--soft { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }

.btn--excel { background: color-mix(in srgb, var(--green) 14%, transparent); color: #047857; border-color: color-mix(in srgb, var(--green) 30%, transparent); }
html[data-theme="dark"] .btn--excel { color: #6ee7b7; }
.btn--excel:hover { background: var(--green); color: #fff; border-color: transparent; }

.btn--success { background: var(--green); color: #fff; box-shadow: 0 8px 18px -8px var(--green); }
.btn--warn { background: var(--amber); color: #3b2503; box-shadow: 0 8px 18px -8px var(--amber); }
.btn--danger { background: var(--red); color: #fff; box-shadow: 0 8px 18px -8px var(--red); }

.btn--sm { padding: 7px 12px; font-size: 12.8px; border-radius: 9px; }
.btn--lg { padding: 13px 24px; font-size: 15px; border-radius: 13px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.ripple {
    position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
    background: rgba(255, 255, 255, .45); animation: ripple .6s var(--ease) forwards;
}
.btn--ghost .ripple, .btn--soft .ripple, .btn--excel .ripple { background: color-mix(in srgb, var(--brand) 25%, transparent); }

.btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------------------------------- cards --------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .3s var(--ease), transform .3s var(--ease), border-color .3s;
}
.card--pad { padding: clamp(16px, 2.2vw, 24px); }
.card--hover:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }

.card__head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card__head h2 { font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.card__head h2 .icon { color: var(--brand); }
.card__head p { font-size: 12.5px; color: var(--text-3); }
.card__head .spacer { margin-left: auto; }
.card__body { padding: 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* min() lets a track shrink below its ideal width on narrow screens instead of
   overflowing the page (body has overflow-x:hidden, so overflow means clipped). */
.grid { display: grid; gap: 18px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(min(196px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid--form { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
/* Master pages: form beside the list only when there is genuinely room for
   both (the lists are wide). Below that the form stacks above a full-width
   table, which is what nearly every real screen gets. */
.grid--master { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); align-items: start; }

.section-title {
    display: flex; align-items: center; gap: 10px; margin: 30px 0 14px;
    font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--text-3);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------------------------- stats --------------------------------- */
.stat {
    position: relative; overflow: hidden;
    padding: 18px 20px; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.stat::after {
    content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
    border-radius: 50%; background: var(--tone, var(--brand)); opacity: .09;
    transition: transform .45s var(--ease);
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stat:hover::after { transform: scale(1.5); }
.stat__top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat__icon {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    color: var(--tone, var(--brand)); background: color-mix(in srgb, var(--tone, var(--brand)) 14%, transparent);
}
.stat__label { font-size: 12.2px; font-weight: 620; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.stat__value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat__value small { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.stat__sub { font-size: 12.4px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.stat__bar { height: 5px; border-radius: 4px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.stat__bar i { display: block; height: 100%; border-radius: 4px; background: var(--tone, var(--brand)); width: 0; transition: width 1.1s var(--ease) .15s; }

.tone-brand { --tone: var(--brand); }
.tone-green { --tone: var(--green); }
.tone-amber { --tone: var(--amber); }
.tone-red   { --tone: var(--red); }
.tone-blue  { --tone: var(--blue); }
.tone-slate { --tone: var(--slate); }

/* --------------------------------- badges --------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 640; white-space: nowrap;
    background: color-mix(in srgb, var(--bd, var(--slate)) 14%, transparent);
    color: var(--bd, var(--slate));
    border: 1px solid color-mix(in srgb, var(--bd, var(--slate)) 26%, transparent);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--green { --bd: var(--green); }
.badge--amber { --bd: var(--amber); }
.badge--red   { --bd: var(--red); }
.badge--blue  { --bd: var(--blue); }
.badge--slate { --bd: var(--slate); }
.badge--soft { border-style: dashed; }
.badge--amber .dot { animation: blink 1.4s ease-in-out infinite; }

.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 580;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.chip .icon { width: 14px; height: 14px; color: var(--text-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.tabs a {
    padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2);
    transition: background .22s var(--ease), color .22s, transform .2s var(--ease-back);
}
.tabs a:hover { color: var(--text); transform: translateY(-1px); }
.tabs a.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* --------------------------------- tables --------------------------------- */
.tablewrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tablewrap::-webkit-scrollbar { height: 9px; }
.tablewrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 9px; }

table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.6px; }
table.tbl th {
    position: sticky; top: 0; z-index: 2;
    text-align: left; font-size: 11.4px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-3); background: var(--surface-2);
    padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
table.tbl tbody tr { animation: rowIn .45s var(--ease) both; animation-delay: var(--d, 0s); transition: background .18s; }
table.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: center; font-variant-numeric: tabular-nums; }
table.tbl .strong { color: var(--text); font-weight: 620; }
table.tbl .nowrap { white-space: nowrap; }
table.tbl tfoot td {
    background: var(--surface-2); font-weight: 700; color: var(--text);
    border-top: 2px solid var(--line-strong); border-bottom: none;
}

.cellstack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cellstack strong { color: var(--text); font-weight: 620; }
.cellstack small { color: var(--text-3); font-size: 11.8px; }

.person { display: flex; align-items: center; gap: 9px; min-width: 0; }

.linkcell { color: var(--text); font-weight: 620; display: inline-flex; align-items: center; gap: 6px; }
.linkcell:hover { color: var(--brand); }
.linkcell::after {
    content: ""; height: 1px; width: 0; background: currentColor;
    transition: width .25s var(--ease);
}
.linkcell:hover::after { width: 14px; }

.progress { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 88px; }
.progress i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand-1), var(--brand-3)); width: 0; transition: width 1s var(--ease) .1s; }

.empty { padding: 56px 24px; text-align: center; color: var(--text-3); }
.empty .icon { width: 46px; height: 46px; margin: 0 auto 14px; color: var(--line-strong); animation: floaty 3.4s ease-in-out infinite; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 380px; margin: 0 auto 18px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pager__links { display: flex; gap: 6px; flex-wrap: wrap; }
.pager__links a, .pager__links span {
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px;
    display: grid; place-items: center; font-size: 13px; font-weight: 600;
    border: 1px solid var(--line); color: var(--text-2); background: var(--surface);
    transition: transform .18s var(--ease-back), border-color .2s, color .2s;
}
.pager__links a:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--brand); }
.pager__links .is-active { background: var(--brand); border-color: transparent; color: #fff; }
.pager__links .is-gap { border: none; background: none; }

/* ---------------------------------- forms --------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; min-width: 0; }
.field > label { font-size: 12.6px; font-weight: 650; color: var(--text-2); letter-spacing: .01em; display: flex; align-items: center; gap: 6px; }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12.2px; color: var(--red); display: flex; align-items: center; gap: 6px; animation: shake .4s var(--ease); }

.input, .textarea, select.input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--line); border-radius: 11px;
    background: var(--surface); color: var(--text);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .textarea:focus, select.input:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring);
}
.textarea { min-height: 108px; resize: vertical; line-height: 1.6; }
.input.has-error, .textarea.has-error { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent); }
.input[readonly] { background: var(--surface-2); color: var(--text-3); }

.inputgroup { position: relative; }
.inputgroup .input { padding-left: 40px; }
.inputgroup > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.inputgroup .toggle-pass {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-3);
    padding: 7px; border-radius: 8px; transition: color .2s, background .2s;
}
.inputgroup .toggle-pass:hover { color: var(--brand); background: var(--surface-3); }

.radios { display: flex; flex-wrap: wrap; gap: 10px; }
.radiocard {
    position: relative; display: flex; align-items: center; gap: 9px;
    padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 570;
    transition: border-color .2s, background .2s, transform .2s var(--ease-back), box-shadow .2s;
}
.radiocard input { position: absolute; opacity: 0; pointer-events: none; }
.radiocard .icon { color: var(--text-3); transition: color .2s; }
.radiocard:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.radiocard:has(input:checked) {
    border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand);
}
.radiocard:has(input:checked) .icon { color: var(--brand); }
.radiocard:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 570; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong);
    position: relative; transition: background .25s var(--ease); flex: none;
}
.switch__track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .28s var(--ease-back);
}
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 2px; }

.filterbar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.filterbar .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.filterbar .field--sm { flex: 0 1 130px; }
.filterbar .btnrow { margin-left: auto; }

.meter { display: flex; align-items: center; gap: 10px; }
.meter__track { flex: 1; height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.meter__fill { height: 100%; border-radius: 6px; width: 0; transition: width .4s var(--ease), background .3s; }

/* ------------------------------- autocomplete ----------------------------- */
.ac { position: relative; }
.ac__list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
    max-height: 268px; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.985);
    transform-origin: top center;
    transition: opacity .18s var(--ease), transform .22s var(--ease-back), visibility .18s;
}
.ac.is-open .ac__list { opacity: 1; visibility: visible; transform: none; }
.ac__list::-webkit-scrollbar { width: 7px; }
.ac__list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 7px; }

.ac__opt {
    display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
    cursor: pointer; font-size: 13.6px;
    animation: rowIn .3s var(--ease) both; animation-delay: var(--d, 0s);
    transition: background .15s;
}
.ac__opt strong { color: var(--text); font-weight: 600; }
.ac__opt small { color: var(--text-3); font-size: 11.6px; }
.ac__opt mark { background: color-mix(in srgb, var(--brand) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; font-weight: 700; }
.ac__opt.is-active, .ac__opt:hover { background: color-mix(in srgb, var(--brand) 11%, transparent); }
.ac__opt .avatar { background: linear-gradient(135deg, var(--brand-3), var(--brand-1)); }
.ac__empty { padding: 14px 12px; font-size: 13px; color: var(--text-3); text-align: center; }
.ac__hintrow { padding: 8px 11px 4px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.ac__spin { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: 0; transition: opacity .2s; }
.ac.is-loading .ac__spin { opacity: 1; }
.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--brand) 28%, transparent);
    border-top-color: var(--brand); animation: spin .7s linear infinite;
}
.ac__ok { position: absolute; right: 12px; top: 50%; transform: translateY(-50%) scale(0); color: var(--green); transition: transform .3s var(--ease-back); }
.ac.is-valid .ac__ok { transform: translateY(-50%) scale(1); }

/* -------------------------------- timeline -------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl {
    position: relative; padding: 0 0 20px; animation: rowIn .5s var(--ease) both; animation-delay: var(--d, 0s);
}
.tl:last-child { padding-bottom: 0; }
.tl::before {
    content: ""; position: absolute; left: -24px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--tone, var(--brand));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone, var(--brand)) 14%, transparent);
}
.tl__title { font-size: 13.8px; font-weight: 640; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl__meta { font-size: 12.2px; color: var(--text-3); }
.tl__note { font-size: 13px; color: var(--text-2); margin-top: 5px; padding: 9px 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }

/* --------------------------------- charts --------------------------------- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bars__row { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 12px; align-items: center; font-size: 13.2px; }
.bars__label { color: var(--text-2); font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bars__fill {
    display: block; height: 100%; border-radius: 6px; width: 0;
    background: linear-gradient(90deg, var(--tone, var(--brand-1)), color-mix(in srgb, var(--tone, var(--brand-1)) 55%, var(--brand-3)));
    transition: width 1s var(--ease); transition-delay: var(--d, 0s);
}
.bars__val { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text); min-width: 30px; text-align: right; }

.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut__svg { width: 156px; height: 156px; flex: none; transform: rotate(-90deg); }
.donut__svg circle { fill: none; stroke-width: 15; stroke-linecap: round; }
.donut__svg .trackc { stroke: var(--surface-3); }
.donut__svg .seg {
    stroke-dasharray: var(--len) 999; stroke-dashoffset: var(--len);
    transition: stroke-dashoffset 1.2s var(--ease); transition-delay: var(--d, 0s);
}
.donut__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut__wrap { position: relative; width: 156px; height: 156px; flex: none; }
.donut__big { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.donut__cap { font-size: 11.4px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 170px; }
.legend__row { display: flex; align-items: center; gap: 10px; font-size: 13.3px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--tone); }
.legend__name { color: var(--text-2); flex: 1; }
.legend__val { font-weight: 680; color: var(--text); font-variant-numeric: tabular-nums; }

/* --------------------------------- toasts --------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-lg); font-size: 13.6px; color: var(--text-2);
    animation: toastIn .45s var(--ease-back) both;
    position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--brand)); }
.toast .icon { color: var(--tone, var(--brand)); margin-top: 1px; }
.toast strong { display: block; color: var(--text); font-size: 13.6px; }
.toast.is-out { animation: toastOut .3s var(--ease) forwards; }
.toast__close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-3); padding: 2px; border-radius: 6px; }
.toast__close:hover { color: var(--text); }
.toast--success { --tone: var(--green); }
.toast--error { --tone: var(--red); }
.toast--info { --tone: var(--blue); }
.toast--warning { --tone: var(--amber); }

/* --------------------------------- modal ---------------------------------- */
.modal { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 20px; }
.modal__scrim { position: absolute; inset: 0; background: rgba(8, 12, 26, .55); backdrop-filter: blur(3px); animation: fade .25s var(--ease); }
.modal__box {
    position: relative; width: min(430px, 100%); padding: 26px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg); text-align: center;
    animation: modalIn .4s var(--ease-back) both;
}
.modal__icon {
    width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center;
    color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent);
}
.modal__icon .icon { width: 26px; height: 26px; }
.modal__box h2 { font-size: 18px; margin-bottom: 8px; }
.modal__box p { font-size: 13.8px; color: var(--text-2); margin-bottom: 22px; }
.modal__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* --------------------------------- login ---------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; position: relative; z-index: 1; }

.auth__side {
    position: relative; overflow: hidden; padding: 44px clamp(28px, 4vw, 60px);
    display: flex; flex-direction: column; justify-content: space-between; color: #fff;
    background: linear-gradient(140deg, #312e81, #4f46e5 42%, #0ea5e9 100%);
    background-size: 200% 200%; animation: gradientShift 18s ease infinite;
}
.auth__side::after {
    content: ""; position: absolute; inset: 0; opacity: .3;
    background-image: radial-gradient(rgba(255, 255, 255, .35) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: radial-gradient(90% 70% at 30% 20%, #000 20%, transparent 75%);
}
.auth__brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.auth__brand .brand__mark { background: rgba(255, 255, 255, .16); box-shadow: none; backdrop-filter: blur(6px); }
.auth__brand strong { font-size: 19px; }
.auth__brand small { color: rgba(255, 255, 255, .72); }

.auth__pitch { position: relative; z-index: 2; max-width: 460px; }
.auth__pitch h2 { font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -.035em; margin-bottom: 14px; }
.auth__pitch p { color: rgba(255, 255, 255, .82); font-size: 15px; }
.auth__features { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 11px; }
.auth__features li {
    display: flex; align-items: center; gap: 11px; font-size: 14px; color: rgba(255, 255, 255, .93);
    animation: fadeUp .6s var(--ease) both; animation-delay: var(--d, 0s);
}
.auth__features .tick {
    width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .18);
}
.auth__features .icon { width: 14px; height: 14px; stroke-width: 2.6; }

.auth__cards { position: relative; z-index: 2; display: flex; gap: 12px; flex-wrap: wrap; }
.auth__mini {
    flex: 1 1 130px; padding: 14px 16px; border-radius: var(--r);
    background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .2);
    backdrop-filter: blur(8px);
    animation: fadeUp .7s var(--ease) both; animation-delay: var(--d, 0s);
    transition: transform .3s var(--ease-back), background .3s;
}
.auth__mini:hover { transform: translateY(-4px); background: rgba(255, 255, 255, .2); }
.auth__mini b { display: block; font-size: 22px; letter-spacing: -.03em; }
.auth__mini span { font-size: 12px; color: rgba(255, 255, 255, .78); }

.auth__main { display: grid; place-items: center; padding: 40px 24px; }
.auth__form { width: min(410px, 100%); animation: fadeUp .6s var(--ease) both; }
.auth__form h1 { font-size: 26px; letter-spacing: -.03em; margin-bottom: 6px; }
.auth__form > p { color: var(--text-3); font-size: 14px; margin-bottom: 26px; }
.auth__alert {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 18px;
    border-radius: 12px; font-size: 13.5px;
    background: color-mix(in srgb, var(--red) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); color: var(--red);
    animation: shake .45s var(--ease);
}
.auth__note { margin-top: 22px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 12.6px; color: var(--text-2); }
.auth__note strong { display: flex; align-items: center; gap: 7px; color: var(--text); margin-bottom: 8px; font-size: 12.4px; letter-spacing: .06em; text-transform: uppercase; }
.auth__note table { width: 100%; border-collapse: collapse; font-size: 12.6px; }
.auth__note td { padding: 3px 0; }
.auth__note td:last-child { text-align: right; }
.auth__note code { background: var(--surface-3); padding: 2px 7px; border-radius: 6px; font-size: 12px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.auth__demo { background: none; border: none; padding: 0; color: var(--brand); font-weight: 650; cursor: pointer; font-size: 12.4px; text-decoration: underline; }
.auth__topright { position: absolute; top: 20px; right: 20px; z-index: 5; }

/* ------------------------------- task detail ------------------------------ */
.detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 12px 14px; font-size: 13.6px; }
.kv dt { color: var(--text-3); font-weight: 570; }
.kv dd { margin: 0; color: var(--text); font-weight: 570; }

.hero {
    position: relative; overflow: hidden; padding: 24px clamp(18px, 2.4vw, 28px);
    border-radius: var(--r-xl); color: #fff;
    background: linear-gradient(130deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
    background-size: 200% 200%; animation: gradientShift 16s ease infinite;
    box-shadow: 0 18px 40px -18px var(--brand-1);
}
.hero::after {
    content: ""; position: absolute; inset: 0; opacity: .25;
    background-image: radial-gradient(rgba(255, 255, 255, .4) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(80% 80% at 85% 10%, #000, transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { font-size: clamp(19px, 2.3vw, 25px); letter-spacing: -.03em; margin-bottom: 8px; }
.hero p { color: rgba(255, 255, 255, .87); font-size: 14px; max-width: 640px; }
.hero__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero .chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .26); color: #fff; }
.hero .chip .icon { color: rgba(255, 255, 255, .8); }

.notebox { padding: 13px 15px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.4px; color: var(--text-2); }
.notebox strong { display: block; color: var(--text); font-size: 12.2px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 5px; }

.calloutbox {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    padding: 14px 16px; border-radius: var(--r);
    background: color-mix(in srgb, var(--tone, var(--blue)) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone, var(--blue)) 28%, transparent);
    font-size: 13.4px; color: var(--text-2);
}
.calloutbox .icon { color: var(--tone, var(--blue)); flex: none; margin-top: 2px; }
.calloutbox strong { display: block; color: var(--text); margin-bottom: 3px; }
.calloutbox--amber { --tone: var(--amber); }
.calloutbox--green { --tone: var(--green); }
.calloutbox--red { --tone: var(--red); }

/* ------------------------------- utilities -------------------------------- */
.reveal { animation: fadeUp .55s var(--ease) both; animation-delay: var(--d, 0s); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 28px; }
.mb { margin-bottom: 18px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.6px; }
.grow { flex: 1; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------- keyframes -------------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes navIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.7) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-12deg) scale(1.12); } 65% { transform: rotate(9deg) scale(1.06); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes pulseBadge {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--red) 0%, transparent); }
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes confetti { to { transform: translate3d(var(--cx), var(--cy), 0) rotate(var(--cr)); opacity: 0; } }

.confetti-piece {
    position: fixed; width: 9px; height: 9px; z-index: 500; pointer-events: none; border-radius: 2px;
    animation: confetti 1.15s var(--ease) forwards;
}

/* ------------------------------ responsive -------------------------------- */
@media (max-width: 1700px) {
    .grid--master { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1180px) {
    .detail { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth__side { display: none; }
}

@media (max-width: 980px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100%;
        transform: translateX(-104%); transition: transform .34s var(--ease);
        box-shadow: var(--shadow-lg); background: var(--surface);
    }
    body.drawer-open .sidebar { transform: none; }
    .sidebar__close { display: grid; place-items: center; margin-left: auto; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-2); cursor: pointer; }
    .topbar__burger { display: grid; }
    .topbar__search input { width: 140px; }
    .topbar__search input:focus { width: 190px; }
    .usermenu__name { display: none; }
}

@media (max-width: 700px) {
    body { font-size: 14px; }
    .topbar { flex-wrap: wrap; }
    .topbar__search { order: 5; flex: 1 1 100%; margin-left: 0; }
    .topbar__search input, .topbar__search input:focus { width: 100%; }
    .topbar__actions { margin-left: auto; }
    .filterbar .btnrow { margin-left: 0; width: 100%; }
    .kv { grid-template-columns: 1fr; gap: 4px 0; }
    .kv dd { margin-bottom: 10px; }
    .bars__row { grid-template-columns: 1fr; gap: 5px; }
    .bars__val { text-align: left; }
    .foot { justify-content: center; text-align: center; }
}

/* --------------------------- reduced motion ------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    .aurora__blob { animation: none; }
}

@media print {
    .sidebar, .topbar, .foot, .toasts, .aurora, .btnrow, .filterbar { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
}
