/* Adly Video Editor (job type video_editor). Web app world: Tajawal 400/500/700, white panels on
 * #f7f7fb, purple #7c3aed. The preview sits on a dark well so footage color is judged true.
 * Type scale: 12 (meta, timecodes), 14 (body, controls), 16 (panel titles), 20 (screen title). */

.ved-root {
  --v-ink: #1a202c;
  --v-muted: #5b6474;
  --v-line: #e6e8f0;
  --v-line-strong: #cfd3e0;
  --v-ground: #f7f7fb;
  --v-card: #ffffff;
  --v-purple: #7c3aed;
  --v-purple-deep: #5b21b6;
  --v-purple-ink: #2e1065;
  --v-purple-soft: #f3edff;
  --v-purple-line: #dccbff;
  --v-well: #15131c;
  --v-bad: #b42318;
  --v-bad-soft: #fee9e8;
  --v-ok: #15803d;
  --v-ease: cubic-bezier(.16, 1, .3, 1);
  position: fixed;
  inset: 0;
  z-index: var(--z-create-nested-modal, 222000);
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: var(--v-ground);
  color: var(--v-ink);
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
body.ved-open { overflow: hidden; }
.ved-root *, .ved-root *::before, .ved-root *::after { box-sizing: border-box; }
.ved-root ::selection { background: var(--v-purple-line); color: var(--v-purple-ink); }
.ved-root :focus-visible { outline: 2px solid var(--v-purple); outline-offset: 2px; }
.ved-tnum { font-variant-numeric: tabular-nums; }
.ved-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ved-ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ved-ico svg, .ved-icon-btn svg, .ved-mini svg, .ved-play svg, .ved-thumb-x svg { width: 100%; height: 100%; }
.ved-loading { place-self: center; grid-row: 1 / -1; color: var(--v-muted); }

/* Buttons */
.ved-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--v-line-strong); background: var(--v-card); color: var(--v-ink);
  font: 500 14px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background .18s var(--v-ease), color .18s var(--v-ease), border-color .18s var(--v-ease);
}
.ved-btn:hover:not(:disabled) { border-color: var(--v-purple-line); color: var(--v-purple-deep); background: var(--v-purple-soft); }
.ved-btn:disabled { opacity: .5; cursor: not-allowed; }
.ved-btn-primary { background: var(--v-purple); border-color: var(--v-purple); color: #fff; font-weight: 700; }
.ved-btn-primary:hover:not(:disabled) { background: var(--v-purple-deep); border-color: var(--v-purple-deep); color: #fff; }
.ved-btn-quiet { background: var(--v-card); }
.ved-btn-lg { min-height: 46px; padding: 10px 20px; border-radius: 12px; font-size: 16px; }
.ved-btn-sm { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.ved-btn-block { width: 100%; }
.ved-icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 9px;
  border: 0; border-radius: 10px; background: transparent; color: var(--v-ink); cursor: pointer;
  transition: background .18s var(--v-ease), color .18s var(--v-ease);
}
.ved-icon-btn:hover:not(:disabled) { background: var(--v-purple-soft); color: var(--v-purple-deep); }
.ved-icon-btn.is-danger:hover:not(:disabled) { background: var(--v-bad-soft); color: var(--v-bad); }
.ved-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.ved-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; border: 0; background: none;
  color: var(--v-purple-deep); font: 500 14px/1.3 inherit; font-family: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--v-purple-line);
}
.ved-link:hover:not(:disabled) { text-decoration-color: currentColor; }
.ved-link:disabled { color: var(--v-muted); cursor: progress; }

