/* Large type and high contrast throughout — this is a readability requirement,
   not a style preference. Base font is 19px and nothing user-facing goes below
   17px. Status is never colour alone: every coloured state also carries a word
   or a symbol, so it survives colour-blindness and a bad screen. */

:root {
  --bg:        #0b1220;
  --panel:     #131c2e;
  --panel-2:   #1a2438;
  --line:      #2b3a55;
  --text:      #f2f6fc;
  --muted:     #a8b6cf;
  --accent:    #4da3ff;
  --good:      #38d39f;
  --warn:      #ffc043;
  --bad:       #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 19px;
  line-height: 1.65;
}

a { color: var(--accent); }

.wrap { max-width: 940px; margin: 0 auto; padding: 32px 22px 64px; }
.narrow { max-width: 520px; }

header.top {
  display: flex; align-items: baseline; gap: 14px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 18px; margin-bottom: 30px;
  flex-wrap: wrap;
}
/* align-self:center because header.top aligns on the baseline, and a replaced
   element's baseline is its bottom edge — the mark would sit low without this. */
header.top .logo { width: 58px; height: 58px; flex: none; display: block; align-self: center; }
/* Must stay in step with --brandfont in internal/ui/page.html and with the font stack in
   brand/make.py. Three copies of one decision; changing one alone is the bug to watch for.
   ⚠️ None of these is shipped — they render only if the viewer's machine has one. */
header.top .brand {
  font-family: "Oswald","Archivo Narrow","Roboto Condensed","Barlow Condensed",
               "Arial Narrow","DejaVu Sans Condensed","Liberation Sans Narrow",sans-serif;
  font-size: 40px; font-weight: 500; letter-spacing: 1.6px;
  font-stretch: condensed; color: var(--text); white-space: nowrap;
  /* Elongated rather than just larger — see the matching note in internal/ui/page.html.
     ⚠️ display:inline-block is load-bearing: transform is IGNORED on a non-replaced inline
     element, and this wordmark is a <span>. Without it the scale silently does nothing. */
  display: inline-block;
  transform: scaleY(1.18); transform-origin: left center;
}
header.top .tag { color: var(--muted); font-size: 17px; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 17px; color: var(--muted); }

h1 { font-size: 28px; margin: 0 0 10px; }
h2 { font-size: 23px; margin: 34px 0 12px; }
p.lede { font-size: 20px; color: var(--muted); margin-top: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 22px;
}

label { display: block; font-size: 18px; font-weight: 600; margin: 18px 0 7px; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: 14px 15px;
  font-size: 19px; font-family: inherit;
  background: var(--panel-2); color: var(--text);
  border: 2px solid var(--line); border-radius: 9px;
}
input:focus { outline: none; border-color: var(--accent); }

