:root {
  --bg: #1a1a1a;
  --bg-alt: #1f1f1e;
  --surface: #262626;
  --surface-2: #303030;
  --border: #333333;
  --text: #ededed;
  --muted: #9ca3af;
  --subtle: #6b7280;
  --brand: #e56a4a;
  --brand-soft: #ee8d6a;
  --success: #22c55e;
  --warning: #fbbf24;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; color-scheme: dark; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(900px 460px at 8% -10%, rgba(229, 106, 74, 0.16), transparent 60%),
    radial-gradient(700px 420px at 95% 0%, rgba(229, 106, 74, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
button, input, select, textarea {
  min-width: 0;
}

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 26, .96);
}
.app-loading[hidden] { display: none; }
.app-loading-card {
  width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(38, 38, 38, .96);
  padding: 22px;
  box-shadow: 0 24px 90px -38px rgba(0, 0, 0, .85);
}
.app-loading-bar {
  position: relative;
  overflow: hidden;
  height: 4px;
  margin-top: 20px;
  border-radius: 999px;
  background: var(--border);
}
.app-loading-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--brand);
  animation: slide 1050ms ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(85%); }
  100% { transform: translateX(260%); }
}

.app-shell {
  width: min(1320px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 72px;
}
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 22px;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-lockup.compact { gap: 9px; }
.brand-lockup h1, .brand-lockup p { margin: 0; }
.brand-lockup h1 { font-size: 24px; line-height: 1.15; }
.brand-lockup p, .brand-lockup span:not(.brand-mark) {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.brand-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #f08d6d);
  box-shadow: 0 14px 36px -18px rgba(229, 106, 74, .75);
}
.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.status-pill, .metric, .icon-btn, .btn-secondary {
  border: 1px solid rgba(51, 51, 51, .95);
  background: rgba(38, 38, 38, .92);
  color: var(--text);
  border-radius: 10px;
  min-height: 36px;
}
.status-pill {
  padding: 0 12px;
  color: var(--muted);
}
.status-pill.ok { color: var(--success); border-color: rgba(34, 197, 94, .35); }
.status-pill.waiting { color: var(--warning); border-color: rgba(251, 191, 36, .3); }
.metric {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { color: var(--brand-soft); font-size: 12px; }
.icon-btn {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-btn.primary {
  background: var(--brand);
  border-color: rgba(229, 106, 74, .7);
  color: white;
}
.btn-secondary {
  padding: 0 12px;
}
.view-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(31, 31, 30, .76);
}
.view-tab {
  width: 42px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.view-tab.active {
  color: white;
  background: rgba(229, 106, 74, .18);
  border-color: rgba(229, 106, 74, .42);
}
.view[hidden] { display: none !important; }
.settings-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 14px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(31, 31, 30, .62);
}
.settings-tab {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
}
.settings-tab.active {
  color: white;
  background: rgba(229, 106, 74, .18);
  border-color: rgba(229, 106, 74, .42);
}
.settings-panel[hidden] { display: none !important; }
.panel-title.nested {
  margin-top: 4px;
  padding-top: 2px;
}
.grid-main {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}
.panel {
  border: 1px solid rgba(51, 51, 51, .95);
  border-radius: 12px;
  background: rgba(38, 38, 38, .92);
  padding: 16px;
  box-shadow: 0 22px 80px -48px rgba(0, 0, 0, .9);
}
.hero-panel { min-height: 340px; }
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: #f7f4f0;
  font-weight: 700;
}
textarea, input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #1f1f1e;
  color: var(--text);
  outline: none;
}
textarea:focus, input:focus, select:focus {
  border-color: rgba(229, 106, 74, .7);
  box-shadow: 0 0 0 3px rgba(229, 106, 74, .13);
}
textarea {
  min-height: 190px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}