/* Fields */
.ved-input, .ved-select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--v-line-strong); background: #fff; color: var(--v-ink);
  font: 400 14px/1.4 inherit; font-family: inherit;
  transition: border-color .18s var(--v-ease), box-shadow .18s var(--v-ease);
}
.ved-input::placeholder { color: #8a92a3; }
.ved-input:focus, .ved-select:focus { outline: none; border-color: var(--v-purple); box-shadow: 0 0 0 3px rgba(124, 58, 237, .16); }
.ved-textarea { min-height: 76px; resize: vertical; }
.ved-select { appearance: auto; min-height: 38px; padding: 6px 10px; }
.ved-field { display: grid; gap: 6px; }
.ved-label { font-size: 14px; font-weight: 500; color: var(--v-ink); }
.ved-help { margin: 0; font-size: 12px; color: var(--v-muted); }
.ved-h3 { margin: 18px 0 8px; font-size: 16px; font-weight: 700; }
.ved-check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 14px; }
.ved-check input { width: 18px; height: 18px; accent-color: var(--v-purple); }
.ved-range { display: grid; gap: 2px; }
.ved-range-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.ved-range-head output { font-size: 12px; color: var(--v-muted); }
.ved-range input[type="range"] { width: 100%; accent-color: var(--v-purple); height: 28px; }

