:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #66737f;
  --line: #d9e1e8;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --accent: #1f7a68;
  --accent-dark: #145a4c;
  --sun: #f5b642;
  --rose: #cf5c78;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }

a { color: inherit; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(140deg, rgba(31,122,104,.12), transparent 44%),
    linear-gradient(30deg, rgba(245,182,66,.18), transparent 50%),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(20, 38, 48, .12);
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 5vw, 2.7rem); }
h2 { margin-bottom: 6px; font-size: 1.35rem; }
h3 { margin-bottom: 8px; }

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: .78rem;
  margin-bottom: 4px;
}

.muted { color: var(--muted); }

.ghost {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 12px;
  text-decoration: none;
  background: white;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(245,247,248,.96);
  padding: 8px 0;
}

.tabs button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0 10px;
}

.tabs button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-top: 10px;
}

.panel.active { display: block; }

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: .85rem;
}

.metrics {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 6px;
  align-items: baseline;
  margin: 18px 0;
}

.metrics strong { font-size: 1.45rem; color: var(--rose); }

.scene-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.wide { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

textarea { resize: vertical; line-height: 1.45; }

.stack {
  display: grid;
  gap: 14px;
}

.alert {
  border: 1px solid #f0a0a0;
  background: #fff0f0;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.list {
  display: grid;
  gap: 8px;
}

.row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.row.selected {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.row span {
  display: grid;
  gap: 4px;
}

.row small {
  color: var(--muted);
}

.row em {
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
}

.upload-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

meter {
  width: 96px;
  height: 14px;
}

.preview {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.result-video {
  display: block;
  width: min(100%, 640px);
  aspect-ratio: 16 / 9;
  background: #172026;
  margin-bottom: 12px;
}

.result-video[hidden] { display: none; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.setting {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 6px;
  background: #fbfcfd;
}

.setting strong { color: var(--rose); }
.setting.ok strong { color: var(--accent); }

.notice {
  margin-top: 16px;
  padding: 12px;
  border-left: 4px solid var(--sun);
  background: #fff9ec;
}

.action-status {
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: #edf7f4;
  margin: 0 0 16px;
}

.action-status.error {
  border-left-color: var(--rose);
  background: #fff0f2;
}

.action-status[hidden] { display: none; }

@media (max-width: 720px) {
  .app-shell { padding: 12px; }
  .topbar { align-items: start; }
  .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }
  .tabs button { font-size: .9rem; }
  .section-head, .row, .upload-box {
    display: grid;
    grid-template-columns: 1fr;
  }
  .scene-editor {
    grid-template-columns: 1fr;
  }
  .panel { padding: 14px; }
}
