:root {
  --bg: #0a101d;
  --bg-2: #0e1628;
  --surface: #121b2f;
  --surface-2: #17223a;
  --border: #22304d;
  --border-2: #2c3c5e;
  --text: #e6ebf5;
  --muted: #8e9bb6;
  --faint: #5f6c88;
  --brand: #e8412c;
  --brand-2: #1d55b4;
  --ok: #22c55e;
  --maint: #3b82f6;
  --warn: #eab308;
  --orange: #f97316;
  --bad: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #14213d 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: #7fb0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }

/* ---------- layout ---------- */
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.site-header { padding: 28px 0 18px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.logo-chip {
  display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 9px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.logo-chip img { display: block; height: 30px; width: auto; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-title { font-weight: 600; font-size: .95rem; color: var(--muted); letter-spacing: .02em; }
.header-links { display: flex; gap: 18px; font-size: .9rem; }
.header-links a { color: var(--muted); }
.header-links a:hover { color: var(--text); }
main { padding-bottom: 48px; }
.site-footer { border-top: 1px solid var(--border); padding: 22px 0 36px; color: var(--faint); font-size: .85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
}
.card-h { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-h h2 { margin: 0; font-size: 1rem; }
.card-b { padding: 18px 20px; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 30px 0 10px; font-weight: 700; }

/* ---------- overall banner ---------- */
.overall {
  display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--surface)) 0%, var(--surface) 70%);
  margin: 8px 0 24px; box-shadow: var(--shadow);
}
.overall .icon {
  width: 46px; height: 46px; border-radius: 50%; background: var(--c); display: grid; place-items: center; flex: none;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 20%, transparent);
}
.overall .icon svg { width: 26px; height: 26px; color: #fff; }
.overall .t { font-size: 1.35rem; font-weight: 700; }
.overall .s { color: var(--muted); font-size: .88rem; }

/* ---------- status dots / pills ---------- */
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  white-space: nowrap;
}
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--muted); margin: 2px 4px 2px 0; }

/* ---------- services ---------- */
.svc-group + .svc-group { border-top: 1px solid var(--border); }
.svc-group-name { padding: 12px 20px 4px; font-size: .74rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.svc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
.svc + .svc { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.svc-name { font-weight: 600; }
.svc-desc { color: var(--faint); font-size: .82rem; }
.svc-status { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--c); font-weight: 600; white-space: nowrap; }

/* ---------- incidents / timeline ---------- */
.inc { border-left: 4px solid var(--c); }
.inc .card-h { align-items: flex-start; }
.inc-title { font-size: 1.08rem; font-weight: 700; margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .st { font-weight: 700; color: var(--c); margin-right: 6px; }
.timeline .when { color: var(--faint); font-size: .8rem; margin-top: 2px; }

/* ---------- notices ---------- */
.notice { border-left: 4px solid var(--c); }
.notice .card-b { padding: 16px 20px; }
.notice h3 { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice .body { color: #cdd5e4; }

/* ---------- maintenance ---------- */
.maint { border-left: 4px solid var(--c); }
.maint-when { display: flex; gap: 18px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin: 6px 0 8px; }
.maint-when b { color: var(--text); font-weight: 600; }

.empty { text-align: center; color: var(--faint); padding: 18px; font-size: .9rem; }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 20px; align-items: center; }
.list-row + .list-row { border-top: 1px solid var(--border); }

/* ---------- forms & buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: #1e2b48; border-color: #3a4d75; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #d23621; border-color: #d23621; }
.btn-blue { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-blue:hover { background: #1a4a9c; }
.btn-danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: #3a1212; border-color: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 7px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

label { display: block; font-weight: 600; font-size: .86rem; margin: 0 0 6px; color: #cbd3e3; }
.field { margin-bottom: 16px; }
.hint { font-size: .8rem; color: var(--faint); margin-top: 5px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border-2); background: #0b1324; color: var(--text);
  font: inherit; font-size: .93rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4b7bd8; box-shadow: 0 0 0 3px rgba(75,123,216,.22); }
input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; margin: 0 0 10px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.svc-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #0b1324; max-height: 260px; overflow: auto; }
.svc-picker .check { margin: 4px 0; font-size: .9rem; }
.notify-box { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 9%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); margin-bottom: 16px; }
.notify-box .check { margin: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.flash.success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.35); color: #86efac; }
.flash.error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35); color: #fca5a5; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: rgba(255,255,255,.015); }
.toggle { border: 0; background: none; cursor: pointer; padding: 0; font: inherit; }

/* ---------- admin shell ---------- */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #0b1222; border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side .logo-chip { margin: 0 6px 6px; }
.side .logo-chip img { height: 24px; }
.side .sub { color: var(--faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin: 8px 8px 18px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .92rem; margin-bottom: 2px; }
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.active { background: color-mix(in srgb, var(--brand) 15%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .sep { height: 1px; background: var(--border); margin: 12px 6px; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--border); font-size: .82rem; color: var(--muted); }
.side-foot .who { color: var(--text); font-weight: 600; word-break: break-all; }
.admin-main { padding: 26px 32px 60px; min-width: 0; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat .n { font-size: 1.6rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .82rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: #fff; border-bottom-color: var(--brand); }
.quick-status select { width: auto; padding: 6px 8px; font-size: .85rem; }
.secret-set { color: var(--ok); font-size: .8rem; font-weight: 600; }
details.box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #0b1324; margin-bottom: 16px; }
details.box summary { cursor: pointer; font-weight: 600; color: #cbd3e3; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 400px; }
.login .logo-chip { margin: 0 auto 22px; display: flex; width: max-content; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .sep { display: none; }
  .admin-main { padding: 20px 16px 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .svc { flex-wrap: wrap; }
  .overall .t { font-size: 1.12rem; }
  .logo-chip img { height: 24px; }
  table.t th, table.t td { padding: 9px 10px; }
}
