/*
 * admin.wavilu.com. The Wavilu kit: "Night glow" (dark) and "Warm paper"
 * (light), chosen by the system. No web fonts, no icon fonts.
 */
:root {
  color-scheme: dark;
  --pg: #0F1426;
  --cd: #1A2240;
  --ch: #222B4A;
  --ln: #2A3352;
  --ink: #F3EFE7;
  --so: #A7AEC6;
  --ac: #FF8B3D;
  --on: #1A1206;
  --lk: #8DB6FF;
  --bad: #FF8A80;
  --ok: #5FD08E;
  --oks: #173527;
  --bl: #246FE5;
  --smile: #FF8B3D;
  --stage: #0B1222;
  --cut: #38BDF8;
  --to-cut: #64748B;
  --rejected: #EF4444;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --pg: #FBF6EE;
    --cd: #FFFFFF;
    --ch: #F3E9DA;
    --ln: #EADFCF;
    --ink: #1F2340;
    --so: #6E665B;
    --ac: #F2762E;
    --on: #1F2340;
    --lk: #1E5FCC;
    --bad: #C62828;
    --ok: #1F7A45;
    --oks: #E3F1E8;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--pg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-weight: 600; margin: 0; }
h2:focus, h1:focus { outline: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--lk); }
:focus-visible { outline: 2px solid var(--lk); outline-offset: 2px; }
.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;
}

/* Icons: inline SVG paths drawn with the text colour. */
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The logo: the blue mark with its orange smile, the word, the Admin tag. */
.logo { display: flex; align-items: center; gap: 6px; }
.logo .mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--bl); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 17px; line-height: 1; position: relative; overflow: hidden; flex: none;
}
.logo .mark::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 6px;
  border-bottom: 2px solid var(--smile); border-radius: 0 0 50% 50%;
}
.logo .word { font-weight: 600; font-size: 19px; letter-spacing: .2px; }
.logo .tag { margin-left: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--ch); color: var(--so); }

/* Buttons: 44 px high at least. */
.btn {
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ch); color: var(--ink); font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  text-decoration: none;
}
.btn.primary { background: var(--ac); color: var(--on); font-weight: 600; }
.btn.outline { background: none; border-color: var(--ln); }
.btn.danger { background: none; border-color: var(--bad); color: var(--bad); font-weight: 600; }
.btn.danger.solid { background: var(--bad); color: var(--pg); }
.btn.quiet { background: none; color: var(--so); padding: 0 12px; }
.btn.quiet:hover { color: var(--ink); }
.btn.small { padding: 0 14px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; color: var(--so);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.icon-btn:hover { color: var(--ink); background: var(--ch); }

/* Gates: loading, sign-in and no access. */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate .box { width: min(360px, 100%); text-align: center; }
.gate .logo { justify-content: center; }
.gate h1 { font-size: 22px; margin: 16px 0 8px; }
.gate-text { color: var(--so); margin: 0 0 24px; }
.gate-error { margin: 24px 0 16px; }

/* Forms. */
.form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin: 16px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--so); }
.field input, .field select, .field textarea {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--ln); background: var(--pg);
  color: var(--ink); padding: 0 14px; font-size: 15px; width: 100%;
}
.field textarea { padding: 10px 14px; resize: vertical; min-height: 88px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ac); }
.form-error { margin: 0; color: var(--bad); font-size: 14px; }

/* The site: the side nav and the content. */
.site { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--ln); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.side > .logo { padding: 0 8px 16px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px;
  border-radius: 12px; color: var(--so); text-decoration: none;
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--cd); color: var(--ink); font-weight: 600; }
.nav-count {
  margin-left: auto; min-width: 20px; padding: 0 7px; border-radius: 999px; text-align: center;
  background: var(--ac); color: var(--on); font-size: 12px; font-weight: 600; line-height: 20px;
}
.me { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; }
.me-who { display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 13px; color: var(--so); min-width: 0; }
.me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .btn { justify-content: flex-start; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ch); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none;
}
.content { padding: 24px 32px 48px; min-width: 0; }

/* A view: its head, filters, cards and tables. */
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; min-height: 44px; }
.view-head h2 { font-size: 28px; }
.view-meta { margin-right: auto; color: var(--so); font-size: 13px; }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.search {
  flex: 1 1 240px; max-width: 360px; min-height: 44px; border-radius: 999px;
  border: 1px solid var(--ln); background: var(--cd); color: var(--ink); padding: 0 16px;
}
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 22px; background: var(--ch); }
.seg button {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--so);
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--pg); color: var(--ink); font-weight: 600; }
.seg button:disabled { opacity: .45; cursor: default; }
.seg .icon { width: 16px; height: 16px; }
.seg-count { font-size: 12px; font-weight: 400; color: var(--so); }
.seg-count:not(:empty)::before { content: "·"; margin-right: 6px; }
.seg-pad { margin: 16px; }

