/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(45, 112, 255, 0.18), transparent 60%),
    radial-gradient(700px 500px at 90% 110%, rgba(85, 60, 220, 0.12), transparent 60%),
    #070d17;
  color: #eef1ff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(11, 13, 21, 0.88);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 800;
  flex-shrink: 0;
}

.ligo-app-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ligo-app-switcher::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 10px;
}

.ligo-tool-chooser-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  color: #d5e0ff;
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
  transition: all 0.18s;
}

.ligo-tool-chooser-btn:hover {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.1);
}

.ligo-tool-chooser-btn img {
  width: auto;
  height: 22px;
  object-fit: contain;
}

.ligo-logo-fallback {
  font-size: 12px;
  font-weight: 700;
  color: #22c55e;
}

.ligo-app-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 194px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(16, 20, 28, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 1200;
}

.ligo-app-switcher:hover .ligo-app-switcher-menu,
.ligo-app-switcher:focus-within .ligo-app-switcher-menu {
  display: flex;
}

.ligo-app-switcher-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #eaf0ff;
  text-decoration: none;
  transition: all 0.16s;
}

.ligo-app-switcher-link:hover {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}

.ligo-app-switcher-link img {
  max-width: 170px;
  max-height: 44px;
}

.ligo-app-switcher-link-fallback {
  font-size: 0.86rem;
  font-weight: 600;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tool-header-logo {
  height: 36px;
  width: auto;
  max-width: min(50vw, 340px);
  display: block;
  object-fit: contain;
}

.tool-header-text {
  font-size: 15px;
  font-weight: 700;
  color: #c0f0d0;
}

.header-sequence {
  margin-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.header-sequence-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5a8a6a;
}

.sequence-name {
  font-size: 12px;
  font-weight: 600;
  color: #22c55e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.sequence-name.sequence-missing {
  color: #e0a050;
}

.sequence-monitor {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6aaa7a;
}

.sequence-monitor.monitor-source { color: #7dd3fc; }
.sequence-monitor.monitor-record { color: #86efac; }

.sequence-warning {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid rgba(224, 160, 80, 0.45);
  background: rgba(224, 160, 80, 0.1);
  color: #f0d8a8;
  font-size: 11px;
  line-height: 1.45;
}

.sequence-warning[hidden] {
  display: none !important;
}

.sequence-warning strong {
  color: #fde68a;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Workspace layout ─────────────────────────────────────── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 12px;
  padding: 12px 14px 16px;
  min-height: 0;
}

.card {
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(17, 22, 33, 0.92) 0%, rgba(12, 15, 24, 0.95) 100%);
  box-shadow: inset 0 1px 0 rgba(34, 197, 94, 0.08), 0 14px 26px rgba(0, 0, 0, 0.42);
  min-height: 0;
}

.settings-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.list-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.list-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: center 58% / min(72%, 420px) no-repeat radial-gradient(ellipse at center, rgba(34, 197, 94, 0.08), transparent 70%);
  opacity: 0.06;
  pointer-events: none;
}

.list-panel:has(#changes-list:not([hidden]))::before {
  opacity: 0.03;
}

.panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6aaa7a;
}

.panel-title-spaced {
  margin-top: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px 10px;
  margin-top: 10px;
  align-items: center;
}

.section-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: #5a8a6a;
  line-height: 1.4;
}

.locators-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(34, 197, 94, 0.18);
}

.locator-type-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.locator-type-row {
  display: grid;
  grid-template-columns: 1fr 58px 78px;
  gap: 6px;
  align-items: center;
}

.locator-type-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #9aca9a;
  cursor: pointer;
  min-width: 0;
}

.locator-type-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locator-type-check input {
  flex-shrink: 0;
}

.locator-track-select,
.locator-color-select {
  padding: 5px 6px;
  font-size: 11px;
}

.primary-btn {
  width: 100%;
  margin-top: 4px;
}

.settings-grid label {
  font-size: 12px;
  color: #6aaa7a;
  font-weight: 600;
}

