:root,
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c232d;
    --border: #2b3440;
    --text: #e6edf3;
    --muted: #9aa7b4;
    --accent: #58a6ff;
    --accent-ink: #0b1220;
    --ok: #3fb950;
    --warn: #e3b341;
    --fail: #f0883e;
    --down: #f85149;
    --wait: #8b98a5;
    --ok-bg: rgba(63, 185, 80, .15);
    --warn-bg: rgba(227, 179, 65, .15);
    --fail-bg: rgba(240, 136, 62, .15);
    --down-bg: rgba(248, 81, 73, .16);
    --wait-bg: rgba(139, 152, 165, .16);
    --c1: #58a6ff;
    --c2: #b392f0;
    --c3: #39c5cf;
    --shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

[data-theme="gray"] {
    color-scheme: dark;
    --bg: #363b43;
    --surface: #424851;
    --surface-2: #4a515b;
    --border: #5c646f;
    --text: #eef1f4;
    --muted: #c3cad2;
    --accent: #9cc2ff;
    --accent-ink: #14202e;
    --ok: #6ee08a;
    --warn: #f4cd5c;
    --fail: #ffa466;
    --down: #ffa198;
    --wait: #bcc5cf;
    --ok-bg: rgba(110, 224, 138, .17);
    --warn-bg: rgba(244, 205, 92, .17);
    --fail-bg: rgba(255, 164, 102, .17);
    --down-bg: rgba(255, 161, 152, .18);
    --wait-bg: rgba(188, 197, 207, .18);
    --c1: #9cc2ff;
    --c2: #cdb8ff;
    --c3: #5ee0e8;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --border: #d3dae2;
    --text: #14202b;
    --muted: #4f5c69;
    --accent: #1f6feb;
    --accent-ink: #ffffff;
    --ok: #1a7f37;
    --warn: #9a6700;
    --fail: #c2410c;
    --down: #cf222e;
    --wait: #66727f;
    --ok-bg: rgba(26, 127, 55, .12);
    --warn-bg: rgba(154, 103, 0, .13);
    --fail-bg: rgba(194, 65, 12, .12);
    --down-bg: rgba(207, 34, 46, .11);
    --wait-bg: rgba(102, 114, 127, .13);
    --c1: #1f6feb;
    --c2: #8250df;
    --c3: #0e7490;
    --shadow: 0 8px 24px rgba(20, 32, 43, .15);
}

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

html {
    font-size: var(--fs, 14px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Fira Sans", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 100vh;
}
html[lang="th"] body { line-height: 1.65; }
html[lang="th"] .table th { text-transform: none; letter-spacing: 0; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; }
h2 { font-size: 1.125rem; line-height: 1.3; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: "Fira Code", ui-monospace, Consolas, monospace; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: .25rem;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: .5rem 1rem;
    z-index: 100;
}
.skip:focus { left: 0; }

.ico { width: 1.125rem; height: 1.125rem; flex: none; vertical-align: -.2em; }

/* top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    padding: .5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: .08em;
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 1.75rem; width: auto; padding: .1875rem .5rem; border-radius: .5rem; background: #fff; }

.nav { display: flex; gap: .25rem; }
.nav a {
    padding: .375rem .75rem;
    border-radius: .375rem;
    color: var(--muted);
    font-weight: 500;
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }

.tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.refresh-info {
    font-family: "Fira Code", ui-monospace, Consolas, monospace;
    font-size: .75rem;
    color: var(--muted);
    white-space: nowrap;
}
.refresh-info.err { color: var(--warn); }

.user {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-left: .75rem;
    margin-left: .25rem;
    border-left: 1px solid var(--border);
    font-size: .875rem;
}
.user-name { font-weight: 500; }
.role-tag {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: .25rem;
    padding: 0 .375rem;
}
.link { color: var(--accent); font-size: .875rem; }
.link-btn {
    background: none;
    border: 0;
    padding: .25rem 0;
    cursor: pointer;
    font-family: inherit;
    min-height: 2.25rem;
}
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

.icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: .375rem;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.spin .ico { animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* settings panel */
.settings {
    position: fixed;
    top: 3.5rem;
    right: 1rem;
    z-index: 30;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: var(--shadow);
    padding: 1rem;
    display: grid;
    gap: 1rem;
}

.field { display: grid; gap: .375rem; }
.label { font-size: .8125rem; font-weight: 600; color: var(--muted); }

.seg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--border);
    border-radius: .375rem;
    overflow: hidden;
}
.seg button {
    min-height: 2.25rem;
    background: var(--surface-2);
    color: var(--text);
    border: 0;
    border-right: 1px solid var(--border);
    font: inherit;
    cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg button:focus-visible { outline-offset: -2px; }

.stepper { display: flex; align-items: center; gap: .5rem; }
.fs-val { min-width: 2.5rem; text-align: center; font-family: "Fira Code", ui-monospace, Consolas, monospace; }

/* buttons / forms */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    min-height: 2.25rem;
    padding: 0 .875rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: .375rem;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
    text-decoration: none;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--down); border-color: var(--down); background: transparent; }
