/* ===================================================================
   Task Tracker — design system
   Hand written, no build step, no framework.

   Direction: deep navy chrome, saturated accent gradients, layered
   shadows. The colour is carried by the data itself — status,
   priority, progress, teams — rather than by decoration.
   =================================================================== */

:root {
    /* ---- Chrome ---- */
    --ink:            #0B1220;
    --ink-2:          #111C33;
    --ink-soft:       #1B2842;
    --ink-line:       #26355A;
    --ink-glow:       rgba(88, 120, 255, .22);

    --surface:        #F1F4FB;
    --surface-2:      #E7ECF7;
    --card:           #FFFFFF;
    --line:           #E2E8F5;
    --line-soft:      #EDF1F9;

    /* ---- Type ---- */
    --text:           #0D1526;
    --muted:          #56617A;
    --faint:          #8B95AC;
    --on-ink:         #EAEFFB;
    --on-ink-muted:   #93A1C4;

    /* ---- Accents ---- */
    --cobalt:         #2B50F6;
    --cobalt-2:       #5B7BFF;
    --cobalt-deep:    #1A32B8;
    --cobalt-soft:    #E7ECFF;

    --violet:         #7A5AF8;
    --violet-2:       #A48BFF;
    --violet-deep:    #5433D6;
    --violet-soft:    #EFEBFF;

    --teal:           #00A6A0;
    --teal-2:         #2FD3CB;
    --teal-deep:      #067673;
    --teal-soft:      #DBF6F4;

    --green:          #12A150;
    --green-2:        #34C971;
    --green-deep:     #0A6E37;
    --green-soft:     #DCF6E6;

    --amber:          #E08700;
    --amber-2:        #FFB020;
    --amber-deep:     #8C5606;
    --amber-soft:     #FFF1D9;

    --red:            #E03B41;
    --red-2:          #FF6B6B;
    --red-deep:       #A31B22;
    --red-soft:       #FDE6E7;

    --pink:           #E5479B;
    --pink-deep:      #B22270;
    --pink-soft:      #FDE6F2;

    --slate:          #64748B;
    --slate-soft:     #EBEFF7;

    /* ---- Gradients ---- */
    --g-cobalt: linear-gradient(135deg, #3E63FF 0%, #2438D8 100%);
    --g-violet: linear-gradient(135deg, #9A7CFF 0%, #6A3FE8 100%);
    --g-teal:   linear-gradient(135deg, #2FD3CB 0%, #018E89 100%);
    --g-green:  linear-gradient(135deg, #3DD07A 0%, #0C8A43 100%);
    --g-amber:  linear-gradient(135deg, #FFC048 0%, #DE7B00 100%);
    --g-red:    linear-gradient(135deg, #FF7A7E 0%, #D2262C 100%);
    --g-pink:   linear-gradient(135deg, #FF7FC0 0%, #C62E7E 100%);
    --g-slate:  linear-gradient(135deg, #93A0B8 0%, #5A6982 100%);
    --g-ink:    linear-gradient(160deg, #16233D 0%, #0B1220 62%);

    /* ---- Shape and depth ---- */
    --r-xs: 7px;
    --r-sm: 10px;
    --r:    14px;
    --r-lg: 20px;
    --r-xl: 26px;

    --shadow-xs: 0 1px 2px rgba(13, 21, 38, .06);
    --shadow-sm: 0 2px 6px rgba(13, 21, 38, .06), 0 1px 2px rgba(13, 21, 38, .04);
    --shadow:    0 6px 20px rgba(13, 21, 38, .07), 0 2px 6px rgba(13, 21, 38, .04);
    --shadow-md: 0 14px 34px rgba(13, 21, 38, .10), 0 3px 10px rgba(13, 21, 38, .05);
    --shadow-lg: 0 28px 64px rgba(13, 21, 38, .16), 0 6px 18px rgba(13, 21, 38, .07);

    --ring: 0 0 0 3px rgba(43, 80, 246, .16);

    --sidebar-w: 262px;
    --topbar-h:  68px;

    /* ---- Type families ---- */
    --display: "Sora", "Noto Sans Bengali", system-ui, sans-serif;
    --body:    "Inter", "Noto Sans Bengali", system-ui, -apple-system, sans-serif;
    --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

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

body {
    margin: 0;
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 82% -8%, rgba(122, 90, 248, .10), transparent 62%),
        radial-gradient(900px 520px at 4% 4%, rgba(43, 80, 246, .09), transparent 58%),
        var(--surface);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: var(--display);
    color: var(--text);
    letter-spacing: -.022em;
    margin: 0 0 .4em;
    font-weight: 600;
}

h1 { font-size: 1.72rem; font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.04rem; }
h4 { font-size: .95rem; }

p { margin: 0 0 1rem; }

a { color: var(--cobalt); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--cobalt-deep); text-decoration: underline; }

code {
    font-family: var(--mono);
    font-size: .85em;
    background: var(--cobalt-soft);
    color: var(--cobalt-deep);
    padding: .1em .4em;
    border-radius: 5px;
}

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

::selection { background: rgba(43, 80, 246, .18); }

* { scrollbar-width: thin; scrollbar-color: #C6D0E4 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    background: #C6D0E4;
    border-radius: 20px;
    border: 3px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #A9B6D0; background-clip: content-box; }

/* -------------------------------------------------------------------
   Shell
   ----------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--g-ink);
    color: var(--on-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    box-shadow: 1px 0 0 rgba(255, 255, 255, .04), 12px 0 40px rgba(11, 18, 32, .16);
}

/* Soft aurora at the top of the rail so the navy is not flat. */
.sidebar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 320px;
    background:
        radial-gradient(420px 220px at 12% 0%, rgba(91, 123, 255, .30), transparent 68%),
        radial-gradient(360px 200px at 92% 12%, rgba(122, 90, 248, .22), transparent 70%);
    pointer-events: none;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.15rem 1.05rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar__mark {
    width: 38px; height: 38px;
    flex: none;
    border-radius: 11px;
    background: var(--g-cobalt);
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: .92rem;
    color: #fff;
    letter-spacing: -.02em;
    box-shadow: 0 6px 18px rgba(43, 80, 246, .45), inset 0 1px 0 rgba(255, 255, 255, .28);
}

.sidebar__name { font-family: var(--display); font-weight: 600; font-size: .95rem; color: #fff; line-height: 1.2; }

.sidebar__tenant {
    font-size: .7rem;
    color: var(--on-ink-muted);
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 600;
    margin-top: .12rem;
}

.sidebar__nav { padding: .85rem .7rem 2rem; overflow-y: auto; flex: 1; }

.nav-label {
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .13em;
    color: #6E7FA6;
    font-weight: 700;
    padding: 1.15rem .6rem .4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .56rem .65rem;
    border-radius: var(--r-sm);
    color: #C3CEE6;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .12rem;
    position: relative;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; transform: translateX(2px); }

.nav-item.is-active {
    background: linear-gradient(100deg, rgba(43, 80, 246, .34), rgba(122, 90, 248, .16));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(120, 150, 255, .28), 0 4px 14px rgba(43, 80, 246, .18);
}

.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 22px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--cobalt-2), var(--violet));
    box-shadow: 0 0 12px var(--ink-glow);
}

.nav-item svg { width: 17px; height: 17px; opacity: .7; flex: none; }
.nav-item.is-active svg { opacity: 1; }

.nav-item__count {
    margin-left: auto;
    background: var(--g-cobalt);
    color: #fff;
    font-family: var(--mono);
    font-size: .66rem;
    font-weight: 600;
    padding: .1rem .4rem;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(43, 80, 246, .5);
}

.nav-item__count--amber { background: var(--g-amber); box-shadow: 0 2px 8px rgba(224, 135, 0, .45); }

.sidebar__foot {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    background: rgba(0, 0, 0, .18);
}

.sidebar__foot small { color: var(--on-ink-muted); display: block; font-size: .72rem; }
.sidebar__foot strong { font-size: .85rem; font-weight: 600; color: #fff; }

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

/* -------------------------------------------------------------------
   Topbar
   ----------------------------------------------------------------- */

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 0 1.6rem;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar__search { flex: 1; max-width: 440px; position: relative; }

/*
   Specificity has to beat the global input rule further down, otherwise the
   left gutter collapses and the magnifier lands on top of the placeholder.
*/
.topbar .topbar__search input {
    width: 100%;
    padding: .55rem .9rem .55rem 2.5rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    font-size: .87rem;
    font-family: var(--body);
    box-shadow: none;
    transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.topbar .topbar__search input:focus { background: #fff; border-color: var(--cobalt); box-shadow: var(--ring); }

.topbar__search svg {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--faint);
    pointer-events: none;
    z-index: 1;
}

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.sidebar-toggle { display: none; }

.content { padding: 1.7rem 1.8rem 4.5rem; flex: 1; }

/* -------------------------------------------------------------------
   Page header
   ----------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

.page-head > div:first-child { flex: 1; min-width: 240px; }
.page-head h1 { margin-bottom: .18rem; }
.page-head p { color: var(--muted); margin: 0; font-size: .9rem; }
.page-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.section-title {
    font-family: var(--display);
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--faint);
    margin: 1.5rem 0 .8rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* -------------------------------------------------------------------
   Cards
   ----------------------------------------------------------------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.card--link { display: block; color: inherit; }
.card--link:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #CFDAF4; }

.card__head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .95rem 1.2rem;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #FBFCFF, #F6F8FD);
}

.card__head h2, .card__head h3, .card__title { margin: 0; font-size: 1rem; font-weight: 600; }
.card__head > a, .card__head > span:last-child { margin-left: auto; }
.card__head svg { width: 17px; height: 17px; color: var(--cobalt); }

.card__body { padding: 1.2rem; }

.card__foot {
    padding: .95rem 1.2rem;
    border-top: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #F9FAFE, #F4F7FD);
    display: flex;
    align-items: center;
    gap: .6rem;
}

/* -------------------------------------------------------------------
   Grids
   ----------------------------------------------------------------- */

.grid { display: grid; gap: 1.15rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2.15fr) minmax(300px, 1fr); align-items: start; }

.stat-grid { display: grid; gap: 1.15rem; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

/* -------------------------------------------------------------------
   Stat tiles
   ----------------------------------------------------------------- */

.stat {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1.15rem 1.2rem 1.2rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: block;
    color: inherit;
    isolation: isolate;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

a.stat:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #CFDAF4; }

/* Coloured cap across the top */
.stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--g-cobalt); }

/* Tinted glow bleeding in from the corner */
.stat::after {
    content: "";
    position: absolute;
    width: 190px; height: 190px;
    right: -70px; top: -80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43, 80, 246, .14), transparent 68%);
    z-index: -1;
}

.stat__label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--faint);
    font-weight: 700;
    margin-bottom: .35rem;
}

.stat__value {
    font-family: var(--display);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.035em;
    background: var(--g-cobalt);
    color: var(--cobalt);
}

/*
   Gradient numerals, but only where the browser can actually clip the
   background to the glyphs. Without the guard an unsupporting browser
   would paint transparent text on a gradient block.
*/
@supports (background-clip: text) or (-webkit-background-clip: text) {
    .stat__value {
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}

.stat__meta { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

.stat--cobalt::before { background: var(--g-cobalt); }
.stat--cobalt::after { background: radial-gradient(circle, rgba(43, 80, 246, .16), transparent 68%); }
.stat--cobalt .stat__value { background: var(--g-cobalt); -webkit-background-clip: text; background-clip: text; }

.stat--green::before { background: var(--g-green); }
.stat--green::after { background: radial-gradient(circle, rgba(18, 161, 80, .16), transparent 68%); }
.stat--green .stat__value { background: var(--g-green); -webkit-background-clip: text; background-clip: text; }

.stat--amber::before { background: var(--g-amber); }
.stat--amber::after { background: radial-gradient(circle, rgba(224, 135, 0, .18), transparent 68%); }
.stat--amber .stat__value { background: var(--g-amber); -webkit-background-clip: text; background-clip: text; }

.stat--red::before { background: var(--g-red); }
.stat--red::after { background: radial-gradient(circle, rgba(224, 59, 65, .17), transparent 68%); }
.stat--red .stat__value { background: var(--g-red); -webkit-background-clip: text; background-clip: text; }

.stat--violet::before { background: var(--g-violet); }
.stat--violet::after { background: radial-gradient(circle, rgba(122, 90, 248, .17), transparent 68%); }
.stat--violet .stat__value { background: var(--g-violet); -webkit-background-clip: text; background-clip: text; }

.stat--teal::before { background: var(--g-teal); }
.stat--teal::after { background: radial-gradient(circle, rgba(0, 166, 160, .17), transparent 68%); }
.stat--teal .stat__value { background: var(--g-teal); -webkit-background-clip: text; background-clip: text; }

.stat--slate::before { background: var(--g-slate); }
.stat--slate::after { background: radial-gradient(circle, rgba(100, 116, 139, .13), transparent 68%); }
.stat--slate .stat__value { background: var(--g-slate); -webkit-background-clip: text; background-clip: text; }

/* -------------------------------------------------------------------
   Badges, chips, avatars
   ----------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .34rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .17rem .55rem;
    border-radius: 20px;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .7);
}

.badge--plain::before { display: none; }

.badge--cobalt { background: var(--cobalt-soft); color: var(--cobalt-deep); border-color: #CBD7FF; }
.badge--green  { background: var(--green-soft);  color: var(--green-deep);  border-color: #B6EBCB; }
.badge--amber  { background: var(--amber-soft);  color: var(--amber-deep);  border-color: #FBDCA4; }
.badge--red    { background: var(--red-soft);    color: var(--red-deep);    border-color: #F8C3C5; }
.badge--violet { background: var(--violet-soft); color: var(--violet-deep); border-color: #D9CEFF; }
.badge--teal   { background: var(--teal-soft);   color: var(--teal-deep);   border-color: #A9E9E5; }
.badge--pink   { background: var(--pink-soft);   color: var(--pink-deep);   border-color: #F8C2DF; }
.badge--slate  { background: var(--slate-soft);  color: var(--slate);       border-color: #DBE2EF; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .24rem .6rem .24rem .3rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: .78rem;
    color: var(--text);
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

a.chip:hover { text-decoration: none; border-color: var(--cobalt); background: var(--cobalt-soft); transform: translateY(-1px); }

.chip svg { width: 13px; height: 13px; color: var(--muted); margin-left: .25rem; }

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--g-cobalt);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--display);
    flex: none;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(43, 80, 246, .32), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.avatar--xs { width: 22px; height: 22px; font-size: .6rem; }
.avatar--sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar--md { width: 42px; height: 42px; font-size: .92rem; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.12rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--card); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.team-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
    background: var(--g-cobalt);
    box-shadow: 0 0 0 3px rgba(43, 80, 246, .14);
}

.team-dot--cobalt { background: var(--g-cobalt); box-shadow: 0 0 0 3px rgba(43, 80, 246, .14); }
.team-dot--teal   { background: var(--g-teal);   box-shadow: 0 0 0 3px rgba(0, 166, 160, .16); }
.team-dot--violet { background: var(--g-violet); box-shadow: 0 0 0 3px rgba(122, 90, 248, .16); }
.team-dot--amber  { background: var(--g-amber);  box-shadow: 0 0 0 3px rgba(224, 135, 0, .16); }
.team-dot--green  { background: var(--g-green);  box-shadow: 0 0 0 3px rgba(18, 161, 80, .16); }
.team-dot--red    { background: var(--g-red);    box-shadow: 0 0 0 3px rgba(224, 59, 65, .16); }

.swatch { cursor: pointer; padding: .3rem; border-radius: var(--r-xs); border: 2px solid transparent; display: inline-flex; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-soft); }

/* -------------------------------------------------------------------
   Progress
   ----------------------------------------------------------------- */

.progress {
    height: 9px;
    background: var(--surface-2);
    border-radius: 20px;
    overflow: hidden;
    flex: 1;
    box-shadow: inset 0 1px 2px rgba(13, 21, 38, .08);
}

.progress__bar {
    height: 100%;
    border-radius: 20px;
    background: var(--g-cobalt);
    position: relative;
    transition: width .5s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 1px 5px rgba(43, 80, 246, .45);
}

/* A slow sheen, so a bar that is mid-progress reads as alive */
.progress__bar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 100%);
    background-size: 200% 100%;
    animation: sheen 2.6s linear infinite;
}

@keyframes sheen {
    0%   { background-position: 140% 0; }
    100% { background-position: -40% 0; }
}

.progress__bar--green  { background: var(--g-green);  box-shadow: 0 1px 5px rgba(18, 161, 80, .45); }
.progress__bar--amber  { background: var(--g-amber);  box-shadow: 0 1px 5px rgba(224, 135, 0, .45); }
.progress__bar--red    { background: var(--g-red);    box-shadow: 0 1px 5px rgba(224, 59, 65, .45); }
.progress__bar--violet { background: var(--g-violet); box-shadow: 0 1px 5px rgba(122, 90, 248, .45); }
.progress__bar--slate  { background: var(--g-slate);  box-shadow: none; }
.progress__bar--slate::after { animation: none; }

.progress-row { display: flex; align-items: center; gap: .65rem; }
.progress-row .progress { flex: 1; min-width: 70px; }

.progress-row__value {
    font-family: var(--mono);
    font-size: .78rem;
    font-weight: 600;
    color: var(--text);
    min-width: 38px;
    text-align: right;
}

/* -------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .52rem 1rem;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: var(--body);
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    white-space: nowrap;
    transition: transform .14s ease, box-shadow .18s ease, background .18s ease,
                border-color .18s ease, filter .18s ease;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 15px; height: 15px; }

.btn--primary {
    background: var(--g-cobalt);
    color: #fff;
    box-shadow: 0 4px 14px rgba(43, 80, 246, .34), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--primary:hover { color: #fff; box-shadow: 0 8px 22px rgba(43, 80, 246, .44); filter: brightness(1.05); }

.btn--dark {
    background: linear-gradient(135deg, #22314F, #101A2E);
    color: #fff;
    box-shadow: 0 4px 14px rgba(13, 21, 38, .28), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn--dark:hover { color: #fff; box-shadow: 0 8px 20px rgba(13, 21, 38, .34); }

.btn--danger {
    background: var(--g-red);
    color: #fff;
    box-shadow: 0 4px 14px rgba(224, 59, 65, .34), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--danger:hover { color: #fff; box-shadow: 0 8px 22px rgba(224, 59, 65, .44); }

.btn--success { background: var(--g-green); color: #fff; box-shadow: 0 4px 14px rgba(18, 161, 80, .34); }
.btn--success:hover { color: #fff; }

.btn--ghost { border-color: var(--line); color: var(--muted); background: var(--card); box-shadow: var(--shadow-xs); }
.btn--ghost:hover { border-color: var(--cobalt); color: var(--cobalt); background: var(--cobalt-soft); }

.btn--sm { padding: .38rem .72rem; font-size: .79rem; border-radius: var(--r-xs); }
.btn--block { width: 100%; }

.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; transform: none; }

.icon-btn {
    width: 38px; height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-xs);
    transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}

.icon-btn:hover { color: var(--cobalt); border-color: var(--cobalt); background: var(--cobalt-soft); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-btn__dot {
    position: absolute;
    top: -5px; right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 20px;
    background: var(--g-red);
    color: #fff;
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid var(--card);
    box-shadow: 0 2px 8px rgba(224, 59, 65, .5);
    animation: pop .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes pop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-btn:hover { color: var(--cobalt); }
.link-btn--danger:hover { color: var(--red); }

/* -------------------------------------------------------------------
   Forms
   ----------------------------------------------------------------- */

.field { margin-bottom: 1.05rem; }

.field label, .label {
    display: block;
    font-size: .81rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .35rem;
}

.field .hint { font-size: .76rem; color: var(--faint); margin-top: .3rem; }

/*
   Deliberately broad: an <input> with no type attribute is still a text
   field, and input[type=text] would never match it.
*/
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=submit]):not([type=button]),
select,
textarea {
    width: 100%;
    padding: .58rem .8rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-family: var(--body);
    font-size: .88rem;
    color: var(--text);
    background: var(--card);
    box-shadow: var(--shadow-xs);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356617A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .6rem center;
    background-size: 15px;
    padding-right: 2.1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cobalt);
    box-shadow: var(--ring);
    background: #fff;
}

input::placeholder, textarea::placeholder { color: #A6B0C4; }

input[type=file] {
    width: 100%;
    font-size: .82rem;
    padding: .6rem;
    border: 1.5px dashed #CBD5E8;
    border-radius: var(--r-sm);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}
input[type=file]:hover { border-color: var(--cobalt); background: var(--cobalt-soft); }

input[type=file]::file-selector-button {
    border: 0;
    border-radius: var(--r-xs);
    padding: .35rem .75rem;
    margin-right: .7rem;
    background: var(--g-cobalt);
    color: #fff;
    font-family: var(--body);
    font-weight: 600;
    font-size: .78rem;
    cursor: pointer;
}

input[type=range] {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--cobalt) 0%, var(--violet) 100%);
    box-shadow: inset 0 1px 2px rgba(13, 21, 38, .12);
    padding: 0;
    border: 0;
}

