/* Dragon Connector HQ, on top of the builder app's styles (../styles/app.css): the same Obsidian,
   Ivory and Dragon Gold, Oxanium, Space Grotesk and IBM Plex Mono. HQ adds tables, figures and a
   wider page. Chart marks use --chart, a darker step of Dragon Gold validated against the panel
   (OKLCH lightness 0.66, chroma above 0.1, contrast above 3:1); hovered marks lift to Dragon Gold. */

:root { --chart: #B08B2A; --chart-hover: #D4AF37; --grid: rgba(248, 248, 246, 0.10); }

.hq main { max-width: 1180px; padding-bottom: 64px; }
.hq.signed-out .topbar, .hq.signed-out .sidebar { display: none; }
.hq.signed-out .layout { display: block; }
.hq .topbar .spacer { flex: 1; }
.who-chip { display: grid; justify-items: end; line-height: 1.2; min-width: 0; }
.who-chip strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.who-chip span { font: 600 0.62rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.btn.icon-only { min-height: 40px; padding: 8px; }
.btn.icon-only .icon { width: 20px; height: 20px; }

/* Phones and tablets: the sections become a strip under the bar (judges and crew have one page). */
@media (max-width: 959px) {
  .hq .sidebar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); position: sticky; top: var(--top); z-index: 40; background: var(--obsidian); scrollbar-width: none; }
  .hq .sidebar::-webkit-scrollbar { display: none; }
  .hq .nav-group { display: contents; }
  .hq .nav-group .label { display: none; }
  .hq .nav-link { flex: none; padding: 7px 10px; border: 1px solid var(--line); white-space: nowrap; font-size: 0.9rem; }
  body.hq:not([data-role="organizer"]) .sidebar { display: none; }
  .who-chip { display: none; }
}

/* Cards and fields keep their content at the top when a neighbour in the row is taller. */
.hq .card, .hq .field, .hq .chart { align-content: start; }

.view-head-row { display: flex; gap: 12px 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.prose-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }

/* Signing in */
.signin { display: grid; gap: 20px; max-width: 440px; margin: 6vh auto 0; }
.signin img { width: 180px; }
.signin .lede { color: var(--muted); }
.access-code { font-size: clamp(1.1rem, 4.5vw, 1.6rem); letter-spacing: 0.06em; color: var(--ivory); overflow-wrap: anywhere; user-select: all; }

/* Stat tiles: a label, a value in the body face (proportional figures) and a note. */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kpi { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ivory); text-decoration: none; }
a.kpi:hover { border-color: var(--gold); color: var(--ivory); }
.tile-label { font-size: 0.85rem; color: var(--muted); }
.tile-value { font: 700 1.9rem/1.1 var(--body); color: var(--ivory); }
.tile-note { font-size: 0.78rem; color: var(--muted); }

.switch-strip { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.switch-strip li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-small); }
.switch-list, .announcement-list, .thread-list, .project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* Charts */
.chart { margin: 0; display: grid; gap: 12px; }
.chart-title { font-weight: 700; }
.columns-frame { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font: 500 0.72rem/1 var(--mono); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.columns { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; height: 160px; border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0 / 100% 50%; }
.column { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; cursor: default; }
.column-bar { position: relative; display: block; width: min(100%, 24px); min-height: 0; background: var(--chart); border-radius: 4px 4px 0 0; }
.column-bar.zero { background: transparent; }
.column:hover .column-bar, .column:focus-visible .column-bar { background: var(--chart-hover); }
.column-value { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font: 600 0.75rem/1 var(--body); color: var(--ivory); white-space: nowrap; }
.x-axis { display: flex; justify-content: space-between; padding-left: 36px; font: 500 0.72rem/1 var(--mono); color: var(--muted); }
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.barlist li { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; gap: 10px; align-items: center; border-radius: var(--radius-small); }
.barlist-label { font-size: 0.9rem; overflow-wrap: anywhere; }
.barlist-track { height: 12px; }
.barlist-bar { display: block; height: 100%; min-width: 2px; background: var(--chart); border-radius: 0 4px 4px 0; }
.barlist li:hover .barlist-bar, .barlist li:focus-visible .barlist-bar { background: var(--chart-hover); }
.barlist-value { font: 600 0.9rem/1 var(--body); font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: right; }
.chart-tip { position: fixed; z-index: 300; max-width: 260px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-small); background: var(--panel-raised); color: var(--ivory); font-size: 0.85rem; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.table-view summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.table-view table { margin-top: 8px; }
.score-meter { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--charcoal); overflow: hidden; min-width: 60px; }
.score-meter > span { display: block; height: 100%; background: var(--chart); border-radius: 2px; }
.plain-list .score-meter { flex: 1; min-width: 80px; margin: 0; }

/* Tables. Under 720px each row becomes a small card with its labels. */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data thead th { font: 600 0.68rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data a { color: var(--ivory); font-weight: 600; text-decoration: none; }
table.data a:hover { color: var(--gold-light); }
.cell-sub { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.leaderboard tr.finalist > th { box-shadow: inset 3px 0 0 var(--gold); }
.leaderboard th[scope="row"] { min-width: 14rem; }
.leaderboard abbr { text-decoration: none; cursor: help; }
.leaderboard .breakdown td { padding-top: 0; }
.leaderboard .breakdown summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 719px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data th, table.data td { display: block; width: 100%; }
  table.data tbody tr { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
  table.data th, table.data td { padding: 4px 0; border: 0; }
  table.data td[data-label]::before { content: attr(data-label); display: block; font: 600 0.62rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
  table.data .num { text-align: left; }
  table.data td:empty { display: none; }
  .leaderboard tr.finalist { border-color: rgba(212, 175, 55, 0.55); }
  .leaderboard tr.finalist > th { box-shadow: none; }
  .table-view table.data tbody tr { display: flex; justify-content: space-between; margin: 0; padding: 6px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
  .table-view table.data th, .table-view table.data td { width: auto; }
}

/* Registration states: a word in every pill, never colour alone. */
.pill.state-registered { border-color: var(--gold); color: var(--gold); }
.pill.state-unconfirmed, .pill.state-waitlist, .pill.state-profile { color: var(--muted); }

/* Lists */
.filter-row { display: grid; gap: 10px; }
.filter-row .row .input { flex: 1; min-width: 200px; }
.filter-row select { width: auto; min-width: 160px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list li > .snippet { flex-basis: 100%; }
.thread-row, .project-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ivory); text-decoration: none; }
.thread-row:hover, .project-row:hover { border-color: var(--gold); color: var(--ivory); }
.rubric-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); font-size: 0.9rem; color: var(--muted); }
.rubric-list strong { color: var(--ivory); font-variant-numeric: tabular-nums; }
.role-help { margin: 0; padding-left: 1.1rem; display: grid; gap: 4px; }

/* Inbox */
.hq-messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hq-messages li { max-width: min(560px, 88%); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hq-messages li.ours { justify-self: end; border-color: rgba(212, 175, 55, 0.45); background: var(--gold-tint); }
.hq-messages .who { display: block; margin-bottom: 4px; font: 600 0.66rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hq-messages p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Check-in desk */
.pass-input { font-size: 1.3rem; letter-spacing: 0.08em; text-transform: uppercase; }
.door-card h2 { font-size: 1.6rem; }

/* Judging */
.criteria { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.score-input { font: 700 1.4rem/1 var(--body); max-width: 140px; }
.score-total { font: 700 1.2rem/1 var(--body); color: var(--ivory); }

@media (forced-colors: active) {
  .column-bar, .barlist-bar, .score-meter > span { background: CanvasText; }
}