.btn-danger:hover { background: var(--down-bg); border-color: var(--down); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 2rem; padding: 0 .625rem; font-size: .875rem; }

.input, .select, textarea.input {
    width: 100%;
    min-height: 2.25rem;
    padding: .375rem .625rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: .375rem;
    font: inherit;
}
textarea.input { min-height: 4.5rem; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.input::placeholder { color: var(--muted); }

.form { display: grid; gap: 1rem; max-width: 36rem; }
.form .row { display: grid; gap: .375rem; }
.form label.lbl { font-weight: 600; font-size: .875rem; }
.hint { color: var(--muted); font-size: .8125rem; }
.field-error, .validation-summary-errors { color: var(--down); font-size: .8125rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.125rem; }
.chk { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.25rem; cursor: pointer; }
.chk input { width: 1.125rem; height: 1.125rem; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* layout */
body { display: flex; flex-direction: column; }
.container { flex: 1 0 auto; width: 100%; max-width: 84rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.site-footer { padding: 1rem; text-align: center; color: var(--muted); font-size: .8125rem; border-top: 1px solid var(--border); }
.bare .site-footer { border-top: 0; }
.bare .container { max-width: 28rem; padding-top: 12vh; }

.page-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    margin-bottom: 1rem;
}
.page-head .spacer { margin-left: auto; }

.flash {
    border: 1px solid var(--border);
    border-left-width: .25rem;
    border-radius: .375rem;
    padding: .625rem .875rem;
    margin-bottom: 1rem;
    background: var(--surface);
}
.flash-ok { border-left-color: var(--ok); }
.flash-err { border-left-color: var(--down); }

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: 1rem;
}
.panel-card + .panel-card { margin-top: 1rem; }
.panel-card > h2 { margin-bottom: .75rem; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    font-weight: 700;
    letter-spacing: .1em;
    margin-bottom: 1.25rem;
}
.auth-brand .brand-logo { height: 2.5rem; padding: .3125rem .75rem; }
.auth-card h1 { margin-bottom: .25rem; }
.auth-card .auth-sub { color: var(--muted); margin-bottom: 1.25rem; }
.auth-card .form { max-width: none; }

/* status tokens */
.s-OK { --c: var(--ok); --c-bg: var(--ok-bg); }
.s-WARN { --c: var(--warn); --c-bg: var(--warn-bg); }
.s-FAIL { --c: var(--fail); --c-bg: var(--fail-bg); }
.s-DOWN { --c: var(--down); --c-bg: var(--down-bg); }
.s-WAIT { --c: var(--wait); --c-bg: var(--wait-bg); }
.s-CLOSED { --c: var(--accent); --c-bg: var(--wait-bg); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .125rem .5rem .125rem .375rem;
    border-radius: 999px;
    background: var(--c-bg);
    color: var(--c);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.badge .ico { width: .9375rem; height: .9375rem; }

.dot {
    display: inline-block;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--c);
    flex: none;
}

/* summary / filters */
.summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.25rem;
    padding: 0 .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .375rem;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.pill:hover { border-color: var(--muted); }
.pill[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); }
.pill .n { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; }
.pill .dot { background: var(--c, var(--muted)); }