input[type=range]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--cobalt);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(43, 80, 246, .4);
    transition: transform .15s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type=range]::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--cobalt);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(43, 80, 246, .4);
}

input[type=checkbox], input[type=radio] { accent-color: var(--cobalt); width: 16px; height: 16px; cursor: pointer; }

.input--sm { padding: .38rem .6rem !important; font-size: .8rem !important; }
.select--sm { padding: .3rem 1.9rem .3rem .55rem !important; font-size: .79rem !important; }

.check {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    font-size: .87rem;
    margin-bottom: .5rem;
    cursor: pointer;
    padding: .4rem .55rem;
    border-radius: var(--r-xs);
    transition: background .15s ease;
}
.check:hover { background: var(--surface); }
.check input { margin-top: .18rem; flex: none; }

.check-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: .4rem;
    background: var(--surface);
}
.check-list .check { margin-bottom: 0; }
.check-list .check:hover { background: #fff; }

.form-grid { display: grid; gap: 0 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }

.field--inline { margin-bottom: 0; }
.field--inline label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }

.copy-row { display: flex; gap: .5rem; }
.copy-row input { font-family: var(--mono); font-size: .76rem; }

.form-error { color: var(--red); font-size: .78rem; margin-top: .25rem; }

/* -------------------------------------------------------------------
   Filter bar
   ----------------------------------------------------------------- */