.large-editor { min-height: 320px; }
input, select {
  height: 40px;
  padding: 0 11px;
}
.inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 10px;
  margin-top: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.cards.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card, .list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .82);
  padding: 12px;
}
.card strong, .list-item strong { display: block; color: #f7f4f0; }
.card span, .list-item span { color: var(--muted); font-size: 12px; }
.list { display: grid; gap: 10px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .62);
}
.pagination-bar > span {
  color: var(--muted);
  font-size: 12px;
}
.pagination-bar select {
  width: auto;
  min-width: 112px;
  height: 36px;
}
.pagination-bar strong {
  min-width: 54px;
  align-self: center;
  color: var(--text);
  font-size: 12px;
  text-align: center;
}
.result-box {
  margin-top: 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .82);
  padding: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}
.editor-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  height: clamp(680px, calc(100vh - 190px), 900px);
  min-height: 680px;
  border: 1px solid rgba(51, 51, 51, .95);
  border-radius: 12px;
  background: #161616;
  box-shadow: 0 22px 80px -48px rgba(0, 0, 0, .9);
}
.editor-topbar,
.editor-timeline-head,
.editor-stage-toolbar,
.editor-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.editor-workspace > *,
.editor-grid,
.editor-stage-panel,
.editor-timeline-shell,
.editor-timeline-scroll {
  min-width: 0;
}
.editor-topbar {
  width: 100%;
  flex-wrap: wrap;
  min-height: 56px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #1d1d1d;
}
.editor-topbar .row-actions,
.editor-pane-head .row-actions,
.editor-stage-toolbar {
  flex-wrap: wrap;
}
.editor-project-title {
  min-width: 0;
  flex: 1 1 260px;
}
.editor-project-title strong,
.editor-pane-head span {
  display: block;
  overflow: hidden;
  color: #f7f4f0;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-project-title span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-grid {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(190px, 240px) minmax(360px, 1fr) minmax(240px, 300px);
  min-height: 0;
}
.editor-sidebar,
.editor-inspector,
.editor-stage-panel {
  min-width: 0;
  min-height: 0;
}
.editor-sidebar,
.editor-inspector {
  display: grid;
  border-right: 1px solid var(--border);
  background: #1b1b1b;
}
.editor-sidebar {
  grid-template-rows: auto minmax(0, 1fr);
}
.editor-inspector {
  overflow: auto;
  grid-template-rows: auto auto auto minmax(180px, 1fr);
  border-right: 0;
  border-left: 1px solid var(--border);
}
.editor-pane-head {
  min-height: 46px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #202020;
}
.editor-pane-head.secondary {
  border-top: 1px solid var(--border);
}
.editor-media-bin,
.editor-layer-stack,
.editor-inspector-body {
  padding: 10px;
}
.editor-media-bin,
.editor-layer-stack {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
}
.editor-media-item,
.editor-layer-item {
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #242424;
  color: var(--text);
  padding: 10px;
  text-align: left;
}
.editor-media-item:hover,
.editor-media-item.active,
.editor-layer-item:hover,
.editor-layer-item.active {
  border-color: rgba(56, 189, 248, .5);
  background: rgba(56, 189, 248, .09);
}
.editor-media-item span,
.editor-media-item small,
.editor-layer-item span,
.editor-layer-item small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-media-item strong,
.editor-layer-item strong {
  display: block;
  overflow: hidden;
  margin: 5px 0;
  color: #f7f4f0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 14px;
  text-align: center;
  font-size: 12px;
}
.editor-stage-panel {
  display: grid;
  width: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  background: #111;
}
.editor-stage-toolbar {
  align-content: center;
  min-height: 46px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: #191919;
}
.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101010;
}
.segmented-control button {
  min-width: 34px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.segmented-control button.active {
  border-color: rgba(56, 189, 248, .42);
  background: rgba(56, 189, 248, .14);
  color: #e0f7ff;
}
.editor-playback {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}
.editor-stage-toolbar strong {
  flex: 0 0 108px;
  min-width: 108px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.editor-preview-zoom {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101010;
  padding: 4px;
}
.editor-preview-zoom .icon-btn {
  width: 30px;
  height: 28px;
}
.editor-zoom-value {
  min-width: 54px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  padding: 0 8px;
  font-size: 11px;
}
.editor-active-line {
  flex: 1 1 140px;
  overflow: hidden;
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(251, 191, 36, .28);
  border-radius: 8px;
  background: rgba(251, 191, 36, .08);
  color: #fde68a;
  padding: 7px 10px 0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-stage-wrap {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(45deg, #111 25%, transparent 25%),
    linear-gradient(-45deg, #111 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #111 75%),
    linear-gradient(-45deg, transparent 75%, #111 75%),
    #151515;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}
.editor-stage {
  width: min(calc(26vh * var(--editor-preview-zoom, 1)), calc(330px * var(--editor-preview-zoom, 1)));
  aspect-ratio: 9 / 16;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: #0d0d0d;
  box-shadow: 0 28px 90px -34px rgba(0, 0, 0, .95);
}
.editor-preview-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 24%, rgba(236, 191, 164, .82) 0 12%, transparent 13%),
    linear-gradient(180deg, #343434 0 22%, #242424 22% 38%, #1b1b1b 38% 100%);
}
.editor-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #050505;
  object-fit: contain;
  z-index: 1;
}
.editor-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.editor-preview-empty strong {
  position: relative;
  z-index: 1;
  color: #f7f4f0;
  font-size: 13px;
}
.editor-preview-empty span {
  position: relative;
  z-index: 1;
  font-size: 11px;
}
.editor-preview-person {
  position: absolute;
  left: 22%;
  right: 18%;
  bottom: 10%;
  height: 58%;
  border-radius: 46% 46% 12% 12%;
  background: linear-gradient(180deg, #b47a5d 0 24%, #242424 24% 100%);
  opacity: .82;
}
.editor-safe-area {
  position: absolute;
  inset: 6%;
  border: 1px dashed rgba(255, 255, 255, .18);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}
.editor-overlay-layer {
  position: absolute;
  z-index: 3;
  max-width: 86%;
  border: 1px solid transparent;
  border-radius: 8px;
  color: white;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  line-height: 1.25;
  transform-origin: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  white-space: normal;
}
.editor-overlay-layer.dragging {
  cursor: grabbing;
}
.editor-overlay-layer.caption {
  background: rgba(0, 0, 0, .62);
}
.editor-overlay-layer.title {
  color: #ffe54f;
  font-weight: 800;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
.editor-overlay-layer.badge {
  background: rgba(56, 189, 248, .78);
  color: #051923;
  font-weight: 700;
}
.editor-overlay-layer.active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, .24);
}
.editor-overlay-layer.current-time {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, .36), 0 12px 28px -18px rgba(251, 191, 36, .8);
}
.editor-inspector-body {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: visible;
}
.editor-inspector-body textarea {
  min-height: 76px;
  padding: 10px;
}
.editor-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.editor-timeline-panel {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: #171717;
}
.editor-timeline-head {
  flex-wrap: wrap;
  min-height: 38px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: #1e1e1e;
}
.editor-ruler {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  height: 24px;
}
.editor-ruler span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 10px;
}
#editorZoom {
  width: 132px;
  height: 28px;
  padding: 0;
}
#editorTimelineScrollLeftBtn,
#editorTimelineScrollRightBtn {
  width: 30px;
  height: 28px;
}
.editor-timeline {
  overflow: auto;
  max-width: 100%;
  min-height: 214px;
  padding: 0;
}
.editor-timeline-shell {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(132px, 170px) minmax(0, 1fr);
  max-width: 100%;
  min-width: 0;
}
.editor-timeline-labels {
  position: sticky;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-rows: 34px repeat(4, 44px);
  border-right: 1px solid var(--border);
  background: #191919;
}
.editor-timeline-scroll {
  width: 100%;
  overflow: auto hidden;
  min-width: 0;
  max-width: 100%;
  scrollbar-color: rgba(148, 163, 184, .62) rgba(31, 31, 31, .88);
  scrollbar-width: thin;
}
.editor-timeline-scroll::-webkit-scrollbar {
  height: 10px;
}
.editor-timeline-scroll::-webkit-scrollbar-track {
  background: rgba(31, 31, 31, .88);
}
.editor-timeline-scroll::-webkit-scrollbar-thumb {
  border: 2px solid rgba(31, 31, 31, .88);
  border-radius: 999px;
  background: rgba(148, 163, 184, .62);
}
.editor-timeline-surface {
  position: relative;
  display: grid;
  grid-template-rows: 34px repeat(4, 44px);
  min-width: 100%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px) 0 0 / 72px 100%,
    #121212;
}
.editor-timeline-ruler-row {
  position: relative;
  border-bottom: 1px solid #2b2b2b;
  background: #1f1f1f;
  cursor: ew-resize;
}
.editor-timeline-ruler-row span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, .12);
}
.editor-timeline-ruler-row span.major {
  background: rgba(255, 255, 255, .28);
  color: var(--muted);
  padding: 4px 0 0 5px;
  font-size: 10px;
  white-space: nowrap;
}
.editor-track {
  display: grid;
  grid-template-columns: 150px minmax(360px, 1fr);
  gap: 10px;
  min-width: var(--timeline-zoom, 100%);
  margin-bottom: 8px;
}
.editor-track-label {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #202020;
  padding: 6px 8px;
}
.editor-timeline-labels .editor-track-label {
  border-width: 0 0 1px;
  background: #202020;
}
.editor-timeline-labels .editor-track-label.ruler {
  background: #242424;
}
.editor-timeline-labels .editor-track-label.video strong { color: #bfdbfe; }
.editor-timeline-labels .editor-track-label.audio strong { color: #bbf7d0; }
.editor-timeline-labels .editor-track-label.caption strong { color: #fde68a; }
.editor-timeline-labels .editor-track-label.text strong { color: #e9d5ff; }
.editor-track-label strong,
.editor-track-label span {
  display: block;
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-track-label strong {
  color: #f7f4f0;
  font-size: 12px;
}
.editor-track-label span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.editor-track-lane {
  position: relative;
  min-height: 42px;
  border: 1px solid #242424;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px) 0 0 / 10% 100%, #111;
}
.editor-timeline-surface .editor-track-lane {
  min-height: 44px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  cursor: ew-resize;
}
.editor-timeline-surface .editor-track-lane.video {
  background: rgba(30, 64, 175, .08);
}
.editor-timeline-surface .editor-track-lane.audio {
  background:
    repeating-linear-gradient(90deg, rgba(34, 197, 94, .16) 0 3px, transparent 3px 10px),
    rgba(20, 83, 45, .08);
}
.editor-timeline-surface .editor-track-lane.caption {
  background: rgba(113, 63, 18, .08);
}
.editor-timeline-surface .editor-track-lane.text {
  background: rgba(88, 28, 135, .08);
}
.editor-track.active .editor-track-lane {
  border-color: rgba(56, 189, 248, .45);
}
.editor-layer-item.current-time,
.editor-track.current-time .editor-track-label,
.editor-track.current-time .editor-track-lane {
  border-color: rgba(251, 191, 36, .55);
  background: rgba(251, 191, 36, .08);
}
.editor-clip {
  position: absolute;
  top: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 7px;
  color: white;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-clip span,
.editor-clip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-clip small {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .72);
  font-size: 10px;
}
.editor-clip.active {
  border-color: rgba(56, 189, 248, .78);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .36);
}
.editor-clip.video-source {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .18) 0 18px, transparent 18px 22px),
    linear-gradient(135deg, #1d4ed8, #0f172a);
}
.editor-clip.audio-source {
  background:
    repeating-linear-gradient(90deg, rgba(187, 247, 208, .38) 0 2px, transparent 2px 8px),
    linear-gradient(135deg, #166534, #052e16);
}
.editor-clip.caption {
  background: linear-gradient(135deg, #3a3a3a, #252525);
}
.editor-clip.title {
  background: linear-gradient(135deg, #7a651c, #3c320f);
}
.editor-clip.badge {
  background: linear-gradient(135deg, #0e7490, #164e63);
}
.editor-clip.current-time {
  border-color: rgba(251, 191, 36, .8);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .35);
}
.editor-timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 2px;
  background: #f05252;
  cursor: ew-resize;
}
.editor-timeline-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -6px;
  width: 14px;
  height: 14px;
  border-radius: 0 0 7px 7px;
  background: #f05252;
}
.editor-timeline-playhead span {
  position: absolute;
  top: 15px;
  left: 8px;
  border: 1px solid rgba(240, 82, 82, .55);
  border-radius: 6px;
  background: rgba(20, 20, 20, .92);
  color: #fecaca;
  padding: 3px 6px;
  font-size: 10px;
  white-space: nowrap;
}
.voice-finder-form {
  grid-template-columns: minmax(0, 1fr) minmax(140px, 220px);
}
.voice-finder-metrics {
  margin-top: 12px;
}
.voice-finder-metrics .card strong {
  overflow-wrap: anywhere;
}
.voice-finder-recommendations {
  margin-top: 12px;
}
.voice-finder-recommendations .list-item {
  align-items: flex-start;
}
.voice-finder-recommendations .list-item > div:first-child {
  min-width: 0;
}
.voice-finder-recommendations .list-item span {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
}
.tested-voice-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
}
.tested-voice-list {
  display: grid;
  gap: 10px;
}
.tested-voice-detail {
  margin-top: 0;
  min-height: 100%;
  white-space: normal;
}
.tested-voice-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .82);
  color: var(--text);
  padding: 12px;
  text-align: left;
}
.tested-voice-card.active {
  border-color: rgba(229, 106, 74, .55);
  background: rgba(229, 106, 74, .14);
}
.tested-voice-card strong,
.tested-detail-head strong {
  display: block;
  color: #f7f4f0;
}
.tested-voice-card span,
.tested-detail-head span,
.tested-detail-block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.tested-voice-card span + strong {
  margin-top: 5px;
}
.tested-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.tested-detail-head .row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tested-detail-metrics {
  margin-top: 12px;
}
.tested-detail-metrics .card {
  min-width: 0;
}
.tested-detail-metrics .card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tested-detail-block {
  margin-top: 12px;
}
.tested-detail-block code {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 5px;
  color: #ffd0bd;
}
.tested-detail-notes {
  margin: 12px 0 0;
  color: var(--text);
  line-height: 1.55;
}
.progress-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .82);
  padding: 12px;
}
.progress-panel[hidden] { display: none; }
.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 9px;
}
.progress-head strong {
  color: var(--brand-soft);
}
.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #171717;
}
.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--success));
  transition: width 240ms ease;
}
.shortcut-grid, .settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.shortcut-grid button {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(31, 31, 30, .78);
  color: var(--text);
}
.skill-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.skill-layout h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--brand-soft);
}
.log-viewport {
  min-height: 520px;
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111;
  padding: 12px;
  color: #d6d3cf;
  white-space: pre-wrap;
}
.agent-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(229, 106, 74, .7);
  border-radius: 18px;
  background: var(--brand);
  color: white;
  font-size: 24px;
  box-shadow: 0 18px 50px -18px rgba(229, 106, 74, .85);
}
body[data-active-view="editor"] .agent-fab {
  display: none;
}
.agent-drawer {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  width: min(560px, calc(100vw - 40px));
  border: 1px solid rgba(51, 51, 51, .95);
  border-radius: 16px;
  background: rgba(31, 31, 30, .98);
  box-shadow: 0 28px 120px -48px rgba(0, 0, 0, .95);
  overflow: hidden;
}
.agent-drawer[hidden] { display: none; }
.agent-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.drawer-actions { display: flex; gap: 6px; }
.agent-skill-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.agent-skill-chips button {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #262626;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
}
.context-meter {
  position: relative;
  height: 26px;
  border-bottom: 1px solid var(--border);
  background: #181818;
}
.context-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(229, 106, 74, .32);
}
.context-meter strong {
  position: relative;
  z-index: 1;
  display: block;
  padding: 5px 14px 0;
  color: var(--muted);
  font-size: 11px;
}
.agent-messages {
  overflow: auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}
