/* ITS Teknik brand tokens (its-teknik-brand skill, brand layer). Do not add colours that are not listed here. */
:root {
    --brand-navy: #424e55;
    --brand-red: #a22223;
    --brand-green: #297b40;
    --navy-600: #556168;
    --ink: #2d3740;          /* report.ink, 12.1:1 on white */
    --ink-muted: #656e74;    /* 5.2:1 on white, 4.77:1 on neutral-100 */
    --on-dark-muted: #c8d4dc;
    --neutral-white: #ffffff;
    --neutral-100: #f4f5f6;
    --neutral-200: #eaeced;
    --line: #d9dde0;
    --warning-bg: #f7dede;   /* component layer: warning info box */
    --warning-ink: #7a1a1a;
    --warning-edge: #9e2a2a;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--neutral-100);
}

h1, h2 { color: var(--brand-navy); line-height: 1.2; }
h1 { font-size: 26px; margin: 0 0 var(--space-md); }
h2 { font-size: 18px; margin: 0 0 var(--space-sm); }
a { color: var(--brand-navy); }
.muted { color: var(--ink-muted); }

.accent-line { height: 2px; background: var(--brand-red); }

/* Top bar: white so the full-colour logo keeps its contrast */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--neutral-white);
}
.brand { display: flex; align-items: center; gap: var(--space-md); text-decoration: none; }
.brand-name { font-weight: bold; color: var(--brand-navy); font-size: 17px; }
.who { display: flex; align-items: center; gap: var(--space-md); }
.who form { margin: 0; }
.chip {
    padding: 2px var(--space-sm);
    border-radius: 999px;
    background: var(--neutral-200);
    color: var(--brand-navy);
    font-size: 13px;
    font-weight: bold;
}
.link-button {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--brand-navy);
    text-decoration: underline;
    cursor: pointer;
}

/* Navy side menu, white text (8.6:1) */
.shell { display: flex; min-height: calc(100vh - 52px); }
.sidenav {
    flex: 0 0 200px;
    background: var(--brand-navy);
    padding: var(--space-md) 0;
}
.sidenav a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--neutral-white);
    text-decoration: none;
    border-left: 4px solid transparent;
}
.sidenav a:hover { background: var(--navy-600); }
.sidenav a.active { border-left-color: var(--brand-red); font-weight: bold; }
.content { flex: 1; min-width: 0; padding: var(--space-lg); max-width: 1200px; }
/* A section heading after a card or table gets room above it. */
.content > * + h2 { margin-top: var(--space-lg); }

/* auto-fit, not auto-fill: two cards share the full width instead of sitting in two of four narrow tracks. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-md); }
.card { background: var(--neutral-white); border: 1px solid var(--line); padding: var(--space-md); }
.figure { font-size: 32px; font-weight: bold; color: var(--brand-navy); margin: 0; }
.figure span { font-size: 15px; font-weight: normal; color: var(--ink-muted); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: var(--space-md); }
label { display: flex; flex-direction: column; gap: var(--space-xs); font-weight: bold; color: var(--brand-navy); }
input[type=text], input[type=password] {
    font: inherit;
    font-weight: normal;
    color: var(--ink);
    padding: var(--space-sm);
    border: 1px solid var(--ink-muted);
    border-radius: 0;
}
input:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand-navy); outline-offset: 2px; }
.button {
    align-self: flex-start;
    font: inherit;
    font-weight: bold;
    padding: var(--space-sm) var(--space-lg);
    border: 0;
    background: var(--brand-navy);
    color: var(--neutral-white);
    cursor: pointer;
}
.button:hover { background: var(--navy-600); }
.alert {
    background: var(--warning-bg);
    color: var(--warning-ink);
    border-left: 4px solid var(--warning-edge);
    padding: var(--space-sm) var(--space-md);
}

/* Login page */
.bare-main {
    max-width: 400px;
    margin: 10vh auto;
    padding: var(--space-lg);
    background: var(--neutral-white);
    border: 1px solid var(--line);
}
.bare-logo { display: block; margin-bottom: var(--space-md); }
.bare-main .accent-line { margin-bottom: var(--space-lg); }

@media (max-width: 700px) {
    .shell { flex-direction: column; }
    .sidenav { flex: none; padding: 0; display: flex; overflow-x: auto; }
    .sidenav a { border-left: 0; border-bottom: 3px solid transparent; }
    .sidenav a.active { border-bottom-color: var(--brand-red); }
    .content { padding: var(--space-md); }
    .who span:first-child { display: none; }
}

