/* SecuredSignals — single hand-written stylesheet. No framework, no build step.
   Mobile-first: base rules target a ~375px phone; breakpoints add desktop comfort.
   Tokens first, then the shell (sidebar + topbar), then components, then the
   activity-monitoring visuals, which keep their original class names. */

/* ---------- Fonts (self-hosted, no external requests) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-700.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
    --navy-900: #0b1f33;
    --navy-800: #10314f;
    --navy-700: #163f66;
    --brand: #1f5f99;
    --brand-dark: #174a78;
    --brand-tint: #e8f1fa;
    --accent: #2aa79b;
    --accent-tint: #e3f5f2;

    --ink: #14202b;
    --ink-2: #4a5a6a;
    --ink-3: #7b8794;
    --line: #e3e9ef;
    --line-2: #eef2f6;
    --bg: #f5f7fa;
    --card: #ffffff;

    --ok: #1e8a5a;      --ok-tint: #e6f5ee;
    --warn: #b8741a;    --warn-tint: #fdf3e4;
    --bad: #c0392b;     --bad-tint: #fdecea;
    --info: #2c6fb0;    --info-tint: #e8f0fa;

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --sh-1: 0 1px 2px rgba(11, 31, 51, .06), 0 1px 0 rgba(11, 31, 51, .03);
    --sh-2: 0 6px 20px rgba(11, 31, 51, .10), 0 1px 3px rgba(11, 31, 51, .06);

    --sidebar-w: 248px;
    --topbar-h: 60px;
    --content-w: 1180px;

    /* Legacy aliases used by older partials. */
    --ink-soft: var(--ink-2);
    --radius: var(--r);
    --shadow: var(--sh-1);
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    /* Never let the page itself scroll sideways on a phone. */
    overflow-x: hidden;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 1.4rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--line-2); padding: .1em .35em; border-radius: 5px; }

.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.td-num, .num { font-variant-numeric: tabular-nums; text-align: right; }

.icon { display: inline-block; vertical-align: -.2em; flex: 0 0 auto; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--navy-900); color: #fff; padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--r-sm) 0; }
.skip-link:focus { left: 0; }

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

.shell { min-height: 100dvh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    color: rgba(255, 255, 255, .86);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 50;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.nav-open .sidebar { transform: none; box-shadow: var(--sh-2); }
body.nav-open { overflow: hidden; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 51, .45);
    z-index: 40;
    backdrop-filter: blur(1px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 1.1rem 1rem .9rem 1.1rem;
}

.brand { display: inline-flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 120%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(42, 167, 155, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { font-size: .74rem; color: rgba(255, 255, 255, .62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--r-sm);
    border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); }
.sidebar-close { color: rgba(255, 255, 255, .8); }

.nav { padding: .25rem .75rem 1rem; flex: 1; }
.nav-group { margin-top: .9rem; }
.nav-group:first-child { margin-top: .25rem; }
.nav-group-label {
    padding: 0 .75rem .4rem;
    font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
}

.nav-item {
    position: relative;
    display: flex; align-items: center; gap: .7rem;
    width: 100%;
    min-height: 44px;
    padding: .55rem .75rem;
    border-radius: var(--r-sm);
    color: rgba(255, 255, 255, .84);
    text-decoration: none;
    font: inherit; font-weight: 500; font-size: .95rem;
    border: 0; background: transparent; cursor: pointer; text-align: left;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item .icon { opacity: .8; }
.nav-item.is-active { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-item.is-active .icon { opacity: 1; color: var(--accent); }
.nav-item.is-active::before {
    content: ""; position: absolute; left: -.75rem; top: 20%; bottom: 20%; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--accent);
}

.sidebar-foot { padding: .75rem .75rem 1rem; border-top: 1px solid rgba(255, 255, 255, .09); }
.sidebar-foot form { margin: .25rem 0 0; }
.nav-logout { color: rgba(255, 255, 255, .7); }

.user-chip { display: flex; align-items: center; gap: .7rem; padding: .4rem .5rem; min-width: 0; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip-text strong { font-size: .92rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { font-size: .74rem; color: rgba(255, 255, 255, .6); }

.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em;
}
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: .6rem;
    min-height: var(--topbar-h);
    padding: .5rem .85rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.nav-toggle { color: var(--ink); flex: 0 0 auto; margin-left: -.4rem; }
.topbar-title { flex: 1 1 auto; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { margin: 0; font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.topbar-actions .btn { min-height: 40px; padding: .45rem .9rem; }
.topbar-actions .btn .icon { display: none; }

.content { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 1rem .85rem 3rem; }

/* Legacy wrapper (kept for any page still using it). */
.wrap { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 1rem; }

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh-1);
    padding: 1.1rem;
    margin-bottom: 1rem;
}
.card-narrow { max-width: 640px; }
.card-lead { margin-top: -.25rem; }

.card-title {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
    margin-bottom: .85rem;
}
.card-title h2 { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
.card-title h2 .icon { color: var(--brand); }

/* Older pages: a heading row with actions. The page title itself now lives in the topbar. */
.card-head {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.card-head h1, .card-head h2 { margin: 0; }
.card-head > h1:only-child { display: none; }

.card-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }

/* ---------- KPI tiles ---------- */

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .75rem;
    align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1);
    padding: .9rem 1rem; text-decoration: none; color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}
a.kpi:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.kpi-icon {
    grid-row: 1 / 3;
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-tint); color: var(--brand);
}
.kpi-icon-accent { background: var(--accent-tint); color: var(--accent); }
.kpi-icon-ok { background: var(--ok-tint); color: var(--ok); }
.kpi-icon-warn { background: var(--warn-tint); color: var(--warn); }
.kpi-icon-bad { background: var(--bad-tint); color: var(--bad); }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .78rem; color: var(--ink-2); }

/* Legacy stat tiles (activity pages). */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); padding: .9rem 1rem; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; color: var(--navy-800); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .76rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }

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

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }

