/* Trellis console — mobile-first, light/dark */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1d2330; --muted: #667085; --border: #e3e6eb;
  --accent: #2f6f4f; --accent-text: #ffffff; --ok: #1f7a46; --warn: #b54708; --off: #98a2b3; --on: #22a55a;
  --radius: 12px; --gap: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b; --surface: #1d2027; --text: #e6e8ec; --muted: #9aa3b2; --border: #2c313b;
    --accent: #4caf7d; --accent-text: #0e1a13; --ok: #5fd08f; --warn: #f5a35c; --off: #5b6372; --on: #4ade80;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 var(--gap); }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand-mark { color: var(--accent); }
.container { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--gap); margin-bottom: var(--gap); }
.card.narrow { max-width: 480px; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password] { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.button, button, input[type=submit] { font: inherit; display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.button.primary, input[type=submit].primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.link-button { background: none; border: none; color: var(--muted); padding: 4px; }
.muted { color: var(--muted); }
.mono, .command, .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.flash { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); }
.flash.alert { border-color: var(--warn); color: var(--warn); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: var(--gap); }
.page-head h1 { margin: 0; }
.device-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.device-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.device-main { display: grid; flex: 1; min-width: 0; }
.device-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.dot.on { background: var(--on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--on) 25%, transparent); }
.dot.off { background: var(--off); }
.verdict { font-size: .9rem; white-space: nowrap; }
.verdict.protected { color: var(--ok); }
.verdict.attention { color: var(--warn); }
.verdict.unknown { color: var(--muted); }
.verdict.big { font-size: 1.25rem; font-weight: 700; margin: 8px 0; }
.status-line { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.checks { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 8px 0 0; }
.details dt { font-weight: 600; margin-top: 8px; }
.details dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); }
summary { cursor: pointer; color: var(--accent); margin-top: 8px; }
.code { font-size: 2rem; letter-spacing: .12em; font-weight: 700; margin: 4px 0 12px; }
.command { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }
.ping { margin: 12px 0 0; }
.empty p { margin: 0; }
.nav { display: flex; align-items: center; gap: 14px; }
.nav form { margin: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 700; }
.hint { margin: -6px 0 0; font-size: .9rem; }
input[type=number], select { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
fieldset.choices { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; margin: 0; display: grid; gap: 8px; }
fieldset.choices legend { font-weight: 600; padding: 0 4px; }
label.choice { display: flex; align-items: center; gap: 10px; font-weight: 400; }
label.choice input { width: 20px; height: 20px; }
.inline-form { display: grid; gap: 8px; margin-top: 8px; }
.button.danger { color: var(--warn); border-color: var(--warn); }
.flash.notice { border-color: var(--ok); color: var(--ok); }
.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; }
.page-nav { display: flex; justify-content: space-between; gap: 12px; }
.sync-line { margin: -8px 0 var(--gap); }
.sync-applied { color: var(--ok); }
.sync-pending { color: var(--muted); }
.sync-attention { color: var(--warn); }
.counts p { margin: 4px 0; }
/* Function rows on the child page: name on the left, Off · On · Scheduled on the right
   (wrapping under the name on narrow phones). */
