:root {
  --ink: #14201f;
  --muted: #657674;
  --paper: #fffaf0;
  --mist: #e8f4ef;
  --sage: #b8d8cc;
  --teal: #0b625b;
  --teal-2: #128b79;
  --navy: #19324a;
  --amber: #e5a93e;
  --rose: #c95650;
  --line: rgba(20, 32, 31, 0.13);
  --shadow: 0 26px 90px rgba(25, 50, 74, 0.16);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: "Avenir Next", "Gill Sans", Candara, sans-serif;
  font-family: var(--display);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 12%, rgba(229, 169, 62, 0.22), transparent 22rem),
    radial-gradient(circle at 88% 4%, rgba(11, 98, 91, 0.22), transparent 25rem),
    linear-gradient(145deg, #fffaf0 0%, #e8f4ef 58%, #eaf1f6 100%);
}

body::before {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none; content: ""; opacity: 0.24;
  background-image:
    linear-gradient(rgba(20, 32, 31, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 31, 0.08) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at top, #000, transparent 72%);
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 12px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 12px 0 24px; padding: 12px;
  border: 1px solid var(--line); border-radius: 28px;
  background: rgba(251, 250, 245, 0.78);
  box-shadow: 0 16px 50px rgba(16, 36, 33, 0.08);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid; width: 48px; height: 48px;
  place-items: center; border-radius: 18px;
  color: #fff; background: var(--teal);
  font-weight: 800; letter-spacing: 0.04em;
}

.brand strong, h1, h2, h3 { letter-spacing: -0.04em; }
.brand small { display: block; color: var(--muted); font-family: var(--sans); font-size: 0.78rem; }

.nav { display: flex; gap: 6px; font-family: var(--sans); font-size: 0.92rem; }
.nav a { padding: 10px 13px; border-radius: 999px; color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--ink); background: #fff; }

/* ── Buttons ────────────────────────────────────────────────── */
.capture-btn, .primary, .secondary, .danger {
  padding: 12px 18px; border-radius: 999px;
  font-family: var(--sans); font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.capture-btn, .primary {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  box-shadow: 0 16px 35px rgba(14, 107, 99, 0.26);
}
.capture-btn:hover, .primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(14, 107, 99, 0.34);
}
.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.secondary:hover { background: var(--mist); }
.danger { color: #fff; background: var(--rose); }
.wide { width: 100%; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 24px; align-items: stretch;
}

.panel, .card, .modal-card {
  border: 1px solid var(--line); border-radius: 34px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.panel { padding: clamp(24px, 5vw, 48px); }

.hero h1 {
  max-width: 820px; margin: 0 0 16px;
  font-size: clamp(3.1rem, 8vw, 7.2rem);
  line-height: 0.84;
}
.hero p { max-width: 680px; font-size: 1.16rem; line-height: 1.7; }

.hero-copy {
  position: relative; overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.88), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at 85% 18%, rgba(184, 216, 204, 0.75), transparent 18rem);
}

.hero-copy::after {
  position: absolute; right: -80px; bottom: -100px;
  width: 280px; height: 280px;
  border: 1px solid rgba(11, 98, 91, 0.2);
  border-radius: 48% 52% 46% 54%;
  content: ""; transform: rotate(-18deg);
}

.hero-actions, .metrics { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.metrics { margin-top: 34px; }
.metrics div { min-width: 140px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,0.62); }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 1.45rem; }
.metrics span { color: var(--muted); font-family: var(--sans); font-size: 0.8rem; font-weight: 800; }

.command-card {
  background:
    linear-gradient(160deg, rgba(20, 32, 31, 0.96), rgba(25, 50, 74, 0.9)),
    radial-gradient(circle at 30% 20%, rgba(229, 169, 62, 0.42), transparent 15rem);
  color: #fff;
}
.command-card .muted, .command-card .tiny, .command-card p { color: rgba(255,255,255,0.72); }

.case-flow { display: grid; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.case-flow li {
  display: grid; grid-template-columns: 116px 1fr; gap: 12px; padding: 14px;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 20px;
  background: rgba(255,255,255,0.08); font-family: var(--sans);
}
.case-flow strong { color: #fff3cf; }
.case-flow span { color: rgba(255,255,255,0.76); }

.feature-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; margin: 18px 0 30px;
}
.feature-card {
  padding: 22px; border: 1px solid var(--line); border-radius: 28px;
  background: rgba(255,255,255,0.56);
  box-shadow: 0 18px 46px rgba(25, 50, 74, 0.08);
  transition: transform 0.18s ease;
}
.feature-card:hover { transform: translateY(-2px); }
.feature-card h3 { margin: 0 0 8px; font-size: 1.45rem; }
.feature-card p { margin: 0; color: var(--muted); font-family: var(--sans); line-height: 1.55; }

/* ── Labels ─────────────────────────────────────────────────── */
.eyebrow, .status, .chip, .tiny, .muted, .field-note { font-family: var(--sans); }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 0.82rem; }
.field-note { color: var(--muted); font-size: 0.88rem; }

