/* Figtree, bundled (the CSP only allows fonts from the app itself). Indian scripts fall back
   to the system fonts listed after it. */
@font-face {
  font-family: "Figtree";
  src: url("fonts/Figtree-Latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  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+20B9, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/Figtree-LatinExt.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Graphite neutrals, one blue accent, FCP-style clip colours. */
:root {
  --bg: #1c1c1e;
  --panel: #242426;
  --panel-2: #2e2e31;
  --panel-3: #38383c;
  --line: #38383c;
  --text: #f2f2f3;
  --muted: #a1a1a6;
  --accent: #3d74ff;
  --accent-soft: rgba(61, 116, 255, 0.2);
  --on-accent: #ffffff;
  --hover: rgba(255, 255, 255, 0.06);
  --now: rgba(61, 116, 255, 0.32);
  --select: #f2c94c;
  --cut: #ff6961;
  --wave: #8a8894;
  --chip: #2e2e31;
  --chip-text: #d4d4d8;
  --broll: #3b5ba9;
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Kohinoor Telugu", "Noto Sans Telugu", "Nirmala UI", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

button, select, input { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px 0 88px; /* leave room for macOS traffic lights */
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
  flex-shrink: 0;
}
.toolbar button, .toolbar select { -webkit-app-region: no-drag; }
.brand { font-weight: 650; letter-spacing: 0.2px; }
.toolbar-group { display: flex; gap: 2px; }
.spacer { flex: 1; }

.setting { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.setting select, .speed {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}

.btn {
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--muted); background: var(--panel-3); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #0d1020); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); filter: brightness(1.12); }
.btn.icon { width: 30px; padding: 0; font-size: 15px; }
.btn.large { height: 40px; padding: 0 22px; font-size: 15px; }
.btn.wide { width: 100%; }

/* Layout */
.workspace { flex: 1; display: flex; min-height: 0; }
.transcript-pane { flex: 0 0 var(--transcript-w, 38%); min-width: 240px; position: relative; display: flex; border-right: 1px solid var(--line); }
.preview-pane {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  overflow: hidden;
}

/* Empty state */
.empty { flex: 1; display: grid; place-items: center; padding: 32px; }
.empty-card { max-width: 440px; text-align: center; }
.empty-card h1 { font-size: 24px; margin: 0 0 10px; font-weight: 650; }
.empty-card p { color: var(--muted); margin: 0 0 22px; }
.empty-card .hint { margin: 14px 0 0; font-size: 13px; }

/* Transcript */
.transcript-wrap { flex: 1; overflow-y: auto; padding: 28px max(28px, calc((100% - 720px) / 2)) 80px; }
.transcript-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.doc-title { font-size: 26px; font-weight: 500; margin: 0; word-break: break-all; }
.doc-language {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.transcript { font-size: var(--transcript-size, 18px); font-family: var(--transcript-font, inherit); line-height: 1.95; outline: none; user-select: none; cursor: text; }
.transcript p { margin: 0 0 22px; padding-left: 14px; border-left: 2px solid var(--line); }
.w { border-radius: 4px; padding: 1px 1px; transition: background-color 80ms; }
.w:hover { background: var(--hover, rgba(255, 255, 255, 0.06)); }
.w.sel { background: var(--accent-soft); }
.w.now { background: var(--now); }
.w.cut { color: var(--cut); text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.55; }
.w.cut.sel { background: rgba(255, 107, 107, 0.25); opacity: 0.85; }
.w.filler:not(.cut) { text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.transcript:focus .w.caret-before { box-shadow: inset 2px 0 0 var(--accent); animation: blink 1s steps(1) infinite; }
.transcript:focus .w.caret-after { box-shadow: inset -2px 0 0 var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { box-shadow: none; } }
.del {
  display: inline-block;
  color: var(--cut);
  opacity: 0.7;
  font-size: 13px;
  padding: 0 3px;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
}
.del:hover { opacity: 1; background: rgba(255, 107, 107, 0.15); }
.editing {
  outline: 2px solid var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  background: var(--accent-soft);
  white-space: pre-wrap;
}


/* Player */
.player {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.stage { position: absolute; overflow: hidden; }
.pic { position: absolute; overflow: hidden; }
.pic-inner { position: absolute; left: 50%; top: 50%; overflow: hidden; }
.pic-inner video { position: absolute; max-width: none; }
.player video#video { display: block; }
.overlay-layers { position: absolute; inset: 0; pointer-events: none; }
.overlay-layer { position: absolute; object-fit: cover; overflow: hidden; }
.track-audio { display: none; }
.caption-layer {
  position: absolute;
  display: flex;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.caption-line { display: inline-block; max-width: 84%; line-height: 1.25; paint-order: stroke fill; overflow-wrap: anywhere; }
.caption-line .cw { white-space: pre-wrap; }
.audio-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle at 50% 40%, #2c3050, #111319 70%);
}
.audio-glyph { font-size: 44px; opacity: 0.7; }
.audio-name { color: var(--muted); font-size: 13px; padding: 0 16px; text-align: center; word-break: break-all; }

.time { font-variant-numeric: tabular-nums; font-size: 14px; }
.muted { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; flex-shrink: 0; }
.stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.stats dt { color: var(--muted); font-size: 11px; }
.stats dd { margin: 1px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Sidebar + rail */
.sidebar {
  width: var(--sidebar-w, 300px);
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar.collapsed { display: none; }
.rail {
  width: 68px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 6px;
}
.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.rail-btn:hover { background: var(--panel-2); color: var(--text); }
.rail-btn.on { background: var(--panel-3); color: var(--text); }
.rail-icon { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }

.panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.panel-body { padding: 8px 16px 16px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.panel-hint { color: var(--muted); font-size: 12px; margin: 0; }
.panel-steps { color: var(--muted); font-size: 12px; margin: 0; padding-left: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--muted); }

.switch { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }

.segmented { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; gap: 2px; }
.segmented.wide { margin: 0 16px 6px; }
.segmented button {
  flex: 1;
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.segmented button.on { background: var(--panel-3); color: var(--text); }

.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121116;
  padding: 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.preset-sample { height: 56px; display: flex; align-items: center; justify-content: center; font-size: 19px; padding: 0 8px; }
.preset-name { font-size: 12px; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--line); background: var(--panel-2); }

.text-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}
.text-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-row { display: flex; gap: 6px; }

.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-item {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-2) center / cover no-repeat;
  cursor: pointer;
  padding: 0;
}
.media-item:hover { border-color: var(--accent); }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 0 5px;
  border-radius: 4px;
}
.media-item .name {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  font-size: 10px;
  padding: 2px 5px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-item.loading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--progress, 30%);
  background: var(--accent);
}
.credit { margin-top: 4px; }

/* Timeline */
.timeline-panel {
  flex-shrink: 0;
  height: var(--timeline-height, 300px);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--line);
  position: relative;
}
.tl-resize { position: absolute; left: 0; right: 0; top: -4px; height: 8px; cursor: ns-resize; z-index: 6; }
.tl-resize::after { content: ""; position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
.tl-resize:hover::after, .tl-resize.dragging::after { background: var(--accent); }
.tl-scrub { height: 6px; background: var(--panel-3); cursor: pointer; flex-shrink: 0; position: relative; }
.tl-scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #e8e7ee; }
.tl-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tl-bar .time { display: flex; align-items: center; gap: 4px; }
.tl-transport { display: flex; align-items: center; gap: 4px; }
.tl-transport .play { width: 34px; font-size: 16px; }
.tl-zoom { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.tl-zoom-label { font-size: 12px; color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.tl-status { font-size: 12px; color: var(--muted); margin-left: 10px; }
.tl-body { flex: 1; min-height: 0; display: flex; overflow-y: auto; overflow-x: hidden; position: relative; }
.tl-heads { width: 132px; flex-shrink: 0; position: relative; margin-top: 4px; border-right: 1px solid var(--line); background: var(--panel); }
.tl-head { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 2px; padding: 0 6px; font-size: 11px; color: var(--muted); }
.tl-head-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tl-head-name.dim { color: var(--muted); }
.tl-head.hidden .tl-head-name, .tl-head.muted .tl-head-name { opacity: 0.5; }
.tl-head-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 2px 3px; border-radius: 4px; cursor: pointer; }
.tl-head-btn:hover { background: var(--panel-3); color: var(--text); }
.tl-head-btn.on { color: var(--cut); }
.tl-head-btn.add { color: var(--accent); font-size: 11px; font-weight: 600; }
.tl-add-menu { position: absolute; left: 8px; top: 30px; bottom: auto; right: auto; width: 240px; }
.tl-add-menu li .muted { margin-left: auto; font-size: 11px; }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; position: relative; align-self: flex-start; }
.tl-content { position: relative; margin: 4px 0; min-width: 100%; cursor: pointer; }
.tl-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }
.tl-lanes { position: absolute; inset: 0; pointer-events: none; }
.tl-lanes .tl-item { pointer-events: auto; }
.tl-item {
  position: absolute;
  top: 2px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #4a8f7d;
  background: var(--broll) center / auto 100% repeat-x;
  color: #eafff8;
  font-size: 11px;
  line-height: 28px;
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.tl-item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tl-item .handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(255, 255, 255, 0.15); }
.tl-chips { position: absolute; left: 0; right: 0; height: 28px; }
.tl-chip {
  position: absolute;
  top: 1px;
  bottom: 1px;
  display: flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 12.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.tl-chip.word { background: var(--chip); color: var(--chip-text); border: 1px solid var(--chip-border, #403f48); }
.tl-chip.word:hover { border-color: var(--muted); color: var(--text); }
.tl-chip.gap { background: transparent; color: var(--muted); border: 1px dashed var(--chip-border, #4a4954); justify-content: center; padding: 0 2px; font-size: 11px; }
.tl-chip.gap.shortened { border-color: var(--cut); color: var(--cut); }
.tl-chip.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  pointer-events: none;
  will-change: transform;
  z-index: 3;
}
.tl-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border: 6px solid transparent;
  border-top-color: var(--accent);
}

/* Overlay, toast, drop */
.overlay { position: fixed; inset: 0; background: rgba(10, 11, 13, 0.72); display: grid; place-items: center; z-index: 10; }
.overlay-card { width: 400px; padding: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.overlay-title { font-weight: 600; font-size: 16px; margin-top: 14px; }
.overlay-detail { color: var(--muted); font-size: 13px; margin-top: 4px; min-height: 20px; }
.progress { margin-top: 14px; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 150ms; }
.progress.indeterminate .progress-bar { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.spinner { width: 28px; height: 28px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 284px;
  transform: translateX(-50%);
  max-width: 640px;
  padding: 10px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.toast.error { border-color: var(--cut); }

.drop-hint {
  position: fixed;
  inset: 12px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: rgba(124, 140, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
  z-index: 30;
}

[hidden] { display: none !important; }

/* Key dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(10, 11, 13, 0.6); display: grid; place-items: center; z-index: 60; }
.dialog { width: 440px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 17px; }
.dialog p { margin: 0; color: var(--muted); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.keys-dialog { width: 520px; max-height: 86vh; overflow-y: auto; }
.key-service { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.key-service-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.key-service-head h3 { margin: 0; font-size: 14px; }
.key-service-head .muted { font-size: 12px; }
.key-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.key-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}
.key-list li.active { border-color: var(--accent); }
.key-list li.empty { color: var(--muted); font-size: 12px; border-style: dashed; background: transparent; }
.key-list input[type="radio"] { accent-color: var(--accent); margin: 0; }
.key-list .key-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-list .key-last4 { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.key-list .badge { font-size: 10px; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0 6px; }
.key-add { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }

/* Keep Export in view on narrower windows. */
.toolbar { min-width: 0; }
.toolbar .btn { flex-shrink: 0; }
.toolbar .setting select { max-width: 150px; }
#btn-keys { font-size: 17px; }
@media (max-width: 1560px) {
  .setting > span { display: none; }
  .toolbar { gap: 8px; }
}
@media (max-width: 1320px) {
  .brand { display: none; }
  .toolbar { gap: 6px; padding-right: 10px; }
  .toolbar .btn:not(.icon) { padding: 0 7px; }
  .toolbar .setting select { max-width: 112px; }
}
.key-list li.key-usage {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  margin: -2px 0 4px;
  padding: 4px 8px 8px;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
}
.key-usage .btn.icon { width: 24px; height: 22px; font-size: 13px; }
.usage-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.usage-bar > div { height: 100%; width: 0; background: var(--accent); }
.key-usage.low .usage-bar > div { background: var(--cut); }
.key-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.key-text .key-name { flex: none; }
.key-note { font-size: 12px; color: var(--muted); cursor: text; overflow-wrap: anywhere; border-radius: 3px; }
.key-note.placeholder { font-style: italic; opacity: 0.6; }
.key-note:hover { color: var(--text); }
.key-note[contenteditable="plaintext-only"] { outline: 1px solid var(--accent); padding: 1px 4px; color: var(--text); background: var(--panel); }
.key-list li.disabled { opacity: 0.55; }
.toggle { position: relative; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; inset: 0; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line); transition: background 120ms; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform 120ms, background 120ms; }
.toggle input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); background: var(--accent); }

/* Properties panel */
.props { gap: 14px; }
.prop-group { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.prop-group h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.prop-row { display: flex; align-items: center; gap: 8px; }
.prop-field { display: flex; flex-direction: column; gap: 4px; flex: 1; font-size: 12px; color: var(--muted); }
.prop-slider { display: grid; grid-template-columns: 52px 1fr 58px 14px; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.prop-group > .prop-slider:first-of-type:not(:has(.lbl)) { grid-template-columns: 1fr 58px 14px auto; }
.prop-slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.text-input.num { height: 26px; padding: 0 6px; text-align: right; font-variant-numeric: tabular-nums; }
.prop-inline { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.prop-inline input[type="color"] { width: 40px; height: 24px; border: 1px solid var(--line); border-radius: 4px; background: none; padding: 0; }
.segmented.wrap { flex-wrap: wrap; }
.segmented.wrap button { flex: 1 1 30%; }
#prop-mute.on { color: var(--cut); }
.lbl { font-size: 12px; color: var(--muted); }

/* Timeline tools */
.tool-picker { position: relative; }
.tool-btn { min-width: 52px; }
.tool-menu {
  position: absolute;
  right: 0;
  bottom: 36px;
  z-index: 15;
  list-style: none;
  margin: 0;
  padding: 4px;
  width: 190px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.tool-menu li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.tool-menu li:hover { background: var(--panel-2); }
.tool-menu li.on { background: var(--panel-3); }
.tool-menu li.on::after { content: "✓"; margin-left: 6px; color: var(--accent); }
.tool-menu .ti { width: 18px; text-align: center; }
.tool-menu kbd { margin-left: auto; }
.tl-content[data-tool="hand"] { cursor: grab; }
.tl-content[data-tool="blade"] { cursor: crosshair; }
.tl-content[data-tool="range"] { cursor: text; }
.tl-content[data-tool="slip"] .tl-item { cursor: ew-resize; }

/* Home screen */
.home { position: fixed; inset: 52px 0 0 0; z-index: 8; background: var(--bg); overflow-y: auto; }
.home-inner { max-width: 1200px; margin: 0 auto; padding: 32px 32px 60px; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.home-head h1 { margin: 0; font-size: 26px; font-weight: 600; }
.home-actions { display: flex; gap: 8px; }
.home-empty { margin-top: 40px; color: var(--muted); text-align: center; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 22px; }
.project-card { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px; cursor: pointer; outline: none; }
.project-card:hover, .project-card:focus { border-color: var(--accent); }
.project-thumb { position: relative; height: 150px; border-radius: 7px; background: #000; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 32px; }
.project-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.project-thumb .badge { position: absolute; right: 6px; bottom: 6px; font-size: 11px; background: rgba(0, 0, 0, 0.7); padding: 0 6px; border-radius: 4px; color: var(--text); }
.project-name { margin-top: 8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-name[contenteditable="plaintext-only"] { outline: 1px solid var(--accent); white-space: normal; padding: 0 4px; }
.project-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 2px; opacity: 0; transition: opacity 100ms; background: rgba(20, 20, 24, 0.85); border-radius: 7px; }
.project-card:hover .project-actions, .project-card:focus-within .project-actions { opacity: 1; }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status.unsaved { color: #f0b35a; }
.doc-title[contenteditable="plaintext-only"] { outline: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
.doc-title { cursor: text; }

.tl-item { position: absolute; }
.tl-item.t-audio { background: repeating-linear-gradient(90deg, #3b3570 0 2px, #2c2850 2px 5px); border-color: #6a60c8; color: #ece9ff; }
.tl-item.k-text { background: #5a3f17; border-color: #c08a3a; color: #ffe9c7; }
.tl-item.off { opacity: 0.45; }
.media-item.audio-tile { background: repeating-linear-gradient(90deg, #3b3570 0 2px, #2c2850 2px 6px); }

/* Canvas editing */
.canvas-ui { position: absolute; z-index: 40; }
.canvas-box { position: absolute; border: 2px solid #a77cff; box-sizing: border-box; pointer-events: none; cursor: move; }
.canvas-handle { position: absolute; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: #fff; border: 1px solid #a77cff; pointer-events: auto; }
.canvas-handle.nw { left: 0; top: 0; cursor: nwse-resize; }
.canvas-handle.ne { right: 0; top: 0; margin-right: -6px; cursor: nesw-resize; }
.canvas-handle.sw { left: 0; bottom: 0; margin-bottom: -6px; cursor: nesw-resize; }
.canvas-handle.se { right: 0; bottom: 0; margin-right: -6px; margin-bottom: -6px; cursor: nwse-resize; }
.canvas-bar {
  position: absolute;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 12px;
}
.canvas-bar button { border: 0; background: transparent; color: var(--text); padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.canvas-bar button:hover { background: var(--panel-3); }
.canvas-bar-name { padding: 0 8px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-bar-size { padding: 0 8px; color: var(--muted); font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.prop-toggle { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); cursor: pointer; }
.prop-toggle b { color: var(--text); }
.prop-toggle input { margin-top: 2px; accent-color: var(--accent); }

/* Elements: text presets */
.text-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.text-preset { position: relative; height: 74px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(135deg, #3a3f4b, #1d2027); cursor: pointer; overflow: hidden; padding: 0; }
.text-preset:hover { border-color: var(--accent); }
.text-preset .overlay-layer { position: absolute; }
.text-preset .preset-name { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 3px 8px; text-align: left; }
#text-content { resize: vertical; font: inherit; }
.prop-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.text-layer { pointer-events: none; user-select: none; }

/* Export dialog */
.export-dialog { width: 520px; }
.export-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.export-presets button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.export-presets button b { font-size: 13px; font-weight: 600; }
.export-presets button span { font-size: 11px; color: var(--muted); }
.export-presets button:hover { border-color: var(--muted); }
.export-presets button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.export-options { display: flex; flex-direction: column; gap: 8px; }

/* Speaker labels */
.speaker-label { display: block; width: fit-content; font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: 0.02em; color: var(--muted); padding: 2px 8px; margin: 0 0 4px -2px; border-radius: 5px; cursor: pointer; }
.speaker-label:hover { background: var(--panel-2); color: var(--text); }
.speaker-menu { position: fixed; right: auto; bottom: auto; width: 220px; z-index: 30; }
.speaker-menu .menu-head { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; cursor: default; }
.speaker-menu .menu-head:hover { background: none; }
.speaker-menu input { width: 100%; box-sizing: border-box; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.head-tools { margin-left: auto; display: flex; gap: 2px; }

/* Transcription choice */
.engine-dialog { width: 520px; }
.engine-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.engine-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.engine-list button b { font-size: 13px; font-weight: 600; }
.engine-list button span { font-size: 11px; color: var(--accent); }
.engine-list button em { font-style: normal; font-size: 11px; color: var(--muted); line-height: 1.35; }
.engine-list button:hover { border-color: var(--muted); }
.engine-list button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.engine-list button:disabled { opacity: 0.5; cursor: default; }
.no-transcript { border: 1px dashed var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 14px; }
.no-transcript p { margin: 0; }

/* B-roll inspector */
.place-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.place-grid button { aspect-ratio: 9 / 13; position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); cursor: pointer; padding: 0; }
.place-grid button i { position: absolute; background: var(--accent); opacity: 0.75; border-radius: 2px; }
.place-grid button:hover { border-color: var(--muted); }
.place-grid button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.btn.danger { color: #ff8a8a; }
.add-as { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }

/* Find and replace */
.find-dialog { width: 460px; }
.word-list h3 { font-size: 12px; color: var(--muted); margin: 6px 0; font-weight: 600; }
.word-list ul { list-style: none; margin: 0; padding: 0; max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.word-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 8px; background: var(--panel-2); border-radius: 6px; }
.word-list li span { flex: 1; }
.word-list li button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.word-list .empty-note { color: var(--muted); background: none; padding: 0; }
.w.found { background: rgba(255, 216, 77, 0.35); border-radius: 3px; }

/* Themes */
:root[data-theme="midnight"] { --bg: #000000; --panel: #121213; --panel-2: #1c1c1e; --panel-3: #2a2a2d; --line: #2a2a2d; --chip: #1c1c1e; }
:root[data-theme="light"] {
  --bg: #f4f4f6; --panel: #ffffff; --panel-2: #ececef; --panel-3: #e0e0e5; --line: #e0e0e4;
  --text: #1c1c1e; --muted: #5f5f66; --chip: #ececef; --chip-text: #2a2a2e; --wave: #8f8d99;
  --now: rgba(47, 99, 240, 0.18); --hover: rgba(0, 0, 0, 0.05); --broll: #8faaf0;
  --select: #c99a06; --cut: #d93025; --scrim: rgba(20, 20, 30, 0.35); --shadow: 0 12px 40px rgba(20, 20, 30, 0.18);
  color-scheme: light;
}
:root[data-theme="light"] .player { background: #1a1a1d; }

/* Density */
:root[data-density="compact"] .toolbar { height: 44px; gap: 8px; }
:root[data-density="compact"] .btn { height: 26px; padding: 0 8px; font-size: 13px; }
:root[data-density="compact"] .btn.icon { width: 26px; padding: 0; }
:root[data-density="compact"] .preview-pane { padding: 10px; gap: 8px; }
:root[data-density="compact"] .transcript-wrap { padding-top: 16px; }
:root[data-density="compact"] .panel-body { gap: 8px; padding: 6px 12px 12px; }
:root[data-density="compact"] .rail { width: 58px; }
:root[data-density="compact"] .stats { display: none; }

/* Splitters and panel toggles */
.splitter { width: 6px; margin: 0 -3px; flex-shrink: 0; cursor: col-resize; position: relative; z-index: 5; }
.splitter:hover, .splitter.dragging { background: var(--accent-soft); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing video { pointer-events: none; }
body.hide-transcript .transcript-pane, body.hide-transcript #split-transcript { display: none; }
body.hide-timeline .timeline-panel { display: none; }
.sidebar.collapsed + .rail, .sidebar.collapsed ~ .rail { border-left: 1px solid var(--line); }
#split-sidebar:has(+ .sidebar.collapsed) { display: none; }
.layout-toggles { display: flex; gap: 0; }
.layout-toggles .btn.on { color: var(--accent); }

/* Preview guides */
.guides, .grid-lines { position: absolute; inset: 0; pointer-events: none; display: none; z-index: 30; }
body.show-guides .guides, body.show-grid .grid-lines { display: block; }
.guides i { position: absolute; background: rgba(255, 80, 80, 0.16); border: 1px dashed rgba(255, 120, 120, 0.55); }
.guides .safe-top { left: 0; right: 0; top: 0; height: 12%; }
.guides .safe-bottom { left: 0; right: 0; bottom: 0; height: 22%; }
.guides .safe-right { right: 0; top: 40%; bottom: 22%; width: 15%; }
.grid-lines i { position: absolute; background: rgba(255, 255, 255, 0.35); }
.grid-lines i:nth-child(1) { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.grid-lines i:nth-child(2) { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.grid-lines i:nth-child(3) { top: 33.33%; left: 0; right: 0; height: 1px; }
.grid-lines i:nth-child(4) { top: 66.66%; left: 0; right: 0; height: 1px; }

/* Settings */
.settings-dialog { width: 560px; max-height: 88vh; overflow-y: auto; }
.set-group { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.set-group h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.set-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.set-row .segmented { grid-column: 2 / 4; }
.set-row select { grid-column: 2 / 4; }
.set-out { font-size: 12px; color: var(--muted); min-width: 36px; }
.set-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.set-workspaces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.set-workspaces button { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.set-workspaces button span { font-size: 11px; color: var(--muted); }
.set-workspaces button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.swatches { display: flex; gap: 8px; grid-column: 2 / 4; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel); }

/* Top bar and AI tools */
.hidden-tool { display: none !important; }
.ai-tools { gap: 8px; }
.ai-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.ai-card > div { flex: 1; min-width: 0; }
.ai-card b { font-size: 13px; font-weight: 600; }
.ai-card p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.ai-card .btn { flex-shrink: 0; }
.ai-card .btn.on { border-color: var(--accent); color: var(--accent); }

/* Transcript header: title on its own line, tools underneath */
.transcript-head { flex-wrap: wrap; row-gap: 6px; }
.transcript-head .doc-title { flex: 1 1 auto; min-width: 0; word-break: normal; overflow-wrap: anywhere; }
.transcript-head .head-tools { flex-basis: 100%; margin-left: -8px; flex-wrap: wrap; }

/* Timeline polish */
:root { --lane: rgba(255, 255, 255, 0.03); --wave-bg: rgba(124, 140, 255, 0.09); --wave: #a6a2bf; --chip-border: #43424c; --film-border: rgba(236, 235, 240, 0.8); }
:root[data-theme="light"] { --lane: rgba(0, 0, 0, 0.035); --wave-bg: rgba(90, 100, 220, 0.08); --wave: #7d7a92; --chip-border: #d2d0da; --film-border: rgba(40, 40, 50, 0.6); }
.tl-item { border-radius: 7px; font-size: 12px; display: flex; align-items: center; padding: 0 10px 0 8px; text-shadow: none; }
.tl-item.t-overlay:not(.k-text) { background-size: auto 100%; background-repeat: repeat-x; }
.tl-item.t-overlay:not(.k-text)::before { content: attr(data-label); background: rgba(0, 0, 0, 0.6); color: #fff; border-radius: 4px; padding: 1px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px; }
.tl-head { font-size: 12px; padding: 0 8px; }

/* Canvas size tiles */
.canvas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.canvas-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; font-size: 12px; }
.canvas-grid button i { display: block; border: 1.5px solid var(--muted); border-radius: 3px; }
.canvas-grid button small { font-size: 10px; color: var(--muted); }
.canvas-grid button:hover { border-color: var(--muted); }
.canvas-grid button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.canvas-grid button.on i { border-color: var(--accent); background: var(--accent-soft); }
#prop-bgmode { flex: 1; margin: 0 8px; }
.btn.icon.on { color: var(--accent); background: var(--accent-soft); }
.bg-video { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(22px) brightness(0.92); pointer-events: none; }

/* Crop on the video */
body.cropping .overlay-layers, body.cropping .caption-layer, body.cropping .canvas-ui, body.cropping .canvas-bar, body.cropping .guides, body.cropping .grid-lines, body.cropping .bg-video { display: none !important; }
.crop-ui { position: absolute; z-index: 40; }
.crop-box { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.66); cursor: move; }
.crop-ui { overflow: hidden; }
.crop-box > i { position: absolute; background: rgba(255, 255, 255, 0.35); pointer-events: none; }
.crop-box > i:nth-of-type(1) { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.crop-box > i:nth-of-type(2) { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.crop-box > i:nth-of-type(3) { top: 33.33%; left: 0; right: 0; height: 1px; }
.crop-box > i:nth-of-type(4) { top: 66.66%; left: 0; right: 0; height: 1px; }
.crop-handle { position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); z-index: 1; }
.crop-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.crop-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-handle.n, .crop-handle.s { left: 50%; margin-left: -12px; width: 24px; height: 6px; cursor: ns-resize; }
.crop-handle.n { top: -3px; } .crop-handle.s { bottom: -3px; }
.crop-handle.e, .crop-handle.w { top: 50%; margin-top: -12px; width: 6px; height: 24px; cursor: ew-resize; }
.crop-handle.e { right: -3px; } .crop-handle.w { left: -3px; }
.crop-bar { position: absolute; z-index: 41; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); white-space: nowrap; }
.crop-bar button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.crop-bar button:hover { background: var(--panel-3); }
.crop-bar button.on { background: var(--accent-soft); color: var(--accent); }
.crop-bar button.primary { background: var(--accent); color: var(--on-accent, #0d1020); font-weight: 600; }
.crop-ratios { display: flex; gap: 1px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.crop-size { font-size: 11px; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }

/* Captions row */
.tl-caps { position: absolute; inset: 0; pointer-events: none; }
.tl-cap { position: absolute; pointer-events: auto; display: flex; align-items: center; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; background: rgba(255, 216, 77, 0.16); color: #ffe48a; border: 1px solid rgba(255, 216, 77, 0.45); }
.tl-cap:hover { background: rgba(255, 216, 77, 0.26); }
.tl-cap.sel { background: rgba(255, 216, 77, 0.38); border-color: #ffd84d; color: #fff; }
:root[data-theme="light"] .tl-cap { color: #6b4e00; background: rgba(255, 200, 40, 0.22); }
.tl-head.caps .tl-head-name { color: #ffd84d; }

/* Windows: a normal title bar, so no room is needed for the macOS window buttons; the face
   finder behind Auto-frame is macOS-only. */
:root[data-platform="win32"] .toolbar { padding-left: 14px; -webkit-app-region: no-drag; }
:root[data-platform="win32"] #prop-autoframe, :root[data-platform="win32"] .ai-card:has(#ai-autoframe) { display: none; }
:root[data-platform="win32"] body { font-family: "Segoe UI", "Nirmala UI", sans-serif; }
:root[data-platform="win32"] .transcript { font-family: var(--transcript-font, "Segoe UI", "Nirmala UI", sans-serif); }

/* Credit */
.brand-by { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.home-credit { position: fixed; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); margin: 0; pointer-events: none; }

/* ===================================================================================
   Redesign, option A: FCP-style studio. Graphite panels, one blue accent, Figtree.
   Later rules here override the older ones above.
   =================================================================================== */
:root { --seg-on: #48484d; --toolbar-h: 48px; }
:root[data-theme="light"] { --seg-on: #ffffff; }
:root[data-theme="midnight"] { --seg-on: #2e2e31; }
:root[data-density="compact"] { --toolbar-h: 44px; }
:root[data-platform="win32"] body { font-family: var(--font); }
:root[data-platform="win32"] .transcript { font-family: var(--transcript-font, var(--font)); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Toolbar */
.toolbar { height: var(--toolbar-h); gap: 10px; background: var(--panel); }
.brand { font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }
.toolbar-group { gap: 2px; }
.btn { height: 32px; border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.icon { width: 32px; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.btn.primary { color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.danger-fill, .btn.primary.danger-fill { background: var(--cut); border-color: var(--cut); color: #fff; }
.layout-toggles .btn.on, .btn.icon.on { color: var(--accent); background: var(--accent-soft); }
.setting select, .speed, .text-input { border-radius: 8px; background: var(--panel); border-color: var(--line); }
.text-input { height: 34px; }

/* Segmented controls */
.segmented { background: var(--panel-2); border: 0; border-radius: 9px; padding: 3px; }
.segmented button { height: 26px; border-radius: 7px; font-size: 13px; font-weight: 600; }
.segmented button.on { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }

/* Empty editor */
.empty-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.6px; }
.empty-card p { font-size: 15px; }

/* Transcript */
.transcript-pane { background: var(--panel); }
.doc-title { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.doc-language { border: 0; background: var(--panel-2); font-weight: 600; padding: 2px 10px; }
.transcript { line-height: 2; }
.transcript p { border-left: 0; padding-left: 0; }
.w.sel { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.w.filler:not(.cut) { text-decoration: none; background: rgba(242, 201, 76, 0.18); }
.speaker-label { padding: 0; margin: 0 0 4px; color: var(--text); font-weight: 700; letter-spacing: 0; }
.speaker-label:hover { background: none; color: var(--accent); }
.no-transcript { border-style: solid; background: var(--panel-2); border-color: transparent; }

/* Viewer */
.preview-pane { padding: 14px; gap: 10px; }
.player { border-radius: 8px; }
.stats div { background: transparent; border: 0; padding: 0; text-align: center; }
.stats dt { font-size: 12px; }
.stats dd { font-weight: 600; }

/* Inspector: icon tabs on the rail */
.sidebar { border-left: 1px solid var(--line); }
.rail { width: 60px; padding: 8px 6px; gap: 2px; }
.rail-btn { padding: 8px 0 6px; gap: 3px; font-size: 11px; font-weight: 500; border-radius: 8px; }
.rail-btn:hover { background: var(--hover); }
.rail-btn.on { background: var(--accent-soft); color: var(--accent); }
.rail-icon { display: grid; place-items: center; height: 20px; }
.rail-icon svg.i { width: 19px; height: 19px; }
.panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-body { padding: 12px 16px 16px; }
.prop-group h3, .set-group h3 { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.prop-group { padding-bottom: 14px; }
.ai-card { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 0; }
.ai-card b { font-size: 14px; }
.ai-card p { font-size: 12px; }
.preset, .text-preset { background: var(--panel-2); border-radius: 10px; }
.preset.on, .canvas-grid button.on, .place-grid button.on, .set-workspaces button.on, .export-presets button.on, .engine-list button.on { box-shadow: none; }

/* Timeline: FCP clip colours, yellow selection */
.timeline-panel { background: var(--panel); }
.tl-bar { height: 44px; }
.tl-transport .play { width: 36px; background: var(--panel-2); border-color: var(--line); }
.tl-scrub { height: 4px; background: var(--panel-2); }
.tl-scrub-fill { background: var(--accent); }
.tl-item { border-radius: 6px; border: 1px solid #7194ea; background-color: #3b5ba9; color: #fff; font-weight: 600; }
.tl-item.sel { border-color: var(--select); box-shadow: 0 0 0 1px var(--select); }
.tl-item.k-text { background: #6b4fb3; border-color: #9a82e0; color: #fff; }
.tl-item.t-audio { background: repeating-linear-gradient(90deg, #2f7a55 0 2px, #276647 2px 5px); border-color: #4fae7f; color: #fff; }
.tl-chip.word { border-radius: 5px; }
.tl-chip.sel { border-color: var(--select); background: rgba(242, 201, 76, 0.18); }
.tl-playhead, .tl-playhead::before { background: var(--cut); }
.tl-playhead::before { background: none; border-top-color: var(--cut); }
.tool-menu { border-radius: 10px; box-shadow: var(--shadow); }
.tool-menu li:hover { background: var(--hover); }
.tool-menu li.on { background: var(--accent-soft); }

/* Overlay, toast */
.overlay { background: var(--scrim); }
.overlay-card { border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.toast { border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }

/* Dialogs are native <dialog> elements filling the window; the inner .dialog is the card. */
dialog.dialog-backdrop {
  margin: 0; padding: 0; border: 0; max-width: none; max-height: none;
  width: 100vw; height: 100vh; background: var(--scrim); color: var(--text);
}
dialog.dialog-backdrop[open] { display: grid; place-items: center; }
dialog.dialog-backdrop::backdrop { background: transparent; }
.dialog { padding: 24px; gap: 16px; border-radius: 14px; box-shadow: var(--shadow); }
.dialog h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.dialog p { font-size: 14px; }
.prop-check { font-size: 14px; color: var(--text); gap: 10px; }
.prop-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.prop-field { font-size: 13px; font-weight: 600; color: var(--text); gap: 6px; }
.confirm-dialog { width: 420px; }

/* Transcribe: one option per row with a radio mark */
.engine-list { grid-template-columns: 1fr; }
.engine-list button {
  display: grid; grid-template-columns: 18px auto 1fr; align-items: baseline; column-gap: 12px; row-gap: 2px;
  padding: 14px 16px; border-radius: 10px; background: transparent;
}
.engine-list button::before {
  content: ""; grid-row: 1 / 3; align-self: start; margin-top: 2px;
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box;
}
.engine-list button b { font-size: 14px; font-weight: 700; }
.engine-list button span { font-size: 12px; color: var(--muted); }
.engine-list button em { grid-column: 2 / 4; font-size: 13px; }
.engine-list button:hover { background: var(--hover); border-color: var(--line); }
.engine-list button.on { border-color: var(--accent); background: var(--accent-soft); }
.engine-list button.on::before { border: 5px solid var(--accent); }

/* Export: preset grid with frame-shape marks */
.export-dialog { width: 620px; }
.export-presets { gap: 10px; }
.export-presets button { min-height: 104px; gap: 4px; padding: 14px; border-radius: 10px; background: transparent; justify-content: flex-end; }
.export-presets button::before {
  content: ""; display: block; margin-bottom: auto; box-sizing: border-box;
  border: 2px solid var(--muted); border-radius: 3px; width: 15px; height: 26px;
}
.export-presets [data-preset="youtube"]::before { width: 40px; height: 23px; }
.export-presets [data-preset="square"]::before { width: 26px; height: 26px; }
.export-presets [data-preset="edited"]::before { border-style: dashed; }
.export-presets [data-preset="audio"]::before { width: 26px; height: 26px; border-radius: 50%; }
.export-presets [data-preset="captions"]::before { width: 36px; height: 24px; border-radius: 5px; }
.export-presets button b { font-size: 14px; font-weight: 700; }
.export-presets button span { font-size: 12px; }
.export-presets button:hover { background: var(--hover); border-color: var(--line); }
.export-presets button.on { border-color: var(--accent); background: var(--accent-soft); }
.export-presets button.on::before { border-color: var(--accent); }

/* Settings, keys, find */
.set-workspaces button, .canvas-grid button, .place-grid button { background: transparent; border-radius: 10px; }
.set-workspaces button.on, .canvas-grid button.on { background: var(--accent-soft); }
.key-list li, .word-list li { background: var(--panel-2); border-radius: 8px; }

/* Home: library sidebar + project table */
.home { inset: var(--toolbar-h) 0 0 0; display: flex; overflow: hidden; }
.home-side {
  width: 232px; flex-shrink: 0; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border-right: 1px solid var(--line);
}
.home-side-label { margin: 0 0 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.home-nav {
  display: flex; justify-content: space-between; align-items: center; height: 34px; padding: 0 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text); font-weight: 500; text-align: left; cursor: pointer;
}
.home-nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.home-nav span { font-size: 12px; color: var(--muted); font-weight: 500; }
.home-side .grow { flex: 1; }
.home-side-note { margin: 0; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.home-side .home-credit { position: static; text-align: left; padding: 8px 10px 0; }
.home-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 28px 32px 0; overflow: hidden; }
.home-head { margin-bottom: 20px; gap: 10px; }
.home-head h1 { flex: 1; font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.home-search { display: flex; align-items: center; gap: 8px; width: 240px; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.home-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.home-empty { margin-top: 0; padding: 48px; border: 1.5px dashed var(--line); border-radius: 12px; }
.home-empty p { margin: 0 0 16px; }
.home-table {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--panel);
}
#home-grid { flex: 1; overflow-y: auto; }
.home-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 80px minmax(0, 220px) 130px 132px; gap: 16px; align-items: center;
  padding: 0 16px; border-bottom: 1px solid var(--line);
}
.home-row-head { height: 36px; font-size: 12px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.project-row { height: 60px; cursor: pointer; color: var(--text); }
.project-row:hover { background: var(--hover); }
.project-row:focus-visible { outline-offset: -2px; background: var(--accent-soft); }
.project-row .cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.project-row .project-thumb { width: 64px; height: 36px; flex-shrink: 0; border-radius: 5px; font-size: 14px; background: var(--panel-2); }
.project-row .project-thumb img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.project-row .project-name { margin: 0; }
.project-row .cell { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.project-row .project-actions { position: static; opacity: 0; background: none; justify-content: flex-end; }
.project-row:hover .project-actions, .project-row:focus-within .project-actions { opacity: 1; }
@media (max-width: 1100px) {
  .home-side { display: none; }
  .home-row { grid-template-columns: minmax(0, 1fr) 70px 110px 132px; }
  .home-row .cell-media { display: none; }
}

/* Drop target */
.drop-hint { background: var(--accent-soft); }

/* Option A, round 2: match the mockup more closely. */
:root {
  --font: "Figtree", "Noto Sans Telugu", "Noto Sans Malayalam", "Noto Sans Tamil", "Noto Sans Kannada", "Noto Sans Devanagari", "Noto Sans Bengali", -apple-system, BlinkMacSystemFont, "Kohinoor Telugu", "Nirmala UI", "Segoe UI", sans-serif;
}
html:root[data-platform] body { font-family: var(--font); }
html:root[data-platform] .transcript { font-family: var(--transcript-font, var(--font)); }

/* Theme button shows the mode you would switch to. */
#btn-theme .i-moon { display: none; }
:root[data-theme="light"] #btn-theme .i-sun { display: none; }
:root[data-theme="light"] #btn-theme .i-moon { display: block; }

/* Panel toggles: tint the icon only, as in the mockup. */
.layout-toggles .btn.on { background: transparent; color: var(--accent); }
.layout-toggles .btn.on:hover { background: var(--hover); }
.brand-by { display: none; }
.dialog-actions .btn.ghost { border-color: var(--line); background: var(--panel); }

/* Inspector tabs sit across the top of the side panel on desktop. When the panel is
   closed the rail stays a slim column on the right so a tab can reopen it. */
@media (min-width: 901px) {
  .workspace { position: relative; }
  .sidebar:not(.collapsed) { padding-top: 44px; position: relative; }
  .sidebar:not(.collapsed) + .rail {
    position: absolute; top: 0; right: 0; z-index: 4;
    width: var(--sidebar-w, 300px); height: 44px; padding: 0; gap: 0;
    flex-direction: row; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  }
  .sidebar:not(.collapsed) + .rail .rail-btn {
    flex: 1; flex-direction: row; justify-content: center; padding: 0; border-radius: 0; height: 44px;
    background: transparent; font-size: 0; gap: 0;
  }
  .sidebar:not(.collapsed) + .rail .rail-btn:hover { background: var(--hover); }
  .sidebar:not(.collapsed) + .rail .rail-btn.on { color: var(--accent); background: transparent; box-shadow: inset 0 -2px var(--accent); }
  .sidebar:not(.collapsed) + .rail .rail-icon svg.i { width: 18px; height: 18px; }
  .panel-head { padding-top: 12px; }
}

/* Audit fixes (web) */
/* No macOS window buttons in a browser tab: no left gutter, nothing draggable. */
:root[data-platform="web"] .toolbar { padding-left: 14px; -webkit-app-region: no-drag; }

/* Timeline bar: the loading status shares the time's cell instead of pushing the zoom
   controls onto a second row over the ruler. */
.tl-bar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.tl-bar .time { grid-column: 1; grid-row: 1; }
.tl-status { grid-column: 1; grid-row: 1; justify-self: end; margin: 0 12px 0 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-transport { grid-column: 2; grid-row: 1; }
.tl-zoom { grid-column: 3; grid-row: 1; }

/* Playhead in the accent colour so it never reads as one of the red cut marks. */
.tl-playhead { background: var(--accent); }
.tl-playhead::before { background: none; border-top-color: var(--accent); }

/* Captions track label readable on a light timeline. */
:root[data-theme="light"] .tl-head.caps .tl-head-name { color: #7a5a00; }
:root[data-theme="light"] .tl-cap.sel { color: #3d2c00; }

/* Cut-word markers: a small pill that stays with the word before it. */
.del {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: 0.1em;
  min-width: 22px; height: 18px; padding: 0 5px; margin: 0 1px; border-radius: 9px;
  font-size: 12px; line-height: 1; opacity: 1;
  color: var(--cut); background: color-mix(in srgb, var(--cut) 14%, transparent);
}
.del:hover { background: color-mix(in srgb, var(--cut) 26%, transparent); }

/* Dialog cards get focus on open; the ring belongs on the controls, not the card. */
.dialog:focus, .dialog:focus-visible, dialog.dialog-backdrop:focus, dialog.dialog-backdrop:focus-visible, .overlay-card:focus { outline: none; }

/* Short labels stay on one line. */
.segmented button { white-space: nowrap; padding: 0 8px; }
.stats dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Title and language tag share a centre line. */
.transcript-head { align-items: center; }
.doc-language { align-self: center; }

/* Indic scripts have tall vowel signs: a little more room in captions and chips. */
.caption-line { line-height: 1.35; }
.tl-chip, .tl-cap { line-height: 1.3; }

/* Layering: the Projects page sits above the editor's on-video handles (z 40–45), so nothing
   from the editor catches clicks meant for the project list. Notices stay on top of it. */
.home { z-index: 50; }
.toast { z-index: 70; }
.drop-hint { z-index: 75; }
.overlay { z-index: 80; }

/* Projects on a phone: one stacked row per project, actions always visible (no hover). */
@media (max-width: 700px) {
  .home-main { padding: 20px 16px 0; }
  .home-head { flex-wrap: wrap; row-gap: 12px; }
  .home-head h1 { flex-basis: 100%; }
  .home-search { flex: 1 1 100%; width: auto; }
  .home-actions { flex-wrap: wrap; }
  .home-row-head { display: none; }
  .home-row {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name actions" "meta actions";
    column-gap: 8px; row-gap: 0; padding: 10px 8px 10px 12px;
  }
  .project-row { height: auto; }
  .project-row .cell-name { grid-area: name; }
  .project-row .cell-len { grid-area: meta; padding-left: 76px; }
  .project-row .cell-when { grid-area: meta; justify-self: end; }
  .project-row .cell-media { display: none; }
  .project-row .project-actions { grid-area: actions; opacity: 1; }
  .project-row .project-thumb { grid-row: span 2; }
}
