/* Aegis console. Layout: a calm watch-room — one top bar (brand, views, account); checks
   as ledgers grouped by app, each opening its own page; settings one app at a time. The logo is
   the Aegis shield with a heartbeat and the ΛEGIS wordmark (console/brand/build-icons.mjs);
   small dots mark each run. */
:root {
  --glass: rgb(255 255 255 / .72); --glass-edge: rgb(255 255 255 / .7); --glass-shine: rgb(255 255 255 / .9); --glass-active: rgb(20 34 42 / .08);
  --bg: #f2f5f6;
  --surface: #ffffff;
  --sunk: #e8eef0;
  --ink: #14222a;
  --muted: #586a73;
  --line: #d6e0e4;
  --accent: #0c6b78;
  --accent-ink: #ffffff;
  --accent-soft: #dcefF1;
  --pass: #1d7f47;  --pass-bg: #dff2e6;
  --warn: #9a6512;  --warn-bg: #f7ead2;
  --fail: #b8382a;  --fail-bg: #f8e0dc;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418; --surface: #141f25; --sunk: #0f191e; --ink: #e1eaed; --muted: #8fa3ab;
    --line: #22333b; --accent: #4cb3c2; --accent-ink: #061215; --accent-soft: #15323a;
    --pass: #57c487; --pass-bg: #143022; --warn: #e2ad57; --warn-bg: #33270f;
    --fail: #f0806b; --fail-bg: #3a1a15; color-scheme: dark;
    --glass: rgb(30 42 49 / .66); --glass-edge: rgb(255 255 255 / .08); --glass-shine: rgb(255 255 255 / .06); --glass-active: rgb(255 255 255 / .1);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 56px;
}
.wrap { max-width: 1120px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.mono, code { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* top bar */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-block: 18px 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand svg { flex: none; display: block; }
.brand .mark { width: 30px; height: 34px; }
.brand .word { width: 90px; height: 14px; }
.views { display: flex; gap: 4px; flex-wrap: wrap; }
.views a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 7px 12px; border-radius: 8px; }
.views a:hover { color: var(--ink); background: var(--sunk); }
.views a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.views a svg { display: none; }   /* icons only in the phone's bottom bar */
.views a.you, .who .initials { display: none; }   /* the "You" tab is the phone's account button */
.views a { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--fail); color: #fff; font: 700 11px/1 var(--font-body); vertical-align: 1px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.who a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.who a:hover { color: var(--ink); background: var(--sunk); }
.who a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

main { margin-top: 24px; }
main > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }
.lead { display: grid; gap: 4px; min-width: 0; }
.lead p { color: var(--muted); }