.workflow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 28px; }
.step { padding: 16px; min-height: 118px; border-radius: 24px; background: var(--mist); font-family: var(--sans); }
.step strong { display: block; margin-bottom: 8px; }

/* ── Vault Grid ─────────────────────────────────────────────── */
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 22px 0 80px; }
.card { overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 32px 80px rgba(25,50,74,0.2); }

.thumb {
  position: relative; display: grid; min-height: 168px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(14, 107, 99, 0.16), rgba(246, 189, 96, 0.16)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(16, 36, 33, 0.04) 12px 13px);
}
.thumb img, .thumb video { width: 100%; height: 210px; object-fit: cover; }

.thumb-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: rgba(16,36,33,0.5); font-family: var(--sans); font-size: 0.85rem; text-align: center; padding: 16px;
}
.thumb-icon { font-size: 2.5rem; }

.card-body { padding: 18px; }
.card h3 { margin: 0 0 8px; font-size: 1.35rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip, .status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(14, 107, 99, 0.1); color: var(--teal);
  font-size: 0.78rem; font-weight: 800;
}
.status.warn { color: #8a5a00; background: rgba(246, 189, 96, 0.24); }
.status.danger { color: var(--rose); background: rgba(217, 93, 93, 0.12); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; margin-bottom: 18px;
}

/* ── Forms / Search ─────────────────────────────────────────── */
.searchbar, .form-grid input, .form-grid select, .form-grid textarea, .share-box input {
  width: 100%; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 18px;
  color: var(--ink); background: rgba(255,255,255,0.82);
  transition: border-color 0.15s;
}
.searchbar:focus, .form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--teal); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-family: var(--sans); font-size: 0.85rem; font-weight: 800; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 18px;
  background: rgba(16, 36, 33, 0.44); backdrop-filter: blur(12px);
}
.modal-card {
  position: relative; width: min(720px, 100%);
  max-height: calc(100vh - 36px); overflow: auto;
  padding: clamp(22px, 4vw, 38px); background: var(--paper);
}
.icon-close {
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px; border-radius: 50%; background: #fff;
}
.dropzone {
  display: grid; place-items: center; min-height: 190px; padding: 28px;
  border: 2px dashed rgba(14, 107, 99, 0.28); border-radius: 30px;
  background: var(--mist); text-align: center; cursor: pointer;
  transition: background 0.15s;
}
.dropzone:hover { background: rgba(14, 107, 99, 0.08); }
.dropzone input { display: none; }
.dropzone span { display: block; font-size: 1.5rem; font-weight: 900; }

/* ── Detail View ────────────────────────────────────────────── */
.detail-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px; align-items: start;
}

.viewer-wrap { display: flex; flex-direction: column; gap: 14px; }

.viewer {
  position: relative; overflow: hidden;
  min-height: 320px; border-radius: 34px;
  background: #102421;
  display: flex; align-items: center; justify-content: center;
}
.viewer img, .viewer video { display: block; width: 100%; max-height: 68vh; object-fit: contain; }
.viewer-video { width: 100%; max-height: 68vh; }
.stream-player { width: 100%; min-height: 420px; border: 0; }

.viewer-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.edit-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px;
  font-family: var(--sans); font-weight: 800; font-size: 1rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff; box-shadow: 0 12px 30px rgba(11,98,91,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.edit-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(11,98,91,0.38); }

.detail-sidebar { position: sticky; top: 100px; }
.meta-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.meta-list > div { display: flex; align-items: center; justify-content: space-between; }
.meta-label { color: var(--muted); font-family: var(--sans); font-size: 0.85rem; }

.share-box { display: grid; gap: 10px; }

/* ── Editor ──────────────────────────────────────────────────── */
.editor-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 360px;
  grid-template-areas:
    "topbar topbar"
    "main   sidebar";
  gap: 0;
  min-height: calc(100vh - 120px);
  border: 1px solid var(--line); border-radius: 34px;
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 40px;
}

.editor-topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
}
.editor-back {
  font-family: var(--sans); font-weight: 700; font-size: 0.9rem;
  color: var(--teal); padding: 8px 14px; border-radius: 999px;
  transition: background 0.13s;
}
.editor-back:hover { background: var(--mist); }
.editor-title { font-family: var(--sans); font-weight: 700; font-size: 1rem; }
.editor-topbar-right { display: flex; gap: 10px; }

.editor-main {
  grid-area: main;
  display: flex; flex-direction: column;
  background: #0d1e1c; overflow: hidden;
}

.editor-canvas-wrap {
  position: relative; flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 360px;
}

.editor-video {
  display: block; max-width: 100%; max-height: calc(100vh - 280px);
  width: 100%; object-fit: contain;
}
.editor-image {
  display: block; max-width: 100%; max-height: calc(100vh - 260px);
  object-fit: contain; transition: filter 0.2s, transform 0.3s;
}

