:root {
  --bg: #f4efe7;
  --bg-panel: rgba(255, 255, 255, 0.74);
  --bg-dark: #182127;
  --ink: #1f2c33;
  --muted: #5f6d74;
  --accent: #d75d39;
  --shadow: 0 18px 60px rgba(17, 24, 39, 0.12);
  --radius: 24px;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(215, 93, 57, 0.15), transparent 30%),
    radial-gradient(circle at top right, rgba(31, 138, 112, 0.12), transparent 25%),
    linear-gradient(180deg, #f8f4ed 0%, #f3eee5 100%);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.18rem rgba(215, 93, 57, 0.22);
  border-color: rgba(215, 93, 57, 0.5);
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(24, 33, 39, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.shell-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.main-nav {
  display: flex;
  gap: 1.2rem;
}

.main-nav a,
.auth-nav .nav-link {
  color: rgba(255, 255, 255, 0.82);
}

.page-body {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.app-footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
}

.hero-panel,
.panel-card,
.stat-card,
.project-card,
.summary-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  padding: 2.25rem;
  border-radius: calc(var(--radius) + 8px);
  margin-bottom: 2rem;
}

.hero-panel--compact {
  grid-template-columns: 1fr auto;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero-panel h1,
.panel-card h1,
.panel-card h2 {
  margin: 0 0 0.75rem;
  font-weight: 800;
}

.hero-panel p,
.project-card p,
.panel-card p,
.remote-source p,
.form-text {
  color: var(--muted);
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero-summary {
  display: grid;
  gap: 1rem;
}

.summary-card,
.stat-card,
.project-card {
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.summary-card strong,
.stat-card strong,
.project-card h3 {
  display: block;
}

.stats-grid,
.project-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat-card span,
.project-type {
  color: var(--muted);
  font-size: 0.9rem;
}

.project-type {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.panel-card {
  border-radius: calc(var(--radius) + 2px);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.3fr);
  gap: 1.5rem;
}

.timeline-editor {
  display: grid;
  gap: 1rem;
}

.timeline-controls {
  display: grid;
  gap: 0.9rem;
}

.timeline-control-row,
.timeline-readout,
.timeline-cuts,
.timeline-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.timeline-readout {
  align-items: center;
  color: var(--muted);
}

.timeline-readout strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.timeline-scrubber {
  width: 100%;
}

.timeline-stage {
  display: grid;
  gap: 0.55rem;
}

.timeline-ruler {
  position: relative;
  height: 1.5rem;
}

.timeline-ruler-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--muted);
}

.timeline-ruler-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  width: 1px;
  height: 0.5rem;
  background: rgba(31, 44, 51, 0.25);
}

.timeline-track {
  position: relative;
  min-height: 68px;
  border-radius: 20px;
  background: linear-gradient(90deg, rgba(24, 33, 39, 0.08), rgba(24, 33, 39, 0.14));
  border: 1px solid rgba(31, 44, 51, 0.09);
  overflow: hidden;
}

.timeline-segment-bar {
  position: absolute;
  top: 12px;
  height: 44px;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.timeline-segment-bar:hover,
.timeline-cut-marker:hover {
  transform: translateY(-1px);
}

.timeline-segment-bar--keep {
  background: linear-gradient(90deg, rgba(31, 138, 112, 0.75), rgba(31, 138, 112, 0.94));
}

.timeline-segment-bar--remove {
  background: linear-gradient(90deg, rgba(215, 93, 57, 0.78), rgba(215, 93, 57, 0.96));
}

.timeline-cut-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  cursor: pointer;
}

.timeline-cut-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 999px;
  background: #182127;
  transform: translateX(-50%);
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(24, 33, 39, 0.18);
  pointer-events: none;
}

.timeline-help {
  color: var(--muted);
  font-size: 0.92rem;
}

.timeline-segments,
.timeline-cuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.segment-card,
.cut-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 44, 51, 0.1);
  background: rgba(255, 255, 255, 0.72);
}

.segment-card--keep {
  box-shadow: inset 0 0 0 1px rgba(31, 138, 112, 0.18);
}

.segment-card--remove {
  box-shadow: inset 0 0 0 1px rgba(215, 93, 57, 0.18);
}

.segment-card__header,
.segment-card__actions,
.cut-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}

.segment-card__header span,
.cut-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.project-status {
  display: inline-flex;
  margin-top: 0.85rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.project-status--ready {
  color: #0d5b48;
  background: rgba(31, 138, 112, 0.16);
}

.project-status--pending {
  color: #8a5a11;
  background: rgba(222, 163, 46, 0.18);
}

.project-status--failed {
  color: #922f15;
  background: rgba(215, 93, 57, 0.16);
}

.is-active {
  color: #fff !important;
}

.timeline-segment-bar,
.timeline-cut-marker,
.segment-card button,
.cut-card button {
  outline-offset: 2px;
}

.danger-zone {
  border: 1px solid rgba(215, 93, 57, 0.22);
}

.editor-form {
  display: grid;
  gap: 0.9rem;
}

.field-block {
  display: grid;
  gap: 0.45rem;
}

.auth-label {
  display: inline-block;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.editor-form .form-control,
.editor-form .form-select {
  min-height: 3rem;
  border-radius: 14px;
  border: 1px solid rgba(31, 44, 51, 0.16);
}

.editor-form .form-control::placeholder {
  color: #8a9499;
}

.code-editor {
  min-height: 380px;
  font-family: Consolas, "Courier New", monospace;
}

.video-preview {
  width: 100%;
  border-radius: 18px;
  background: #000;
}

.auth-card {
  max-width: 560px;
  margin: 0 auto;
}

.empty-state {
  padding: 1rem 0;
  color: var(--muted);
}

.remote-source {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(31, 138, 112, 0.08);
}

.table {
  --bs-table-bg: transparent;
}

@media (max-width: 991px) {
  .hero-panel,
  .hero-panel--compact,
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .shell-container {
    flex-wrap: wrap;
  }
}

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

  .main-nav {
    width: 100%;
    justify-content: space-between;
  }

  .timeline-control-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