/* ledger */
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; }
.page-head .lead { flex: 1 1 420px; }
.page-head h1 .tag { font-family: var(--font-body); vertical-align: 4px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: -10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.group { display: grid; gap: 10px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.group-head .hint { white-space: nowrap; }
.group-head a { margin-left: auto; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.stat > span { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 16px; font-weight: 600; }
.stat small { color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side { gap: 16px; }
.side-sec { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.side-sec:last-of-type { border-bottom: 0; padding-bottom: 0; }
.side .btn { justify-self: start; text-decoration: none; color: var(--ink); }
table.runs td { vertical-align: middle; }
td.sum { width: 100%; max-width: 0; }
td.sum span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.sum small { display: block; color: var(--muted); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { display: grid; padding: 8px 14px 10px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a small { font-weight: 400; font-size: 12.5px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; }
.check-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.check-list li:first-child { border-top: 0; padding-top: 0; }
.check-list .toggle span { display: grid; }
.check-list small { color: var(--muted); font-size: 13px; }
.check-list a { font-size: 14px; }
.notif { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--bg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.narrow { max-width: 560px; }
.card.channel dl { font-size: 14px; }
th.plain { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); background: none; font-weight: 600; }
.day { display: grid; gap: 8px; }
.day h2 { font-size: 16px; }
table.activity td:first-child { width: 64px; }
table.activity .who-cell { width: 180px; font-weight: 500; }
.actions.end { justify-content: flex-end; }
.ledger-head, .row-main {
  display: grid; grid-template-columns: 104px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) 128px 28px;
  gap: 14px; align-items: center; padding: 12px 18px;
}
.ledger-head { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--sunk); }
.row + .row { border-top: 1px solid var(--line); }
.row-main { width: 100%; text-align: left; color: inherit; text-decoration: none; }
.row-main:hover { background: var(--sunk); }
.row-main:hover .chev { color: var(--accent); }
.name { display: grid; gap: 1px; min-width: 0; }
.name b { font-weight: 600; }
.name small, .cell small { display: block; color: var(--muted); font-size: 12.5px; }
.cell { font-size: 14px; min-width: 0; }
.chev { width: 18px; height: 18px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.pass { color: var(--pass); background: var(--pass-bg); }
.pill.fail { color: var(--fail); background: var(--fail-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.idle { color: var(--muted); background: var(--sunk); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.write { color: var(--warn); border-color: currentColor; }
.eyes { display: flex; gap: 5px; align-items: center; }
.eye { width: 11px; height: 11px; border-radius: 50%; background: var(--pass); }
.eye.fail { background: var(--fail); }
.eye.none { background: transparent; border: 1.5px dashed var(--line); }

dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.btn.danger { color: var(--fail); }
.btn.danger:hover { border-color: var(--fail); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn[disabled]:hover { border-color: var(--line); color: inherit; }
.tbl-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--sunk); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* cards and forms (Setup, People, Account) */
.cards { display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.card > header { display: grid; gap: 3px; }
.card > header p { color: var(--muted); font-size: 14px; }
.dests { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dest { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); font: 12.5px var(--font-mono); }
.dest.bad { border-color: var(--warn); }
.dest button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.dest button:hover { color: var(--fail); }
.dest.ro { padding-right: 10px; background: var(--surface); }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], select {
  min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 7px 10px;
}
.inline-form input { flex: 1 1 220px; }
.mono-input { font: 13px var(--font-mono); }
.form { display: grid; gap: 12px; max-width: 420px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 500; }
.form label small { font-weight: 400; color: var(--muted); }
.msg { font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.msg.err { color: var(--fail); background: var(--fail-bg); }
.msg.ok { color: var(--pass); background: var(--pass-bg); }
.msg.warn { color: var(--warn); background: var(--warn-bg); }
.cred-table th { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--ink); background: none; width: 34%; white-space: normal; }
.cred-table td { vertical-align: middle; overflow-wrap: anywhere; }
.cred-table td.cred-act { width: 1%; text-align: right; white-space: nowrap; }
.cred-table .inline-form input { flex: 1 1 200px; }
.out { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.6 var(--font-mono); background: var(--sunk); border-radius: 8px; padding: 10px 12px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.toggle input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.toggle input:checked { background: var(--pass); }
.toggle .paused { color: var(--warn); }
.toggle input:checked::after { transform: translateX(16px); }
.linkbox { display: grid; gap: 8px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
.linkbox code { overflow-wrap: anywhere; background: var(--surface); padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); }

/* report dialog */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .45); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: min(860px, 100%); max-height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog-body { overflow: auto; padding: 16px; display: grid; gap: 14px; }
.dialog-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--ink); background: var(--sunk); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); z-index: 40; }

/* sign-in and setup pages */
.auth { min-height: 100%; display: grid; place-items: center; padding-block: 10vh 40px; }
.auth .card { width: min(420px, 100%); }
.auth .brand { flex-direction: column; gap: 14px; margin-bottom: 4px; }
.auth .brand .mark { width: 58px; height: 64px; }
.auth .brand .word { width: 123px; height: 19px; }

@media (max-width: 860px) {
  .ledger-head { display: none; }
  .row-main { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name chev" "status status" "sched last" "eyes eyes"; gap: 8px 12px; }
  .row-main .c-status { grid-area: status; } .row-main .name { grid-area: name; }
  .row-main .c-sched { grid-area: sched; } .row-main .c-last { grid-area: last; }
  .row-main .eyes { grid-area: eyes; } .row-main .chev { grid-area: chev; }
  .split, .notif { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.activity .who-cell { width: auto; }
  /* Phones: the views move to a floating bar at the bottom, clear of the home indicator. */
  .bar { flex-wrap: nowrap; padding-block: 12px 10px; }
  /* ...and the top bar keeps just the logo; your account is the bar's "You" tab (Sign out is on Account). */
  .who { display: none; }
  /* A frosted-glass capsule, like WhatsApp's tab bar: neutral highlight on the current tab. */
  .views {
    position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: min(480px, calc(100% - 20px));
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 5px;
    background: var(--glass); backdrop-filter: blur(22px) saturate(1.8); -webkit-backdrop-filter: blur(22px) saturate(1.8);
    border: 1px solid var(--glass-edge); border-radius: 999px;
    box-shadow: 0 10px 34px rgb(0 0 0 / .14), 0 1px 3px rgb(0 0 0 / .06), inset 0 1px 0 var(--glass-shine);
  }
  .views a { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 7px 2px 6px; border-radius: 999px; color: var(--ink); font-size: 11px; font-weight: 500; line-height: 1.1; }
  .views a:hover { background: none; }
  .views a[aria-current="page"] { color: var(--ink); background: var(--glass-active); font-weight: 600; }
  .views a svg { display: block; width: 25px; height: 25px; }
  .views a.you { display: grid; }
  .views .initials { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
  /* Order on phones: Apps · Channels · (Checks) · Activity · You — Checks in the middle as a
     larger, raised accent button. People is reached from the You page. */
  .views a[data-view="apps"] { order: 1; } .views a[data-view="channels"] { order: 2; }
  .views a[data-view="checks"] { order: 3; } .views a[data-view="activity"] { order: 4; } .views a.you { order: 5; }
  .views a[data-view="people"] { display: none !important; }
  .views a[data-view="checks"] { background: none; }
  .views a[data-view="checks"][aria-current="page"] { background: none; color: var(--accent); font-weight: 600; }
  .views a[data-view="checks"] svg {
    width: 26px; height: 26px; padding: 11px; box-sizing: content-box; margin-top: -24px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); border: 3px solid var(--bg);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 38%, transparent);
  }
  .views a[data-view="checks"]:active svg { transform: scale(.95); }
  .views a[data-view="checks"] .badge { top: -22px; left: calc(50% + 12px); }
  .views .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 19px; height: 19px; border: 2px solid var(--surface); box-sizing: content-box; }
  .views a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* settings additions: channel set-up forms, the Retire section, the schedule editor */
h2.sub { font-size: 16px; margin-top: 6px; }
.chan-form { padding-top: 12px; border-top: 1px solid var(--line); }
.side-sec.retire { border-bottom: 0; padding-bottom: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.stat small .link-btn { font-size: inherit; }

/* "Keep me signed in" on the sign-in page; the "couldn't update" warning */
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.form label.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.form label.check small { display: block; margin-top: 2px; }
.stale { position: sticky; top: 8px; z-index: 15; margin-top: 16px; box-shadow: 0 4px 14px rgb(0 0 0 / .08); }