.filters {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: .85rem 1rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow-sm);
}

.filters__row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters__row .field { min-width: 130px; margin-bottom: 0; }

/* -------------------------------------------------------------------
   Tables
   ----------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }

.table thead th {
    text-align: left;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--faint);
    font-weight: 700;
    padding: .75rem 1.2rem;
    background: linear-gradient(180deg, #F7F9FE, #F1F4FC);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table tbody td { padding: .85rem 1.2rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }

.table tbody tr { transition: background .14s ease; }
.table tbody tr:hover { background: linear-gradient(90deg, var(--cobalt-soft), rgba(232, 237, 255, .25)); }
.table tbody tr:last-child td { border-bottom: 0; }

.table .num { text-align: right; }
.table .center { text-align: center; }

.table--tight thead th { padding: .6rem 1rem; }
.table--tight tbody td { padding: .6rem 1rem; }

/* -------------------------------------------------------------------
   The timeline — the signature element
   ----------------------------------------------------------------- */

.timeline { display: flex; flex-direction: column; }

.tl-entry { display: flex; gap: .9rem; position: relative; }

.tl-entry__date {
    width: 78px;
    flex: none;
    text-align: right;
    padding-top: .15rem;
    font-family: var(--mono);
    line-height: 1.35;
}

.tl-entry__date b { display: block; font-size: .81rem; font-weight: 600; color: var(--text); }
.tl-entry__date span { display: block; font-size: .68rem; color: var(--faint); }