/* Lists and tables */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-md); margin-bottom: var(--space-md); }
.filters .button { align-self: flex-end; }
.reset { align-self: center; }
select, input[type=search] {
    max-width: 100%;
    font: inherit;
    font-weight: normal;
    color: var(--ink);
    padding: var(--space-sm);
    border: 1px solid var(--ink-muted);
    border-radius: 0;
    background: var(--neutral-white);
}
.table-wrap { position: relative; overflow-x: auto; background: var(--neutral-white); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: var(--neutral-200); color: var(--brand-navy); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
table.data tbody tr:nth-child(even) { background: var(--neutral-100); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap + .form-card { margin-top: var(--space-md); }
.table-wrap + .hint { margin: var(--space-sm) 0 var(--space-md); }
.nowrap { white-space: nowrap; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.error-text { color: var(--brand-red); font-weight: bold; }
.chip-ok { background: var(--brand-green); color: var(--neutral-white); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-xs) var(--space-md); margin: 0 0 var(--space-md); }
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; gap: var(--space-md); align-items: center; margin-top: var(--space-md); }
.card h2 a { text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.filters label.check { flex-direction: row; align-items: center; gap: var(--space-sm); font-weight: normal; color: var(--ink); align-self: center; }

/* Map */
.map { height: 65vh; min-height: 360px; border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-md); list-style: none; padding: 0; margin: var(--space-sm) 0 0; }
.legend li { display: flex; align-items: center; gap: var(--space-xs); }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--neutral-white); box-shadow: 0 0 0 1px var(--line); }
.dot-online { background: var(--brand-green); }
.dot-error { background: var(--brand-red); }
.dot-stale { background: #8c949a; }
.dot-never { background: var(--navy-600); }

/* Edit forms */
.form-card { background: var(--neutral-white); border: 1px solid var(--line); padding: var(--space-md) var(--space-lg); max-width: 760px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-md); }
fieldset { border: 1px solid var(--line); padding: var(--space-md); margin: 0; display: flex; flex-direction: column; gap: var(--space-md); }
legend { font-weight: bold; color: var(--brand-navy); padding: 0 var(--space-xs); }
label.check { flex-direction: row; align-items: center; gap: var(--space-sm); font-weight: normal; color: var(--ink); }
.hint { font-weight: normal; color: var(--ink-muted); font-size: 13px; margin: 0; }
.field-error { font-weight: normal; color: var(--brand-red); font-size: 14px; }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--brand-red); border-width: 2px; }
input:disabled { background: var(--neutral-100); color: var(--ink-muted); }
.flash { background: var(--neutral-white); border-left: 4px solid var(--brand-green); padding: var(--space-sm) var(--space-md); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; }
a.button { text-decoration: none; display: inline-block; }
.button-danger { background: var(--brand-red); }
.button-danger:hover { background: var(--warning-edge); }
.danger-zone { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--line); }
.danger-zone a { color: var(--brand-red); }
h2.section { margin-top: var(--space-lg); }
ul.plain { padding-left: var(--space-md); }

/* Schedules */
details.add { margin: var(--space-md) 0; }
details.add summary { cursor: pointer; font-weight: bold; color: var(--brand-navy); margin-bottom: var(--space-sm); }
fieldset.weekdays { flex-direction: row; flex-wrap: wrap; gap: var(--space-md); }
fieldset.weekdays .field-error { flex-basis: 100%; }
fieldset[aria-invalid=true] { border-color: var(--brand-red); }
tr.inactive td { color: var(--ink-muted); }
.chip-warn { background: var(--warning-bg); color: var(--warning-ink); }
input[type=time], input[type=datetime-local], input[type=number] {
    font: inherit; font-weight: normal; color: var(--ink); padding: var(--space-sm);
    border: 1px solid var(--ink-muted); border-radius: 0; background: var(--neutral-white);
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Settings and commands */
form.send { margin-top: var(--space-lg); }
table.settings th[scope=row] { background: none; text-transform: none; letter-spacing: normal; font-size: 15px; width: 40%; }
table.settings input[type=number] { width: 9em; }
button:disabled { background: var(--neutral-200); color: var(--ink-muted); cursor: not-allowed; }