.msg {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(38, 38, 38, .92);
  padding: 11px;
}
.msg.user { border-color: rgba(229, 106, 74, .38); }
.msg.tool { border-color: rgba(34, 197, 94, .28); }
.msg-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--brand-soft);
  font-size: 12px;
  margin-bottom: 8px;
}
.msg-body {
  color: #f1eee9;
  line-height: 1.55;
  font-size: 14px;
}
.msg-body pre {
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #121212;
}
.msg-body code {
  color: #ffd0bd;
}
.agent-input-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.agent-input-row textarea {
  min-height: 42px;
  max-height: 130px;
  padding: 10px 12px;
}
.audio-dock {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 22px;
  z-index: 55;
  display: grid;
  grid-template-columns: minmax(140px, 260px) minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(51, 51, 51, .95);
  border-radius: 12px;
  background: rgba(31, 31, 30, .98);
  padding: 12px;
  box-shadow: 0 18px 70px -32px rgba(0, 0, 0, .95);
}
.audio-dock[hidden] { display: none; }
.audio-dock span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.audio-dock strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audio-dock audio {
  width: 100%;
  min-width: 0;
  height: 36px;
}
.notice-toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 60;
  max-width: min(520px, calc(100vw - 40px));
  transform: translateX(-50%);
  border: 1px solid rgba(51, 51, 51, .95);
  border-radius: 10px;
  background: rgba(38, 38, 38, .98);
  color: var(--text);
  padding: 11px 14px;
  box-shadow: 0 18px 60px -28px rgba(0, 0, 0, .9);
  font-size: 13px;
}
.notice-toast.ok {
  border-color: rgba(34, 197, 94, .45);
  color: #bbf7d0;
}
.notice-toast.error {
  border-color: rgba(239, 68, 68, .45);
  color: #fecaca;
}
.notice-toast[hidden] { display: none; }