.card { background: var(--cd); border: 1px solid var(--ln); border-radius: 16px; margin: 0 0 16px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px 16px; border-bottom: 1px solid var(--ln); }
.card-head h3 { margin-right: auto; font-size: 15px; }
.card-meta { font-size: 13px; color: var(--so); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-size: 12px; font-weight: 400; color: var(--so); text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--ln); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--ln); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.empty, p.empty { color: var(--so); padding: 24px 16px; }
p.empty { margin: 0; padding: 8px 0; }
.sub { display: block; font-size: 13px; color: var(--so); overflow-wrap: anywhere; }
.muted { color: var(--so); }
.warn { display: block; margin-top: 4px; font-size: 12px; color: var(--ac); }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--so); }
.pick tbody tr { cursor: pointer; }
.pick tbody tr.picked td { background: var(--ch); }
.row-open {
  display: block; min-height: 32px; padding: 0; border: 0; background: none; color: var(--ink);
  font-weight: 600; text-align: left; cursor: pointer;
}
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--ch); color: var(--so); font-size: 12px; line-height: 1.3; white-space: nowrap; }
.chip.ok { background: var(--oks); color: var(--ok); }
.chip.ac { background: var(--ac); color: var(--on); font-weight: 600; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--ln); color: var(--so); font-size: 13px; }

/* People: the list and the open person beside it. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.panel { position: sticky; top: 24px; margin: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px; }
.panel-head h3 { margin-right: auto; font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; padding: 0 16px 8px; font-size: 14px; }
.kv dt { color: var(--so); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.group-label { font-size: 12px; color: var(--so); padding: 12px 16px 6px; }
.group { margin: 0 16px; border: 1px solid var(--ln); border-radius: 16px; overflow: hidden; }
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--ln); }
.switch-row .t { flex: 1; min-width: 0; }
.switch-row .t b { display: block; }
.switch-row .s { display: block; font-size: 13px; color: var(--so); }
.switch-row > .icon { color: var(--ac); }
.sw {
  -webkit-appearance: none; appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 44px; height: 26px; border-radius: 13px;
  background: radial-gradient(circle, var(--so) 0 9px, transparent 10px) 0 50% / 26px 26px no-repeat, var(--ch);
}
.sw:checked { background: radial-gradient(circle, #FFFFFF 0 9px, transparent 10px) 18px 50% / 26px 26px no-repeat, var(--ok); }
.sw:disabled { opacity: .45; cursor: default; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px; margin-top: 16px; border-top: 1px solid var(--ln); }
.panel-actions .push { margin-left: auto; }

/* Pipeline. */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.metric { background: var(--cd); border: 1px solid var(--ln); border-radius: 16px; padding: 14px 16px; }
.metric h3 { font-size: 13px; color: var(--so); margin: 0 0 8px; }
.metric dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.metric dt { color: var(--so); }
.metric dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* Dialogs. */
.dialog {
  border: 1px solid var(--ln); border-radius: 20px; background: var(--cd); color: var(--ink); padding: 0;
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
.dialog.wide { width: min(900px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 12px 4px 20px; }
.dialog-titles { flex: 1; min-width: 0; padding-top: 10px; }
.dialog-titles h2 { font-size: 18px; overflow-wrap: anywhere; }
.dialog-sub { margin: 2px 0 0; font-size: 13px; color: var(--so); overflow-wrap: anywhere; }
.dialog-body { padding: 8px 20px 12px; }
.dialog-body h3 { font-size: 14px; margin: 16px 0 8px; }
.dialog-body .table-wrap { border: 1px solid var(--ln); border-radius: 12px; }
.dialog-text { margin: 0; color: var(--so); }
.dialog-body .form-error { margin-top: 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 20px 20px; }

/* The dot figure player. */
.figure { display: block; width: min(420px, 100%); height: auto; aspect-ratio: 1; margin: 0 auto; border-radius: 16px; background: var(--stage); }
.phrase-bar { position: relative; width: min(420px, 100%); height: 14px; margin: 12px auto 0; border-radius: 7px; background: var(--ch); overflow: hidden; }
.seg-mark { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.seg-mark.confirmed, .dot.confirmed { background: var(--cut); }
.seg-mark.proposed, .dot.proposed { background: var(--to-cut); }
.seg-mark.rejected, .dot.rejected { background: var(--rejected); }
.cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 8px 0 0; font-size: 13px; color: var(--so); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.player-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; width: min(420px, 100%); margin: 12px auto 0; }
.player-controls input[type="range"] { flex: 1 1 160px; min-height: 44px; accent-color: var(--ac); }
.player-controls select { min-height: 44px; border-radius: 12px; border: 1px solid var(--ln); background: var(--pg); color: var(--ink); padding: 0 10px; }
.player-controls .frame { font-size: 13px; color: var(--so); min-width: 72px; text-align: right; }

/* The toast: empty = not shown, but still in the page for screen readers. */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 20px; border-radius: 14px;
  background: var(--ink); color: var(--pg); font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.toast.bad { background: var(--cd); color: var(--bad); border: 1px solid var(--bad); }
.toast:empty { padding: 0; border: 0; box-shadow: none; background: none; }

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
}
@media (max-width: 760px) {
  .site { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--ln); background: var(--pg); padding: 8px; gap: 2px;
  }
  .side > .logo { padding: 0 8px 0 4px; }
  .side > .logo .word, .side > .logo .tag { display: none; }
  .nav-link { flex: none; padding: 8px 10px; }
  .nav-count { margin-left: 4px; }
  .me { margin: 0 0 0 auto; padding: 0; flex-direction: row; align-items: center; }
  .me-name { display: none; }
  .me-who { padding: 0 4px; }
  .content { padding: 16px; }
  .view-head h2 { font-size: 22px; }
  .search { max-width: none; }
}
