/* Greek dubbing studio — "circuit board" look: solder-mask green, gold pads, silkscreen white. */
:root {
  --mask: #0e4a3b;        /* solder mask */
  --mask-deep: #08372b;
  --gold: #d9a92b;        /* ENIG gold pad */
  --gold-ink: #2f2300;
  --silk: #f1f6f3;        /* silkscreen */
  --bench: #e5ebe7;       /* page */
  --panel: #ffffff;
  --ink: #14201b;
  --muted: #5b6a63;
  --line: #d2dbd6;
  --field: #f6f8f7;
  --ok: #2e7d4f;
  --warn: #9a6100;
  --bad: #b4372b;
  --display: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --r-panel: 14px;
  --r-ctl: 8px;
  color-scheme: light;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --mask: #0c4033; --mask-deep: #072c22; --gold: #e3b53a; --silk: #e9f1ec;
    --bench: #0c1411; --panel: #131e1a; --ink: #e4ece8; --muted: #93a39b; --line: #25342e; --field: #0f1915;
    --ok: #5cc28d; --warn: #e3a050; --bad: #f08079;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bench); line-height: 1.5; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--bad); }
.warn-text { color: var(--warn); }
.lead { max-width: 70ch; margin: 0 0 16px; }
code { background: var(--field); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; font-size: 0.9em; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: 0.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 1.45rem; margin-bottom: 14px; }
h3 { font-size: 1.1rem; margin: 24px 0 10px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- board header */
.board { position: relative; overflow: hidden; background: var(--mask); color: var(--silk); }
.traces { position: absolute; inset: 0; width: 100%; height: 100%; }
.traces path { stroke: var(--gold); stroke-width: 3; opacity: 0.38; }
.traces .pads circle, .traces .pads rect { fill: var(--gold); opacity: 0.7; }
.board-inner {
  position: relative; max-width: 1280px; margin: 0 auto; padding: 26px 20px 30px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; gap: 8px; margin-right: auto; }
.brand h1 { font-size: 2rem; font-weight: 700; font-stretch: 90%; }
.budget { min-width: 240px; font-size: 0.9rem; }
.budget strong { font-family: var(--display); font-size: 1.15rem; }
.trace-meter { height: 8px; border-radius: 4px; background: var(--mask-deep); margin-top: 6px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(217, 169, 43, 0.35); }
.trace-meter > span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.trace-meter.hot > span { background: #f0715f; }
.pill { display: inline-block; font-size: 0.78rem; padding: 2px 10px; border-radius: 99px; width: fit-content; }
.pill.gold { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
button.ghost { background: transparent; color: var(--silk); border-color: rgba(241, 246, 243, 0.45); }
button.ghost:hover { border-color: var(--gold); color: #fff; }

/* ---------------------------------------------------------------- layout */
.bench {
  max-width: 1280px; margin: 24px auto 40px; padding: 0 20px;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start;
}
.rail { display: grid; gap: 14px; position: sticky; top: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px 24px; }
.stage { display: grid; gap: 14px; min-width: 0; }
.stage > footer { padding: 0 4px; }

/* ---------------------------------------------------------------- controls */
button, .button {
  font: inherit; font-size: 0.95rem; cursor: pointer; border-radius: var(--r-ctl); padding: 8px 14px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.3;
}
button:hover:not(:disabled), .button:hover { border-color: var(--mask); }
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--mask); color: var(--silk); border-color: var(--mask); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--mask-deep); border-color: var(--gold); }
.danger { color: var(--bad); }
.danger:hover:not(:disabled) { border-color: var(--bad); }
.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.link { border: none; background: none; padding: 4px 0; color: var(--bad); }
select, textarea, input[type="password"] {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: var(--r-ctl);
}
select { padding: 8px 10px; width: 100%; }
textarea { width: 100%; padding: 8px 10px; resize: vertical; }
textarea:focus, select:focus { border-color: var(--mask); }
#gl-text { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 0.88rem; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin: 4px 0 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--mask); }

/* ---------------------------------------------------------------- upload footprint */
.footprint {
  position: relative; display: grid; gap: 6px; justify-items: center; text-align: center; cursor: pointer;
  padding: 30px 18px; border-radius: var(--r-panel); background-color: var(--panel);
  border: 2px dashed color-mix(in srgb, var(--mask) 55%, transparent);
  background-image:
    radial-gradient(circle at 14px 14px, var(--gold) 5px, transparent 6px),
    radial-gradient(circle at calc(100% - 14px) 14px, var(--gold) 5px, transparent 6px),
    radial-gradient(circle at 14px calc(100% - 14px), var(--gold) 5px, transparent 6px),
    radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), var(--gold) 5px, transparent 6px);
  transition: border-color 0.15s, background-color 0.15s;
}
.footprint:hover, .footprint.over { border-color: var(--mask); background-color: color-mix(in srgb, var(--gold) 8%, var(--panel)); }
.footprint input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.footprint:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.drop-title { font-family: var(--display); font-size: 1.1rem; font-weight: 600; max-width: 24ch; }
.progress { display: block; width: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.3s; }

