:root {
  --sea: #0E2A47; --sea-2: #163A5F; --surface: #F5F8FA; --paper: #FFFFFF; --ink: #1B2733; --muted: #5B6B7A; --line: #D6E0E8;
  --action: #0077B6; --action-dark: #005F92; --free: #2E8B6E; --warn: #B7791F; --danger: #B3261E; --orange: #D9772B; --radius: 4px;
}
* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--surface); line-height: 1.45; font-variant-numeric: tabular-nums; }
a { color: var(--action); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
h1 { font-size: 1.45rem; font-weight: 600; margin: 0 0 .75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 .35rem; }
p { margin: 0 0 .75rem; max-width: 72ch; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: #EEF3F7; padding: 0 .25rem; border-radius: 3px; }
pre { background: #EEF3F7; padding: .6rem .8rem; border-radius: var(--radius); overflow: auto; font-size: .82rem; max-height: 420px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--sea); color: #fff; padding: 0 0 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: block; color: #fff; font-weight: 600; font-size: 1.05rem; padding: .9rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.side .brand span { font-weight: 400; opacity: .7; display: block; font-size: .8rem; }
.side .group { padding: .7rem 1.1rem 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .55; }
.side a.item { display: block; color: #fff; opacity: .82; padding: .32rem 1.1rem .32rem 1.5rem; font-size: .9rem; border-left: 3px solid transparent; }
.side a.item:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,.06); }
.side a.item[aria-current="page"] { opacity: 1; background: var(--sea-2); border-left-color: #fff; }
.side .group.open + .items { display: block; } .side .items { display: none; } .side details { border: 0; }
.side details summary { list-style: none; cursor: pointer; padding: .55rem 1.1rem .3rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; }
.side details summary::-webkit-details-marker { display: none; }
.side details[open] summary { opacity: .95; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: .55rem 1.5rem; background: var(--paper); border-bottom: 1px solid var(--line); font-size: .9rem; }
.topbar .who form { display: inline; margin-left: .75rem; }
button.link { background: none; border: 0; color: var(--action); cursor: pointer; font: inherit; padding: 0; }
main { padding: 1.1rem 1.5rem 3rem; max-width: 1500px; }
.narrow { max-width: 760px; }

/* forms */
label { display: block; font-size: .82rem; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: .15rem; padding: .4rem .5rem; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 .35rem 0 0; vertical-align: middle; }
input:focus, select:focus, textarea:focus { border-color: var(--action); outline: none; box-shadow: 0 0 0 2px rgba(0,119,182,.2); }
input[readonly] { background: #F3F6F8; }
button, .button { font: inherit; font-weight: 500; padding: .45rem .85rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; display: inline-block; line-height: 1.2; }
button.primary, .button.primary { background: var(--action); border-color: var(--action); color: #fff; } button.primary:hover { background: var(--action-dark); }
button.small, .button.small { padding: .22rem .55rem; font-size: .82rem; }
button.danger { border-color: var(--danger); color: var(--danger); } button.danger:hover { background: var(--danger); color: #fff; }
button.warn { border-color: var(--warn); color: var(--warn); }
.grid { display: grid; gap: .6rem .9rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: .9rem; }
.grid .wide { grid-column: 1 / -1; }
.grid label, .row label { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: .6rem .9rem; align-items: flex-end; margin-bottom: .9rem; }
.row > label { flex: 1 1 10rem; } .row > label.s { flex: 0 1 7rem; } .row > label.xs { flex: 0 1 5rem; } .row > label.l { flex: 2 1 16rem; }
.row > button, .row > .button { margin-bottom: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.help { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.inline { display: inline; } .inline button { vertical-align: middle; }
.check { display: flex; align-items: center; gap: .35rem; font-size: .9rem; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem .8rem; margin: 0 0 .9rem; } legend { font-size: .82rem; color: var(--muted); padding: 0 .3rem; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; font-size: .76rem; color: var(--muted); background: #EEF3F7; white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: #FAFCFD; }
td.num, th.num { text-align: right; white-space: nowrap; } td.total { font-weight: 600; }
td form { margin: 0; display: inline; }
.tablewrap { overflow-x: auto; margin-bottom: 1rem; }
table.compact th, table.compact td { padding: .3rem .45rem; font-size: .84rem; }
table.grid-input input { width: 5.2rem; padding: .2rem .35rem; margin: 0; text-align: right; }
table.grid-input select { width: auto; padding: .2rem .3rem; margin: 0; }
td.override, .override { color: var(--orange); font-weight: 600; }
td.neg, .neg { color: var(--danger); font-weight: 600; }
tr.same td { color: var(--muted); } tr.changed td { background: #FFF8E8; } tr.added td { background: #E8F5EF; } tr.removed td { background: #FBECEB; }

/* status */
.status { font-size: .76rem; padding: .08rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; font-weight: 500; white-space: nowrap; }
.status.confirmed, .status.active, .status.applied, .status.validated, .status.UP, .status.received, .status.resolved { color: var(--free); border-color: var(--free); }
.status.on_request, .status.pending_approval, .status.pending, .status.DEGRADED, .status.uploaded, .status.acknowledged, .status.warning, .status.claimed { color: var(--warn); border-color: var(--warn); }
.status.cancelled, .status.superseded, .status.expired, .status.terminated, .status.rejected, .status.no_show { color: var(--muted); text-decoration: line-through; }
.status.failed, .status.DOWN, .status.critical, .status.open { color: var(--danger); border-color: var(--danger); }
.status.draft { color: var(--action); border-color: var(--action); }

/* tiles */
.tiles { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.tile .v { font-size: 1.5rem; font-weight: 600; line-height: 1.2; } .tile .l { font-size: .78rem; color: var(--muted); }
.tile.warn .v { color: var(--warn); } .tile.bad .v { color: var(--danger); } .tile.good .v { color: var(--free); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: .1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .45rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--action); font-weight: 500; } .tabs a:hover { text-decoration: none; color: var(--ink); }

/* messages */
.flash { padding: .5rem .8rem; margin-bottom: .8rem; border-left: 3px solid var(--free); background: #E8F5EF; }
.flash.error { border-left-color: var(--danger); background: #FBECEB; }
.alertbox { background: #FFF4E5; border-left: 3px solid #E0A100; padding: .5rem .8rem; margin-bottom: .8rem; }
.callout { background: #EEF3F7; border-left: 3px solid var(--sea); padding: .5rem .8rem; margin-bottom: .8rem; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1rem; } .actions form { margin: 0; }
.facts { display: grid; grid-template-columns: 12rem 1fr; gap: .3rem 1rem; margin: 0 0 1rem; } .facts dt { color: var(--muted); } .facts dd { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .8rem; font-size: .88rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: .3rem 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.calendar { display: grid; gap: .5rem; } .day { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .8rem; } .day h3 { margin-bottom: .3rem; }
.login { max-width: 380px; margin: 5rem auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; } .login label { margin-bottom: .75rem; } .login button { width: 100%; margin-top: .5rem; }
.chip { display: inline-block; font-size: .74rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; margin: 0 .2rem .2rem 0; color: var(--muted); }
.bar { height: 6px; background: #E3EAF0; border-radius: 3px; overflow: hidden; } .bar span { display: block; height: 100%; background: var(--action); } .bar span.warn { background: var(--warn); } .bar span.bad { background: var(--danger); }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; white-space: pre-wrap; } .diff .b { color: var(--danger); } .diff .a { color: var(--free); }
.toggle-block { display: none; } .toggle-block.on { display: block; }
@media (max-width: 960px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .facts { grid-template-columns: 1fr; } }
@media print { .side, .topbar, .actions, form { display: none !important; } .shell { grid-template-columns: 1fr; } }