/* ---------------- Setup (Creator step 2) ---------------- */
/* The Creator styles bare buttons; the setup's own controls win by scoping to the section. */
#video-editor-section .ved-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px; border-radius: 10px; width: auto;
  border: 1px solid #cfd3e0; background: #fff; color: #1a202c; box-shadow: none;
  font: 500 14px/1.2 'Tajawal', system-ui, sans-serif; cursor: pointer;
}
#video-editor-section .ved-btn:hover:not(:disabled) { border-color: #dccbff; color: #5b21b6; background: #f3edff; }
#video-editor-section .ved-btn:disabled { opacity: .5; cursor: not-allowed; }
#video-editor-section .ved-btn-primary { background: #7c3aed; border-color: #7c3aed; color: #fff; font-weight: 700; }
#video-editor-section .ved-btn-primary:hover:not(:disabled) { background: #5b21b6; border-color: #5b21b6; color: #fff; }
#video-editor-section .ved-btn-lg { min-height: 46px; padding: 10px 20px; border-radius: 12px; font-size: 16px; }
#video-editor-section .ved-ico { display: inline-flex; width: 18px; height: 18px; }
#video-editor-section .ved-ico svg { width: 100%; height: 100%; }
#video-editor-section .ved-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 2px; color: #5b21b6; font: 500 14px/1.3 'Tajawal', sans-serif; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #dccbff; }
#video-editor-section .ved-input { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px; border: 1px solid #cfd3e0; background: #fff; font: 400 14px/1.4 'Tajawal', sans-serif; color: #1a202c; }
#video-editor-section .ved-input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .16); }
#video-editor-section .ved-textarea { min-height: 76px; resize: vertical; }
#video-editor-section .ved-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#video-editor-section .ved-thumb-x svg { width: 100%; height: 100%; }
#wizard-step-2.is-video-editor > :not(.step-panel-header):not(#video-editor-section) { display: none !important; }
#create-panel:has(#wizard-step-2.is-video-editor.active) #wizard-nav { display: none; }
#video-editor-section { font-family: 'Tajawal', system-ui, sans-serif; color: #1a202c; }
.ved-setup { display: grid; gap: 14px; max-width: 760px; margin: 0 auto; }
.ved-block, .ved-fold {
  display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: #fff;
  border: 1px solid #e6e8f0;
}
.ved-block h3, .ved-fold summary { margin: 0; font-size: 16px; font-weight: 700; color: #1a202c; }
.ved-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ved-block-head h3 { margin: 0; }
.ved-count { font-size: 12px; color: #5b6474; font-variant-numeric: tabular-nums; }
.ved-setup .ved-help { font-size: 14px; color: #5b6474; margin: 0; }
.ved-setup .ved-cost { font-size: 12px; text-align: center; }
.ved-fold summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; min-height: 28px; }
.ved-fold summary::-webkit-details-marker { display: none; }
.ved-fold summary::after { content: ''; margin-inline-start: auto; width: 8px; height: 8px; border-inline-end: 2px solid #5b6474; border-bottom: 2px solid #5b6474; transform: rotate(45deg); transition: transform .2s; }
.ved-fold[open] summary::after { transform: rotate(-135deg); }
.ved-fold-note { font-size: 12px; font-weight: 500; color: #5b6474; }
.ved-thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ved-thumbs.is-small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.ved-thumb { position: relative; aspect-ratio: 9 / 12; border-radius: 12px; overflow: hidden; background: #15131c; }
.ved-thumb video, .ved-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ved-thumb-dur {
  position: absolute; inset-block-end: 6px; inset-inline-start: 6px; padding: 1px 6px; border-radius: 6px;
  background: rgba(21, 19, 28, .78); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums;
}
.ved-thumb-x {
  position: absolute; inset-block-start: 6px; inset-inline-end: 6px; width: 28px; height: 28px; padding: 7px;
  border: 0; border-radius: 999px; background: rgba(21, 19, 28, .72); color: #fff; cursor: pointer;
}
.ved-thumb-x:hover { background: #b42318; }
.ved-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ved-dirs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ved-dir {
  display: grid; gap: 2px; text-align: start; padding: 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid #e6e8f0; background: #fff; font-family: inherit; color: #1a202c;
  transition: border-color .18s, background .18s;
}
.ved-dir:hover { border-color: #dccbff; background: #faf7ff; }
.ved-dir.is-on { border-color: #7c3aed; background: #f3edff; box-shadow: inset 0 0 0 1px #7c3aed; }
.ved-dir-title { font-size: 14px; font-weight: 700; }
.ved-dir-meta { font-size: 12px; color: #5b6474; }
.ved-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ved-seg-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 52px; border-radius: 12px; cursor: pointer;
  border: 1px solid #e6e8f0; background: #fff; font-family: inherit; color: #1a202c; text-align: start;
  transition: border-color .18s, background .18s;
}
.ved-seg-btn:hover { border-color: #dccbff; }
.ved-seg-btn.is-on { border-color: #7c3aed; background: #f3edff; box-shadow: inset 0 0 0 1px #7c3aed; }
.ved-seg-txt { display: grid; font-size: 14px; font-weight: 500; line-height: 1.2; }
.ved-seg-txt small { font-size: 12px; color: #5b6474; font-weight: 400; font-variant-numeric: tabular-nums; }
.ved-ratio { flex: none; border: 2px solid currentColor; border-radius: 3px; color: #5b6474; }
.ved-seg-btn.is-on .ved-ratio { color: #7c3aed; }
.ratio-9x16 { width: 12px; height: 20px; } .ratio-16x9 { width: 22px; height: 13px; } .ratio-1x1 { width: 16px; height: 16px; } .ratio-4x5 { width: 15px; height: 18px; }
.ved-setup-actions { display: grid; justify-items: center; gap: 8px; padding: 6px 0 4px; }
.ved-setup-actions .ved-btn-primary { min-width: 260px; }

/* ---------------- Editor shell ---------------- */
.ved-top {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 58px;
  background: var(--v-card); border-bottom: 1px solid var(--v-line);
}
.ved-top-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.ved-top-title h2 { margin: 0; font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ved-savestate { font-size: 12px; color: var(--v-muted); white-space: nowrap; }
.ved-savestate[data-state="dirty"] { color: var(--v-purple-deep); }
.ved-top-actions { display: flex; align-items: center; gap: 8px; }
.ved-aspect .ved-select { width: auto; min-width: 84px; }
.ved-mtabs { display: none; }
.ved-body {
  min-height: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: minmax(0, 1fr) minmax(220px, 34vh);
  grid-template-areas: 'stage side' 'tl tl';
}
.ved-stage-col { grid-area: stage; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--v-well); }
.ved-stage-wrap { min-height: 0; display: grid; place-items: center; padding: 18px; overflow: hidden; }
.ved-stage {
  position: relative; overflow: hidden; background: #000; border-radius: 6px;
  box-shadow: 0 18px 50px -20px rgba(0, 0, 0, .7);
}
.ved-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; background: #000; }
.ved-shadow-host { position: absolute; inset: 0; pointer-events: none; }
.ved-layer { display: block; }
.ved-render-video { width: 100%; height: 100%; display: block; background: #000; }
.ved-stage-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #b9b4c9; font-size: 14px; text-align: center; padding: 20px; }
.ved-transport {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; color: #ecebf5; min-height: 54px;
}
.ved-play {
  width: 40px; height: 40px; padding: 10px; border-radius: 999px; border: 0; cursor: pointer;
  background: #fff; color: var(--v-purple-ink); display: grid; place-items: center;
}
.ved-play:hover { background: var(--v-purple-soft); }
.ved-time { font-size: 14px; font-variant-numeric: tabular-nums; color: #ecebf5; }
.ved-preview-note { margin-inline-start: auto; font-size: 12px; color: #a9a3bd; }
.ved-viewswitch { margin-inline-start: auto; display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.ved-viewswitch button {
  border: 0; background: transparent; color: #d6d2e5; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font: 500 12px/1.2 inherit; font-family: inherit; min-height: 30px;
}
.ved-viewswitch button.is-on { background: #fff; color: var(--v-purple-ink); }

/* Side panel */
.ved-side { grid-area: side; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--v-card); border-inline-start: 1px solid var(--v-line); }
.ved-tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--v-line); }
.ved-tab {
  position: relative; border: 0; background: none; padding: 10px 12px 12px; cursor: pointer;
  font: 500 14px/1.2 inherit; font-family: inherit; color: var(--v-muted);
}
.ved-tab:hover { color: var(--v-ink); }
.ved-tab.is-on { color: var(--v-purple-deep); font-weight: 700; }
.ved-tab.is-on::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--v-purple); }
.ved-panel { overflow-y: auto; padding: 14px 16px 24px; scrollbar-width: thin; scrollbar-color: var(--v-line-strong) transparent; }
.ved-ai-run { display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--v-purple); color: #fff; box-shadow: 0 10px 24px -14px rgba(46, 16, 101, .55); }
.ved-ai-run-title { margin: 0; font-size: 16px; font-weight: 700; }
.ved-ai-run .ved-help { color: #ede4ff; }
.ved-ai-run .ved-btn { justify-self: start; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.ved-ai-run .ved-btn:hover { background: #fff; color: var(--v-purple-ink); }
.ved-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ved-steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #d9cdfb; }
.ved-steps li.is-done { color: #fff; }
.ved-steps li.is-now { color: #fff; font-weight: 700; }
.ved-step-dot { width: 10px; height: 10px; border-radius: 999px; border: 2px solid currentColor; flex: none; }
.ved-steps li.is-done .ved-step-dot { background: #fff; border-color: #fff; }
.ved-steps li.is-now .ved-step-dot { background: #fff; animation: ved-pulse 1.4s var(--v-ease) infinite; }
.ved-step-sub { font-weight: 500; color: #ede4ff; font-variant-numeric: tabular-nums; }
@keyframes ved-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); } }
@media (prefers-reduced-motion: reduce) { .ved-steps li.is-now .ved-step-dot { animation: none; } }
.ved-ai-empty { display: grid; gap: 12px; justify-items: start; }
.ved-ai-lead, .ved-ai-notes { margin: 0; font-size: 14px; color: var(--v-ink); }
.ved-ai-notes { padding: 12px 14px; border-radius: 12px; background: var(--v-purple-soft); color: var(--v-purple-ink); }
.ved-style-note { margin: 10px 0 0; font-size: 12px; color: var(--v-muted); }
.ved-alert { padding: 10px 12px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; }
.ved-alert.is-error { background: var(--v-bad-soft); color: #7a1a12; }
.ved-ask { display: grid; gap: 8px; margin-top: 14px; }
.ved-ask-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ved-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ved-beat {
  width: 100%; display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; text-align: start;
  padding: 6px; border-radius: 12px; border: 1px solid var(--v-line); background: #fff; cursor: pointer; font-family: inherit; color: var(--v-ink);
}
.ved-beat:hover { border-color: var(--v-purple-line); background: #faf7ff; }
.ved-beat img, .ved-beat-ph { width: 64px; aspect-ratio: 9 / 13; object-fit: cover; border-radius: 8px; background: #15131c; display: block; }
.ved-beat-txt { display: grid; gap: 2px; font-size: 12px; color: var(--v-muted); min-width: 0; }
.ved-beat-head { display: flex; justify-content: space-between; gap: 8px; color: var(--v-ink); font-size: 14px; }
.ved-chapters, .ved-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.ved-log li { padding: 6px 10px; border-radius: 10px; background: var(--v-ground); }
.ved-log li.is-ai { background: var(--v-purple-soft); color: var(--v-purple-ink); }
.ved-redo { margin-top: 16px; }

/* Inspector */
.ved-insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ved-insp-head .ved-h3 { margin: 0; }
.ved-insp-actions { display: flex; gap: 2px; }
.ved-insp-hint { margin-bottom: 8px; font-size: 14px; }
.ved-group { border-top: 1px solid var(--v-line); padding: 4px 0; }
.ved-group summary { list-style: none; cursor: pointer; padding: 10px 0; font-size: 14px; font-weight: 700; display: flex; align-items: center; }
.ved-group summary::-webkit-details-marker { display: none; }
.ved-group summary::after { content: ''; margin-inline-start: auto; width: 7px; height: 7px; border-inline-end: 2px solid var(--v-muted); border-bottom: 2px solid var(--v-muted); transform: rotate(45deg); transition: transform .2s; }
.ved-group[open] summary::after { transform: rotate(-135deg); }
.ved-group-body { display: grid; gap: 10px; padding-bottom: 12px; }
.ved-chips { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ved-chips legend { margin-bottom: 6px; }
.ved-chip { position: relative; }
.ved-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ved-chip span {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--v-line-strong); font-size: 14px; background: #fff;
}
.ved-chip input:checked + span { background: var(--v-purple-soft); border-color: var(--v-purple); color: var(--v-purple-deep); font-weight: 500; }
.ved-chip input:focus-visible + span { outline: 2px solid var(--v-purple); outline-offset: 2px; }

/* Files panel */
.ved-files { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ved-files.is-small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ved-file { position: relative; }
.ved-file-btn {
  position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; display: block;
  border: 0; padding: 0; cursor: pointer; background: #15131c;
}
.ved-file-btn.is-static { cursor: default; }
.ved-file-btn video, .ved-file-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ved-file-audio { display: grid; place-items: center; height: 100%; color: #fff; padding: 30%; }
.ved-file-plus {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(46, 16, 101, .55); color: #fff;
  opacity: 0; transition: opacity .18s var(--v-ease); padding: 34%;
}
.ved-file-btn:hover .ved-file-plus, .ved-file-btn:focus-visible .ved-file-plus { opacity: 1; }
.ved-sfx { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ved-sfx li { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 0; }
.ved-sfx-play { width: 32px; height: 32px; padding: 8px; border-radius: 999px; border: 1px solid var(--v-line-strong); background: #fff; color: var(--v-purple-deep); cursor: pointer; }
.ved-sfx-play:hover { background: var(--v-purple-soft); }
.ved-sfx-name { flex: 1; font-size: 14px; text-transform: capitalize; }

/* Timeline */
.ved-timeline { grid-area: tl; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--v-card); border-top: 1px solid var(--v-line); }
.ved-tl-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--v-line); flex-wrap: wrap; }
.ved-tl-tools, .ved-tl-zoom { display: flex; align-items: center; gap: 4px; }
.ved-tl-zoom input { width: 120px; accent-color: var(--v-purple); }
.ved-tl-sep { width: 1px; height: 22px; background: var(--v-line); margin: 0 6px; }
.ved-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 12px; border-radius: 10px;
  border: 0; background: transparent; cursor: pointer; font: 500 14px/1 inherit; font-family: inherit; color: var(--v-ink);
}
.ved-tool:hover:not(:disabled) { background: var(--v-purple-soft); color: var(--v-purple-deep); }
.ved-tool:disabled { opacity: .35; cursor: not-allowed; }
.ved-tl-grid { min-height: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); overflow-y: auto; }
.ved-tl-heads { position: sticky; left: 0; z-index: 3; background: var(--v-card); border-inline-end: 1px solid var(--v-line); }
.ved-tl-corner { height: 24px; border-bottom: 1px solid var(--v-line); }
.ved-tl-head { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 10px; border-bottom: 1px solid var(--v-line); }
.ved-tl-head.is-audio { height: 36px; }
.ved-tl-name { font-size: 12px; font-weight: 700; color: var(--v-muted); font-variant-numeric: tabular-nums; }
.ved-mini { width: 28px; height: 28px; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--v-muted); cursor: pointer; }
.ved-mini:hover { background: var(--v-purple-soft); color: var(--v-purple-deep); }
.ved-mini[aria-pressed="true"] { color: var(--v-bad); }
.ved-tl-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--v-line-strong) transparent; }
.ved-tl-content { position: relative; min-height: 100%; }
.ved-ruler { position: relative; height: 24px; border-bottom: 1px solid var(--v-line); cursor: ew-resize; background: var(--v-ground); }
.ved-tick { position: absolute; top: 4px; padding-left: 4px; border-left: 1px solid var(--v-line-strong); font-size: 12px; line-height: 16px; color: var(--v-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ved-lane { position: relative; height: 44px; border-bottom: 1px solid var(--v-line); }
.ved-lane.is-audio { height: 36px; background: #fbfbfd; }
.ved-lane.is-off .ved-clip { opacity: .4; }
.ved-clip {
  position: absolute; top: 4px; bottom: 4px; border-radius: 8px; overflow: hidden; cursor: grab;
  display: flex; align-items: center; padding: 0 10px; touch-action: none; user-select: none;
  border: 1px solid; font-size: 12px; font-weight: 500;
}
.ved-clip:active { cursor: grabbing; }
.ved-clip-bg { position: absolute; inset: 0; background-image: var(--thumb, none); background-size: auto 100%; background-repeat: repeat-x; opacity: .32; }
.ved-clip-label { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ved-clip.k-video { background: #ede4ff; border-color: #c4b5fd; color: #2e1065; }
.ved-clip.k-image { background: #e7eeff; border-color: #b6c8f5; color: #1e3a8a; }
.ved-clip.k-text { background: #fff4d6; border-color: #f2d48a; color: #6b4a07; }
.ved-clip.k-graphic { background: #fde7f1; border-color: #f5b5cf; color: #831843; }
.ved-clip.k-music { background: #dcfce7; border-color: #98dcb0; color: #14532d; }
.ved-clip.k-voice { background: #e0f2fe; border-color: #9ccbe8; color: #0c4a6e; }
.ved-clip.k-sfx { background: #eef0f5; border-color: #cfd3e0; color: #334155; }
.ved-clip.is-sel { box-shadow: 0 0 0 2px var(--v-purple); border-color: var(--v-purple); z-index: 2; }
.ved-clip:focus-visible { outline: 2px solid var(--v-purple); outline-offset: 1px; }
.ved-clip-h { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; }
.ved-clip-h.is-l { left: 0; } .ved-clip-h.is-r { right: 0; }
.ved-clip.is-sel .ved-clip-h::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 4px; width: 2px; border-radius: 2px; background: var(--v-purple); }
.ved-clip-tr { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(-45deg, rgba(124, 58, 237, .55) 0 3px, transparent 3px 6px); }
.ved-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--v-purple); pointer-events: none; z-index: 4; will-change: transform; }
.ved-playhead-knob { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; border-radius: 0 0 7px 7px; background: var(--v-purple); }

/* Toasts */
#ved-toasts { position: fixed; z-index: 230000; inset-inline: 0; bottom: 18px; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.ved-toast {
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; font: 500 14px/1.4 'Tajawal', sans-serif;
  background: #1a202c; color: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, .25);
  animation: ved-toast-in .25s var(--v-ease, ease) both;
}
.ved-toast.is-error { background: #7a1a12; }
.ved-toast.is-success { background: #2e1065; }
.ved-toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes ved-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Tablet and phone ---------------- */
@media (max-width: 1023px) {
  .ved-body { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 760px) {
  .ved-dirs { grid-template-columns: 1fr; }
  .ved-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ved-setup-actions .ved-btn-primary { width: 100%; min-width: 0; }
  .ved-block, .ved-fold { padding: 14px; }

  .ved-top { padding: 6px 8px; min-height: 52px; gap: 6px; }
  .ved-top-title { flex-direction: column; align-items: flex-start; gap: 0; }
  .ved-top-title h2 { font-size: 16px; max-width: 100%; }
  .ved-aspect { display: none; }
  .ved-top-actions .ved-btn { min-height: 38px; padding: 6px 12px; }
  .ved-top-actions a.ved-btn span { display: none; }
  .ved-mtabs {
    display: flex; gap: 2px; overflow-x: auto; padding: 0 8px; background: var(--v-card); border-bottom: 1px solid var(--v-line);
    scrollbar-width: none;
  }
  .ved-mtab {
    position: relative; flex: none; border: 0; background: none; min-height: 44px; padding: 0 12px; cursor: pointer;
    font: 500 14px/1 inherit; font-family: inherit; color: var(--v-muted);
  }
  .ved-mtab.is-on { color: var(--v-purple-deep); font-weight: 700; }
  .ved-mtab.is-on::after { content: ''; position: absolute; inset-inline: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--v-purple); }
  .ved-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: 'main'; }
  .ved-root { grid-template-columns: minmax(0, 1fr); }
  .ved-top { min-width: 0; }
  .ved-top-actions { flex: none; }
  .ved-preview-note { display: none; }
  .ved-transport { padding: 8px 12px 10px; }
  .ved-stage-col, .ved-side, .ved-timeline { grid-area: main; }
  .ved-root:not([data-mtab="preview"]):not([data-mtab="timeline"]) .ved-stage-col { display: none; }
  /* Cutting on a phone needs the picture: the timeline tab keeps a smaller preview above the tracks. */
  .ved-root[data-mtab="timeline"] .ved-body { grid-template-rows: minmax(0, 40vh) minmax(0, 1fr); grid-template-areas: 'stage' 'tl'; }
  .ved-root[data-mtab="timeline"] .ved-stage-col { grid-area: stage; }
  .ved-root[data-mtab="timeline"] .ved-timeline { grid-area: tl; }
  .ved-root[data-mtab="timeline"] .ved-stage-wrap { padding: 8px; }
  .ved-root[data-mtab="timeline"] .ved-transport { min-height: 44px; padding: 4px 12px 6px; }
  .ved-root[data-mtab="timeline"] .ved-play { width: 34px; height: 34px; padding: 9px; }
  .ved-root:not([data-mtab="ai"]):not([data-mtab="edit"]):not([data-mtab="files"]) .ved-side { display: none; }
  .ved-root:not([data-mtab="timeline"]) .ved-timeline { display: none; }
  .ved-side { border-inline-start: 0; }
  .ved-side .ved-tabs { display: none; }
  .ved-stage-wrap { padding: 12px; }
  .ved-tl-grid { grid-template-columns: 56px minmax(0, 1fr); }
  .ved-tl-head { padding-left: 6px; }
  .ved-tl-zoom input { width: 90px; }
  .ved-files { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* A voiceover from Voice: the narration the edit is cut to, above the files. */
.ved-vo-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px; padding: 12px 14px; border: 1px solid #c9dafc; border-radius: 12px; background: #f3f7ff; }
.ved-vo-icon { display: inline-flex; width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: #e8f0fe; color: #2563eb; }
.ved-vo-icon svg { width: 100%; height: 100%; }
.ved-vo-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ved-vo-text b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ved-vo-text small { font-size: 12px; color: #5b6474; font-variant-numeric: tabular-nums; }
.ved-vo-row audio { grid-column: 1 / -1; width: 100%; height: 40px; }