.tl-entry__rail { width: 14px; flex: none; display: flex; justify-content: center; position: relative; }

/* The vertical rail, faded at both ends */
.tl-entry__rail::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--line), #D6DEEF, var(--line));
}

.tl-entry:first-child .tl-entry__rail::before { top: 12px; }
.tl-entry:last-child .tl-entry__rail::before { bottom: calc(100% - 12px); }

.tl-entry__node {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--g-cobalt);
    margin-top: 6px;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 4px var(--card), 0 0 0 6px rgba(43, 80, 246, .16), 0 2px 8px rgba(43, 80, 246, .4);
}

.tl-entry__node--green {
    background: var(--g-green);
    box-shadow: 0 0 0 4px var(--card), 0 0 0 6px rgba(18, 161, 80, .16), 0 2px 8px rgba(18, 161, 80, .4);
}

.tl-entry__node--red {
    background: var(--g-red);
    box-shadow: 0 0 0 4px var(--card), 0 0 0 6px rgba(224, 59, 65, .16), 0 2px 8px rgba(224, 59, 65, .4);
}

.tl-entry__body { flex: 1; min-width: 0; padding-bottom: 1.1rem; }

.tl-card {
    background: linear-gradient(180deg, #FFFFFF, #FBFCFF);
    border: 1px solid var(--line);
    border-left: 3px solid var(--cobalt);
    border-radius: var(--r);
    padding: .8rem .95rem;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .18s ease, transform .18s ease;
}

.tl-card:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }

