/* Colours, each with one meaning: blue = working now, amber = needs the owner, green = healthy. */
:root {
  --bg: #0F1419;
  --panel: #141A22;
  --line: #232C38;
  --line-2: #3A4656;
  --text: #E6EAF0;
  --text-strong: #F2F5F9;
  --text-2: #C3CCD7;
  --muted: #9AA6B5;
  --faint: #7D8A9A;
  --blue: #4C8DFF;
  --blue-soft: #7FB0FF;
  --blue-fill: #1A2A44;
  --link-on: #4C6E9E;
  --amber: #E0A33A;
  --amber-text: #E7C47D;
  --amber-fill: #2A2418;
  --green: #3FB68B;
  --red: #F07A6A;
  --bar: #33507A;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--blue-soft); }
a:hover { color: #B5D0FF; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }
.loading, .message { padding: 48px; color: var(--muted); }

/* --- the 1920x1080 stage, scaled to fit the window ------------------------------------- */
.viewport { position: fixed; inset: 0; overflow: hidden; }
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; }

/* Text sizes are for the 1920x1080 stage, which a laptop shows at about 0.75: keep the smallest at 16px
   or more so it reads at 12px or more on screen. */
header.top { position: absolute; left: 40px; top: 16px; width: 1840px; height: 100px; display: flex; flex-direction: column; justify-content: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.top .row1, .top .row2 { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.top .left, .top .right { display: flex; align-items: center; gap: 24px; }
.top h1 { margin: 0; font-size: 30px; font-weight: 600; color: var(--text-strong); }
.top .site { font-size: 18px; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tab { font-size: 19px; font-weight: 600; border: 0; border-radius: 7px; padding: 6px 16px; min-height: 40px; cursor: pointer; background: transparent; color: var(--muted); }
.tab:hover { background: #1E2733; }
.tab[aria-pressed="true"] { background: #2A3A55; color: var(--text-strong); }
.pill { font-size: 16px; font-weight: 600; border-radius: 999px; padding: 3px 12px; color: var(--muted); border: 1px solid var(--line-2); }
.status { display: flex; align-items: center; gap: 10px; font-size: 19px; color: var(--text-2); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.down { background: var(--red); }
.clock { font-family: var(--mono); font-size: 24px; color: var(--text-strong); min-width: 128px; text-align: right; }
.menu-btn { font-size: 18px; background: transparent; border: 1px solid var(--line-2); color: var(--text-2); border-radius: 8px; padding: 6px 14px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; }
.menu-btn:hover { background: #1E2733; }

section.flow { position: absolute; left: 40px; top: 128px; width: 1400px; height: 720px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.panel-title { display: flex; align-items: baseline; gap: 12px; }
.panel-title h2 { margin: 0; font-size: 23px; font-weight: 600; color: var(--text-strong); }
.panel-title span { font-size: 18px; color: var(--muted); }
.flow > .panel-title { position: absolute; left: 24px; top: 18px; }
.flow svg { position: absolute; left: 0; top: 0; }
.lk { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.lk-on { fill: none; stroke: var(--link-on); stroke-width: 2; }
.lk-ask { fill: none; stroke: #9A7536; stroke-width: 2; stroke-dasharray: 5 5; }
.lk-next { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 5 5; }
.col-label { position: absolute; font-size: 17px; font-weight: 600; color: var(--muted); }

.node { position: absolute; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 0 10px; overflow: hidden; }
.node b { font-size: 19px; font-weight: 600; white-space: nowrap; }
.node small { font-size: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.done { border: 1px solid var(--line-2); background: #1A2230; color: var(--text); }
.node.active { border: 1.5px solid var(--blue); background: var(--blue-fill); color: var(--text-strong); animation: ring 3s ease-in-out infinite; }
.node.queued { border: 1px dashed var(--line-2); background: var(--panel); color: var(--faint); }
.node.owner { border: 1.5px solid var(--amber); background: var(--amber-fill); color: #F4DDAE; animation: ringAmber 3s ease-in-out infinite; }
.node.core { border: 1.5px solid var(--blue); background: var(--blue-fill); color: var(--text-strong); border-radius: 12px; align-items: center; text-align: center; }
.node.off { border: 1px dashed var(--line-2); background: var(--panel); color: var(--muted); }
.node.wrap small { white-space: normal; line-height: 1.25; }
.lane-label { position: absolute; font-size: 19px; color: var(--text-2); white-space: nowrap; }
.lane-label b { color: var(--text-strong); font-weight: 600; }
.lane-label a { color: inherit; text-decoration: none; }
.lane-label a:hover { text-decoration: underline; }
.flow .note { position: absolute; width: 640px; font-size: 19px; color: var(--muted); }
.legend { position: absolute; left: 24px; bottom: 18px; display: flex; gap: 28px; font-size: 17px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 20px; height: 14px; border-radius: 3px; display: inline-block; }
.packet { position: absolute; left: 0; top: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-soft); offset-rotate: 0deg; animation: travel linear infinite; }
.packet.amber { background: var(--amber); }

aside.side { position: absolute; left: 1468px; top: 128px; width: 412px; height: 720px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-strong); }
.side .card h2 { font-size: 22px; }
.agent { display: flex; flex-direction: column; gap: 5px; }
.agent .row { display: flex; justify-content: space-between; gap: 12px; font-size: 18px; }
.agent .name { color: var(--text-strong); font-weight: 600; }
.agent.wait .name { color: var(--amber-text); }
.agent .time { color: var(--muted); font-family: var(--mono); font-size: 16px; white-space: nowrap; }
.agent .task { font-size: 16px; color: var(--muted); }
.track { height: 5px; background: var(--line); border-radius: 2px; overflow: hidden; }
.track i { display: block; height: 5px; background: var(--blue); border-radius: 2px; }
.agent.wait .track i { background: var(--amber); width: 100%; }
.empty { font-size: 18px; color: var(--muted); }
.agents { flex: 0 1 auto; min-height: 0; overflow: hidden; }
.activity { flex: 1 1 0; min-height: 240px; overflow: hidden; gap: 10px; }
.event { font-size: 19px; line-height: 1.4; color: var(--text-2); padding-bottom: 8px; border-bottom: 1px solid #1E2631; }
.event.ask { color: var(--amber-text); }
.event time { font-family: var(--mono); font-size: 16px; color: var(--faint); margin-right: 8px; }
.event .tag { font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; margin-right: 8px; }
.event .detail { display: block; font-family: var(--mono); font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }

section.health { position: absolute; left: 40px; top: 864px; width: 1840px; height: 184px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; justify-content: space-between; }
.tile .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tile .label { font-size: 18px; white-space: nowrap; font-weight: 500; color: var(--muted); }
.tile .value { font-size: 36px; white-space: nowrap; font-weight: 600; color: var(--text-strong); }
.tile .bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; }
.tile .bars i { flex: 1 1 0; background: var(--bar); border-radius: 2px 2px 0 0; min-height: 1px; }
.tile .bars i:last-child { background: var(--blue-soft); }
.tile .sub { font-size: 17px; color: var(--muted); }

@keyframes travel { from { offset-distance: 0%; opacity: 0; } 10% { opacity: .9; } 90% { opacity: .9; } to { offset-distance: 100%; opacity: 0; } }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(76,141,255,.35); } 50% { box-shadow: 0 0 0 6px rgba(76,141,255,0); } }
@keyframes ringAmber { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,163,58,.4); } 50% { box-shadow: 0 0 0 5px rgba(224,163,58,0); } }
@media (prefers-reduced-motion: reduce) { .node.active, .node.owner, .packet { animation: none; } .packet { display: none; } }

/* --- the board on a phone (below 768px wide): one stacked column you scroll, same colours ---
   Real pixels here, not stage pixels: body text 16px or more, tap targets 44px or more. */
.phone { max-width: 640px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; font-size: 16px; overflow-wrap: anywhere; }
.phone .loading { padding: 32px 0; }
.ph-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ph-title { display: flex; align-items: center; gap: 10px; }
.ph-head h1 { margin: 0; font-size: 22px; font-weight: 600; color: var(--text-strong); }
.ph-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ph-updated { font-family: var(--mono); font-size: 16px; color: var(--muted); }
.phone .menu-btn { font-size: 16px; min-height: 44px; padding: 8px 14px; text-decoration: none; }
.phone .pill { font-size: 14px; padding: 2px 10px; white-space: nowrap; }
.phone .tabs { width: 100%; }
.phone .tab { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 16px; padding: 8px 6px; }
.phone .card { padding: 14px 16px; gap: 10px; }
.phone .card h2 { font-size: 18px; }
.phone .empty, .ph-empty { font-size: 16px; color: var(--muted); }
.ph-status { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 17px; color: var(--text-2); }
.ph-status b { color: var(--text-strong); font-weight: 600; }
.ph-status .dot { width: 12px; height: 12px; }
.ph-status.ok span:last-child { color: var(--green); }
.ph-status.warn span:last-child { color: var(--amber-text); }
.ph-status.down span:last-child { color: var(--red); }
.ph-status.runner { font-size: 16px; color: var(--muted); }
.ph-inc { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #1A2230; }
.ph-inc.ask { border-color: var(--amber); background: var(--amber-fill); }
.ph-inc-top { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.ph-inc-top b { color: var(--text-strong); }
.ph-inc-top a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.ph-inc-sub { font-size: 16px; color: var(--muted); }
.ph-wait { font-size: 16px; font-weight: 600; color: var(--amber-text); }
.ph-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ph-tile { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.ph-tile .label { font-size: 16px; color: var(--muted); }
.ph-tile .value { font-size: 24px; font-weight: 600; color: var(--text-strong); line-height: 1.15; }
.ph-tile .bars { display: flex; align-items: flex-end; gap: 2px; height: 28px; margin-top: 4px; }
.ph-tile .bars i { flex: 1 1 0; background: var(--bar); border-radius: 1px 1px 0 0; min-height: 1px; }
.ph-tile .bars i:last-child { background: var(--blue-soft); }
.ph-agent { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; color: var(--text-2); }
.ph-agent .time { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.phone .event { font-size: 16px; }
.phone .event time { font-size: 15px; }
.phone .event .detail { font-size: 15px; }
.phone .event:last-child { border-bottom: 0; padding-bottom: 0; }

/* --- normal pages: sign-in, Users, Login history ---------------------------------------- */
.page { max-width: 960px; margin: 0 auto; padding: 40px 16px 64px; }
.page h1 { font-size: 24px; font-weight: 600; color: var(--text-strong); margin: 0 0 8px; }
.page p { color: var(--text-2); line-height: 1.5; }
.page nav { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 24px; }
.page .card { margin-bottom: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Sign-in: Cross Way's lockup (as in Community) in this app's own colours: the board's dark
   background and panels, with a soft glow of its blue. */
.auth-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background:
    radial-gradient(420px 320px at 100% -5%, rgba(76, 141, 255, 0.28), transparent 70%),
    radial-gradient(360px 300px at -5% 45%, rgba(76, 141, 255, 0.14), transparent 70%),
    linear-gradient(160deg, #16233A 0%, var(--bg) 60%);
}
.auth-hero { padding: calc(48px + env(safe-area-inset-top)) 24px 32px; color: #fff; }
.auth-hero p { margin: 8px 0 0; color: var(--text-2); font-size: 16px; line-height: 1.5; }
.auth-card {
  flex: 1; background: var(--panel); border-top: 1px solid var(--line); border-radius: 28px 28px 0 0;
  padding: 28px 24px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
}
.auth-card h2 { margin: 0; font-size: 22px; font-weight: 600; color: var(--text-strong); }
.auth-card .muted { margin: 0 0 8px; color: var(--muted); font-size: 16px; line-height: 1.5; }
/* Google's button is drawn at the card's content width, so its edges line up with the text. */
.gsi-slot { min-height: 44px; width: 100%; display: flex; justify-content: center; }
.auth-card .err { margin: 0; }
.auth-card .err:empty { display: none; }

/* The lockup: logo, hairline, app name centred on the logo's artwork (fractions of --h). */
.lockup { --h: 64px; display: inline-flex; align-items: flex-start; height: var(--h); color: #fff; margin-bottom: 28px; }
.lockup .logo { display: block; height: var(--h); width: auto; }
.lockup-rule { flex: none; width: 1px; margin-top: calc(var(--h) * 0.26); height: calc(var(--h) * 0.643); background: rgba(255, 255, 255, 0.4); }
.lockup-word { flex: none; margin-left: calc(var(--h) * 0.213); margin-top: calc(var(--h) * 0.582); transform: translateY(-46%); font-size: calc(var(--h) * 0.24); font-weight: 700; line-height: 1; white-space: nowrap; letter-spacing: 0.005em; }

@media (min-width: 900px) {
  .auth-screen {
    align-items: center; justify-content: center; padding: 40px;
    background:
      radial-gradient(700px 520px at 92% 0%, rgba(76, 141, 255, 0.24), transparent 70%),
      radial-gradient(640px 520px at 0% 85%, rgba(76, 141, 255, 0.12), transparent 70%),
      linear-gradient(160deg, #16233A 0%, var(--bg) 65%);
  }
  .auth-hero { padding: 0 0 28px; text-align: center; }
  .auth-card { flex: none; width: 440px; border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45); }
}
.err { color: var(--red); font-size: 14px; min-height: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-wrap { overflow-x: auto; }
form.add { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; background: var(--bg); color: var(--text); border: 1px solid #5F6B7B; border-radius: 8px; padding: 8px 10px; min-height: 40px; }
input { min-width: 260px; }
.btn { background: #2A3A55; color: var(--text-strong); border: 0; border-radius: 8px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.btn:hover { background: #34486A; }
.perms { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); min-height: 32px; }
label.check input { min-width: 0; min-height: 0; width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
tr.inactive td { color: var(--faint); }
td .err { display: block; min-height: 0; margin-top: 4px; font-size: 13px; }
.no-access { position: absolute; left: 40px; top: 140px; font-size: 22px; color: var(--text-2); }
.btn.quiet { background: transparent; border: 1px solid var(--line-2); color: var(--text-2); }