.search { position: relative; }
.search .ico { position: absolute; left: .625rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.125rem; min-width: 16rem; }

/* project cards */
.grid { display: grid; gap: .75rem; }
.grid.view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.view-list { grid-template-columns: minmax(0, 1fr); }

.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: .375rem; overflow: hidden; }
.view-toggle button {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    min-height: 2.25rem;
    padding: 0 .875rem;
    background: var(--surface-2);
    color: var(--text);
    border: 0;
    border-right: 1px solid var(--border);
    font: inherit;
    cursor: pointer;
}
.view-toggle button:last-child { border-right: 0; }
.view-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.view-toggle button:focus-visible { outline-offset: -2px; }

.node-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.node-row.multi { border-top: 1px dashed var(--border); padding-top: .625rem; }
.node-row .node-block.multi { border-top: 0; padding-top: 0; }
.view-list .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .375rem 1.25rem; }

.strip { display: grid; gap: .25rem; min-width: 0; }
.strip-head, .strip-axis { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .75rem; }
.strip-up { font-family: "Fira Code", ui-monospace, Consolas, monospace; color: var(--text); }
.strip-body svg { display: block; width: 100%; height: 1.75rem; }
.strip-body .b-O { fill: var(--ok); }
.strip-body .b-W { fill: var(--warn); }
.strip-body .b-F { fill: var(--fail); }
.strip-body .b-D { fill: var(--down); opacity: .45; }
.strip-body .b-N { fill: var(--border); }
.strip-body .b-C { fill: var(--accent); opacity: .3; }

.card {
    display: grid;
    gap: .625rem;
    align-content: start;
    background: var(--surface);
    border: 1px solid var(--c, var(--border));
    border-left: .3125rem solid var(--c, var(--border));
    border-radius: .5rem;
    padding: .875rem;
    color: var(--text);
    transition: border-color .15s, transform .15s;
}
a.card:hover { text-decoration: none; }

