/* One look for the account page and the broker's terminal pages (sign-in, opening a session):
   the broker serves this same file as /_rt.css on the terminal hosts. Light by default, dark on request. */
:root {
  color-scheme: light dark;
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #eaeff5; --text: #16202a; --muted: #4b5b6b;
  --border: #c9d3de; --accent: #0b5cad; --accent-text: #ffffff; --link: #0a58a6;
  --danger: #b42318; --danger-bg: #fdecea; --ok: #1a7032; --ok-bg: #e5f4e8; --warn: #6b4500; --warn-bg: #fff3d6;
  --focus: #b35c00; --code-bg: #eef2f6; --tip-bg: #16202a; --tip-text: #ffffff;
  --radius: 10px; --gap: 1rem;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151d; --surface: #16202b; --surface-2: #1e2a37; --text: #e6edf3; --muted: #a8b6c4;
    --border: #344658; --accent: #8cc4ff; --accent-text: #0a1b2c; --link: #9ccdff;
    --danger: #ffb3a7; --danger-bg: #3a1a16; --ok: #8fd6a0; --ok-bg: #143021; --warn: #ffd98a; --warn-bg: #3a2d0e;
    --focus: #f7c65b; --code-bg: #0a1017; --tip-bg: #e6edf3; --tip-text: #0e151d;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--link); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 1rem; }
.muted { color: var(--muted); }
p, li, dd { overflow-wrap: anywhere; }
code, kbd, samp, pre { font: .92em/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3em; background: var(--surface-2); }

/* The shell header */
header.shell { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  padding: .75rem max(1rem, calc((100% - 1040px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; }
.mark { font: 700 .8rem/1 ui-monospace, monospace; background: var(--text); color: var(--surface); border-radius: 6px; padding: .35rem .4rem; }
header.shell nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .95rem; }
header.shell nav a { color: var(--muted); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
header.shell nav a:hover { color: var(--text); border-bottom-color: var(--accent); }
.who { margin-left: auto; display: inline-flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .95rem; }
.who button { margin: 0; }

main { max-width: 1040px; margin: auto; padding: 1.25rem 1rem 3rem; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
h4 { font-size: 1rem; margin: 1rem 0 .3rem; }
#hosted-list article { margin: .5rem 0; }
#notice { min-height: 1.5rem; margin: 0 0 .75rem; font-weight: 600; color: var(--warn); }
#notice:not(:empty) { background: var(--warn-bg); border-radius: var(--radius); padding: .6rem .9rem; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 0 0 1.25rem; }
.panel > p { max-width: 72ch; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.callout { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: .6rem .9rem; }

/* The overview: what you have, and the one button you usually want */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: center; }
.hero h1 { margin-bottom: .75rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin: 0; }
.facts div { background: var(--surface-2); border-radius: 8px; padding: .6rem .8rem; min-width: 0; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 600; }
.hero-action { text-align: center; max-width: 18rem; }
.hero-action p { margin: .4rem 0; font-size: .92rem; }
.badge { display: inline-block; border-radius: 999px; padding: .05rem .55rem; font-size: .8rem; font-weight: 600; vertical-align: .1em; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--surface-2); color: var(--muted); }
.badge.warn { background: var(--danger-bg); color: var(--danger); }

/* Cards */
.cards { display: grid; gap: .75rem; margin: .75rem 0; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
article { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; background: var(--surface); min-width: 0; }
article > p { margin: .3rem 0; }
.meta { color: var(--muted); font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.actions button { margin: 0; }
article details { margin-top: .6rem; border: 0; padding: 0; }
details { margin: 1rem 0 0; }
summary { cursor: pointer; font-weight: 600; color: var(--link); padding: .25rem 0; }
details[open] > summary { margin-bottom: .5rem; }

/* Forms and buttons */
label { display: block; margin: .8rem 0; }
label.inline { display: inline-flex; align-items: center; gap: .5rem; margin: 0; max-width: 100%; }
label.inline select { width: auto; min-width: 0; }
label.check { display: flex; align-items: center; gap: .5rem; }
input, select { display: block; background: var(--surface); color: inherit; border: 1px solid var(--muted); border-radius: 6px;
  font: inherit; padding: .5rem; max-width: 100%; width: 30rem; margin-top: .25rem; }
input[type=checkbox] { display: inline; width: auto; margin: 0 .5rem 0 0; accent-color: var(--accent); }
label.check input { margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
button, .button { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit;
  padding: .5rem .9rem; cursor: pointer; display: inline-block; text-decoration: none; margin: .4rem .5rem .4rem 0; }
button:hover, .button:hover { border-color: var(--muted); }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.big { font-size: 1.15rem; padding: .85rem 1.6rem; margin: 0; width: 100%; }
button.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
button.quiet { background: transparent; }
button:disabled { opacity: .55; cursor: not-allowed; }
.copy-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.copy-row input { flex: 1 1 14rem; width: auto; }
.copy-row button { margin: .25rem 0 0; }

/* Join from your terminal */
.steps { padding-left: 1.4rem; margin: 1rem 0 0; }
.steps > li { margin: 0 0 1.25rem; padding-left: .25rem; }
.steps > li::marker { font-weight: 700; }
.steps p { margin: .25rem 0 .5rem; max-width: 72ch; }
.code { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; }
.code pre { margin: 0; padding: .75rem 5.5rem .75rem .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.code .copy { position: absolute; top: .4rem; right: .4rem; margin: 0; padding: .3rem .7rem; font-size: .9rem; }

/* Secrets */
.revealed { border: 2px solid var(--focus); border-radius: 8px; padding: .75rem; margin: .8rem 0; }
.revealed pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 .5rem; max-height: 16rem; overflow: auto; }
#lock-state { font-weight: 600; }
.machine { padding: .25rem 0; }
.machine .actions { margin-top: .4rem; }
.picklist { max-height: 20rem; overflow: auto; }
.picklist label { margin: .4rem 0; }
.unavailable { color: var(--danger); }

/* Activity */
.scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
td, th { border-bottom: 1px solid var(--border); padding: .5rem; overflow-wrap: anywhere; }
caption { text-align: left; color: var(--muted); }

/* Explanations: a key word with a plain-English tooltip on hover, keyboard focus or tap */
button.term { all: unset; cursor: help; border-bottom: 1px dashed currentColor; }
button.term:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.tip { position: fixed; z-index: 30; max-width: min(22rem, calc(100vw - 2rem)); background: var(--tip-bg); color: var(--tip-text);
  border-radius: 8px; padding: .55rem .75rem; font: 400 .92rem/1.45 system-ui, sans-serif; text-align: left;
  box-shadow: 0 6px 24px rgb(0 0 0 / .25); white-space: normal; }

/* The broker's terminal pages: one centred card under the same header */
.page { max-width: 34rem; margin: 2.5rem auto; }
.page form { margin-top: 1rem; }

@media (max-width: 720px) {
  header.shell { position: static; padding: .6rem 1rem; }
  header.shell nav { order: 3; width: 100%; font-size: .9rem; }
  main { padding: 1rem 1rem 2.5rem; }
  .panel { padding: 1rem; }
  h1 { font-size: 1.55rem; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-action { max-width: none; }
  input, select { width: 100%; }
  label.inline select { width: auto; }
}
