@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* ============================================================
   infineat IT Portal — v4.1 "Glass" theme
   Frosted-glass surfaces over a brand-colour aurora.
   Light + dark themes, mobile dock, installable as an app.
   ============================================================ */

/* ---------- Tokens: light (default) ---------- */
:root {
    color-scheme: light;
    --purple: #763B88;
    --magenta: #C92A5F;
    --sky: #A3C1E2;
    --mint: #84CDB1;
    --gradient: linear-gradient(120deg, #C92A5F 0%, #A0336F 50%, #763B88 100%); /* same direction as the logo: magenta -> purple */

    --bg-base: #eee8f4;
    --aurora-1: rgba(117,58,136,.38);
    --aurora-2: rgba(204,43,94,.26);
    --aurora-3: rgba(163,193,226,.55);
    --aurora-4: rgba(132,205,177,.40);

    --ink: #241a2e;
    --ink-2: #554862;
    --ink-3: #685b74;
    --accent-text: #6a2f7e;
    --link: #6a2f7e;
    --link-hover: #b0234f;

    --glass: rgba(255,255,255,.60);
    --glass-strong: rgba(255,255,255,.84);
    --glass-soft: rgba(255,255,255,.42);
    --glass-edge: rgba(255,255,255,.75);
    --line: rgba(88,40,110,.13);
    --field: rgba(255,255,255,.78);
    --field-edge: rgba(88,40,110,.22);
    --hover: rgba(117,58,136,.07);
    --tint: rgba(117,58,136,.09);
    --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -22px rgba(70,25,90,.35);
    --shadow-float: 0 1px 0 rgba(255,255,255,.7) inset, 0 20px 50px -18px rgba(70,25,90,.45);
    --blur: saturate(170%) blur(20px);

    --ok-bg: rgba(46,160,116,.15);  --ok-fg: #13604a;
    --warn-bg: rgba(226,150,30,.18); --warn-fg: #763806;
    --bad-bg: rgba(204,43,94,.13);  --bad-fg: #8c1840;
    --info-bg: rgba(79,127,176,.15); --info-fg: #20496f;
    --mute-bg: rgba(60,50,70,.09);  --mute-fg: #3d3646;

    --r-lg: 20px;   /* panels */
    --r-md: 12px;   /* controls, list rows */
    --r-sm: 8px;    /* chips inside controls */
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
    --focus: 0 0 0 3px rgba(117,58,136,.35);
    --dock-h: 0px;
}

/* ---------- Tokens: dark ---------- */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg-base: #120a1a;
    --aurora-1: rgba(117,58,136,.55);
    --aurora-2: rgba(204,43,94,.30);
    --aurora-3: rgba(70,110,170,.35);
    --aurora-4: rgba(60,150,120,.22);

    --ink: #f4edf9;
    --ink-2: #cdbfd8;
    --ink-3: #ad9dba;
    --accent-text: #e0b3f2;
    --link: #e0b3f2;
    --link-hover: #ff9cbc;

    --glass: rgba(36,22,48,.58);
    --glass-strong: rgba(42,27,56,.90);
    --glass-soft: rgba(255,255,255,.05);
    --glass-edge: rgba(255,255,255,.09);
    --line: rgba(255,255,255,.09);
    --field: rgba(255,255,255,.06);
    --field-edge: rgba(255,255,255,.16);
    --hover: rgba(255,255,255,.05);
    --tint: rgba(224,179,242,.10);
    --shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 24px 50px -24px rgba(0,0,0,.7);
    --shadow-float: 0 1px 0 rgba(255,255,255,.08) inset, 0 24px 60px -20px rgba(0,0,0,.8);

    --ok-bg: rgba(80,200,150,.16);  --ok-fg: #8fe3c0;
    --warn-bg: rgba(240,170,60,.16); --warn-fg: #f6c77d;
    --bad-bg: rgba(255,90,140,.16); --bad-fg: #ff9cbc;
    --info-bg: rgba(120,170,230,.16); --info-fg: #a9cdf5;
    --mute-bg: rgba(255,255,255,.08); --mute-fg: #d6cbe0;
    --focus: 0 0 0 3px rgba(224,179,242,.45);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg-base); }