.tl-card__title { margin: 0 0 .25rem; font-size: .93rem; font-weight: 600; }
.tl-card__text { margin: 0; font-size: .855rem; color: var(--muted); line-height: 1.6; }

.tl-card__foot {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-top: .6rem;
    padding-top: .55rem;
    border-top: 1px dashed var(--line);
    font-size: .76rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.timeline--compact .tl-entry__body { padding-bottom: .7rem; }
.timeline--compact .tl-card { padding: .6rem .8rem; }

/* Progress delta pill — the "45 → 65%" marker */
.delta {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-family: var(--mono);
    font-size: .73rem;
    font-weight: 600;
    padding: .16rem .5rem;
    border-radius: 20px;
    white-space: nowrap;
    flex: none;
}

.delta s { opacity: .55; }

.delta--up { background: var(--green-soft); color: var(--green-deep); border: 1px solid #B6EBCB; }
.delta--down { background: var(--amber-soft); color: var(--amber-deep); border: 1px solid #FBDCA4; }

/* -------------------------------------------------------------------
   Lists
   ----------------------------------------------------------------- */

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { padding: .65rem 0; border-bottom: 1px solid var(--line-soft); }
.plain-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.plain-list > li:first-child { padding-top: 0; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.legend li { display: flex; align-items: center; gap: .5rem; font-size: .84rem; }
.legend li b { margin-left: auto; font-family: var(--mono); font-size: .8rem; }

.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: 0 1px 3px rgba(13, 21, 38, .2); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: .7rem; padding: .55rem 0; position: relative; }
.feed li p { margin: 0; font-size: .845rem; line-height: 1.5; }

.feed__dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-top: .42rem;
    flex: none;
    background: var(--cobalt);
    box-shadow: 0 0 0 3px rgba(43, 80, 246, .14);
}

.feed__dot--green  { background: var(--green);  box-shadow: 0 0 0 3px rgba(18, 161, 80, .16); }
.feed__dot--amber  { background: var(--amber);  box-shadow: 0 0 0 3px rgba(224, 135, 0, .16); }
.feed__dot--red    { background: var(--red);    box-shadow: 0 0 0 3px rgba(224, 59, 65, .16); }
.feed__dot--violet { background: var(--violet); box-shadow: 0 0 0 3px rgba(122, 90, 248, .16); }
.feed__dot--slate  { background: var(--slate);  box-shadow: 0 0 0 3px rgba(100, 116, 139, .14); }
.feed__dot--cobalt { background: var(--cobalt); box-shadow: 0 0 0 3px rgba(43, 80, 246, .16); }

.comments { list-style: none; margin: 0; padding: 0; }
.comments li { display: flex; gap: .7rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft); }
.comments li:last-child { border-bottom: 0; padding-bottom: 0; }
.comments li:first-child { padding-top: 0; }

.notif-list { list-style: none; margin: 0; padding: 0; }

.notif-list li {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: .9rem 1.2rem;
    border-bottom: 1px solid var(--line-soft);
    transition: background .15s ease;
}

.notif-list li:hover { background: var(--surface); }
.notif-list li:last-child { border-bottom: 0; }

.notif-list__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: .48rem; flex: none; }

