:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --ink: #14161a;
  --ink-2: #4a5058;
  --ink-3: #7b828c;
  --line: #e3e6ea;
  --line-2: #eef0f3;
  --accent: #015fe4;          /* the logo's royal blue */
  --accent-ink: #ffffff;
  --accent-soft: #e7f0ff;
  --brand-1: #019afe;         /* ring highlight */
  --brand-2: #1f3c9b;         /* ring shadow */
  --danger: #c8202a;
  --danger-soft: #fdeced;
  --ok: #14794a;
  --ok-soft: #e6f4ed;
  --warn: #8a5a06;
  --warn-soft: #fdf3e0;
  --shadow: 0 1px 2px rgba(16, 20, 28, .05), 0 8px 24px rgba(16, 20, 28, .06);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1013;
    --panel: #16191e;
    --panel-2: #1b1f25;
    --ink: #eef1f5;
    --ink-2: #b3bac4;
    --ink-3: #808894;
    --line: #272c34;
    --line-2: #20242a;
    --accent: #52adff;
    --accent-ink: #06182b;
    --accent-soft: #12294a;
    --brand-1: #019afe;
    --brand-2: #1f3c9b;
    --danger: #ff7b81;
    --danger-soft: #351a1e;
    --ok: #64d6a0;
    --ok-soft: #12291f;
    --warn: #e5b45c;
    --warn-soft: #2c2313;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

/* A class with `display` set would otherwise beat the UA rule for [hidden]. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -.01em; }

a { color: var(--accent); }

/* ---------------------------------------------------------------- login */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-card .sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 26px; }

/* ---------------------------------------------------------------- shell */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mark {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  display: block;
}
.auth-card .brand .mark { width: 44px; height: 44px; }
.brand .name { font-weight: 640; font-size: 15px; white-space: nowrap; }
.brand .tag { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }

.topbar .spacer { flex: 1; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  gap: 20px;
}

@media (min-width: 1000px) {
  .page.split {
    grid-template-columns: minmax(380px, 430px) minmax(0, 1fr);
    align-items: start;
  }
  .page.split > .col-form { position: sticky; top: 78px; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card > header h2 { font-size: 14px; letter-spacing: .01em; }
.card > header .spacer { flex: 1; }
.card > .body { padding: 18px; display: grid; gap: 16px; }

/* ---------------------------------------------------------------- forms */

.field { display: grid; gap: 6px; }

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
label .opt { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 90px;
}

#transcript { min-height: 260px; }

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.hint { font-size: 11.5px; color: var(--ink-3); }

.btn {
  font: inherit;
  font-weight: 570;
  font-size: 13.5px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 8px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--line-2); border-color: transparent; }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- misc */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }

.notice {
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid transparent;
}
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 72px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty .big { font-size: 15px; font-weight: 600; color: var(--ink-2); }

/* ------------------------------------------------------------- progress */

.progress { display: grid; gap: 12px; padding: 56px 24px; place-items: center; text-align: center; }
.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: min(360px, 80%); height: 5px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

/* --------------------------------------------------------------- output */

.tabs { display: flex; gap: 2px; padding: 4px; background: var(--line-2); border-radius: 10px; }
.tabs button {
  font: inherit; font-size: 13px; font-weight: 570;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.tabs button[aria-selected=true] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.summary-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.summary-list li { color: var(--ink-2); font-size: 13.5px; }
.summary-list li strong { color: var(--ink); }

.transcript {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px;
  max-height: 65vh;
  overflow: auto;
}
.transcript .cue { color: var(--ink-3); }
.transcript .idx { color: var(--ink-3); }
.corr { color: var(--danger); font-weight: 700; }
.transcript.mark-bg .corr { background: var(--danger-soft); border-radius: 3px; padding: 0 2px; }

table.log { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.log th, table.log td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.log th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 640; }
table.log td.ts { font-family: var(--mono); color: var(--ink-3); white-space: nowrap; }
table.log td.from { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--ink-3); }
table.log td.to { color: var(--danger); font-weight: 640; }
table.log tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* -------------------------------------------------------------- dialog */

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(8, 10, 14, .45); backdrop-filter: blur(2px); }
dialog > form { display: grid; gap: 16px; padding: 22px; }
dialog h2 { font-size: 16px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media print {
  .topbar, .col-form, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
  .transcript { max-height: none; border: 0; background: #fff; font-size: 11pt; }
  .corr { color: #c00 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------------ nav */

.nav { display: flex; gap: 2px; }
.nav .active { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------------- layout */

.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.filters .field:first-child { grid-column: span 2; }
@media (max-width: 700px) { .filters .field:first-child { grid-column: auto; } }

/* --------------------------------------------------------- table extras */

table.log.hist td { padding: 10px; vertical-align: middle; }
table.log.hist tr.active { background: var(--accent-soft); }
table.log.hist .hint { margin-top: 2px; }

table.log.editor td { padding: 5px 6px; }
table.log.editor input, table.log.editor select { padding: 6px 8px; font-size: 12.5px; }
table.log.editor input:disabled { opacity: .45; }
table.log.editor td:last-child { width: 34px; text-align: right; }

.linkish {
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.linkish:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--line-2);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ------------------------------------------------------- feedback notes */

.notes { display: grid; gap: 8px; }
.notes .note {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 40px 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
}
.notes .note .hint { margin-top: 4px; }
.notes .note button { position: absolute; top: 6px; right: 6px; }

/* ---------------------------------------------------------------- users */

table.log.editor tr.muted td { opacity: .55; }
table.log.editor tr.muted input[type=text],
table.log.editor tr.muted input[type=email] { text-decoration: line-through; }

/* ----------------------------------------------------------------- tags */

.tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.tags .tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.tags .tag button {
  font: inherit;
  font-size: 11px;
  line-height: 1;
  border: 0;
  background: none;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 999px;
}
.tags .tag button:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 20%, transparent); }

.tags .tag-add {
  width: auto;
  font-size: 11.5px;
  padding: 2px 4px;
  border-radius: 999px;
  border-style: dashed;
  color: var(--ink-3);
  background: transparent;
}
table.log.editor td .tags .tag-add { padding: 2px 4px; }

/* --------------------------------------------------- settings sidebar */

.settings-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  gap: 20px;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 860px) {
  .settings-shell { grid-template-columns: 1fr; }
  .settings-shell .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
}

.sidebar {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
}

.sidebar button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s, color .12s;
}
.sidebar button:hover { background: var(--line-2); color: var(--ink); }
.sidebar button.active { background: var(--accent-soft); color: var(--accent); font-weight: 640; }

.sidebar .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--line-2);
  padding: 1px 6px;
  border-radius: 999px;
}
.sidebar button.active .count { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.sidebar .count:empty { display: none; }

.panels { display: grid; gap: 20px; }

.three { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .three { grid-template-columns: 1fr; } }
