/* QAce dashboard — dark, dense, premium. Single gold accent (drinktea).
   No framework, no build step. */
:root {
  --bg: #0b0e12;
  --bg-raise: #0e1217;
  --panel: #11151b;
  --panel-2: #161b22;
  --border: #262d37;
  --border-soft: #1c222b;
  --text: #dee5ec;
  --text-dim: #93a1b0;
  --text-faint: #5f6d7c;
  --accent: #d9b36c;            /* drinktea gold */
  --accent-bright: #e8c988;
  --accent-dim: rgba(217, 179, 108, 0.12);
  --accent-border: rgba(217, 179, 108, 0.38);
  --danger: #f87171;
  --ok: #6ee7a0;
  --shadow: 0 10px 32px rgba(3, 5, 8, 0.55);
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --z-toast: 200; --z-lightbox: 100;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(217, 179, 108, 0.05), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(110, 231, 160, 0.025), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
/* faint grain so large dark surfaces don't read as flat vector */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.016 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { position: relative; z-index: 1; }
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-bright); text-decoration: underline; }
code {
  font-family: var(--mono); font-size: 11.5px; background: var(--bg-raise);
  border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 5px;
  color: var(--accent); word-break: break-all;
}
::selection { background: rgba(217, 179, 108, .28); }
:focus-visible { outline: 2px solid var(--accent-border); outline-offset: 2px; border-radius: 4px; }

.boot { display: flex; height: 100vh; align-items: center; justify-content: center; color: var(--text-dim); }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-raise) 100%);
  border-right: 1px solid var(--border-soft);
  padding: 18px 12px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.logo { padding: 2px 10px 18px; }
.logo .mark { font-weight: 800; font-size: 16px; letter-spacing: -.2px; color: var(--text); }
.logo .mark em { font-style: normal; color: var(--accent); }
.logo span { color: var(--text-faint); font-weight: 500; font-size: 11px; display: block; margin-top: 3px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 9px;
  color: var(--text-dim); margin-bottom: 3px; font-weight: 500;
  border: 1px solid transparent; transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-dim); color: var(--accent-bright); border-color: var(--accent-border); }
.nav a .ico { width: 15px; text-align: center; opacity: .9; }
.sidebar .foot { margin-top: auto; font-size: 11px; color: var(--text-faint); padding: 8px 10px 0; }
.sidebar .foot button { margin-top: 8px; }
.brandmark {
  display: block; margin: 16px 10px 0; padding-top: 14px; border-top: 1px solid var(--border-soft);
  opacity: .78; transition: opacity .2s ease, transform .2s ease;
}
.brandmark:hover { opacity: 1; transform: translateY(-1px); }
.brandmark img { width: 108px; display: block; }
.brandmark .tagline { font-size: 9.5px; color: var(--text-faint); margin-top: 5px; letter-spacing: .3px; }
.main { padding: 26px 32px 70px; min-width: 0; max-width: 1240px; }

/* ---- generic ---- */
h1 { font-size: 19px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.3px; text-wrap: balance; }
h2 { font-size: 13.5px; margin: 22px 0 10px; color: var(--text); font-weight: 600; }
.sub { color: var(--text-dim); font-size: 12.5px; margin-bottom: 20px; }
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-raise) 130%);
  border: 1px solid var(--border-soft); border-radius: 14px; padding: 18px;
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }

button, .btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 13px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; font-family: var(--sans);
  transition: background .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
button:hover:not(:disabled) { background: #1c232c; border-color: #364253; }
button:active:not(:disabled) { transform: translateY(1px) scale(.985); }
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent-bright); font-weight: 600;
}
button.primary:hover:not(:disabled) { background: rgba(217, 179, 108, .2); box-shadow: 0 2px 14px rgba(217, 179, 108, .15); }
button.danger { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); color: var(--danger); }
button.danger:hover:not(:disabled) { background: rgba(248, 113, 113, .16); }
button.small { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }

input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 7.5px 11px; font-size: 12.5px; font-family: var(--sans);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(217, 179, 108, .08);
}
label { display: block; font-size: 11.5px; color: var(--text-dim); margin: 13px 0 5px; font-weight: 500; }
label:first-child { margin-top: 0; }
.field-note { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
form .full { width: 100%; }

/* ---- stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-raise) 140%);
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 15px;
}
.stat .n { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .l { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; letter-spacing: .3px; }
.stat.critical .n { color: #fda4af; } .stat.high .n { color: #fdba74; }
.stat.medium .n { color: #fcd34d; } .stat.low .n { color: #7dd3fc; }
.stat.gold .n { color: var(--accent); }

/* ---- login ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 380px; background: linear-gradient(180deg, var(--panel) 0%, var(--bg-raise) 140%);
  border: 1px solid var(--border-soft); border-radius: 16px; padding: 30px; box-shadow: var(--shadow);
}
.auth-card h1 { color: var(--text); }
.auth-card h1 em { font-style: normal; color: var(--accent); }
.auth-card button { width: 100%; margin-top: 18px; padding: 9px; }
.auth-brand { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border-soft); text-align: center; }
.auth-brand img { width: 92px; opacity: .75; transition: opacity .2s ease; }
.auth-brand a:hover img { opacity: 1; }
.error-box {
  background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .3); color: var(--danger);
  border-radius: 9px; padding: 9px 12px; font-size: 12px; margin-top: 12px;
}
.ok-box {
  background: var(--accent-dim); border: 1px solid var(--accent-border); color: var(--accent-bright);
  border-radius: 9px; padding: 9px 12px; font-size: 12px; margin-top: 12px; word-break: break-all;
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; color: var(--text-faint); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
}
td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: rgba(217, 179, 108, .025); }
td .title-link { color: var(--text); font-weight: 600; }

/* ---- chips ---- */
.chip {
  display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 700;
  border: 1px solid transparent; line-height: 1.55; letter-spacing: .2px; font-variant-numeric: tabular-nums;
}
.chip.critical { background: rgba(159, 18, 57, .22); color: #fda4af; border-color: rgba(159, 18, 57, .55); }
.chip.high { background: rgba(154, 52, 18, .22); color: #fdba74; border-color: rgba(154, 52, 18, .55); }
.chip.medium { background: rgba(161, 98, 7, .2); color: #fcd34d; border-color: rgba(161, 98, 7, .5); }
.chip.low { background: rgba(3, 105, 161, .2); color: #7dd3fc; border-color: rgba(3, 105, 161, .5); }
.chip.cat { background: var(--panel-2); color: var(--text-dim); border-color: var(--border); font-weight: 500; }
.chip.status-recording { background: rgba(159, 18, 57, .22); color: #fda4af; border-color: rgba(159, 18, 57, .55); }
.chip.status-recording::before { content: "●"; margin-right: 4px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.chip.status-ended { background: var(--panel-2); color: var(--text-dim); border-color: var(--border); }
.chip.p1 { background: rgba(159, 18, 57, .22); color: #fda4af; border-color: rgba(159, 18, 57, .55); }
.chip.p2 { background: rgba(161, 98, 7, .2); color: #fcd34d; border-color: rgba(161, 98, 7, .5); }
.chip.p3 { background: rgba(3, 105, 161, .2); color: #7dd3fc; border-color: rgba(3, 105, 161, .5); }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-soft); margin: 20px 0 16px; overflow-x: auto; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--text-dim); padding: 8px 15px; font-size: 13px; white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { color: var(--accent-bright); border-bottom-color: var(--accent); font-weight: 600; }

/* ---- timeline ---- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border-soft); }
.tl-item { position: relative; padding: 5px 0 9px; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 3px var(--panel);
}
.tl-item.annotation::before { background: var(--accent); }
.tl-item.navigation::before { background: #7dd3fc; }
.tl-item.screenshot::before { background: var(--ok); }
.tl-item.interaction::before { background: #a78bfa; }
.tl-item.console::before { background: var(--danger); }
.tl-item.network::before { background: #fb923c; }
.tl-item .when { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.tl-item .desc { margin-top: 1px; }

/* ---- annotation cards ---- */
.anno {
  border: 1px solid var(--border-soft); border-left-width: 3px; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px; background: var(--panel-2);
  transition: border-color .15s ease;
}
.anno:hover { border-color: var(--border); }
.anno.sev-critical { border-left-color: #9f1239; }
.anno.sev-high { border-left-color: #c2610c; }
.anno.sev-medium { border-left-color: #a16207; }
.anno.sev-low { border-left-color: #0369a1; }
.anno .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.anno .head .t { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 140px; letter-spacing: -.1px; }
.anno .note { color: var(--text-dim); margin: 9px 0; white-space: pre-wrap; line-height: 1.5; }
.analysis { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 10px; font-size: 12.5px; }
.analysis dt { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .7px; margin-top: 9px; font-weight: 700; }
.analysis dd { margin: 3px 0 0; white-space: pre-wrap; line-height: 1.5; color: var(--text-dim); }

/* ---- fix plan ---- */
.fixplan { list-style: none; margin: 0; padding: 0; }
.fixplan li {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px;
  border-bottom: 1px solid var(--border-soft); line-height: 1.45;
}
.fixplan li:last-child { border-bottom: none; }
.fixplan .box {
  flex: none; width: 14px; height: 14px; margin-top: 1px; border: 1.5px solid var(--accent-border);
  border-radius: 4px;
}
.fixplan .todo { flex: 1; }
.fixplan .todo .refs { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 2px; }

/* ---- screenshots ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.shot {
  border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden;
  background: var(--panel-2); transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
}
.shot:hover { transform: translateY(-2px); border-color: var(--accent-border); box-shadow: 0 8px 22px rgba(3, 5, 8, .5); }
.shot img { width: 100%; height: 150px; object-fit: cover; object-position: top; display: block; cursor: zoom-in; background: #fff; }
.shot .cap { padding: 8px 11px; font-size: 10.5px; color: var(--text-dim); font-family: var(--mono); }
.lightbox {
  position: fixed; inset: 0; background: rgba(4, 6, 9, .9); z-index: var(--z-lightbox);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; box-shadow: 0 24px 80px rgba(0,0,0,.7); }

/* ---- report ---- */
.report-md {
  background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 20px 26px; overflow-x: auto; line-height: 1.6; max-width: 860px;
}
.report-md h1 { font-size: 17px; }
.report-md h2 { font-size: 15px; border-bottom: 1px solid var(--border-soft); padding-bottom: 5px; color: var(--accent-bright); }
.report-md h3 { font-size: 13.5px; } .report-md h4, .report-md h5 { font-size: 12.5px; color: var(--accent); }
.report-md pre { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 9px; padding: 11px; overflow-x: auto; }
.report-md li { margin: 2.5px 0; }

/* ---- settings ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 14px; align-items: start; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 5px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-faint); } .kv dd { margin: 0; word-break: break-all; }
.snippet {
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px;
  font-family: var(--mono); font-size: 11px; color: var(--accent); word-break: break-all; user-select: all;
}
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lab { font-size: 12.5px; }
.toggle-row .lab small { display: block; color: var(--text-faint); margin-top: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--accent-border); color: var(--accent-bright);
  padding: 10px 15px; border-radius: 11px; font-size: 12.5px;
  box-shadow: var(--shadow); max-width: 380px; animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }
.toast.err { border-color: rgba(248, 113, 113, .4); color: var(--danger); }

/* ---- states ---- */
.empty {
  text-align: center; color: var(--text-faint); padding: 46px 20px;
  border: 1px dashed var(--border); border-radius: 12px; line-height: 1.7;
}
.empty b { color: var(--text-dim); }
.spin {
  display: inline-block; width: 12px; height: 12px; border: 2px solid var(--text-faint);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--panel-2) 25%, #1b222b 50%, var(--panel-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton.row-lg { height: 46px; margin: 8px 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; }
  .sidebar .foot { margin: 0 0 0 auto; }
  .brandmark { display: none; }
  .nav { display: flex; gap: 4px; }
  .main { padding: 18px; }
}