.notif-list li.is-unread { background: linear-gradient(90deg, var(--cobalt-soft), transparent 70%); }
.notif-list li.is-unread .notif-list__dot { background: var(--g-cobalt); box-shadow: 0 0 0 3px rgba(43, 80, 246, .18); }

/* Horizontal bar rows on the dashboard and reports */
.bar-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .65rem; }
.bar-row__label { font-size: .82rem; width: 78px; flex: none; color: var(--muted); }

.bar-row__track {
    flex: 1;
    height: 10px;
    background: var(--surface-2);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(13, 21, 38, .07);
}

.bar-row__fill {
    display: block;
    height: 100%;
    border-radius: 20px;
    background: var(--g-cobalt);
    transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

.bar-row b { font-family: var(--mono); font-size: .8rem; min-width: 30px; text-align: right; }

.meta-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .55rem .9rem; align-items: baseline; }
.meta-list dt { font-size: .78rem; color: var(--faint); font-weight: 500; white-space: nowrap; }
.meta-list dd { margin: 0; font-size: .855rem; color: var(--text); min-width: 0; }

.quote {
    border-left: 3px solid var(--cobalt);
    background: var(--cobalt-soft);
    padding: .6rem .85rem;
    border-radius: 0 var(--r-xs) var(--r-xs) 0;
    margin: 0;
    color: var(--text);
}