body[data-theme="apple-glass-pastel"] {
  --bg: #f6f7fb;
  --bg-alt: #eef0f7;
  --surface: rgba(255, 255, 255, .65);
  --surface-2: rgba(255, 255, 255, .78);
  --border: rgba(229, 231, 235, .9);
  --text: #111827;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --brand: #2563eb;
  --brand-soft: #1e3a8a;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;
  --success: #198754;
  --warning: #ff9500;
  --danger: #dc3545;
  --info: #0dcaf0;
  color-scheme: light;
  background:
    radial-gradient(60% 50% at 85% 5%, rgba(255, 200, 220, .55), transparent 60%),
    radial-gradient(55% 50% at 5% 25%, rgba(180, 215, 255, .55), transparent 65%),
    radial-gradient(55% 50% at 95% 95%, rgba(200, 230, 255, .5), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(230, 215, 255, .5), transparent 65%),
    linear-gradient(180deg, #f6f7fb 0%, #eef0f7 100%);
  background-attachment: fixed;
}

body[data-theme="apple-glass-pastel"] .app-loading {
  background:
    radial-gradient(60% 50% at 85% 5%, rgba(255, 200, 220, .55), transparent 60%),
    radial-gradient(55% 50% at 5% 25%, rgba(180, 215, 255, .55), transparent 65%),
    linear-gradient(180deg, rgba(246, 247, 251, .96), rgba(238, 240, 247, .96));
}

body[data-theme="apple-glass-pastel"] .app-loading-card,
body[data-theme="apple-glass-pastel"] .panel,
body[data-theme="apple-glass-pastel"] .view-tabs,
body[data-theme="apple-glass-pastel"] .card,
body[data-theme="apple-glass-pastel"] .list-item,
body[data-theme="apple-glass-pastel"] .result-box,
body[data-theme="apple-glass-pastel"] .progress-panel,
body[data-theme="apple-glass-pastel"] .agent-drawer,
body[data-theme="apple-glass-pastel"] .msg,
body[data-theme="apple-glass-pastel"] .audio-dock,
body[data-theme="apple-glass-pastel"] .notice-toast {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .65);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

body[data-theme="apple-glass-pastel"] .panel,
body[data-theme="apple-glass-pastel"] .agent-drawer {
  border-radius: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
}

body[data-theme="apple-glass-pastel"] .brand-lockup h1 {
  background: linear-gradient(to right, #0f172a 0%, #2563eb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

body[data-theme="apple-glass-pastel"] .brand-mark {
  background: #dbeafe;
  color: #2563eb;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .12), 0 1px 2px rgba(0, 0, 0, .04);
}

body[data-theme="apple-glass-pastel"] .status-pill,
body[data-theme="apple-glass-pastel"] .metric,
body[data-theme="apple-glass-pastel"] .icon-btn,
body[data-theme="apple-glass-pastel"] .btn-secondary,
body[data-theme="apple-glass-pastel"] textarea,
body[data-theme="apple-glass-pastel"] input,
body[data-theme="apple-glass-pastel"] select,
body[data-theme="apple-glass-pastel"] .shortcut-grid button,
body[data-theme="apple-glass-pastel"] .tested-voice-card,
body[data-theme="apple-glass-pastel"] .agent-skill-chips button {
  border-color: rgba(229, 231, 235, .95);
  background: rgba(255, 255, 255, .78);
  color: #111827;
}

body[data-theme="apple-glass-pastel"] .icon-btn,
body[data-theme="apple-glass-pastel"] .btn-secondary,
body[data-theme="apple-glass-pastel"] .status-pill,
body[data-theme="apple-glass-pastel"] .metric,
body[data-theme="apple-glass-pastel"] .view-tab,
body[data-theme="apple-glass-pastel"] input,
body[data-theme="apple-glass-pastel"] select,
body[data-theme="apple-glass-pastel"] textarea,
body[data-theme="apple-glass-pastel"] .tested-voice-card,
body[data-theme="apple-glass-pastel"] .shortcut-grid button {
  border-radius: 12px;
}

body[data-theme="apple-glass-pastel"] .icon-btn.primary,
body[data-theme="apple-glass-pastel"] .agent-fab {
  border-color: rgba(37, 99, 235, .7);
  background: #2563eb;
  color: white;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .12), 0 1px 2px rgba(0, 0, 0, .04);
}

body[data-theme="apple-glass-pastel"] .view-tabs {
  background: rgba(255, 255, 255, .52);
}

body[data-theme="apple-glass-pastel"] .settings-tabs {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .48);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

body[data-theme="apple-glass-pastel"] .pagination-bar {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .48);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

body[data-theme="apple-glass-pastel"] .view-tab.active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #dbeafe;
}

body[data-theme="apple-glass-pastel"] .tested-voice-card.active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #dbeafe;
}