.card.s-WARN .card-top .badge,
.card.s-FAIL .card-top .badge,
.card.s-DOWN .card-top .badge { animation: blink 2s ease-in-out infinite; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .2; }
}
.card-title { display: flex; align-items: center; gap: .375rem; min-width: 0; }
.grip { display: inline-flex; flex: none; color: var(--muted); cursor: grab; }
.grip .ico { width: 1.125rem; height: 1.125rem; }
.card.dragging { opacity: .4; border-style: dashed; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-top h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: .8125rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.card-meta .ico { width: .875rem; height: .875rem; margin-right: .25rem; }
.card-note { color: var(--muted); font-size: .875rem; }
.node-block { display: grid; gap: .625rem; min-width: 0; }
.node-block.multi { border-top: 1px dashed var(--border); padding-top: .625rem; }
.node-block.stale .metrics { opacity: .55; }
.node-head { display: flex; align-items: center; gap: .5rem; font-size: .875rem; min-width: 0; }
.node-head .badge { margin-left: auto; }
.node-name { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-age { color: var(--muted); font-size: .75rem; white-space: nowrap; }

.metrics-wrap { display: grid; gap: .375rem; }
.metrics { display: grid; gap: .375rem; }
.metric { display: grid; grid-template-columns: 5rem 1fr 3.25rem; align-items: center; gap: .5rem; font-size: .8125rem; }
.metric .k { color: var(--muted); font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .v { text-align: right; font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; }

.bar { height: .5rem; background: var(--surface-2); border-radius: .25rem; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.bar.warn > i { background: var(--warn); }
.bar.crit > i { background: var(--down); }

.chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .125rem .5rem;
    border: 1px solid var(--border);
    border-radius: .25rem;
    background: var(--surface-2);
    font-family: "Fira Code", ui-monospace, Consolas, monospace;
    font-size: .75rem;
}

.sublines { display: grid; border-top: 1px solid var(--border); padding-top: .25rem; }
.subline { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .25rem 0; font-size: .8125rem; }
.subline + .subline { border-top: 1px dashed var(--border); }
.subline.dim .sl-name { opacity: .6; }
.sl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-code { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; }
.sl-label { color: var(--muted); margin-left: .5rem; }
.gicons { display: inline-flex; gap: .5rem; flex: none; }
.gicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    min-width: 4.5rem;
    padding: .375rem .75rem;
    border-radius: .375rem;
    background: var(--c-bg);
    color: var(--c);
    font-family: "Fira Code", ui-monospace, Consolas, monospace;
    font-size: 1.03rem;
    font-weight: 600;
}
.gicon .ico { width: 1.5rem; height: 1.5rem; }
.g-ok { --c: var(--ok); --c-bg: var(--ok-bg); }
.g-warn { --c: var(--warn); --c-bg: var(--warn-bg); }
.g-fail { --c: var(--down); --c-bg: var(--down-bg); }
.g-down { --c: var(--down); --c-bg: var(--down-bg); }
.g-off { --c: var(--wait); --c-bg: var(--wait-bg); }
.g-none { --c: var(--wait); --c-bg: transparent; opacity: .4; }

.empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: .5rem;
}

/* detail */
.back { display: inline-flex; align-items: center; gap: .375rem; color: var(--muted); min-height: 2.25rem; }
.back:hover { color: var(--text); text-decoration: none; }

.detail-head { border-left: .3125rem solid var(--c); display: grid; gap: .5rem; }
.detail-head .title { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.detail-head .desc { color: var(--muted); }

.node-section { margin-top: 1rem; display: grid; gap: 1rem; }
.node-section > section.panel-card, .node-body > section.panel-card { margin-top: 0 !important; }
.node-body { display: grid; gap: 1rem; }
.node-card { cursor: pointer; }
.chip .ico { width: .9375rem; height: .9375rem; color: var(--c); }
.node-subs { margin-top: .25rem; }
.node-h2 { margin: 0; font-size: 1.125rem; }
.node-toggle .node-title { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; }
.node-section + .panel-card { margin-top: 1rem; }
.node-section .tiles { margin-top: 0; }
.node-card { border-left: .3125rem solid var(--c); display: grid; gap: .5rem; }
.node-card .title { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
.node-title { font-family: "Fira Code", ui-monospace, Consolas, monospace; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem; margin-top: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: .875rem; display: grid; gap: .5rem; align-content: start; }
.tile .t-label { color: var(--muted); font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile .t-value { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: 1.75rem; font-weight: 500; line-height: 1.2; }
.tile .t-sub { color: var(--muted); font-size: .8125rem; }
.disk-row { display: grid; gap: .25rem; }
.disk-row .d-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .8125rem; }
.disk-row .d-name { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 500; }
.disk-row .d-info { color: var(--muted); }

.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.chart-head h2 { margin: 0; }
.range { display: inline-flex; border: 1px solid var(--border); border-radius: .375rem; overflow: hidden; }
.range button {
    min-height: 2rem;
    padding: 0 .75rem;
    background: var(--surface-2);
    color: var(--text);
    border: 0;
    border-right: 1px solid var(--border);
    font: inherit;
    font-size: .875rem;
    cursor: pointer;
}
.range button:last-child { border-right: 0; }
.range button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.range button:focus-visible { outline-offset: -2px; }

.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; }
.chart-wrap .grid-line { stroke: var(--border); stroke-width: 1; }
.chart-wrap .axis-text { fill: var(--muted); font-size: .6875rem; font-family: "Fira Code", ui-monospace, Consolas, monospace; }
.chart-wrap .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .l1 { stroke: var(--c1); }
.chart-wrap .l2 { stroke: var(--c2); stroke-dasharray: 7 4; }
.chart-wrap .l3 { stroke: var(--c3); stroke-dasharray: 2 4; }
.chart-wrap .cursor { stroke: var(--muted); stroke-width: 1; }
.chart-wrap .cursor-dot { stroke: var(--surface); stroke-width: 2; }
.chart-empty { color: var(--muted); padding: 2rem 0; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .5rem; font-size: .8125rem; color: var(--muted); }
.legend .key { display: inline-flex; align-items: center; gap: .375rem; }
.legend svg { width: 1.75rem; height: .5rem; }
.legend .line { fill: none; stroke-width: 2; stroke-linecap: round; }
.legend .l1 { stroke: var(--c1); }
.legend .l2 { stroke: var(--c2); stroke-dasharray: 7 4; }
.legend .l3 { stroke: var(--c3); stroke-dasharray: 2 4; }
.tiles + .panel-card { margin-top: 1rem; }
.legend .readout { margin-left: auto; font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--text); }

.subs { display: grid; gap: .75rem; }
.sub { border: 1px solid var(--border); border-left: .3125rem solid var(--c); border-radius: .5rem; background: var(--surface-2); }
.sub-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; padding: .625rem .875rem; }
.sub-head .code { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; }
.sub-head .name { color: var(--muted); }
.sub-head .sub-meta { margin-left: auto; color: var(--muted); font-size: .8125rem; }
.check-groups { border-top: 1px solid var(--border); }
.check-group + .check-group { border-top: 1px solid var(--border); }
.cg-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .875rem;
    background: var(--c-bg);
    color: var(--c);
    font-weight: 600;
    font-size: .875rem;
}
.cg-title { color: var(--text); }
.cg-count { margin-left: auto; font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; }
.checks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.check {
    display: grid;
    grid-template-columns: 1.5rem minmax(8rem, 1.2fr) minmax(8rem, 2fr) 4.5rem;
    align-items: center;
    gap: .5rem;
    padding: .5rem .875rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
.check:last-child { border-bottom: 0; }
.check .c-type { color: var(--muted); font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; text-transform: uppercase; }
.check .c-name { font-family: "Fira Code", ui-monospace, Consolas, monospace; word-break: break-word; }
.check .c-msg { color: var(--muted); word-break: break-word; }
.check .c-ms { text-align: right; color: var(--muted); font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; }
.check .ico { color: var(--c); }
.check.bad .c-msg { color: var(--c); }
.sub-empty { padding: .625rem .875rem; color: var(--muted); border-top: 1px solid var(--border); font-size: .875rem; }

.events { list-style: none; margin: 0; padding: 0; }
.event { display: grid; grid-template-columns: 9rem 6.5rem 6rem 1fr; gap: .5rem; align-items: center; padding: .375rem 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.event:last-child { border-bottom: 0; }
.event time { color: var(--muted); font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; }
.event .scope { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: "Fira Code", ui-monospace, Consolas, monospace; }
.table td.actions { white-space: nowrap; }
.tag { display: inline-block; padding: 0 .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--wait-bg); color: var(--muted); }
.tag.on { background: var(--ok-bg); color: var(--ok); }
.tag.off { background: var(--down-bg); color: var(--down); }
.tag.admin { background: var(--warn-bg); color: var(--warn); }
.tag.padmin { background: var(--accent-bg, var(--wait-bg)); color: var(--accent); }

.hours-now { margin: .5rem 0 .75rem; font-weight: 600; }
.hours-table .input { min-width: 7rem; }
.hours-table .h-note { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.hours-table .hours-row.is-closed td { opacity: .7; }
.hours-meta { white-space: nowrap; }
.limits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem 1rem; margin-bottom: .75rem; align-items: start; }
.limits-form, .sec-form { max-width: none; margin-top: .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .375rem 1.5rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: "Fira Code", ui-monospace, Consolas, monospace; }

.lang-links { position: fixed; top: .75rem; right: .75rem; display: flex; gap: .25rem; z-index: 5; }
.lang-links a { padding: .25rem .625rem; border: 1px solid var(--border); border-radius: 999px; font-size: .8125rem; color: var(--muted); background: var(--surface); }
.lang-links a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.lang-links a:hover { text-decoration: none; border-color: var(--accent); }

.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .25rem .75rem; }