/* ── Form elements ────────────────────────────────────────── */
select {
  width: 100%;
  border-radius: 7px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(13, 18, 28, 0.9);
  color: #d0f0d8;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

select:focus {
  border-color: rgba(34, 197, 94, 0.75);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(34, 197, 94, 0.65);
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #0a1a0c;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  border-color: rgba(74, 222, 128, 0.9);
  transform: translateY(-1px);
}

button.secondary {
  background: rgba(17, 24, 36, 0.85);
  border-color: rgba(34, 197, 94, 0.45);
  color: #5aaa6a;
}

button.secondary:hover:not(:disabled) {
  color: #22c55e;
}

button.small-btn {
  padding: 6px 10px;
  font-size: 11px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Drop area ────────────────────────────────────────────── */
.drop-area {
  margin-top: 10px;
  border: 1px dashed rgba(34, 197, 94, 0.55);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  background: rgba(34, 197, 94, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.drop-area.drag-over {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.drop-label {
  font-size: 12px;
  font-weight: 600;
  color: #5aaa6a;
}

.drop-hint {
  font-size: 10px;
  color: #2a5a3a;
}

.status {
  margin-top: 8px;
  font-size: 11px;
  color: #5a8a6a;
  line-height: 1.4;
  white-space: pre-wrap;
}

.changelist-meta {
  margin-top: 6px;
  font-size: 11px;
  color: #8aca9a;
  line-height: 1.35;
}

.stills-status {
  margin-top: 10px;
}

/* ── Changes list ─────────────────────────────────────────── */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.changes-count {
  font-size: 11px;
  color: #5a9a6a;
  font-weight: 600;
}

.changes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  position: relative;
  z-index: 1;
}

.changes-empty[hidden],
.changes-list[hidden] {
  display: none !important;
}

.tab-empty-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  pointer-events: none;
  user-select: none;
}

.tab-empty-logo img {
  width: auto;
  max-width: min(88%, 380px);
  height: auto;
  opacity: 0.45;
}

.empty-hint {
  margin: 0;
  font-size: 12px;
  color: #4a7a5a;
  text-align: center;
  max-width: 320px;
}

.changes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 197, 94, 0.2) transparent;
}

.change-item {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 94, 0.18);
  background: rgba(9, 13, 22, 0.72);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
}

.change-item:hover {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(17, 24, 36, 0.88);
}

.change-item.navigating {
  border-color: #4ade80;
  transform: scale(0.995);
}

.change-thumb {
  width: 88px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(34, 197, 94, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.change-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.change-thumb-placeholder {
  font-size: 9px;
  color: #3a6a4a;
  text-align: center;
  padding: 4px;
}

.change-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.change-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.change-idx {
  font-size: 10px;
  font-weight: 700;
  color: #3a6a4a;
  min-width: 22px;
}

.action-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.action-tag.tag-delete {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
}

.action-tag.tag-insert {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.35);
}

.action-tag.tag-move {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.35);
}

.action-tag.tag-trim {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
}

.action-tag.tag-lengthen {
  color: #a5f3fc;
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.35);
}

.action-tag.tag-other {
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.35);
}

.change-tc {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 12px;
  font-weight: 600;
  color: #22c55e;
}

.change-clip {
  font-size: 11px;
  color: #9aca9a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-note {
  font-size: 10px;
  color: #6a9a7a;
}

.change-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.polarity-badge {
  font-size: 10px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.polarity-badge.minus {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.polarity-badge.plus {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.scene-take {
  font-size: 10px;
  color: #5a8a6a;
}

/* ── Progress ─────────────────────────────────────────────── */
.progress-wrap { margin-top: 8px; }

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(13, 19, 30, 0.86);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 45%, #4ade80 100%);
  transition: width 0.3s ease;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .change-item {
    grid-template-columns: 72px 1fr;
  }

  .change-side {
    display: none;
  }
}

/* Standalone stills workflow: Export Markers modal + Attach Stills button. */
.ct-modal {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.62);
}
.ct-modal[hidden] { display: none !important; }
.ct-modal-card {
  width: min(460px, calc(100% - 32px));
  padding: 16px 18px 18px;
  border-radius: 14px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: #12161c;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.ct-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.ct-modal-header h3 { margin: 0; font-size: 15px; }
.ct-modal-close {
  border: 0;
  background: transparent;
  color: #9ba3b4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ct-modal-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.ct-modal-options label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #8aa;
}
.ct-modal-options select {
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: #0d1018;
  color: #eef1ff;
}
.ct-modal-actions { display: flex; justify-content: flex-end; }

label.attach-stills-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  color: #86c99a;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
}
label.attach-stills-label:hover {
  color: #22c55e;
}
#stills-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