body[data-theme="apple-glass-pastel"] .settings-tab {
  color: #6b7280;
}

body[data-theme="apple-glass-pastel"] .settings-tab.active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #dbeafe;
}

body[data-theme="apple-glass-pastel"] .panel-title,
body[data-theme="apple-glass-pastel"] .card strong,
body[data-theme="apple-glass-pastel"] .list-item strong,
body[data-theme="apple-glass-pastel"] .tested-voice-card strong,
body[data-theme="apple-glass-pastel"] .tested-detail-head strong,
body[data-theme="apple-glass-pastel"] .audio-dock strong {
  color: #0f172a;
}

body[data-theme="apple-glass-pastel"] .metric strong,
body[data-theme="apple-glass-pastel"] .skill-layout h3,
body[data-theme="apple-glass-pastel"] .msg-head {
  color: #2563eb;
}

body[data-theme="apple-glass-pastel"] textarea:focus,
body[data-theme="apple-glass-pastel"] input:focus,
body[data-theme="apple-glass-pastel"] select:focus {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

body[data-theme="apple-glass-pastel"] .progress-track,
body[data-theme="apple-glass-pastel"] .context-meter,
body[data-theme="apple-glass-pastel"] .msg-body pre,
body[data-theme="apple-glass-pastel"] .log-viewport {
  background: rgba(239, 246, 255, .72);
}

body[data-theme="apple-glass-pastel"] .progress-track span {
  background: linear-gradient(90deg, #2563eb, #34c759);
}

body[data-theme="apple-glass-pastel"] .context-meter span {
  background: rgba(37, 99, 235, .18);
}

body[data-theme="apple-glass-pastel"] .msg-body,
body[data-theme="apple-glass-pastel"] .log-viewport {
  color: #111827;
}

body[data-theme="apple-glass-pastel"] .msg-body code {
  color: #1e3a8a;
}

body[data-theme="apple-glass-pastel"] .tested-detail-block code {
  color: #1e3a8a;
}

body[data-theme="apple-glass-pastel"] .status-pill.ok,
body[data-theme="apple-glass-pastel"] .notice-toast.ok {
  color: #1f7d38;
  border-color: rgba(31, 125, 56, .28);
  background: rgba(232, 248, 236, .72);
}

body[data-theme="apple-glass-pastel"] .status-pill.waiting {
  color: #a86200;
  border-color: rgba(255, 149, 0, .28);
  background: rgba(255, 241, 221, .72);
}

body[data-theme="apple-glass-pastel"] .notice-toast.error {
  color: #a11d38;
  border-color: rgba(255, 45, 85, .28);
  background: rgba(252, 229, 235, .78);
}

@media (max-width: 980px) {
  .app-shell { width: min(100vw - 28px, 1320px); }
  .app-header, .grid-main, .skill-layout { grid-template-columns: 1fr; display: grid; }
  .statusbar { justify-content: start; }
  .form-grid, .shortcut-grid { grid-template-columns: 1fr; }
  .voice-finder-form { grid-template-columns: 1fr; }
  .tested-voice-layout { grid-template-columns: 1fr; }
  .tested-detail-head {
    flex-direction: column;
  }
  .tested-detail-head .row-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .settings-tabs { gap: 6px; }
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .pagination-bar .row-actions {
    justify-content: space-between;
  }
  .editor-workspace {
    grid-template-rows: auto auto auto;
    overflow: hidden;
    height: auto;
    min-height: 0;
  }
  .editor-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .editor-sidebar {
    grid-template-rows: auto minmax(160px, 240px);
  }
  .editor-inspector {
    grid-template-rows: auto auto auto minmax(140px, 220px);
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }
  .editor-inspector {
    border-top: 1px solid var(--border);
  }
  .editor-stage-panel {
    grid-template-rows: auto minmax(420px, 1fr);
    min-height: 520px;
  }
  .editor-stage-toolbar {
    align-items: stretch;
  }
  .editor-active-line {
    order: 5;
    flex-basis: 100%;
    height: auto;
    min-height: 30px;
    padding: 7px 10px;
  }
  .editor-stage-toolbar strong {
    flex: 1 1 auto;
    min-width: 92px;
  }
  .editor-stage {
    width: min(calc(100vw - 96px), 320px);
  }
  .editor-timeline-shell {
    grid-template-columns: minmax(86px, 108px) minmax(0, 1fr);
  }
  .editor-track {
    grid-template-columns: 120px minmax(420px, 1fr);
  }
  .audio-dock {
    left: 14px;
    right: 14px;
    grid-template-columns: 1fr 36px;
  }
  .audio-dock audio { grid-column: 1 / -1; }
}