/* ---------------------------------------------------------------- video list */
.list-panel { padding: 18px 16px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px; }
.list-head h2 { margin: 0; font-size: 1.25rem; }
.bulk { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 4px 8px; font-size: 0.88rem; }
.bulk button { padding: 5px 10px; font-size: 0.85rem; }
.jobs { display: grid; gap: 4px; max-height: calc(100vh - 380px); min-height: 60px; overflow-y: auto; }
.job {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
}
.job:hover { background: var(--field); }
.job.selected { border-color: var(--mask); background: color-mix(in srgb, var(--mask) 7%, var(--panel)); }
.job .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .meta { grid-column: 2 / 4; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.job .open { all: unset; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.job .open:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
.empty { padding: 18px 8px; color: var(--muted); }

.status { font-size: 0.75rem; padding: 2px 9px; border-radius: 99px; white-space: nowrap; font-weight: 600;
  background: var(--field); color: var(--muted); border: 1px solid var(--line); }
.status.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.status.running, .status.queued { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.status.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.status.awaiting_confirm { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { border: none; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab[aria-current="page"] { background: var(--mask); color: var(--silk); }

/* ---------------------------------------------------------------- job detail */
.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head .titles { margin-right: auto; min-width: 0; }
.detail-head h2 { margin: 0 0 4px; word-break: break-word; }

.player { position: relative; width: 100%; max-width: 640px; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; object-fit: contain; }
audio.result { width: 100%; max-width: 640px; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* pipeline: five pads joined by a trace */
.pipeline { list-style: none; padding: 0; margin: 4px 0 18px; display: grid; grid-template-columns: repeat(5, 1fr); }
.pipeline li { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 0.82rem; color: var(--muted); }
.pipeline li::before { content: ""; position: absolute; top: 9px; left: -50%; right: 50%; height: 3px; background: var(--line); z-index: 0; }
.pipeline li:first-child::before { display: none; }
.pipeline .pad { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); border: 3px solid var(--line); }
.pipeline li.done { color: var(--ink); }
.pipeline li.done .pad, .pipeline li.done::before, .pipeline li.now::before { background: var(--gold); border-color: var(--gold); }
.pipeline li.now { color: var(--ink); font-weight: 600; }
.pipeline li.now .pad { border-color: var(--gold); box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 30%, transparent); }
.pipeline li.stopped .pad { border-color: var(--bad); }
@media (prefers-reduced-motion: no-preference) {
  .pipeline li.now .pad { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--gold) 0%, transparent); } }
}
.work-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.cost-table { border-collapse: collapse; width: 100%; max-width: 440px; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.cost-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.cost-table .num { text-align: right; }
.cost-table tr.total td { font-weight: 700; border-bottom: none; font-family: var(--display); font-size: 1.05rem; }
.costs { margin-top: 14px; }
.costs summary { cursor: pointer; color: var(--muted); }

.options { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--line); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 8px; }
.opt-grid label { display: grid; gap: 5px; font-size: 0.85rem; color: var(--muted); min-width: 0; }
.voice-row { display: flex; gap: 6px; align-items: center; }
.voice-row select { flex: 1; min-width: 0; }
.preview { display: inline-flex; align-items: center; gap: 6px; }
.preview audio { display: none; }
.play { white-space: nowrap; }

.picker { position: relative; display: inline-block; max-width: 100%; cursor: crosshair; touch-action: none;
  user-select: none; border-radius: 10px; overflow: hidden; background: #000; line-height: 0; margin-top: 6px; }
.picker img { max-width: 100%; max-height: 360px; display: block; pointer-events: none; }
.pick-rect { position: absolute; border: 2px solid var(--gold); background: rgba(217, 169, 43, 0.18);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4); pointer-events: none; }
.burn { margin: 8px 0; }
.field { display: inline-flex; align-items: center; gap: 8px; margin: 10px 12px 4px 0; }
.field select { width: auto; }

/* script editor */
.seg-list { display: grid; }
.seg { display: grid; grid-template-columns: 92px 1fr 1.3fr; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.seg.overflow { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.seg-time { font-variant-numeric: tabular-nums; }
.seg-src { color: var(--muted); }
.seg-edit { display: grid; gap: 2px; }
.counter { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); font-weight: 600; }
.tag-long { display: inline-block; margin-top: 4px; color: var(--bad); font-weight: 600; }
.sticky { position: sticky; bottom: 0; background: var(--panel); padding: 10px 0; border-top: 1px solid var(--line); }

/* empty state: how it works */
.howto { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; max-width: 60ch; }
.howto li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.howto .pad-num { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--gold-ink);
  font-family: var(--display); font-weight: 700; display: grid; place-items: center; }

/* voices */
.vo-list { display: grid; gap: 8px; margin-top: 18px; }
.vo-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.vo-row.is-default { border-color: var(--mask); box-shadow: inset 4px 0 0 var(--gold); }
.vo-name { font-weight: 600; }
.vo-name small { display: block; font-weight: 400; color: var(--muted); }
.vo-group { font-family: var(--display); font-size: 1rem; color: var(--muted); margin: 14px 0 0; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--mask); position: relative; overflow: hidden; }
.login-page .traces { opacity: 0.9; }
.login { position: relative; width: min(380px, 90vw); display: grid; gap: 12px; }
.login h1 { font-size: 1.6rem; }
.login input { padding: 10px 12px; }

@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; }
  .rail { position: static; }
  .jobs { max-height: 50vh; }
}
@media (max-width: 640px) {
  .board-inner { padding: 20px 16px 22px; }
  .brand h1 { font-size: 1.55rem; }
  .bench { padding: 0 16px; }
  .panel { padding: 18px 16px; }
  .opt-grid { grid-template-columns: 1fr; }
  .seg { grid-template-columns: 1fr; gap: 6px; }
  .vo-row { grid-template-columns: 1fr 1fr; }
  .vo-name { grid-column: 1 / -1; }
  .pipeline li span:last-child { font-size: 0.72rem; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 8px 6px; font-size: 0.88rem; }
}

.gl-builtin { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 16px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: inset 4px 0 0 var(--gold); }
.gl-builtin > div:first-child { display: grid; gap: 2px; max-width: 62ch; }
.gl-builtin .actions { margin-top: 0; }
.tab[aria-current="page"] .muted { color: inherit; opacity: 0.85; }