.editor-canvas-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: crosshair; z-index: 2; pointer-events: all;
  /* let pointer events pass through when not drawing */
}

.editor-no-preview {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 48px; text-align: center; color: rgba(255,255,255,0.7);
  font-family: var(--sans);
}
.editor-no-preview .muted { color: rgba(255,255,255,0.4); }

/* Video controls bar */
.video-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: rgba(13, 30, 28, 0.95);
  border-top: 1px solid rgba(255,255,255,0.08);
  font-family: var(--sans);
}

.vc-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: #fff;
  font-size: 1rem; flex-shrink: 0;
  transition: background 0.13s;
}
.vc-btn:hover { background: rgba(255,255,255,0.24); }
.vc-time { color: rgba(255,255,255,0.65); font-size: 0.82rem; min-width: 36px; }

.scrubber-wrap { position: relative; flex: 1; height: 28px; display: flex; align-items: center; }

.scrubber {
  width: 100%; height: 4px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,0.18); border-radius: 4px;
  outline: none;
}
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Editor Sidebar ─────────────────────────────────────────── */
.editor-sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  overflow-y: auto;
}

.editor-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--mist);
  position: sticky; top: 0; z-index: 2;
}

.tab-btn {
  padding: 7px 12px; border-radius: 999px;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  color: var(--muted); background: transparent;
  transition: background 0.13s, color 0.13s;
}
.tab-btn:hover { background: rgba(11,98,91,0.1); color: var(--ink); }
.tab-btn.active { background: #fff; color: var(--teal); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.tab-panel { display: none; padding: 20px 18px; flex-direction: column; gap: 12px; }
.tab-panel.active { display: flex; }
.tab-panel h3 { margin: 0 0 4px; font-size: 1.1rem; }

/* Blur tool chips */
.tool-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-chip {
  padding: 8px 14px; border-radius: 999px;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  cursor: pointer; transition: all 0.13s;
}
.tool-chip:hover { border-color: var(--teal); color: var(--teal); }
.tool-chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* Annotation list */
.annotation-list { display: flex; flex-direction: column; gap: 6px; min-height: 36px; }
.ann-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 12px;
  background: var(--mist); font-family: var(--sans); font-size: 0.82rem;
}
.ann-del {
  background: none; color: var(--rose); font-size: 0.9rem;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ann-del:hover { background: rgba(201,86,80,0.12); }

.tool-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Sliders */
.slider-list { display: flex; flex-direction: column; gap: 16px; }
.slider-list label {
  display: grid; gap: 6px;
  font-family: var(--sans); font-size: 0.83rem; font-weight: 700; color: var(--muted);
}
.adj-slider {
  width: 100%; appearance: none; -webkit-appearance: none;
  height: 5px; border-radius: 5px;
  background: linear-gradient(to right, var(--teal) 50%, var(--line) 50%);
  outline: none; cursor: pointer;
}
.adj-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--teal); cursor: pointer;
  box-shadow: 0 2px 8px rgba(11,98,91,0.3);
}

/* Rotate chips */
.rotate-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rotate-chip {
  padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; font-family: var(--sans); font-size: 0.85rem; font-weight: 700;
  color: var(--ink); cursor: pointer; transition: all 0.13s;
  text-align: center;
}
.rotate-chip:hover { background: var(--mist); border-color: var(--teal); color: var(--teal); }

/* Color swatches */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: border-color 0.13s, transform 0.13s;
}
.swatch.active { border-color: var(--ink); transform: scale(1.2); }
.swatch:hover { transform: scale(1.15); }

/* Trim inputs */
.trim-inputs { display: flex; gap: 12px; }
.trim-inputs label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 0.85rem; font-weight: 700; color: var(--muted);
}
.trim-inputs input {
  width: 70px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px;
  text-align: center; color: var(--ink); background: rgba(255,255,255,0.8);
}

/* ── Empty / Toast ───────────────────────────────────────────── */
.empty {
  padding: 42px; border: 1px dashed var(--line); border-radius: 34px;
  background: rgba(255,255,255,0.52); text-align: center;
}

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  max-width: 360px; padding: 14px 18px;
  border-radius: 18px; color: #fff;
  background: var(--ink); box-shadow: var(--shadow);
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--teal); }
.toast.error { background: var(--rose); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .topbar { align-items: stretch; border-radius: 24px; }
  .nav { display: none; }
  .hero, .detail-layout, .form-grid {
    grid-template-columns: 1fr;
  }
  .workflow { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
  .case-flow li { grid-template-columns: 1fr; }
  .capture-btn {
    position: fixed; right: 16px; bottom: 16px; z-index: 15; padding: 16px 22px;
  }
  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "topbar"
      "main"
      "sidebar";
  }
  .editor-sidebar { border-left: none; border-top: 1px solid var(--line); max-height: 420px; }
  .editor-tabs { position: static; }
}