.feature-list { list-style: none; margin: 0; padding: 0; }
.feature-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.feature-list li:last-child { border-bottom: 0; }
.feature-list li > .icon { color: var(--brand); }
.feature-list li > span:nth-child(2) { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.feature-list small { font-size: .8rem; }

.quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.quick-link {
    display: flex; align-items: center; gap: .6rem; min-height: 48px;
    padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm);
    color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem;
    transition: background .15s ease, border-color .15s ease;
}
.quick-link .icon { color: var(--brand); }
.quick-link:hover { background: var(--brand-tint); border-color: #cfe0ef; color: var(--ink); }

.person { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.person-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.person-text small { font-size: .8rem; }

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

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }

input[type=text], input[type=email], input[type=search], input[type=number], input[type=password], input[type=date], select, textarea {
    width: 100%;
    /* 16px minimum stops iOS zooming in when the field is focused. */
    font-size: 16px;
    font-family: inherit;
    padding: .7rem .85rem;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31, 95, 153, .18);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }

.field { margin-bottom: 1rem; }
.hint { font-size: .83rem; color: var(--ink-2); margin: .4rem 0 0; }
.hint-set { display: flex; align-items: center; gap: .35rem; margin: 0 0 .4rem; }
.readonly-value { padding: .7rem .85rem; min-height: 46px; border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--bg); display: flex; align-items: center; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1.25rem; }
.form-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .25rem; }
.form-actions-sticky {
    position: sticky; bottom: 0; z-index: 20;
    padding: .75rem 1rem; margin: 0 -.85rem;
    background: rgba(245, 247, 250, .92); backdrop-filter: blur(6px);
    border-top: 1px solid var(--line);
}

.check-inline { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; font-size: .9rem; margin-top: .5rem; }
.check-inline input { width: 18px; height: 18px; }

/* Switch */
.field-switch { padding: .25rem 0; }
.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 600; margin: 0; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    position: relative; width: 44px; height: 26px; flex: 0 0 auto;
    background: #cbd5df; border-radius: 999px; transition: background .2s ease;
}
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(42, 167, 155, .3); }

.code-input {
    font-size: 1.9rem;
    letter-spacing: .5em;
    text-align: center;
    font-weight: 700;
    padding-left: .5em;
    min-height: 64px;
    font-variant-numeric: tabular-nums;
}

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 46px;
    padding: .65rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: var(--brand);
    color: #fff;
    font: inherit; font-weight: 600; font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn:hover { background: var(--brand-dark); color: #fff; box-shadow: 0 4px 12px rgba(31, 95, 153, .25); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1rem; }

.btn-secondary { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-secondary:hover { background: var(--brand-tint); color: var(--brand-dark); box-shadow: none; }

.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); box-shadow: none; }