body {
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: transparent;
    -webkit-font-smoothing: antialiased;
}
/* The aurora: brand colours blurred behind every glass surface */
body::before {
    content: '';
    position: fixed; inset: -10vmax; z-index: -1; pointer-events: none;
    background:
        radial-gradient(38vmax 32vmax at 12% 8%, var(--aurora-1), transparent 70%),
        radial-gradient(34vmax 30vmax at 92% 14%, var(--aurora-2), transparent 70%),
        radial-gradient(40vmax 34vmax at 80% 92%, var(--aurora-3), transparent 70%),
        radial-gradient(30vmax 28vmax at 6% 86%, var(--aurora-4), transparent 70%),
        var(--bg-base);
    filter: blur(20px);
}
main { flex: 1; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(204,43,94,.25); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--glass-strong); color: var(--ink); padding: 8px 12px; z-index: 200; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* Shared glass recipe */
.card, .kpi, .dock, .nav-menu-list, .table-wrap, .tabs a, .site-footer, .option, .list-glass {
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
}

/* ---------- Top bar ---------- */
.navbar {
    position: sticky; top: 12px; z-index: 50;
    margin: 12px auto 0;
    width: min(1160px, calc(100% - 24px));
    padding: 8px 10px 8px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-edge);
    border-radius: 18px;
    box-shadow: var(--shadow-float);
    isolation: isolate;
}
/* Glass lives on a pseudo-element: a backdrop-filter on .navbar itself would trap the
   mobile menu sheet (position: fixed) inside the bar */
