:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #12161c;
  --muted: #6b7480;
  --line: #dfe3e8;
  --accent: #1f5fd0;
  --pass: #17803d;
  --fail: #c02b2b;
  --blocked: #b7791f;
  --skip: #6b7480;
  --shadow: 0 1px 2px rgba(16, 22, 28, .06), 0 8px 24px rgba(16, 22, 28, .06);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --panel: #161b22;
    --ink: #e6e9ee;
    --muted: #939ba7;
    --line: #262d36;
    --accent: #5b9cff;
    --pass: #46c07a;
    --fail: #ff6b6b;
    --blocked: #e0a33a;
    --skip: #939ba7;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

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

header.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand { font-weight: 700; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }
.top .spacer { flex: 1; }
.top nav a { margin-left: 14px; text-decoration: none; font-size: 14px; }
.who { font-size: 13px; color: var(--muted); }

.progressbar {
  height: 6px;
  width: 220px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progressbar > i { display: block; height: 100%; background: var(--pass); width: 0; transition: width .3s; }

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  aside.sidebar { order: 2; max-height: none; }
}

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

aside.sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow: auto;
}

.sidebar .filters { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.sidebar input[type="search"] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.section-head {
  padding: 10px 12px 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.qlist { list-style: none; margin: 0; padding: 0 6px 10px; }
.qlist li { display: flex; }
.qlist button {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer;
  font-size: 13px; line-height: 1.35;
}
.qlist button:hover { background: var(--bg); }
.qlist button[aria-current="true"] { background: var(--bg); outline: 1px solid var(--line); }
.qlist .num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 24px; }
.qlist .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--line); flex: 0 0 auto; align-self: center; }
.dot.Pass { background: var(--pass); }
.dot.Fail { background: var(--fail); }
.dot.Blocked { background: var(--blocked); }
.dot.Skipped { background: var(--skip); }

/* --- question card ------------------------------------------------------- */

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

.qmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.badge {
  border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; font-size: 12px;
}
.badge.core { border-color: var(--accent); color: var(--accent); }
.badge.technical { border-color: var(--blocked); color: var(--blocked); }

.testcase { font-size: 18px; line-height: 1.5; margin: 14px 0 6px; }
.review {
  border-left: 3px solid var(--blocked); background: var(--bg); color: var(--muted);
  padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px; margin: 10px 0 0;
}

.statusrow { display: flex; gap: 8px; margin: 18px 0 10px; flex-wrap: wrap; }
.statusrow button {
  flex: 1 1 120px; padding: 12px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); font-weight: 600;
}
.statusrow button kbd {
  font: inherit; font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px; margin-left: 6px;
}
.statusrow button[aria-pressed="true"] { color: #fff; border-color: transparent; }
.statusrow button[aria-pressed="true"] kbd { color: #fff; border-color: rgba(255,255,255,.5); }
.statusrow button[data-status="Pass"][aria-pressed="true"] { background: var(--pass); }
.statusrow button[data-status="Fail"][aria-pressed="true"] { background: var(--fail); }
.statusrow button[data-status="Blocked"][aria-pressed="true"] { background: var(--blocked); }
.statusrow button[data-status="Skipped"][aria-pressed="true"] { background: var(--skip); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.field input, label.field select, textarea {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  width: 100%;
}
textarea { min-height: 120px; resize: vertical; font-family: inherit; }

.evidence-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.btn {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: var(--fail); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.recording { background: var(--fail); border-color: var(--fail); color: #fff; }

.hint { color: var(--muted); font-size: 12px; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.thumb {
  position: relative; width: 168px; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; background: var(--bg);
}
.thumb img, .thumb video { width: 100%; display: block; aspect-ratio: 16/10; object-fit: cover; background: #000; }
.thumb .meta { font-size: 11px; color: var(--muted); padding: 4px 6px; display: flex; justify-content: space-between; gap: 6px; }
.thumb .rm {
  position: absolute; top: 4px; right: 4px; border: 0; border-radius: 99px; width: 22px; height: 22px;
  background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1;
}

.actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

.history { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.history h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.history .row { display: flex; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }

/* --- recorder overlay ---------------------------------------------------- */

.rec-bar {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  background: var(--fail); color: #fff; border-radius: 99px; padding: 10px 16px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); font-weight: 600;
}
.rec-bar button { background: rgba(255,255,255,.2); border: 0; color: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.rec-dot { width: 10px; height: 10px; border-radius: 99px; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

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

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px;
  z-index: 80; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.err { background: var(--fail); color: #fff; }

.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: grid; gap: 12px;
}
.login h1 { margin: 0; font-size: 20px; }
.login p { margin: 0; color: var(--muted); font-size: 13px; }

.uploading { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; width: 160px; }
.uploading > i { display: block; height: 100%; background: var(--accent); width: 0; }

/* --- tables (issues board) ----------------------------------------------- */

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.grid tr:hover td { background: var(--bg); }
.pill { border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; color: #fff; display: inline-block; }
.pill.Fail { background: var(--fail); }
.pill.Blocked { background: var(--blocked); }
.pill.Pass { background: var(--pass); }
.pill.Skipped { background: var(--skip); }
.scroll-x { overflow-x: auto; }

.stat-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
