/*
 * The owner console on the web (D325 stage 2, D326; plan section 12 (2)). The layout follows the window's width, not the
 * device: under 700 px one column - the list, then a box on its own view with a back control; from 700 px (an iPad
 * either way up, Split View, a laptop) the list on the left and the open box on the right, each scrolling on its own and
 * filling the screen. Text at 17 px, every button at least 44 px tall, nothing scrolls sideways, light or dark as the
 * device is set. No inline style anywhere (the CSP allows this file alone).
 */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1c1d1f;
  --muted: #5d6167;
  --line: #d8dbe0;
  --pane: #f6f7f9;
  --chip: #eceff3;
  --accent: #0b57d0;
  --accent-fg: #ffffff;
  --ok: #146c2e;
  --ok-bg: #e6f4ea;
  --warn: #8a4b00;
  --warn-bg: #fff4e0;
  --bad: #b3261e;
  --bad-bg: #fce8e6;
  --code: #f1f3f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --fg: #e6e8eb;
    --muted: #a3a9b0;
    --line: #2f343a;
    --pane: #181b1f;
    --chip: #252a30;
    --accent: #8ab4f8;
    --accent-fg: #0a1b36;
    --ok: #81c995;
    --ok-bg: #16301f;
    --warn: #fdd663;
    --warn-bg: #3a2f10;
    --bad: #f28b82;
    --bad-bg: #3c1a18;
    --code: #22262b;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.busy { cursor: progress; }
body.busy button { opacity: .6; pointer-events: none; }

h1, h2, h3 { line-height: 1.25; margin: .6rem 0 .4rem; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: .45rem 0; }
ul, ol { padding-left: 1.3rem; margin: .4rem 0; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--code);
  border-radius: 4px;
  padding: 0 .2em;
  white-space: pre-wrap;
}
a { color: var(--accent); }
img, svg, video { max-width: 100%; height: auto; }

.muted { color: var(--muted); }
.small { font-size: .88rem; }
.pad { padding: .25rem 1rem 1.5rem; }
.hint { margin-top: 2rem; text-align: center; }

/* ---------------------------------------------------------------- the bar */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .75rem;
  padding: .35rem 1rem;
  padding-top: max(.35rem, env(safe-area-inset-top));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: var(--pane);
}
.bar .name { margin: 0; flex: 0 0 auto; }
.tabs { display: flex; gap: .25rem; flex: 1 1 auto; }
.tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .9rem;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
}
.tab.on { background: var(--chip); font-weight: 600; }
.who { margin: 0; color: var(--muted); font-size: .88rem; flex: 1 1 12rem; }

/* ---------------------------------------------------------------- buttons and fields: 44 px at least */
button {
  font: inherit;
  min-height: 44px;
  padding: .45rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--fg);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.quiet { background: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
input[type="text"], input[type="date"], select, textarea {
  font: inherit;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}
textarea { resize: vertical; }
label { display: block; }
.act { display: flex; flex-direction: column; gap: .4rem; margin: .7rem 0; }
.act button { align-self: flex-start; }
.act.grid { display: grid; grid-template-columns: 1fr; gap: .5rem; }

/* ---------------------------------------------------------------- notes and badges */
.banner { margin: 0; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.banner.warn, .note.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad, .note.bad { background: var(--bad-bg); color: var(--bad); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note { padding: .55rem .75rem; border-radius: 8px; background: var(--pane); }
.badge {
  display: inline-block;
  padding: 0 .55rem;
  border-radius: 999px;
  font-size: .82rem;
  line-height: 1.6;
  background: var(--chip);
  color: var(--fg);
  white-space: nowrap;
}
.badge.done, .badge.pass, .badge.ready { background: var(--ok-bg); color: var(--ok); }
.badge.skipped, .badge.blocked, .badge.notrun, .badge.open, .badge.unskipped { background: var(--chip); color: var(--muted); }
.badge.reopened, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.fail, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.card { margin: 1.5rem auto; max-width: 32rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 12px; }

/* ---------------------------------------------------------------- the three panes */
.pane-tests { display: none; }
.app.view-tests .pane-list, .app.view-tests .pane-box { display: none; }
.app.view-tests .pane-tests { display: block; }

@media (max-width: 699.98px) {
  .app.view-list .pane-box { display: none; }
  .app.view-step .pane-list { display: none; }
}

@media (min-width: 700px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
  .app { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(17rem, 2fr) 3fr; }
  .app.view-tests { display: block; overflow-y: auto; }
  .pane { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .pane-list { border-right: 1px solid var(--line); background: var(--pane); }
  .back { display: none; }
  .act.grid { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; }
  .act.grid button { align-self: end; }
  .foot { flex: 0 0 auto; }
}

/* ---------------------------------------------------------------- the list */
.sittings { list-style: none; padding: 0; }
.sittings > li { margin: .4rem 0 .8rem; }
.place { margin: .3rem 0 .2rem; font-size: 1rem; }
.items { list-style: none; padding: 0; margin: 0; }
a.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 .3rem;
  min-height: 44px;
  padding: .3rem .6rem;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
}
a.item:hover { background: var(--chip); }
a.item.on { background: var(--chip); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
a.inline { display: inline-block; padding: .55rem 0; }
.after { padding-left: 1rem; }
.after > li { margin: .2rem 0; }
.next { padding: .5rem .75rem; border-radius: 8px; background: var(--chip); }
details.fold { margin: .6rem 0; }
summary { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; cursor: pointer; }

/* ---------------------------------------------------------------- one box */
.back { margin: .6rem 0 0; }
.title { margin-top: .8rem; }
.meta { color: var(--muted); }
.meta b { color: var(--fg); }
.section { color: var(--muted); font-size: .9rem; }
.lead { margin: .6rem 0; padding: .3rem .75rem; border-left: 3px solid var(--line); }
.words { overflow-wrap: anywhere; }
.words ol, .words ul { padding-left: 1.4rem; }
.words li { margin: .3rem 0; }
.words .url { color: var(--muted); font-size: .88rem; }
.prose li.direction { list-style: none; margin-left: -1.4rem; display: flex; gap: .55rem; align-items: flex-start; }
.prose li.direction > .text { flex: 1 1 auto; min-width: 0; }
.prose li.direction.done > .text { color: var(--muted); }
input.tick { flex: 0 0 auto; width: 1.6rem; height: 1.6rem; margin: .05rem 0 0; accent-color: var(--accent); }
.links { padding-left: 1.2rem; }
.record { margin-top: 1.2rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.state { margin: .5rem 0; }
.reply { padding: .5rem .75rem; border-radius: 8px; background: var(--ok-bg); }
.history .rows { list-style: none; padding: 0; }
.history .rows > li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.history .words { margin: .2rem 0 0; }

/* ---------------------------------------------------------------- the Test page */
details.stage { margin: .5rem 0; padding: .2rem .75rem; border: 1px solid var(--line); border-radius: 10px; }
details.stage[open] { padding-bottom: .75rem; }

.foot {
  padding: .5rem 1rem;
  padding-bottom: max(.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: .82rem;
}
