:root {
  --bg: #0d0e10;
  --panel: #15171a;
  --panel-2: #1c1f23;
  --panel-3: #24282d;
  --line: #2b2f35;
  --text: #eceef0;
  --muted: #9097a0;
  --faint: #626973;
  --accent: #ff7a45;
  --accent-soft: rgba(255, 122, 69, .14);
  --ok: #3ccf82;
  --ok-soft: rgba(60, 207, 130, .13);
  --danger: #ff5a5f;
  --radius: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .15s, border-color .15s, opacity .15s; text-decoration: none;
}
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d06; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04200f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.link-btn:hover { color: var(--text); }
.link-btn.warn:hover { color: var(--danger); }

input[type=text], input:not([type]), input[type=password], input[type=url], textarea, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }

/* ---------- thanh trên ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  border-bottom: 1px solid var(--line); background: var(--panel); min-height: 58px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #1a0d06; font-size: 13px; }
.topbar .title { min-width: 0; flex: 1; }
.topbar .title h1 { font-size: 15px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title p { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.topbar select { width: auto; height: 34px; padding: 0 30px 0 10px; }
.sep { width: 1px; height: 22px; background: var(--line); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.closed { background: rgba(255, 90, 95, .14); color: var(--danger); }

/* ---------- trang review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 18px 14px; gap: 12px; overflow: auto; }
.player {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; width: 100%; max-height: calc(100dvh - 300px); margin: 0 auto;
}
.player video, .player iframe, .player .yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); background: rgba(0,0,0,.72); }
.player .overlay b { color: var(--text); display: block; margin-bottom: 6px; font-size: 15px; }

.timeline { display: flex; align-items: center; gap: 12px; }
.tc-now { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 108px; }
.tc-now b { color: var(--text); font-weight: 600; }
.track { position: relative; flex: 1; height: 30px; cursor: pointer; touch-action: none; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 4px; background: var(--panel-3); }
.track .fill { position: absolute; left: 0; top: 13px; height: 4px; border-radius: 4px; background: #c9ccd1; width: 0; pointer-events: none; }
.track .head { position: absolute; top: 8px; width: 3px; height: 14px; margin-left: -1.5px; background: #fff; border-radius: 2px; pointer-events: none; }
.marker {
  position: absolute; top: 0; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: pointer; transition: transform .12s;
  display: grid; place-items: center; font-size: 8.5px; font-weight: 700; color: #1a0d06; padding: 0;
}
.marker.resolved { background: var(--faint); }
.marker:hover, .marker.active { transform: scale(1.3); z-index: 2; }
.marker-tip {
  position: absolute; bottom: 34px; transform: translateX(-50%); background: var(--panel-3); border: 1px solid var(--line);
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; width: max-content; max-width: 260px; pointer-events: none; z-index: 5;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.marker-tip b { display: block; font-size: 12px; }

.composer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.composer.focus { border-color: var(--accent); }
.composer-row { display: flex; gap: 10px; align-items: flex-start; }
.composer textarea { border: 0; background: transparent; padding: 6px 2px; min-height: 40px; max-height: 180px; resize: none; }
.composer textarea:focus { border: 0; }
.tc-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; margin-top: 2px;
  border-radius: 7px; border: 1px solid transparent; background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: 13px; font-weight: 600; cursor: pointer;
}
.tc-chip.off { background: var(--panel-3); color: var(--faint); text-decoration: line-through; }
.tc-chip svg { width: 14px; height: 14px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.composer-foot .who { font-size: 12.5px; color: var(--muted); min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.composer-foot .who input { width: 170px; height: 30px; padding: 4px 8px; }
.kbd-hint { font-size: 12px; color: var(--faint); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }
.locked-note { text-align: center; color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- cột góp ý ---------- */
.panel { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 3px; border-radius: 8px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.tabs button.on { background: var(--panel-3); color: var(--text); }
.note-box { margin: 12px 16px 0; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; font-size: 13px; white-space: pre-wrap; border-left: 3px solid var(--accent); }
.note-box b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.approval { margin: 12px 16px 0; padding: 10px 12px; background: var(--ok-soft); color: var(--ok); border-radius: 8px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list { flex: 1; overflow: auto; padding: 8px 8px 24px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }
.empty svg { width: 34px; height: 34px; color: var(--faint); display: block; margin: 0 auto 10px; }

.cmt { padding: 11px 10px 10px; border-radius: 9px; border: 1px solid transparent; transition: background .15s, border-color .3s; }
.cmt + .cmt { margin-top: 2px; }
.cmt:hover { background: var(--panel-2); }
.cmt.active { background: var(--panel-2); border-color: var(--line); }
.cmt.flash { border-color: var(--accent); }
.cmt.resolved .cmt-body, .cmt.resolved .cmt-who { opacity: .5; }
.cmt-head { display: flex; align-items: center; gap: 8px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; color: #0d0e10; }
.cmt-who { flex: 1; min-width: 0; line-height: 1.25; }
.cmt-who b { font-size: 13px; }
.cmt-who time { display: block; font-size: 11.5px; color: var(--faint); }
.tc { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; border: 0; background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.tc.general { background: var(--panel-3); color: var(--muted); cursor: default; font-family: var(--font); }
.num { font-size: 11.5px; color: var(--faint); font-weight: 600; min-width: 20px; }
.cmt-body { margin: 6px 0 0 34px; white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.cmt-actions { margin: 6px 0 0 34px; display: flex; gap: 14px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 5px; }
.check.on { color: var(--ok); }
.check svg { width: 14px; height: 14px; }
.replies { margin: 8px 0 0 34px; border-left: 2px solid var(--line); padding-left: 10px; display: flex; flex-direction: column; gap: 8px; }
.reply { font-size: 13px; }
.reply .avatar { width: 20px; height: 20px; font-size: 10px; }
.reply-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.reply-head time { color: var(--faint); font-size: 11.5px; }
.reply-body { white-space: pre-wrap; word-wrap: break-word; margin-top: 2px; }
.inline-form { margin: 8px 0 0 34px; }
.inline-form textarea { min-height: 60px; font-size: 13px; }
.inline-form .row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

/* ---------- admin ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.search { max-width: 260px; }
.cards { display: grid; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.card h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; }
.card .card-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dot-new { background: var(--accent); color: #1a0d06; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

.login { max-width: 360px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login h1 { font-size: 18px; margin: 14px 0 4px; }

.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 21; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 6px 20px 30px; }
.section { margin-top: 20px; }
.section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.share-row { display: flex; gap: 8px; }
.share-row input { font-family: var(--mono); font-size: 12.5px; }
.ver { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; margin-bottom: 6px; }
.ver .v-label { font-weight: 700; min-width: 34px; }
.ver .v-src { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-tabs { display: flex; gap: 4px; margin: 10px 0; }
.src-tabs button { border: 1px solid var(--line); background: var(--panel-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); }
.src-tabs button.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.browser { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 8px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.crumbs button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.crumbs button:hover { color: var(--text); background: var(--panel-3); }
.entries { max-height: 300px; overflow: auto; }
.entry { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.entry:last-child { border-bottom: 0; }
.entry:hover { background: var(--panel-2); }
.entry.sel { background: var(--accent-soft); }
.entry svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.entry .e-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .e-size { color: var(--faint); font-size: 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--danger); }
.form-row { display: flex; gap: 8px; align-items: flex-end; }
.form-row .field { flex: 1; margin: 0; }

/* ---------- hộp thoại + toast ---------- */
dialog.modal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(420px, calc(100% - 32px)); }
dialog.modal::backdrop { background: rgba(0,0,0,.6); }
dialog.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--panel-3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: var(--danger); }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; height: auto; }
  .stage { padding: 12px 12px 10px; overflow: visible; }
  .player { max-height: none; }
  .panel { border-left: 0; border-top: 1px solid var(--line); min-height: 50vh; }
  .list { overflow: visible; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .topbar .title { flex-basis: calc(100% - 50px); order: 1; }
  .topbar .brand { order: 0; }
  .topbar .brand span:last-child { display: none; }
  .topbar .actions { order: 2; width: 100%; }
  .topbar .actions select { flex: 1; }
  .kbd-hint { display: none; }
  .card { grid-template-columns: 1fr; }
  .card .card-actions { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .tc-now { min-width: 0; font-size: 12px; }
  .composer-foot { flex-wrap: wrap; }
  .composer-foot .who input { width: 100%; }
}