.keybox {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.keybox code {
    flex: 1 1 18rem;
    padding: .5rem .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: .375rem;
    word-break: break-all;
}
pre.snippet {
    margin: .75rem 0 0;
    padding: .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: .375rem;
    overflow-x: auto;
    font-size: .8125rem;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sub-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.sub-row .sub-form { flex: 1 1 30rem; }
.sub-form { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(10rem, 2fr) auto auto; gap: .5rem; align-items: center; }
.sub-form + .sub-form { margin-top: .5rem; }
.sub-form.add { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.subs-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: .75rem; }
.subs-head h2 { margin: 0; }
.subs-head .actions { margin-left: auto; }
.subs-note { color: var(--c); font-size: .8125rem; font-weight: 600; }
.subs-table .sub-tr { cursor: pointer; }
.subs-table .sub-tr:hover { background: var(--surface-2); }
.subs-table .sub-tr td:first-child { box-shadow: inset .3125rem 0 0 var(--c); }
.subs-table .sub-detail > td { padding: 0; background: var(--surface-2); }
.subs-table .sub-detail .check-groups { border-top: 0; }
.subs-table .gicon { min-width: 3.5rem; padding: .25rem .5rem; font-size: .8125rem; }
.subs-table .gicon .ico { width: 1.25rem; height: 1.25rem; }
.sub-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.25rem;
    padding: .25rem 0;
    background: none;
    border: 0;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sub-toggle .chev { color: var(--muted); transition: transform .15s; }
.sub-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.sub-toggle .code { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-weight: 600; }
.sub-toggle .name { color: var(--muted); }

.hide-refresh #btn-refresh, .hide-refresh #refresh-info { display: none; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem; }
.f-group { display: grid; gap: .375rem; }
.f-group .input, .f-group .select { min-width: 10rem; }
.f-actions { margin-left: auto; }
.presets { display: flex; gap: .375rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1rem 0; border-bottom: 1px solid var(--border); }
.tab {
    min-height: 2.5rem;
    padding: 0 1rem;
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

#report > * + * { margin-top: 1rem; }
.rcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
.rcard { display: grid; gap: .125rem; padding: .875rem; background: var(--surface); border: 1px solid var(--border); border-left: .3125rem solid var(--c, var(--border)); border-radius: .5rem; }
.rcard.t-ok { --c: var(--ok); }
.rcard.t-warn { --c: var(--warn); }
.rcard.t-fail { --c: var(--fail); }
.rcard.t-down { --c: var(--down); }
.rcard.t-wait { --c: var(--wait); }
.rc-label { color: var(--muted); font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.rc-value { font-family: "Fira Code", ui-monospace, Consolas, monospace; font-size: 1.75rem; font-weight: 500; line-height: 1.2; }
.rc-sub { color: var(--muted); font-size: .8125rem; }
.chart-box { width: 100%; height: 20rem; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; cursor: pointer; }
.th-sort:hover { color: var(--text); }
.table th[aria-sort="ascending"] .th-sort::after { content: " \25B2"; font-size: .625rem; }
.table th[aria-sort="descending"] .th-sort::after { content: " \25BC"; font-size: .625rem; }
.notes ul { margin: 0; padding-left: 1.125rem; color: var(--muted); }
.notes li + li { margin-top: .25rem; }
.subs-head .hint { margin-left: .25rem; }

.danger-zone { border-color: var(--down); }
.danger-zone h2 { color: var(--down); }

@media (max-width: 720px) {
    .topbar { padding: .5rem .75rem; }
    .refresh-info { display: none; }
    .user { border-left: 0; padding-left: 0; margin-left: 0; flex-wrap: wrap; }
    .grid.view-grid { grid-template-columns: minmax(0, 1fr); }
    .node-row { grid-template-columns: minmax(0, 1fr); }
    .subs-table .col-checks, .subs-table .col-age { display: none; }
    .search input { min-width: 0; width: 100%; }
    .search { flex: 1 1 100%; }
    .check { grid-template-columns: 1.5rem 1fr 4rem; }
    .check .c-msg { grid-column: 2 / -1; }
    .check .c-ms { grid-row: 1; grid-column: 3; }
    .event { grid-template-columns: 1fr auto; }
    .event time { grid-column: 1; }
    .event .badge { grid-column: 2; justify-self: end; }
    .event .scope, .event .msg { grid-column: 1 / -1; }
    .sub-form { grid-template-columns: 1fr 1fr; }
    .settings { right: .5rem; left: .5rem; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .icon-btn.spin .ico { animation: none; }
}

html[data-blink="off"] .card .card-top .badge { animation: none !important; }
