/* Datalac: the Studio's paper workspace (navy actions, gold emphasis, Lora over Be Vietnam Pro), for a phone too. */
@font-face { font-family: 'Be Vietnam Pro'; font-display: swap; font-weight: 400; src: url(/fonts/be-vietnam-pro-vietnamese-400.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-display: swap; font-weight: 400; src: url(/fonts/be-vietnam-pro-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-display: swap; font-weight: 600; src: url(/fonts/be-vietnam-pro-vietnamese-600.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-display: swap; font-weight: 600; src: url(/fonts/be-vietnam-pro-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Lora; font-display: swap; font-weight: 600; src: url(/fonts/lora-vietnamese-600.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: Lora; font-display: swap; font-weight: 600; src: url(/fonts/lora-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --navy: #002e74;
  --navy-2: #1a4790;
  --ink: #0e1f3d;
  --text: #1d2635;
  --muted: #586274;
  --gold: #c19a49;
  --gold-soft: #f6ecd8;
  --bg: #f4f6fa;
  --paper: #ffffff;
  --line: #dfe5ee;
  --field: #f7f9fc;
  --field-line: #cdd6e3;
  --tint: #eaf0f8;
  --error: #b42318;
  --error-soft: #fdf0ee;
  --ok: #2c6e49;
  --ok-soft: #e9f4ee;
  --img: #2f5d8c;
  --img-soft: #e7eef7;
  --snd: #2c6e49;
  --snd-soft: #e6f2eb;
  --txt: #8a6420;
  --txt-soft: #f6ecd8;
  --serif: Lora, Georgia, 'Times New Roman', serif;
  --sans: 'Be Vietnam Pro', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
code { background: var(--tint); padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-word; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--paper);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; color: var(--navy); text-decoration: none; }
nav { display: flex; gap: 4px; }
.tab { background: none; border: 0; padding: 8px 12px; border-radius: 10px; color: var(--muted); font: inherit; cursor: pointer; }
.tab.active { background: var(--tint); color: var(--navy); font-weight: 600; }
.account { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }

main { max-width: 1120px; margin: 0 auto; padding: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.narrow { max-width: 460px; margin: 8vh auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--error); background: var(--error-soft); border-radius: 10px; padding: 8px 12px; margin: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; color: var(--ink); }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--field);
  border: 1px solid var(--field-line); border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
button { font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 14px; border: 1px solid var(--field-line);
  background: var(--paper); color: var(--navy); cursor: pointer; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-2); }
button.link { border: 0; background: none; padding: 6px 4px; color: var(--navy); }
button.danger { color: var(--error); border-color: #f1c7c2; }
button.wide { width: 100%; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.split { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.items { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.items button { width: 100%; text-align: left; border: 0; background: none; color: var(--text); font-weight: 400;
  padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.items button.selected { background: var(--tint); }
.items strong { color: var(--ink); }

.run { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.stage { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--tint); color: var(--navy);
  font-size: .82rem; font-weight: 600; }
.stage.done { background: var(--ok-soft); color: var(--ok); }
.stage.failed, .stage.canceled { background: var(--error-soft); color: var(--error); }
.bar { height: 8px; background: var(--tint); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); transition: width .4s; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0; }
.steps div { background: var(--field); border-radius: 10px; padding: 8px 10px; }
.steps dt { font-size: .8rem; color: var(--muted); }
.steps dd { margin: 0; font-weight: 600; color: var(--ink); }
video { width: 100%; max-height: 70vh; background: #0b1a33; border-radius: 12px; }

.cast { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cast legend { font-family: var(--serif); font-weight: 600; color: var(--ink); padding: 0 6px; }
.person { display: grid; grid-template-columns: 96px 1fr; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.portraits { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.portraits img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--tint); }
.portraits .empty { width: 96px; height: 96px; border-radius: 10px; background: var(--tint); display: grid; place-items: center;
  color: var(--muted); font-size: .8rem; text-align: center; }
.file-button { font-weight: 600; font-size: .85rem; color: var(--navy); cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.shot { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.shot video { max-height: 180px; }
.shot .text { font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wallet { margin-bottom: 16px; }
#admin { display: flex; flex-direction: column; gap: 16px; }
#admin[hidden] { display: none; }
h3 { font-size: 1rem; }
.paid, .log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.paid > li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.paid .row { flex-wrap: wrap; }
.paid > li > button { align-self: flex-start; }
.log li { font-size: .85rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.queue { width: 100%; border-collapse: collapse; font-size: .9rem; }
.queue th, .queue td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.queue th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.devices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px;
  align-items: center; }
.device .name { font-weight: 600; color: var(--ink); flex: 1 1 200px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #aab4c3; margin-right: 6px; }
.dot.online { background: var(--ok); }
.dot.busy { background: var(--gold); }

/* Projects: list, import, vertical timeline, segment detail, order (spec 2026-11-06) */
#projects > div { display: flex; flex-direction: column; gap: 16px; }
#projects > div[hidden] { display: none !important; }
.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.project-row { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; font-weight: 400; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--line); color: var(--text); }
.project-row strong { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); }
.empty-state { align-items: flex-start; }
.importer { max-width: 760px; }
.steps-list { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 18px; }
.steps-list > li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 6px 12px; }
.steps-list > li > * { grid-column: 2; }
.steps-list > li::before { content: counter(step); grid-column: 1; grid-row: 1 / span 6; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .9rem; }
.steps-list h2 { font-size: 1.05rem; }
.button-like { font-weight: 600; border-radius: 10px; padding: 9px 14px; border: 1px solid var(--field-line); color: var(--navy);
  text-decoration: none; background: var(--paper); }
.drop { border: 2px dashed var(--field-line); border-radius: 14px; background: var(--field); padding: 18px; text-align: center;
  cursor: pointer; font-weight: 400; align-items: center; position: relative; }
.drop.over { border-color: var(--gold); background: var(--gold-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.report { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.report:empty { display: none; }
.report li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line);
  font-size: .88rem; overflow-wrap: anywhere; }
.report li:first-child { border-top: 0; }
.report .level { font-weight: 600; font-size: .8rem; }
.level-ok .level { color: var(--ok); }
.level-warning .level { color: var(--txt); }
.level-error { background: var(--error-soft); }
.level-error .level { color: var(--error); }

.project-head h1 { font-size: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.face { display: inline-flex; align-items: center; gap: 6px; background: var(--img-soft); color: var(--img); border-radius: 999px;
  padding: 2px 10px 2px 2px; font-size: .85rem; }
.face img, .face i { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #c9d6e6; display: inline-block; }
.readers summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.readers-list { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reader { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto auto; gap: 8px; align-items: center; }
.reader-name { font-weight: 600; color: var(--ink); }
.readers .row input { flex: 1 1 180px; width: auto; }

.k { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; border-radius: 7px; padding: 2px 8px; }
.k.img { background: var(--img-soft); color: var(--img); }
.k.snd { background: var(--snd-soft); color: var(--snd); }
.k.txt { background: var(--txt-soft); color: var(--txt); }
.k.miss { background: var(--error-soft); color: var(--error); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 4px 0; position: relative; display: flex; flex-direction: column; gap: 10px; }
.timeline::before { content: ''; position: absolute; left: 47px; top: 0; bottom: 0; width: 2px; background: var(--field-line); }
.scene { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 22px; position: relative; }
.scene::before { content: ''; position: absolute; left: 42px; top: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--navy); }
.scene.current::before { background: var(--gold); border-color: var(--gold); }
.scene.warn::before { border-color: var(--error); }
.time { font-size: .8rem; color: var(--muted); text-align: right; padding-top: 8px; font-variant-numeric: tabular-nums; }
.scene-card { width: 100%; text-align: left; font-weight: 400; color: var(--text); background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.scene.current .scene-card { border: 2px solid var(--gold); padding: 9px 11px; }
.scene.warn .scene-card { border-color: #e8b4ad; }
.scene-head { display: flex; justify-content: space-between; gap: 8px; color: var(--ink); }
.scene-card .line { font-family: var(--serif); color: var(--text); display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.issues { color: var(--error); font-size: .82rem; }
.progress { color: var(--snd); }
.pause { margin-left: 62px; font-size: .8rem; color: var(--muted); }
.empty-line, .add-line { margin-left: 62px; }

.segment { gap: 10px; min-width: 0; }
.slot { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.segment textarea.reading { font-family: var(--serif); font-size: 1rem; }
.segment textarea.prompt { font-size: .8rem; }
.cast-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; }
.pick input { width: auto; }
.segment-tools button { font-size: .85rem; }

.order-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 16px;
  box-shadow: 0 -6px 18px rgba(14, 31, 61, .06); }
.order { margin-top: 12px; }
.choices { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.choices legend { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; }
.choice input { width: auto; margin-top: 4px; }
.choice span { display: flex; flex-direction: column; }
.choice.off { opacity: .6; }
.switch { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex: 1 1 100%; font-weight: 400; }
.switch input { width: auto; margin: 0; }
.switch .muted { flex: 1 1 100%; }
#run-box { margin: 16px 0; }
.older summary { cursor: pointer; color: var(--navy); font-weight: 600; }

@media (min-width: 900px) {
  #project.detail-open .workbench { grid-template-columns: minmax(0, 1fr) 360px; }
  .segment { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
}
@media (max-width: 899px) {
  #project.detail-open .timeline { display: none; }
}
@media (max-width: 719px) {
  body { padding-bottom: 64px; }
  nav#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--paper); border-top: 1px solid var(--line);
    justify-content: space-around; gap: 0; overflow-x: auto; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  /* Four tabs, five for an admin, fit 360 px (measured: 360 of 360 with "Quản trị"); a wider fallback font
     scrolls the bar itself, never the page. */
  nav#nav .tab { padding: 8px 6px; font-size: 0.8125rem; white-space: nowrap; }
  .order-bar { bottom: 68px; }
  .reader { grid-template-columns: minmax(0, 1fr) auto; }
  .reader select { grid-column: 1 / -1; grid-row: 2; }
  .timeline::before { left: 37px; }
  .scene { grid-template-columns: 30px minmax(0, 1fr); }
  .scene::before { left: 32px; }
  .pause, .empty-line, .add-line { margin-left: 52px; }
}

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
  .account span { display: none; }
  main { padding: 12px; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }

/* Pictures and music (plan 3/5) */
.thumb { width: 160px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--img-soft); }
.thumb.r9x16 { width: 90px; aspect-ratio: 9 / 16; }
.thumb.r1x1 { width: 120px; aspect-ratio: 1 / 1; }
.thumb.r21x9 { width: 189px; aspect-ratio: 21 / 9; }
.thumb.r4x3 { width: 140px; aspect-ratio: 4 / 3; }
.file-pick { position: relative; display: inline-flex; flex-direction: row; align-items: center; gap: 8px; align-self: flex-start;
  font-weight: 600; color: var(--img); background: var(--img-soft); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.file-pick input { position: absolute; inset: 0; width: 1px; height: 1px; opacity: 0; }
.file-pick:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.media audio { width: 100%; max-width: 420px; }
.media input[type=range] { width: 100%; max-width: 420px; }
.media h3 { margin: 6px 0 0; font-size: .95rem; }
.scene.bad .scene-card { border-color: var(--error); }
.scene-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mark { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: .85rem; color: var(--muted); }
.mark input { width: auto; }
.versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.versions li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.versions li.chosen { border-color: var(--gold); }
.versions video, .versions audio { width: 100%; max-width: 360px; }
.tag { font-size: .75rem; border-radius: 999px; padding: 1px 8px; background: var(--img-soft); color: var(--ink); }
.tag.old { background: var(--gold-soft); }
.tag.off { background: var(--error-soft); color: var(--error); }
.scene.bad::before { border-color: var(--error); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