.navbar::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.navbar .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; flex: none; }
.navbar .logo { height: 28px; width: auto; display: block; }
.logo-white { display: none !important; }
html[data-theme="dark"] .logo-color { display: none !important; }
html[data-theme="dark"] .logo-white { display: block !important; }
.brand-sub { font-weight: 600; font-size: 13px; color: var(--ink-3); padding-left: 12px; border-left: 1.5px solid var(--line); line-height: 1.2; }
.navbar nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.navbar nav > a, .nav-menu > summary, .icon-btn {
    color: var(--ink-2);
    text-decoration: none;
    font-size: 14px; font-weight: 600;
    padding: 8px 12px;
    border-radius: 11px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    list-style: none;
    border: 0; background: transparent; font-family: inherit;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::after { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.navbar nav > a:hover, .nav-menu > summary:hover, .icon-btn:hover { background: var(--hover); color: var(--ink); }
.navbar nav > a.active, .nav-menu.active > summary {
    background: var(--gradient); color: #fff;
    box-shadow: 0 6px 16px -8px rgba(204,43,94,.8);
}
.nav-count { background: var(--magenta); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 800; padding: 1px 7px; line-height: 1.5; }
.navbar nav > a.active .nav-count { background: #fff; color: var(--magenta); }
.nav-menu { position: relative; }
.nav-menu-list {
    position: absolute; top: calc(100% + 10px); left: 0; min-width: 230px;
    background: var(--glass-strong);
    border: 1px solid var(--glass-edge);
    border-radius: 16px; box-shadow: var(--shadow-float);
    padding: 6px; display: flex; flex-direction: column; z-index: 60;
}
.nav-menu-list.right { left: auto; right: 0; }
.nav-menu-list a, .nav-menu-list button { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; text-align: left; background: none; border: 0; font-family: inherit; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.nav-menu-list a:hover, .nav-menu-list a.active, .nav-menu-list button:hover { background: var(--tint); color: var(--accent-text); }
.nav-menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gradient); color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.top-actions { display: none; align-items: center; gap: 4px; }
.icon-btn { padding: 8px; width: 40px; height: 40px; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Mobile dock (bottom navigation) ---------- */
.dock { display: none; }
@media (max-width: 860px) {
    :root { --dock-h: 76px; }
    .navbar { top: 8px; margin-top: 8px; padding: 6px 6px 6px 12px; }
    .navbar .logo { height: 24px; }
    .brand-sub { display: none; }
    .top-actions { display: flex; }
    /* Full nav becomes a sheet that slides up above the dock */
    .navbar nav {
        position: fixed; left: 10px; right: 10px; bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom));
        display: none; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px;
        background: var(--glass-strong); border: 1px solid var(--glass-edge);
        border-radius: 20px; padding: 10px; box-shadow: var(--shadow-float);
        -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
        max-height: 70vh; overflow-y: auto;
    }
    .navbar nav.open { display: flex; animation: sheet-in .18s ease-out; }
    .navbar nav > a, .nav-menu > summary { padding: 12px 14px; font-size: 15px; }
    .nav-menu-list { position: static; box-shadow: none; border: 0; background: transparent; padding: 0 0 0 12px; min-width: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .nav-menu[open] > summary::after { transform: rotate(-135deg); }
    .nav-user { display: none; }

    .dock {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
        position: fixed; z-index: 70;
        left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
        height: var(--dock-h);
        padding: 6px;
        background: var(--glass-strong);
        border: 1px solid var(--glass-edge);
        border-radius: 24px;
        box-shadow: var(--shadow-float);
    }
    .dock a, .dock button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: 100%; border-radius: 16px;
        color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 600;
        background: none; border: 0; font-family: inherit; cursor: pointer; position: relative;
    }
    .dock svg { width: 22px; height: 22px; }
    .dock a.active, .dock button[aria-expanded="true"] { color: var(--accent-text); background: var(--tint); }
    .dock .dock-dot { position: absolute; top: 8px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 0 2px var(--glass-strong); }
    .dock .dock-new { justify-self: center; }
    .dock .dock-new span.orb {
        width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center;
        background: var(--gradient); color: #fff;
        box-shadow: 0 10px 22px -8px rgba(204,43,94,.9), inset 0 1px 0 rgba(255,255,255,.35);
        transform: translateY(-10px);
    }
    .dock .dock-new span.orb svg { width: 26px; height: 26px; }
    .dock .dock-new .lbl { margin-top: -8px; }
    body { padding-bottom: calc(var(--dock-h) + 24px + env(safe-area-inset-bottom)); }
    .page-head .btn.hide-sm { display: none; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
.wrap { max-width: 1160px; width: 100%; margin: var(--space-6) auto var(--space-5); padding: 0 var(--space-4); }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.medium { max-width: 760px; margin-left: auto; margin-right: auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }

.card {
    background: var(--glass);
    border: 1px solid var(--glass-edge);
    border-radius: var(--r-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-5);
}
/* "accent" = the one card on a page that wants attention: a glowing brand rim */
.card.accent { position: relative; }
.card.accent::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
    background: linear-gradient(135deg, rgba(117,58,136,.9), rgba(204,43,94,.8) 45%, rgba(163,193,226,.6));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

h1 { font-size: clamp(24px, 3.2vw, 32px); margin-top: 0; font-weight: 800; color: var(--ink); line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 var(--space-3); letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin: var(--space-4) 0 var(--space-2); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: var(--space-3); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: var(--space-5); }
@media (max-width: 760px) {
    .grid, .grid.three { grid-template-columns: 1fr; gap: var(--space-4); }
    .wrap { margin-top: var(--space-5); padding: 0 12px; }
    .card { padding: 18px; border-radius: 18px; margin-bottom: var(--space-4); }
}

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-5); }
.kpi {
    background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 18px;
    padding: 18px; text-decoration: none; color: var(--ink); display: block; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.kpi::after { /* status light */
    content: ''; position: absolute; top: 18px; right: 18px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--ink-3); opacity: .35;
}
.kpi.good::after { background: #2ea074; opacity: 1; box-shadow: 0 0 0 4px rgba(46,160,116,.18), 0 0 14px rgba(46,160,116,.7); }
.kpi.warn::after { background: #e2961e; opacity: 1; box-shadow: 0 0 0 4px rgba(226,150,30,.2), 0 0 14px rgba(226,150,30,.7); }
.kpi.bad::after  { background: var(--magenta); opacity: 1; box-shadow: 0 0 0 4px rgba(204,43,94,.18), 0 0 14px rgba(204,43,94,.8); }
a.kpi:hover { border-color: rgba(117,58,136,.35); color: var(--ink); transform: translateY(-1px); }
a.kpi { transition: transform .15s ease, border-color .15s ease; }
.kpi .label { font-size: 13px; color: var(--ink-2); font-weight: 600; padding-right: 20px; }
.kpi .value { font-size: 34px; font-weight: 800; line-height: 1.1; margin-top: 8px; color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.kpi.bad .value { color: var(--bad-fg); }
.kpi.warn .value { color: var(--warn-fg); }
.kpi.good .value { color: var(--ok-fg); }
@media (max-width: 860px) {
    .kpis, .kpis[style] { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .kpi { padding: 14px; border-radius: 16px; }
    .kpi .value { font-size: 28px; }
    .kpi::after { top: 14px; right: 14px; }
}

/* ---------- Buttons ---------- */
a.btn, button.btn, summary.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--gradient);
    color: #fff;
    padding: 10px 18px;
    min-height: 44px;
    border: none;
    border-radius: var(--r-md);
    text-decoration: none;
    font: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px -10px rgba(204,43,94,.85), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
a.btn:hover, button.btn:hover { filter: brightness(1.07); color: #fff; }
a.btn:active, button.btn:active { transform: translateY(1px) scale(.99); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary {
    background: var(--glass-strong) !important; color: var(--accent-text) !important;
    box-shadow: inset 0 0 0 1.5px rgba(117,58,136,.45) !important;
}
html[data-theme="dark"] .btn.secondary { box-shadow: inset 0 0 0 1.5px rgba(224,179,242,.45) !important; }
.btn.secondary:hover { background: var(--tint) !important; }
.btn.danger { background: linear-gradient(135deg, #b4234f, #8c1840) !important; }
.btn.ghost { background: var(--glass-soft) !important; color: var(--ink-2) !important; box-shadow: inset 0 0 0 1px var(--line) !important; }
.btn.ghost:hover { color: var(--ink) !important; background: var(--hover) !important; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-top: var(--space-4); margin-bottom: 6px; font-size: 14px; color: var(--ink); }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=file], select, textarea {
    width: 100%;
    padding: 11px 14px;
    min-height: 46px;
    border: 1px solid var(--field-edge);
    border-radius: var(--r-md);
    font-size: 16px; /* 16px stops iOS zooming into fields */
    font-family: inherit;
    background: var(--field);
    color: var(--ink);
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .85; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: var(--focus); background: var(--glass-strong); }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color: #b98ad0; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--bg-base); color: var(--ink); }
input[type=file] { padding: 8px; }
input[type=file]::file-selector-button { border: 0; border-radius: 9px; padding: 7px 12px; margin-right: 10px; background: var(--tint); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
textarea { min-height: 140px; resize: vertical; }
.form-actions { margin-top: var(--space-5); display: flex; gap: var(--space-3); flex-wrap: wrap; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--purple); flex: none; }
input[type=radio] { accent-color: var(--purple); width: 18px; height: 18px; flex: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-top: var(--space-3); border: 1px solid var(--line); border-radius: 14px; background: var(--glass-soft); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--ink-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; background: var(--tint); letter-spacing: .01em; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--ink-3); padding: var(--space-6) var(--space-4); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Phones: each table row becomes its own glass card, with the column name beside each value */
@media (max-width: 640px) {
    .table-wrap { overflow: visible; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
    .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
    .table-wrap tr {
        background: var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: 16px;
        padding: 6px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
    }
    .table-wrap tbody tr:hover { background: var(--glass-strong); }
    .table-wrap td { border: 0; border-bottom: 1px solid var(--line); padding: 10px 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
    .table-wrap tr td:last-child { border-bottom: 0; }
    .table-wrap td::before { content: attr(data-label); color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-align: left; flex: none; max-width: 42%; }
    .table-wrap td[data-label=""]::before, .table-wrap td.empty::before { display: none; }
    .table-wrap td:first-child { display: block; text-align: left; font-size: 15px; padding-top: 12px; }
    .table-wrap td:first-child::before { display: none; }
    .table-wrap td.num { text-align: right; }
    .table-wrap td { flex-wrap: wrap; }
    .table-wrap td > div.small { flex-basis: 100%; text-align: right; margin-top: -8px; }
    .table-wrap td:first-child > div.small { text-align: left; margin-top: 2px; }
    .table-wrap td form.row { justify-content: flex-end; }
    .table-wrap td > div[style*="max-width"] { max-width: none !important; }
}

/* ---------- Badges ---------- */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; background: var(--mute-bg); color: var(--mute-fg); line-height: 1.6; }
.badge.Open, .badge.High, .badge.breach, .badge.bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge.Critical { background: var(--gradient); color: #fff; box-shadow: 0 0 12px rgba(204,43,94,.45); }
.badge.In-Progress, .badge.Medium, .badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.Waiting-on-User, .badge.Low { background: var(--info-bg); color: var(--info-fg); }
.badge.Resolved, .badge.ok, .badge.done, .badge.good { background: var(--ok-bg); color: var(--ok-fg); }
.badge.Closed { background: var(--mute-bg); color: var(--mute-fg); }
/* status dot on SLA badges */
.badge.breach::before, .badge.warn::before, .badge.ok::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Alerts ---------- */
.error, .success, .info, .warning {
    padding: 12px 16px; border-radius: 14px; margin-bottom: var(--space-4); font-size: 14px;
    border: 1px solid transparent; position: relative; padding-left: 20px;
}
.error::before, .success::before, .info::before, .warning::before { content: ''; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: currentColor; opacity: .6; }
.error { color: var(--bad-fg); background: var(--bad-bg); border-color: rgba(204,43,94,.25); }
.success { color: var(--ok-fg); background: var(--ok-bg); border-color: rgba(46,160,116,.25); }
.info { color: var(--info-fg); background: var(--info-bg); border-color: rgba(79,127,176,.25); }
.warning { color: var(--warn-fg); background: var(--warn-bg); border-color: rgba(226,150,30,.28); }
/* .info/.warn/.bad are also badge colours — keep badges compact */
.badge.info { background: var(--info-bg); color: var(--info-fg); padding: 3px 10px; margin: 0; border: 0; font-size: 12px; border-radius: 999px; }
.badge.info::before { display: none; }

/* ---------- Tabs / filters ---------- */
.tabs { display: flex; gap: 6px; margin: var(--space-4) 0 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--glass-soft); border: 1px solid var(--line); white-space: nowrap; }
.tabs a:hover { color: var(--ink); background: var(--hover); }
.tabs a.active { background: var(--gradient); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px rgba(204,43,94,.8); }
.tabs a .count { opacity: .75; font-weight: 500; margin-left: 6px; }

/* ---------- Ticket conversation ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .meta { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.timeline .meta strong { color: var(--ink); }
.timeline li.it { border-left: 3px solid var(--purple); padding-left: var(--space-3); }
html[data-theme="dark"] .timeline li.it { border-left-color: #c28ad8; }
.timeline li.internal { background: var(--warn-bg); border-left: 3px solid #d08a1e; padding: 12px; border-radius: 0 12px 12px 0; }
.timeline li.system { color: var(--ink-3); font-size: 13px; padding: var(--space-2) 0; }
.prewrap { white-space: pre-wrap; word-wrap: break-word; }
.ticket-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-5); align-items: start; }
.ticket-layout .card { margin-bottom: var(--space-4); }
.ticket-layout aside { position: sticky; top: 96px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; }
@media (max-width: 860px) {
    .ticket-layout { grid-template-columns: 1fr; gap: 0; }
    .ticket-layout aside { position: static; order: -1; }
}

/* ---------- Bars & progress ---------- */
.bar-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.bar, .progress { background: var(--tint); border-radius: 99px; overflow: hidden; height: 10px; }
.bar > span, .progress > span { display: block; height: 100%; background: var(--gradient); border-radius: 99px; box-shadow: 0 0 10px rgba(204,43,94,.5); }
.progress { height: 8px; }
@media (max-width: 480px) { .bar-row { grid-template-columns: 100px 1fr 28px; } }

/* ---------- Exam ---------- */
.question { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; }
.question legend { font-weight: 700; padding: 0; margin-bottom: var(--space-3); }
.question fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.option { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); font-weight: 500; cursor: pointer; background: var(--glass-soft); transition: border-color .12s ease, background .12s ease; }
.option:hover { border-color: rgba(117,58,136,.4); }
.option input { margin-top: 2px; }
.option:has(input:checked) { border-color: var(--purple); background: var(--tint); box-shadow: inset 0 0 0 1px var(--purple); }
html[data-theme="dark"] .option:has(input:checked) { border-color: #c28ad8; box-shadow: inset 0 0 0 1px #c28ad8; }
.answer-right { color: var(--ok-fg); }
.answer-wrong { color: var(--bad-fg); }

/* ---------- Lists ---------- */
.list-item { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item a.name { color: var(--link); text-decoration: none; font-weight: 700; }
.list-item a.name:hover { text-decoration: underline; }
@media (max-width: 520px) { .list-item { flex-wrap: wrap; } }
.dash-links { display: grid; gap: 8px; }
.dash-links a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--glass-soft); border: 1px solid var(--line); color: var(--ink); font-weight: 600; text-decoration: none; }
.dash-links a:hover { background: var(--tint); color: var(--accent-text); }
.dash-links a.btn { display: inline-flex; color: #fff; }

/* ---------- Auth pages ---------- */
.auth-shell { max-width: 440px; margin: 0 auto var(--space-5); }
body.guest main { padding-top: 7vh; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: var(--space-5); }
.auth-logo img { height: 52px; width: auto; }
.auth-logo span { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
body.guest .navbar { display: none; }
.auth-shell .card { padding: var(--space-6); }
.auth-shell .lead { color: var(--ink-2); margin-top: -6px; }
.notice { font-size: 12px; color: var(--ink-3); margin-top: var(--space-5); border-top: 1px solid var(--line); padding-top: var(--space-3); }
@media (max-width: 520px) { body.guest main { padding-top: 4vh; } .auth-logo img { height: 42px; } .auth-shell .card { padding: 22px; } }

/* ---------- Article ---------- */
.article { line-height: 1.75; max-width: 72ch; }
.doc-meta { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-bottom: var(--space-4); }
.doc-meta strong { color: var(--ink-2); margin-right: 4px; }

/* ---------- Footer ---------- */
.site-footer { font-size: 13px; color: var(--ink-3); background: var(--glass-soft); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin: 0 auto; padding: var(--space-4); max-width: 1160px; }

/* ---------- Accessibility & fallbacks ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* Browsers without backdrop-filter, or users who ask for less transparency: solid surfaces */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --glass: rgba(255,255,255,.94); --glass-soft: rgba(255,255,255,.7); }
    html[data-theme="dark"] { --glass: rgba(34,22,46,.96); --glass-soft: rgba(255,255,255,.05); }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glass: #fbf9fd; --glass-strong: #ffffff; --glass-soft: #f6f2f9; }
    html[data-theme="dark"] { --glass: #221630; --glass-strong: #2a1b38; --glass-soft: #1c1228; }
}
@media (forced-colors: active) {
    .card, .kpi, .navbar, .dock, .table-wrap tr { border: 1px solid CanvasText; }
}

@media print {
    body::before, .navbar, .dock, .site-footer, .btn, form { display: none !important; }
    html, body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 0; background: #fff; }
}

/* Keep the desktop bar on one line: show just the avatar until there is room for the name */
.nav-user .uname { display: none; }
@media (min-width: 861px) and (max-width: 1200px) { .navbar nav > a, .nav-menu > summary { padding: 8px 9px; font-size: 13.5px; } .brand-sub { display: none; } }

/* Compatibility with variable names used by older portal pages */
:root, html[data-theme="dark"] {
    --text-main: var(--ink);
    --text-dim: var(--ink-3);
    --glass-border: var(--line);
    --infinite-blue: var(--accent-text);
    --infinite-purple: var(--purple);
    --infinite-magenta: var(--magenta);
}
.table-scroll { overflow-x: auto; }