.prose { line-height: 1.7; color: var(--muted); }
.prose p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------------
   Tabs and accordion
   ----------------------------------------------------------------- */

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); overflow-x: auto; }

.tab {
    padding: .6rem .95rem;
    font-size: .87rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
    border-radius: var(--r-xs) var(--r-xs) 0 0;
}

.tab:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.tab.is-active { color: var(--cobalt); border-bottom-color: var(--cobalt); background: linear-gradient(180deg, transparent, var(--cobalt-soft)); }

.accordion { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: .55rem; overflow: hidden; background: var(--card); }

.accordion summary {
    padding: .7rem .95rem;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
    background: linear-gradient(180deg, #FBFCFF, #F6F8FD);
    transition: background .15s ease;
}

.accordion summary:hover { background: var(--cobalt-soft); }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::before { content: "\25B8"; color: var(--faint); transition: transform .18s ease; display: inline-block; }
.accordion[open] summary::before { transform: rotate(90deg); }
.accordion[open] summary { border-bottom: 1px solid var(--line-soft); }

.accordion__body { padding: 1rem; }

/* -------------------------------------------------------------------
   Alerts
   ----------------------------------------------------------------- */

.alert {
    display: flex;
    gap: .7rem;
    padding: .85rem 1.05rem;
    border-radius: var(--r);
    margin-bottom: 1.1rem;
    font-size: .875rem;
    border: 1px solid transparent;
    border-left-width: 4px;
    box-shadow: var(--shadow-xs);
    animation: slide-in .32s cubic-bezier(.16, 1, .3, 1);
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert svg { width: 18px; height: 18px; flex: none; margin-top: .1rem; }
.alert > div { flex: 1; min-width: 0; }
.alert a { text-decoration: underline; }

.alert--success { background: linear-gradient(100deg, var(--green-soft), #F2FCF6); color: var(--green-deep); border-color: #B6EBCB; border-left-color: var(--green); }
.alert--error   { background: linear-gradient(100deg, var(--red-soft), #FEF5F5);   color: var(--red-deep);   border-color: #F8C3C5; border-left-color: var(--red); }
.alert--warn    { background: linear-gradient(100deg, var(--amber-soft), #FFFAF0); color: var(--amber-deep); border-color: #FBDCA4; border-left-color: var(--amber); }
.alert--info    { background: linear-gradient(100deg, var(--cobalt-soft), #F5F7FF); color: var(--cobalt-deep); border-color: #CBD7FF; border-left-color: var(--cobalt); }

.alert--success svg { color: var(--green); }
.alert--error svg   { color: var(--red); }
.alert--warn svg    { color: var(--amber); }
.alert--info svg    { color: var(--cobalt); }

/* -------------------------------------------------------------------
   Empty states
   ----------------------------------------------------------------- */

.empty {
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: var(--card);
    border: 1.5px dashed #CFD9EE;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.empty svg { color: var(--cobalt); opacity: .5; margin-bottom: .6rem; }
.empty h3 { margin-bottom: .3rem; }
.empty p { color: var(--muted); font-size: .89rem; max-width: 400px; margin: 0 auto 1.1rem; }

/* -------------------------------------------------------------------
   Dropdown
   ----------------------------------------------------------------- */

.dropdown { position: relative; }

.dropdown__menu {
    position: absolute;
    right: 0;
    top: calc(100% + .55rem);
    width: 340px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.98);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 60;
    overflow: hidden;
}

.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.dropdown__menu--sm { width: 220px; }

.dropdown__head {
    display: flex;
    align-items: center;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #FBFCFF, #F5F8FD);
}

.dropdown__list { max-height: 380px; overflow-y: auto; }

.dropdown__item {
    display: block;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
    font-size: .86rem;
    transition: background .14s ease;
}

.dropdown__item:hover { background: var(--surface); text-decoration: none; }
.dropdown__item:last-child { border-bottom: 0; }
.dropdown__item span { display: block; }
.dropdown__item.is-unread { background: linear-gradient(90deg, var(--cobalt-soft), transparent 80%); }

/* -------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 1.5rem;
    z-index: 100;
    opacity: 0;
    transition: opacity .2s ease;
}

.modal.is-open { opacity: 1; }
.modal[hidden] { display: none; }

.modal__box {
    background: var(--card);
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(10px) scale(.98);
    transition: transform .24s cubic-bezier(.16, 1, .3, 1);
}

.modal.is-open .modal__box { transform: translateY(0) scale(1); }

.modal__head {
    display: flex;
    align-items: center;
    padding: 1.05rem 1.3rem;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #FBFCFF, #F5F8FD);
}

.modal__head h3 { margin: 0; flex: 1; }
.modal__body { padding: 1.3rem; }

.modal__foot {
    padding: 1rem 1.3rem;
    border-top: 1px solid var(--line-soft);
    background: var(--surface);
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.scrim { display: none; position: fixed; inset: 0; background: rgba(11, 18, 32, .5); backdrop-filter: blur(2px); z-index: 35; }

/* -------------------------------------------------------------------
   Auth screens
   ----------------------------------------------------------------- */

.auth { display: flex; min-height: 100vh; }

.auth__aside {
    width: 44%;
    max-width: 560px;
    background: var(--g-ink);
    color: var(--on-ink);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth__aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(620px 420px at 78% 8%, rgba(122, 90, 248, .34), transparent 66%),
        radial-gradient(520px 400px at 8% 88%, rgba(43, 80, 246, .30), transparent 68%),
        radial-gradient(400px 300px at 60% 100%, rgba(0, 166, 160, .18), transparent 70%);
}

.auth__aside h2 { color: #fff; font-size: 1.85rem; line-height: 1.25; letter-spacing: -.03em; max-width: 15ch; }
.auth__aside p { color: var(--on-ink-muted); font-size: .95rem; line-height: 1.65; max-width: 42ch; }

.auth__demo {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--r-lg);
    padding: 1.2rem 1.2rem .4rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 1.6rem 0;
}

.auth__demo .tl-entry__date b { color: #fff; }
.auth__demo .tl-entry__date span { color: var(--on-ink-muted); }
.auth__demo .tl-entry__rail::before { background: rgba(255, 255, 255, .18); }
.auth__demo .tl-entry__node { box-shadow: 0 0 0 4px #16233D, 0 0 0 6px rgba(91, 123, 255, .3); }
.auth__demo .tl-entry__node--green { box-shadow: 0 0 0 4px #16233D, 0 0 0 6px rgba(52, 201, 113, .3); }

.auth__demo .tl-card { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); border-left-color: var(--cobalt-2); }
.auth__demo .tl-card__title { color: #fff; }
.auth__demo .tl-card__text { color: var(--on-ink-muted); }
.auth__demo .tiny, .auth__aside .tiny { color: var(--on-ink-muted); }

.auth__panel { flex: 1; display: grid; place-items: center; padding: 2.5rem 1.5rem; overflow-y: auto; }

.auth__panel-inner { width: 100%; max-width: 420px; }
.auth--wide .auth__panel-inner { max-width: 620px; }
.auth__panel-inner h1 { font-size: 1.7rem; margin-bottom: .25rem; }
.auth__panel-inner > p:first-of-type { color: var(--muted); margin-bottom: 1.6rem; }

/* -------------------------------------------------------------------
   Utilities
   ----------------------------------------------------------------- */

.row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.row--tight { gap: .45rem; }
.between { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }

.divider { height: 1px; background: var(--line); margin: 1.3rem 0; border: 0; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mono { font-family: var(--mono); }
.small { font-size: .86rem; }
.tiny { font-size: .755rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.hidden { display: none !important; }

.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-cobalt { color: var(--cobalt); }

.mb-1 { margin-bottom: .45rem; }
.mb-2 { margin-bottom: .9rem; }
.mb-3 { margin-bottom: 1.35rem; }
.mt-1 { margin-top: .45rem; }
.mt-2 { margin-top: .9rem; }
.mt-3 { margin-top: 1.35rem; }

/* -------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------- */

@media (max-width: 1100px) {
    .grid--sidebar { grid-template-columns: 1fr; }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .26s cubic-bezier(.16, 1, .3, 1);
    }

    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .scrim { display: block; }

    .sidebar-toggle { display: inline-grid; }

    .content { padding: 1.2rem 1.1rem 3.5rem; }
    .topbar { padding: 0 1.1rem; }

    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .form-grid, .form-grid--3 { grid-template-columns: 1fr; }

    .auth { flex-direction: column; }
    .auth__aside { width: 100%; max-width: none; padding: 1.8rem 1.4rem; }
    .auth__aside h2 { font-size: 1.45rem; }
    .auth__demo { display: none; }

    .dropdown__menu { width: min(340px, calc(100vw - 2rem)); }

    h1 { font-size: 1.45rem; }
}

@media (max-width: 620px) {
    .topbar__search { display: none; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { padding: .9rem; }
    .stat__value { font-size: 1.6rem; }

    .tl-entry__date { width: 54px; }
    .tl-entry__date b { font-size: .74rem; }
    .tl-entry__date span:last-child { display: none; }

    .table thead th, .table tbody td { padding: .6rem .8rem; }
    .page-head__actions { width: 100%; }
}

@media print {
    .sidebar, .topbar, .page-head__actions, .filters, .card__foot { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

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