:root {
  --bg: #f4f6fa; --panel: #fff; --line: #e3e7ee; --text: #1d2330; --muted: #6b7280; --accent: #2563eb; --accent-bg: #e8f0fc;
  --pass: #1a7f37; --pass-bg: #e3f6e8; --fail: #c62828; --fail-bg: #fde8e8; --warn: #b26a00; --warn-bg: #fff3dc; --grey: #4b5563; --grey-bg: #eceef2; --blue: #2563eb; --blue-bg: #e8f0fc;
  --rail: #0f172a; --rail-2: #1e293b; --rail-text: #cbd5e1; --rail-idle: #94a3b8; --rail-active: #fff; --rail-w: 236px; --top-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --panel: #1c2027; --line: #2b313b; --text: #e6e8ec; --muted: #9aa3b2; --accent: #7fb0ff; --accent-bg: #1e2a40;
    --pass: #6fd38a; --pass-bg: #163421; --fail: #ff8a80; --fail-bg: #3b1c1c; --warn: #ffc866; --warn-bg: #3a2c12; --grey: #c3c9d4; --grey-bg: #2a303a; --blue: #7fb0ff; --blue-bg: #1e2a40; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.shell { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar { width: var(--rail-w); flex-shrink: 0; background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; height: var(--top-h); padding: 0 18px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 4px 12px rgba(37, 99, 235, .35); flex-shrink: 0; }
.brand-text { display: grid; line-height: 1.2; } .brand-text b { font-size: 15px; } .brand-text small { font-size: 11px; color: var(--rail-idle); }
.project-box { margin: 6px 12px 10px; padding: 10px 12px; background: var(--rail-2); border-radius: 8px; }
.project-box .lbl { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--rail-idle); }
.project-box .name { color: #fff; font-weight: 700; font-size: 14px; margin: 2px 0; }
.project-box a { color: #93c5fd; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; flex: 1; }
.nav a, .sidebar-foot a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--rail-idle); font-weight: 500; position: relative; }
.nav a:hover, .sidebar-foot a:hover { background: var(--rail-2); color: var(--rail-active); text-decoration: none; }
.nav a.active, .sidebar-foot a.active { background: var(--rail-2); color: var(--rail-active); }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6; }
.nav a svg, .sidebar-foot a svg { flex-shrink: 0; }
.nav .badge { margin-left: auto; font-size: 11px; background: #334155; color: #e2e8f0; padding: 1px 7px; border-radius: 10px; }
.sidebar-foot { padding: 10px; border-top: 1px solid #1e293b; }

/* ---- content ---- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; } .burger { display: none; }
.user { margin-left: auto; color: var(--muted); } .user input { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--text); }
main { padding: 20px 22px; max-width: 1500px; width: 100%; }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 18px 0 8px; } h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.card .n { font-size: 26px; font-weight: 700; } .card .l { color: var(--muted); font-size: 12px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; cursor: pointer; }
.project.default { border-color: var(--accent); }
.project.web { border-style: dashed; } .project .path { font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; } .form-row label { display: grid; gap: 3px; font-size: 12px; }
.chip.run { background: #fef3c7; color: #92400e; } .chip.muted { background: #e5e7eb; color: #6b7280; }
.project .actions { margin-top: 10px; } .project .actions button svg { width: 13px; height: 13px; vertical-align: -2px; }
.project .name { font-size: 18px; font-weight: 700; } .project .tag { display: inline-block; font-size: 11px; background: var(--accent-bg); color: var(--accent); padding: 1px 6px; border-radius: 10px; margin-left: 6px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--grey-bg); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--grey); }
tr.row:hover { background: var(--accent-bg); cursor: pointer; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.pass { background: var(--pass-bg); color: var(--pass); } .chip.fail { background: var(--fail-bg); color: var(--fail); }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.grey { background: var(--grey-bg); color: var(--grey); } .chip.blue { background: var(--blue-bg); color: var(--blue); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.filters input, .filters select, .form input, .form select, .form textarea, .qa-row select, .qa-row input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; }
.form { display: grid; gap: 10px; max-width: 760px; } .form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); } .form textarea { min-height: 220px; font-family: ui-monospace, Consolas, monospace; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: grid; gap: 10px; } .form legend { color: var(--text); font-weight: 600; padding: 0 4px; }
button { padding: 7px 13px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 7px; cursor: pointer; font: inherit; }
button.secondary { background: var(--panel); color: var(--accent); } button:disabled { opacity: .5; cursor: default; }
button.small { padding: 1px 7px; font-size: 11px; border-radius: 5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 6px 6px 0 0; color: var(--muted); } .tabs a.active { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-bottom-color: var(--panel); margin-bottom: -1px; }
.head { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; }
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; font-size: 13px; } .meta b { color: var(--muted); font-weight: 500; margin-right: 4px; }
pre { background: var(--grey-bg); padding: 10px; border-radius: 6px; overflow: auto; font: 12px/1.4 ui-monospace, Consolas, monospace; max-height: 70vh; white-space: pre-wrap; word-break: break-word; }
.md table { margin: 8px 0; } .md h1 { font-size: 18px; } .md h2 { font-size: 15px; } .md code { background: var(--grey-bg); padding: 0 4px; border-radius: 3px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.gallery a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px; font-size: 11px; color: var(--muted); word-break: break-all; }
.gallery img { width: 100%; height: 130px; object-fit: contain; background: #fff; border-radius: 4px; }
.ev a { display: inline-block; margin: 1px 6px 1px 0; font-size: 12px; }
iframe.report { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; z-index: 10; }
.toast.err { background: var(--fail); color: #fff; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.qa-row td { background: var(--accent-bg); }
.hist li { margin-bottom: 4px; }
.inline-list a { margin-right: 8px; }
code.path { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--grey-bg); padding: 1px 4px; border-radius: 3px; }
.ok { color: var(--pass); } .bad { color: var(--fail); }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; } .sidebar.open { transform: none; }
  .burger { display: inline-block; background: none; border: 0; color: var(--text); font-size: 20px; padding: 0 6px; }
  main { padding: 12px; } th, td { padding: 6px 7px; } .user { display: none; }
}

/* ---- khối Retest ---- */
.retest .rt-grid { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.2fr) auto minmax(150px, 1fr) auto; gap: 12px; align-items: end; margin-top: 12px; }
@media (max-width: 1280px) { .retest .rt-grid { grid-template-columns: 1fr 1fr; } .retest .rt-grid .btn-primary { justify-self: start; } }
.fld { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); min-width: 0; }
.fld select, .fld input { height: 36px; width: 100%; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--panel); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; box-sizing: border-box; }
.fld select { appearance: none; -webkit-appearance: none; padding-right: 32px; text-overflow: ellipsis; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.fld select:hover, .fld input:hover { border-color: #c5ccd8; }
.fld select:focus, .fld input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.seg { display: inline-flex; height: 36px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg label { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; border-right: 1px solid var(--line); transition: background .15s, color .15s; }
.seg label:last-child { border-right: 0; } .seg label:hover { background: var(--accent-bg); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; font-weight: 600; }
.seg label:has(input:focus-visible) { box-shadow: inset 0 0 0 2px #fff; }
.btn-primary { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 20px; font-weight: 600; border-radius: 8px; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); transition: filter .15s, transform .05s; }
.btn-primary:hover { filter: brightness(1.08); } .btn-primary:active { transform: translateY(1px); }
.rt-model { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rt-model .rt-model-l { font-weight: 600; color: var(--text); }
.rt-model code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--panel); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line); word-break: break-all; }
.rt-model .rt-src { flex-basis: 100%; font-size: 11.5px; }
.rt-warn { flex-basis: 100%; font-size: 12px; color: var(--warn); }
.rt-hint { margin: 6px 2px 0; }
table.jobs { margin-top: 12px; } table.jobs td { vertical-align: middle; } table.jobs code.path { display: inline-block; margin-top: 2px; font-size: 11px; color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-ghost { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; font-size: 12px; font-weight: 500; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); white-space: nowrap; transition: border-color .15s, color .15s, background .15s; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn-ghost.danger:hover { border-color: var(--fail); color: var(--fail); background: var(--fail-bg); }
.chip .dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; animation: rtpulse 1s ease-in-out infinite; }
@keyframes rtpulse { 50% { opacity: .25; } }
.src-detect { margin-top: -4px; } .src-detect.bad { color: var(--fail); }
.rt-err { margin-top: 3px; color: var(--fail); }

/* ---- thanh lưu verdict QA ---- */
.save-bar { position: sticky; bottom: 12px; z-index: 3; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(15, 23, 42, .08); }
.save-bar .fld { min-width: 240px; }
.status-sel { position: relative; display: block; } .status-sel select { padding-left: 28px; }
.sdot { position: absolute; left: 11px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--grey); pointer-events: none; }
.sdot.pass { background: var(--pass); } .sdot.fail { background: var(--fail); } .sdot.warn { background: var(--warn); } .sdot.blue { background: var(--blue); }
.save-info { display: grid; gap: 2px; flex: 1; min-width: 200px; padding-bottom: 2px; } .save-info b { font-size: 13.5px; }
.save-bar .btn-primary { margin-left: auto; } .btn-primary:disabled { filter: none; opacity: .45; box-shadow: none; }

/* ---- úp file test case ---- */
.io-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 4px; }
.io-bar a.btn-ghost { text-decoration: none; } .file-btn { cursor: pointer; }
.seg-sm { height: 28px; } .seg-sm label { font-size: 12px; padding: 0 10px; }
.imp { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); display: grid; gap: 10px; }
.imp-chips { display: flex; gap: 6px; flex-wrap: wrap; } .imp table { background: var(--panel); }
.imp-err { padding: 8px 10px; border-radius: 8px; background: var(--fail-bg); color: var(--fail); font-size: 12.5px; display: grid; gap: 2px; }
.imp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-primary.alt { background: var(--panel); color: var(--accent); }