button, .btn {
  display: inline-block; margin-top: 24px;
  padding: 14px 26px;
  font-size: 19px; font-weight: 700; font-family: inherit;
  color: #07101f; background: var(--accent);
  border: none; border-radius: 9px; cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button.quiet {
  background: transparent; color: var(--muted);
  border: 2px solid var(--line); padding: 10px 18px; font-size: 17px;
}

.msg {
  padding: 15px 18px; border-radius: 9px; margin: 0 0 20px;
  font-size: 18px; border-left: 6px solid;
}
.msg.bad  { background: #2b1620; border-color: var(--bad);  color: #ffd9d9; }
.msg.good { background: #10261f; border-color: var(--good); color: #c9f7e6; }

.alt { margin-top: 26px; font-size: 17px; color: var(--muted); }

/* --- agent (house) cards --- */
.house {
  display: flex; align-items: center; gap: 18px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 20px 22px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.house .name { font-size: 21px; font-weight: 700; }
.house .meta { color: var(--muted); font-size: 17px; }
.house .spacer { flex: 1; }
.state { font-size: 17px; font-weight: 700; white-space: nowrap; }
.state.on  { color: var(--good); }
.state.off { color: var(--bad); }
.count { font-size: 21px; font-weight: 800; }

.empty {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 30px 26px; color: var(--muted); font-size: 18px;
}
.empty strong { color: var(--text); }

code, .code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 18px; background: #08101d;
  border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 8px;
}

/* --- pairing code: this is read off one screen and typed into another, so it
   is the largest text on the page and uses a font where 8/B and 5/S differ. --- */
.paircode {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 46px; font-weight: 800; letter-spacing: 5px;
  color: var(--warn);
  padding: 14px 0 18px;
}
.cmd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 17px; line-height: 1.5;
  background: #08101d; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
  overflow-x: auto; white-space: pre; color: #cfe6ff;
}

/* --- device table --- */
table.devices {
  width: 100%; border-collapse: collapse; margin-bottom: 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
table.devices th {
  text-align: left; font-size: 17px; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted);
  padding: 14px 16px; background: var(--panel-2);
  border-bottom: 2px solid var(--line);
}
table.devices td {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 18px; vertical-align: top;
}
table.devices tr:last-child td { border-bottom: none; }
.dev-name { font-weight: 700; font-size: 19px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
/* Never colour alone: the warning carries its own symbol and words. */
.warnnote { color: var(--warn); font-size: 17px; }
/* A recorded reading is good news, so it reads as confirmation, not a warning. */
.readnote { color: var(--good); font-size: 17px; }
button.copy{
  margin-top:0; padding:11px 20px; font-size:17px;
  background:var(--panel-2); color:var(--text); border:2px solid var(--accent);
}
details summary{ color:var(--accent); }
/* Numbered onboarding steps: the order is the message, so it is shown as order. */
.steps{ margin-top:22px; }
.step{ display:flex; gap:16px; align-items:flex-start; margin-bottom:26px; }
.step .num{
  flex:0 0 auto; width:38px; height:38px; border-radius:50%;
  background:var(--accent); color:#07101f;
  font-size:20px; font-weight:800; line-height:38px; text-align:center;
}
.step .stitle{ font-size:20px; font-weight:700; margin-bottom:4px; }

/* --- device list: same visual language as the agent's own page, so the site
   does not look worse than the thing running on the owner's machine --- */
.notices{ margin-bottom:26px; }
.notice{
  background:var(--panel); border:1px solid var(--line);
  border-left:6px solid var(--warn); border-radius:10px;
  padding:14px 18px; margin-bottom:10px;
}
.notice .ntext{ font-size:19px; font-weight:700; }
.notice .ndetail{ font-size:17px; color:var(--muted); margin-top:3px; }

.group{ margin-bottom:30px; }
.ghead{
  display:flex; align-items:center; gap:12px;
  margin:0 0 14px; font-size:22px; font-weight:700;
}
.ghead .swatch{ width:16px; height:16px; border-radius:4px; flex:0 0 auto; }
.ghead .gicon{ font-size:20px; }
.ghead .gcount{
  font-size:16px; font-weight:700; color:var(--muted);
  background:var(--panel-2); border:1px solid var(--line);
  border-radius:20px; padding:2px 11px;
}
.cards{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:12px; }
.card{
  background:var(--panel); border:2px solid var(--line); border-left-width:7px;
  border-radius:10px; padding:14px 16px;
}
.card .nm{ font-size:19px; font-weight:700; line-height:1.3; word-break:break-word; }
.card .ip{ font-size:17px; color:var(--accent); margin-top:2px; }
.card .sub{ font-size:16px; color:var(--muted); margin-top:3px; }
.card .chips{ margin-top:8px; display:flex; flex-wrap:wrap; gap:6px; }
.chip{
  font-size:15px; border-radius:20px; padding:2px 10px;
  border:1px solid var(--line); color:var(--muted); background:var(--panel-2);
}
.chip.good{ color:var(--good); border-color:var(--good); }
.chip.known{ color:var(--accent); border-color:var(--accent); }

/* --- add-another collapses to a link once a house exists --- */
details.addmore{ margin:10px 0 26px; }
details.addmore > summary{
  cursor:pointer; display:inline-block;
  font-size:18px; font-weight:700; color:var(--accent);
  padding:8px 0; list-style:none;
}
details.addmore > summary::-webkit-details-marker{ display:none; }

/* --- the assistant --- */
.chatpanel{ display:flex; flex-direction:column; }
#chatlog{ max-height:460px; overflow-y:auto; margin-bottom:14px; }
.bubble{
  padding:13px 16px; border-radius:12px; margin-bottom:10px;
  font-size:18px; line-height:1.55; white-space:pre-wrap; word-wrap:break-word;
}
.bubble.bot{ background:var(--panel-2); border:1px solid var(--line); }
.bubble.me { background:#16304d; border:1px solid #24507f; margin-left:12%; }
.bubble.err{ background:#2b1620; border:1px solid var(--bad); color:#ffd9d9; }
.bubble .who{
  font-size:14px; text-transform:uppercase; letter-spacing:.7px;
  color:var(--muted); margin-bottom:5px; font-weight:700;
}
#composer{ display:flex; gap:12px; align-items:flex-end; }
#composer textarea{
  flex:1; resize:vertical; padding:13px 15px; font:inherit; font-size:18px;
  background:var(--panel-2); color:var(--text);
  border:2px solid var(--line); border-radius:10px;
}
#composer textarea:focus{ outline:none; border-color:var(--accent); }
#composer button{ margin-top:0; }

/* Choosing whether a new machine starts a house or takes one over. The stakes differ
   between the options — one creates, the other re-points an existing house — so they are
   laid out as full rows a person reads, not as a compact control they skim past. */
fieldset.houses { border: 1px solid var(--line); border-radius: 10px; margin: 18px 0; padding: 14px 16px; }
fieldset.houses legend { padding: 0 8px; color: var(--muted); font-size: 17px; }
fieldset.houses label { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
                        align-items: start; padding: 10px 4px; cursor: pointer; }
fieldset.houses label + label { border-top: 1px solid var(--line); }
fieldset.houses input { grid-row: span 2; margin-top: 6px; width: 20px; height: 20px; }
fieldset.houses b { font-size: 19px; }
fieldset.houses span { color: var(--muted); font-size: 16px; }
/* The one consequence that cannot be undone by clicking something else. */
fieldset.houses em { color: var(--warn); font-style: normal; display: block; margin-top: 4px; }