.fn-list { display: grid; list-style: none; padding: 0; margin: 0; }
.fn-list > .fn-row + .fn-row { border-top: 1px solid var(--border); }
.fn-list.unavailable { opacity: .55; }
.fn-row { display: grid; gap: 8px; padding: 12px 0; }
.fn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.fn-main { display: grid; flex: 1 1 140px; min-width: 0; }
.fn-name { font-weight: 600; overflow-wrap: anywhere; }
.fn-detail { font-size: .85rem; }
.fn-status { margin: 0; font-size: .85rem; }
.switch-form { margin: 0; }
/* Segmented switch: a radio group that looks like one pill. */
.switch { display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.switch label { position: relative; display: block; font-weight: 500; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { display: block; padding: 6px 12px; border-radius: 999px; font-size: .9rem; color: var(--muted); }
.switch input:checked + span { background: var(--accent); color: var(--accent-text); }
.switch input[value=off]:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.switch input:focus-visible + span, .day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.windows { display: grid; gap: 8px; padding: 12px; border-radius: 8px; background: var(--bg); }
.windows .hint { margin: 0; }
.window { display: grid; gap: 8px; margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.days { display: flex; flex-wrap: wrap; gap: 4px; }
.day { position: relative; display: block; font-weight: 500; }
.day input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.day span { display: block; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; }
.day input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.times { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.times label { display: grid; gap: 4px; flex: 1 1 8rem; min-width: 0; font-weight: 500; }
/* On a phone the two fields stack and stay inside the card, so the picker they open
   does too (gate 6: it ran off the screen, hiding its Set button). */
input[type=time] { box-sizing: border-box; width: 100%; max-width: 12rem; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.windows, .window { min-width: 0; max-width: 100%; box-sizing: border-box; }
.window-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The Explanation under each switch. */
.explain { margin: 0; }
.explain summary { margin-top: 0; font-size: 0.9rem; }
.explain p { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
/* Off hours (step 6): the status line, the windows, Give more time. */
.off-status { margin: 0; font-weight: 600; }
.off-windows { list-style: none; padding: 0; margin: 4px 0 0; }
/* Each saved time with Change and Remove; Add off hours under them (small fixes). */
.off-window { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.off-window span { margin-right: 4px; }
.inline-action { display: inline; margin: 0; }
.off-add { margin: 12px 0 0; }
.off-hours .windows { margin-top: 12px; }
.off-hours details { margin-top: 12px; }
.inventory li { overflow-wrap: anywhere; }
/* Websites (steps 4, 4b): the add form, row actions, companions and suggestions; requests. */
.add-site { display: grid; gap: 8px; margin: 8px 0 4px; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row-actions form { margin: 0; }
.link-button.remove { font-size: 1rem; padding: 6px 8px; }
.hosts ul { margin: 8px 0 0; }
.host-list { list-style: none; padding: 0; display: grid; gap: 4px; }
.host-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.host-list form { margin: 0; }
/* Sites she opened during open web: site, when, and its two buttons in columns. */
.visit-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; }
.companions { margin: 6px 0 0; }
/* The YouTube panel under its row (step 5): mode, features, approvals. */
.adapter { display: grid; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.adapter-row { padding: 2px 0; }
.adapter-items a { font-weight: 600; }
.companions > form { margin-top: 8px; }
.essentials { margin: 12px 0 0; }
.request-list { display: grid; }
.request-list > .request + .request { border-top: 1px solid var(--border); }
.request { display: grid; gap: 4px; padding: 12px 0; }
.request p { margin: 0; }
.request-url { font-size: .85rem; overflow-wrap: anywhere; }
.request-note { font-style: italic; }
.request-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.request-answer { margin: 0; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .8rem; font-weight: 700; text-align: center; }

/* Alerts (step 7) */
.card.alerts { border-color: var(--warn); }
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-item { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.alert-item:first-child { border-top: 0; }
.alert-item form { display: inline; }
.alert-text { font-weight: 600; }

/* Step 8: kept secrets, lab mode, the safety net (docs/specs/provisioning.md). */
.banner.lab { background: #fff6d6; border: 1px solid var(--warn); border-radius: var(--radius); padding: var(--gap); margin-bottom: var(--gap); }
.secret-value { font-size: 1.6rem; letter-spacing: 0.08em; word-break: break-all; }
.secret-value span + span { margin-left: 0.6em; }
.findings li { margin-bottom: 0.5rem; }
form.inline { display: inline-flex; gap: 0.5rem; align-items: center; }
.button.danger { border-color: var(--warn); }
.error { color: var(--warn); }

/* Recent changes and Connect your assistant (docs/specs/cloud-mcp-auto-releases.md). */
.change-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.change-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: .95rem; }
.connector-url { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* The whole address shows, wrapped (gate 6: an input cut off its /mcp/<number> end). */
.connector-url textarea { flex: 1; min-width: 16rem; resize: none; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.consent ul { margin: 4px 0 12px; }
.consent-actions { display: flex; gap: 8px; }
