/* Questions hub. One column on a phone (under 700px), a side bar beside the page on a wide screen.
   Touch targets are 44px or more. Light and dark follow the system setting. */
:root {
  --bg: #f6f6f2; --panel: #ffffff; --ink: #1c1d20; --muted: #5a5d66; --line: #d8d9d2;
  --accent: #1f5fbf; --accent-ink: #ffffff; --good: #2c7a3a; --bad: #b3261e; --hot: #c4540a;
  --chip: #ebebe4; --chip2: #e3ebf7; --focus: #1f5fbf; --shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417; --panel: #1c1e22; --ink: #ececec; --muted: #a3a6af; --line: #34363c;
    --accent: #6ea2ff; --accent-ink: #0b1220; --good: #6fcf7d; --bad: #ff8a80; --hot: #ffa45c;
    --chip: #2a2c32; --chip2: #24324a; --focus: #6ea2ff; --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code { background: var(--chip); border-radius: 4px; padding: 0 .3em; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; word-break: break-word; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .2rem 0 .4rem; }
h2.grp { font-size: 1.1rem; margin: 1.6rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
h2.blocker-h { color: var(--hot); }
.muted { color: var(--muted); font-size: .92rem; }
.plain { padding: 1rem; }
.bigempty { font-size: 1.2rem; color: var(--muted); padding: 2rem 0; }
.path { display: block; word-break: break-all; }

/* ---- layout */
.app { display: grid; grid-template-columns: 20rem minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .8rem; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.filter { margin: 0 .8rem .6rem; min-height: 44px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--bg); }
.sidelist { flex: 1; padding: 0 .5rem; }
.sidehead { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .9rem .4rem .3rem; }
.srow { display: block; min-height: 44px; padding: .5rem .7rem; margin: .15rem 0; border-radius: .6rem; text-decoration: none; color: var(--ink); }
.srow:hover { background: var(--chip); }
.srow.active { background: var(--chip2); }
.srow-top { display: flex; gap: .5rem; align-items: baseline; justify-content: space-between; }
.sname { font-weight: 600; overflow-wrap: anywhere; }
.srow-sub { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.badge { min-width: 1.7rem; text-align: center; border-radius: 1rem; padding: 0 .5rem; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9rem; }
.badge.hot { background: var(--hot); color: #fff; }
.chips { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.chip { display: inline-block; border-radius: 1rem; padding: 0 .6rem; background: var(--chip); font-size: .8rem; line-height: 1.6; color: var(--ink); }
.chip.alt { background: var(--chip2); }
.chip.bad { background: var(--bad); color: #fff; }
.side-foot { display: flex; justify-content: space-between; padding: .5rem .8rem; border-top: 1px solid var(--line); }
.empty { color: var(--muted); padding: .6rem; }
.main { min-width: 0; padding-bottom: 7rem; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; }
.toptitle { display: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { max-width: 52rem; padding: .4rem 1.2rem 2rem; }
.only-phone { display: none; }
.scrim { display: none; }

/* ---- buttons */
button { min-height: 44px; padding: 0 1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.quiet { background: transparent; }
button.small { min-height: 44px; font-size: .92rem; }
button.icon { width: 44px; padding: 0; font-size: 1.4rem; background: transparent; border-color: transparent; }
button.linkbtn, .linkbtn { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 0 .3rem; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }

/* ---- home and archive lists */
.wait-card { display: flex; gap: 1rem; align-items: center; padding: 1rem; margin: .7rem 0; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: .8rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-height: 44px; }
.wait-card.hot { border-left-color: var(--hot); }
.wait-count { font-size: 2.2rem; font-weight: 700; min-width: 3rem; text-align: center; }
.wait-body { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.wait-name { font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.wait-sub { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }

/* ---- a session */
.sess-head .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0; }
.counts { color: var(--muted); margin: .2rem 0 .6rem; }
.notice { background: var(--chip2); border-radius: .6rem; padding: .7rem 1rem; margin: .8rem 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: .8rem; padding: .9rem 1rem; margin: .8rem 0; box-shadow: var(--shadow); }
.card.blocker { border-left: 6px solid var(--hot); }
.card.has-answer { border-left: 6px solid var(--good); }
.card-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.qid { font: 600 .85rem ui-monospace, Menlo, Consolas, monospace; background: var(--chip); border-radius: .4rem; padding: 0 .4rem; }
.tick { display: none; color: var(--good); font-size: .85rem; font-weight: 600; }
.card.has-answer .tick { display: inline; }
.q-title { font-size: 1.05rem; margin: .3rem 0; overflow-wrap: anywhere; }
.rich { overflow-wrap: anywhere; }
.rich p { margin: .4rem 0; }
.rich ul { margin: .4rem 0 .4rem 1.2rem; padding: 0; }
.more { margin: .4rem 0; }
.more summary, .done-block > summary, .card.done > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; flex-wrap: wrap; gap: .3rem; }
.inputs { margin: .5rem 0; display: flex; flex-direction: column; gap: .3rem; }
.opt { display: flex; gap: .7rem; align-items: flex-start; min-height: 44px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .6rem; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--chip2); }
.opt input { width: 1.4rem; height: 1.4rem; margin: .1rem 0 0; flex: none; accent-color: var(--accent); }
.opt-text { overflow-wrap: anywhere; }
.mark { margin-left: .5rem; font-size: .75rem; background: var(--chip); border-radius: 1rem; padding: 0 .5rem; color: var(--muted); white-space: nowrap; }
.advice { font-size: .92rem; background: var(--chip); border-radius: .6rem; padding: .5rem .7rem; margin: .5rem 0; overflow-wrap: anywhere; }
.silent { margin: .3rem 0; }
textarea, input[type=text], input[type=search], input:not([type]) { width: 100%; border: 1px solid var(--line); border-radius: .6rem; background: var(--bg); padding: .6rem .8rem; }
/* the filter box has side margins: without this it is wider than the side bar */
input.filter { width: calc(100% - 1.6rem); }
textarea.note { margin-top: .3rem; }
.card-foot { display: flex; justify-content: flex-end; }
.given { background: var(--chip); border-radius: .6rem; padding: .3rem .8rem; margin: .5rem 0; }
.notetext { white-space: pre-wrap; overflow-wrap: anywhere; }
.done-block { margin: 1.5rem 0; }
.card.done { padding: .2rem 1rem .8rem; }
.card.withdrawn { opacity: .8; }
.sum { overflow-wrap: anywhere; }
.copybox { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---- bottom bar and toast */
.bar { position: fixed; left: 20rem; right: 0; bottom: 0; z-index: 5; display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: .6rem 1.2rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0, 0, 0, .12); }
.bar[hidden] { display: none; }
.bar-info { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.bar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); max-width: 90vw; padding: .7rem 1.1rem; border-radius: .7rem; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- sign-in pages */
.plainpage { display: flex; justify-content: center; }
.login { width: 100%; max-width: 26rem; padding: 2rem 1rem; }
.login button { width: 100%; margin: .5rem 0; }
.login input { margin: .3rem 0 .3rem; min-height: 48px; font-size: 1.4rem; letter-spacing: .2em; text-align: center; }
.login label { display: block; margin-top: 1rem; }
.msg { min-height: 1.5rem; color: var(--muted); }
.msg.bad { color: var(--bad); }

/* ---- phone: one column, the side bar is a drawer */
@media (max-width: 700px) {
  .app { display: block; }
  .only-phone { display: inline-flex; align-items: center; justify-content: center; }
  .side { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(21rem, 88vw); height: auto; transform: translateX(-105%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
  .topbar { position: sticky; top: 0; z-index: 4; background: var(--bg); border-bottom: 1px solid var(--line); }
  .toptitle { display: block; }
  .content { padding: .4rem 16px 2rem; }
  .bar { left: 0; padding-left: 16px; padding-right: 16px; }
  .bar-actions { width: 100%; }
  .bar-actions button { flex: 1 1 40%; }
  .bar-actions button.primary { order: -1; flex: 1 1 100%; }
  .main { padding-bottom: 14rem; }
  .toast { bottom: 12rem; }
  .wait-count { font-size: 1.8rem; min-width: 2.4rem; }
}