.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #9f2d22; box-shadow: none; }

.btn-sm { min-height: 38px; padding: .35rem .8rem; font-size: .86rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.td-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* ---------- Toolbar / filters ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 38px;
    padding: .3rem .8rem; border-radius: 999px;
    border: 1px solid var(--line); background: #fff; color: var(--ink-2);
    text-decoration: none; font-size: .88rem; font-weight: 500;
}
.chip:hover { background: var(--line-2); color: var(--ink); }
.chip.is-active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.chip-count { font-size: .75rem; padding: 0 .4rem; border-radius: 999px; background: rgba(0, 0, 0, .06); }
.chip.is-active .chip-count { background: rgba(255, 255, 255, .2); }

.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 2.4rem; min-height: 42px; }

/* ---------- Messages ---------- */

.alert {
    display: flex; align-items: flex-start; gap: .6rem;
    border-radius: var(--r-sm);
    padding: .8rem .95rem;
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: .95rem;
}
.alert > .icon { margin-top: .15rem; }
.alert > div { flex: 1; }
.alert-ok { background: var(--ok-tint); border-color: #bfe3d0; color: #145c37; }
.alert-error { background: var(--bad-tint); border-color: #f3c9c6; color: #8f1e17; }
.alert-warn { background: var(--warn-tint); border-color: #f0d9b8; color: #7a4d10; }
.alert-info { background: var(--info-tint); border-color: #c9dcea; color: var(--navy-800); }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.alert-close { border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; padding: .2rem; border-radius: 6px; display: inline-flex; }
.alert-close:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

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

/* Wide tables scroll inside their own box, never the whole page. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

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

th, td {
    text-align: left;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

th {
    background: #f8fafc;
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-2);
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfe; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); }
.empty-state { padding: 1.75rem 1rem; text-align: center; color: var(--ink-2); }
.empty-state .icon { color: var(--ink-3); margin-bottom: .4rem; }
.empty-state p { margin: 0 0 .25rem; }
.empty-state p:first-of-type { color: var(--ink); font-weight: 600; }

/* ---------- Pills ---------- */

.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    line-height: 1.4;
}
.pill-ok { background: var(--ok-tint); color: var(--ok); }
.pill-off, .pill-neutral { background: #edf1f5; color: var(--ink-2); }
.pill-admin { background: var(--brand-tint); color: var(--brand-dark); }
.pill-it { background: var(--accent-tint); color: #1a7a71; }
.pill-info { background: var(--info-tint); color: var(--info); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-bad { background: var(--bad-tint); color: var(--bad); }

.pager { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }

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

.progress { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 5px; background: var(--brand); }
.progress-warn > span { background: var(--warn); }
.progress-crit > span { background: var(--bad); }

/* ---------- Login ---------- */

.auth-body { background: var(--bg); }

.auth-split { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }

.auth-brand {
    position: relative; display: none;
    background: radial-gradient(1200px 600px at 20% 10%, var(--navy-700) 0%, var(--navy-900) 55%);
    color: #fff; overflow: hidden;
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 480px; padding: 3rem 3rem; display: flex; flex-direction: column; gap: 2rem; height: 100%; justify-content: center; }
.auth-glow { position: absolute; right: -20%; bottom: -25%; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(42, 167, 155, .35) 0%, rgba(42, 167, 155, 0) 65%); }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
.brand-lg .brand-text strong { font-size: 1.3rem; }
.brand-lg .brand-text small { font-size: .82rem; }
.auth-headline { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0; color: #fff; }
.auth-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.auth-features li { display: flex; gap: .9rem; align-items: flex-start; color: rgba(255, 255, 255, .8); font-size: .95rem; line-height: 1.45; }
.auth-features .icon { color: var(--accent); margin-top: .2rem; }
.auth-features strong { color: #fff; }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 1.5rem 1.25rem; }
.auth-form-inner { width: 100%; max-width: 420px; }
.auth-compact-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; color: var(--navy-900); font-size: 1.1rem; }
.auth-title { font-size: 1.6rem; margin-bottom: .35rem; }
.auth-lead { margin-bottom: 1.35rem; }
.auth-fields { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 1.25rem; }
.auth-note { text-align: center; margin-top: 1rem; }
.auth-foot { text-align: center; margin-top: 2rem; }

.steps { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; gap: .5rem; align-items: center; }
.steps li { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--ink-3); font-weight: 500; }
.steps li span { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; background: var(--line); color: var(--ink-2); }
.steps li.is-active { color: var(--ink); }
.steps li.is-active span { background: var(--brand); color: #fff; }
.steps li.is-done span { background: var(--accent); color: #fff; }
.steps li + li::before { content: ""; width: 28px; height: 1px; background: var(--line); margin-right: .5rem; }

/* Legacy login classes (unused after the redesign; harmless). */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.auth-box { width: 100%; max-width: 420px; }

/* ---------- Bigger screens ---------- */

@media (min-width: 641px) {
    h1 { font-size: 1.6rem; }
    .content { padding: 1.5rem 1.5rem 3rem; }
    .card { padding: 1.35rem; }
    .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field-wide { grid-column: 1 / -1; }
    .quick-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .topbar { padding: .6rem 1.5rem; }
    .topbar-title h1 { font-size: 1.25rem; }
    .topbar-actions .btn .icon { display: inline-block; }
    .form-actions-sticky { margin: 0 -1.5rem; padding: .85rem 1.5rem; }
}

@media (min-width: 901px) {
    .auth-split { grid-template-columns: 1.1fr 1fr; }
    .auth-brand { display: block; }
    .auth-compact-brand { display: none; }
    .auth-form { padding: 3rem; }
}

@media (min-width: 1001px) {
    .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
    .sidebar { position: sticky; top: 0; height: 100dvh; width: var(--sidebar-w); transform: none; box-shadow: none; }
    .sidebar-close, .nav-toggle, .sidebar-overlay { display: none !important; }
    body.nav-open { overflow: auto; }
    .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .card-grid > .card:only-child { grid-column: 1 / -1; }
}

@media (min-width: 1201px) {
    .content { padding: 2rem 2rem 4rem; }
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ===================================================================
   Activity monitoring (class names unchanged)
   =================================================================== */

/* Category dots and labels */
.cat-dot {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: .35rem;
    flex: 0 0 auto;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: .5rem 0 1rem;
    font-size: .85rem;
}

.legend span { display: inline-flex; align-items: center; }

/* Stacked category bar (one horizontal bar split by category) */
.catbar {
    display: flex;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--line);
    margin: .5rem 0;
}

.catbar > span {
    display: block;
    height: 100%;
    min-width: 2px;
}

/* 24-hour day timeline */
.timeline {
    position: relative;
    height: 46px;
    background: repeating-linear-gradient(
        to right, #f2f6f9 0, #f2f6f9 1px, transparent 1px, transparent 8.333%);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    margin: .25rem 0;
}

.timeline-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    min-width: 1px;
}

.timeline-hours {
    display: flex;
    justify-content: space-between;
    font-size: .68rem;
    color: var(--ink-2);
    margin-top: 2px;
}

.timeline-hours span { flex: 1; text-align: left; }
.timeline-hours span:last-child { text-align: right; flex: 0; }

/* A horizontal ranking bar (top apps) */
.rank { margin: 0; padding: 0; list-style: none; }

.rank li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .5rem .75rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--line-2);
}

.rank li:last-child { border-bottom: 0; }

.rank-name { display: flex; align-items: center; min-width: 0; }
.rank-name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.rank-track {
    grid-column: 1 / -1;
    height: 7px;
    border-radius: 4px;
    background: var(--line);
    overflow: hidden;
}

.rank-fill { height: 100%; border-radius: 4px; }

/* Live "now" dot */
.live-dot {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    margin-right: .4rem;
    vertical-align: middle;
}
.live-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.live-off { background: var(--ink-3); }

.break-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line-2); }
.break-row:last-child { border-bottom: 0; }

/* Week grid */
.weekgrid { display: grid; gap: .6rem; }
@media (min-width: 641px) { .weekgrid { grid-template-columns: repeat(7, 1fr); } }
.weekday { border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; background: var(--card); }
.weekday-date { font-size: .78rem; color: var(--ink-2); margin-bottom: .3rem; }
.weekday-bar { height: 90px; display: flex; flex-direction: column-reverse; border-radius: 4px; overflow: hidden; background: var(--bg); }
.weekday-bar > span { display: block; width: 100%; }

/* ===================================================================
   HR activity view
   =================================================================== */

/* Attention flags */
.flags { display: grid; gap: .6rem; }
.flag {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .7rem .85rem;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: #fff;
}
.flag-dot { width: .8rem; height: .8rem; border-radius: 50%; margin-top: .28rem; flex: 0 0 auto; }
.flag-red    { border-color: #f3c9c6; background: var(--bad-tint); }
.flag-red    .flag-dot { background: var(--bad); }
.flag-amber  { border-color: #f0d9b8; background: var(--warn-tint); }
.flag-amber  .flag-dot { background: var(--warn); }
.flag-info   { border-color: #c9dcea; background: var(--brand-tint); }
.flag-info   .flag-dot { background: var(--brand); }
.flag-ok     { border-color: #bfe3d0; background: var(--ok-tint); }
.flag-ok     .flag-dot { background: var(--ok); }
.flag-title { font-weight: 700; font-size: .92rem; }
.flag-detail { font-size: .86rem; color: var(--ink-2); }

/* Minute-by-minute grid */
.mgrid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mgrid { border-collapse: collapse; }
.mgrid td, .mgrid th { padding: 0; border: 0; background: transparent; }
.mgrid .hr-label {
    font-size: .68rem; color: var(--ink-2); text-align: right;
    padding-right: .4rem; white-space: nowrap; font-variant-numeric: tabular-nums;
    height: 13px; line-height: 13px;
}
.mcell {
    width: 11px; height: 12px; display: block;
    border-right: 1px solid rgba(255,255,255,.6);
    border-bottom: 1px solid rgba(255,255,255,.6);
}
.mcell-active   { background: #1e8a5a; }
.mcell-idle     { background: #e6a53a; }
.mcell-locked   { background: #b8c2cc; }
.mcell-offline  { background: #5b6b7c; }
.mcell-nodata   { background: #eef2f5; }
.mgrid-colhead td { font-size: .6rem; color: var(--ink-2); text-align: center; height: 14px; }
.mgrid tbody tr:hover td { background: transparent; }

/* Input (mouse vs keyboard) per hour */
.inputgrid { display: grid; grid-template-columns: 2.4rem 1fr; gap: .15rem .5rem; align-items: center; }
.inputgrid .ih-label { font-size: .7rem; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.ih-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--bg); }
.ih-key { background: #1f5f99; }
.ih-mouse { background: #7fb2d9; }

/* Score / meter */
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: .35rem; }
.meter > span { display: block; height: 100%; border-radius: 5px; }

/* Weekday HR table strip */
.daystrip { display: flex; height: 26px; gap: 1px; }
.daystrip > span { flex: 1; align-self: flex-end; background: #1e8a5a; border-radius: 1px; min-height: 1px; }

/* ===================================================================
   Laptop health (Phase 2)
   =================================================================== */

.kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-stack { display: flex; flex-direction: column; gap: .25rem; }
.kpi-stack .kpi-label { order: -1; }
.kpi-stack .progress { margin-top: .35rem; height: 6px; }
.kpi-sub { font-size: .78rem; color: var(--ink-3); }
.kpi-value-sm { font-size: .95rem; line-height: 1.3; word-break: break-word; }

.spark-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.spark { min-width: 0; }
.spark-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .25rem; }
.spark-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.spark-now { font-weight: 700; font-variant-numeric: tabular-nums; }
.sparkline { width: 100%; height: 56px; display: block; color: var(--brand); }
.spark-line { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-dot { fill: currentColor; vector-effect: non-scaling-stroke; }
.spark-foot { display: flex; justify-content: space-between; margin-top: .15rem; }
.spark-empty { padding: 1.2rem 0; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-sm); }

.chips-sm .chip { min-height: 32px; padding: .15rem .65rem; font-size: .8rem; }
.text-bad { color: var(--bad); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }

.cell-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; line-height: 1.3; }
.cell-link:hover strong { color: var(--brand); text-decoration: underline; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--brand); }
.table-compact th, .table-compact td { padding: .5rem .65rem; }

.stack > * + * { margin-top: .9rem; }
.switch-label small { display: block; font-weight: 400; font-size: .8rem; margin-top: .1rem; }
.section-h { margin: 1.25rem 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 1rem 0 0; font-size: .9rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

.note-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-bottom: .75rem; }
.note-form textarea { min-height: 60px; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { padding: .65rem 0; border-top: 1px solid var(--line-2); }
.note-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.note-body { white-space: pre-wrap; margin-top: .2rem; }
.inline { display: inline; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; text-decoration: underline; }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line-2); }
.attention li:last-child { border-bottom: 0; }
.attention .icon { color: var(--warn); }
.attention li.is-crit .icon { color: var(--bad); }

@media (min-width: 641px) {
    .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .spark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1001px) {
    .kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .spark-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===================================================================
   Support tickets (Phase 3)
   =================================================================== */

.chat-card { display: flex; flex-direction: column; }
.chat {
    display: flex; flex-direction: column; gap: .75rem;
    max-height: 60vh; overflow-y: auto; padding: .25rem;
    -webkit-overflow-scrolling: touch;
}

.msg { max-width: 82%; border-radius: var(--r); padding: .7rem .9rem; border: 1px solid var(--line); background: #fff; }
.msg-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .2rem; font-size: .85rem; }
.msg-time { color: var(--ink-3); font-size: .78rem; margin-left: auto; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-it { background: #fff; border-color: #cfe0ef; }
.msg-mine { align-self: flex-end; background: var(--brand-tint); border-color: #cfe0ef; }
.msg-requester { align-self: flex-start; }
.msg-mine.msg-requester, .msg-mine.msg-it { align-self: flex-end; }
.msg-system {
    align-self: center; max-width: 100%; background: transparent; border: 0; padding: .1rem .5rem;
    color: var(--ink-3); font-size: .82rem; text-align: center;
}
.msg-attachments { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.msg-attachments img { max-width: 240px; max-height: 200px; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }

.chat-form { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .9rem; }
.chat-form textarea { min-height: 74px; }
.chat-form-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.chat-form-actions .spacer { flex: 1; }
.chat-closed { margin: .9rem 0 0; align-items: center; }

.attach-btn {
    display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
    min-height: 38px; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 600; color: var(--ink-2); margin: 0;
}
.attach-btn:hover { background: var(--line-2); color: var(--ink); }
.attach-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attach-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden-form { display: none; }

.badge-unread {
    display: inline-block; margin-left: .35rem; padding: .1rem .45rem; border-radius: 999px;
    background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700;
}
.row-unread td { background: #fcfdff; }
.row-inline { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.row-inline select { min-width: 150px; min-height: 38px; }

.it-controls { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.it-facts { display: grid; gap: .2rem; }

@media (min-width: 641px) {
    .it-controls { grid-template-columns: 1fr 1fr; }
    .it-facts { grid-column: 1 / -1; }
}

/* ---------- Settings: connection status blocks ---------- */

.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.status-strip-main { flex: 1 1 340px; min-width: 0; }
.status-strip-side { flex: 0 0 auto; }
.status-strip .hint { margin: 8px 0 0; }
.hint-bad { color: var(--bad); }

.mini-facts { margin: 10px 0 0; display: grid; gap: 8px; }
.mini-facts div { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.mini-facts dt { font-weight: 600; font-size: 13px; color: var(--ink-2); min-width: 120px; }
.mini-facts dd { margin: 0; font-size: 13px; word-break: break-all; }

.test-result {
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: var(--r);
    border: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.55;
}

.test-result ul { margin: 0; padding-left: 20px; }
.test-result p { margin: 8px 0 0; }
.test-ok { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }
.test-bad { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }

.storage-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.storage-strip > div { display: flex; flex-direction: column; gap: 2px; }
.storage-strip strong { font-size: 18px; }

/* ---------- Remote diagnostics ---------- */

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.check-tile { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.check-tile .hint { margin: 0; }

.check-result {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.check-result-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 6px;
}

.check-remove { margin-left: auto; }

.check-json {
    margin: 8px 0 0;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: 12.5px;
    line-height: 1.5;
    max-height: 340px;
    overflow: auto;
    white-space: pre;
}
