/* =========================================================
   Live — shared application theme
   -----------------------------------------------------------
   Clean and quiet: white surfaces, one hairline border weight,
   almost no shadow. Colour comes from the Live logo — indigo
   through violet to magenta — and is spent sparingly, so the
   colour is a single solid violet, used sparingly.
   ========================================================= */

:root {
  /* Brand — sampled from the Live mark */
  --indigo: #4b14d8;
  --violet: #6d1de8;
  --violet-deep: #5716c2;
  --magenta: #e621b8;
  --pink: #f5359f;
  --brand: var(--violet);
  --brand-hover: var(--violet-deep);

  /* Tints */
  --brand-soft: #f5efff;
  --brand-softer: #fbf8ff;
  --brand-line: #e7dcfb;

  /* Ink — warmed and softened */
  --ink: #1d1933;
  --ink-2: #322d4c;
  --text: #423d5d;
  --muted: #6f6a88;
  --faint: #a09bb1;

  /* Surfaces — warmer neutrals */
  --canvas: #fafafd;
  --canvas-2: #f3f2f8;
  --surface: #ffffff;
  --line: #eceaf2;
  --line-strong: #e0dde9;

  /* Status */
  --ok: #0f9d6e;
  --ok-soft: #e8f8f2;
  --warn: #b45309;
  --warn-soft: #fdf4e6;
  --bad: #dc2626;
  --bad-soft: #fdeded;

  /* Shape — rounder for a softer feel */
  --r-xs: 10px;
  --r-sm: 12px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --pill: 999px;

  /* Depth — layered soft shadows instead of flat hairlines */
  --shadow-xs: 0 1px 2px rgba(29, 25, 51, 0.05);
  --shadow-sm: 0 1px 2px rgba(29, 25, 51, 0.05), 0 2px 6px -1px rgba(29, 25, 51, 0.06);
  --shadow: 0 1px 2px rgba(29, 25, 51, 0.04), 0 8px 20px -8px rgba(29, 25, 51, 0.12);
  --shadow-soft: 0 1px 2px rgba(29, 25, 51, 0.04), 0 14px 34px -12px rgba(29, 25, 51, 0.16);
  --shadow-brand: 0 1px 2px rgba(109, 29, 232, 0.08), 0 10px 26px -8px rgba(109, 29, 232, 0.35);

  /* Type */
  --font-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Bootstrap overrides */
  --bs-primary: #6d1de8;
  --bs-link-color: #6d1de8;
  --bs-link-hover-color: #5716c2;
  --bs-body-color: #423d5d;
  --bs-body-bg: #fafafd;
  --bs-border-radius: 14px;
}

/* ---------- Base ---------- */
body {
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--brand-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* Entrance — a gentle rise for page blocks. */
@keyframes ev-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: ev-rise 0.42s cubic-bezier(0.16, 1, 0.3, 1) both; }
.rise-d1 { animation-delay: 0.05s; }
.rise-d2 { animation-delay: 0.1s; }
.rise-d3 { animation-delay: 0.15s; }
.rise-d4 { animation-delay: 0.2s; }
.rise-d5 { animation-delay: 0.25s; }
.rise-d6 { animation-delay: 0.3s; }

/* ---------- Typography ---------- */
h1, .h1, h2, .h2, h3, .h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
h4, .h4, h5, .h5, h6, .h6 {
  color: var(--ink-2);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.display-serif {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
/* The one flourish: a headline's tail in the brand violet. */
.tail, .display-serif em {
  font-style: normal;
  color: var(--brand);
}
.text-soft, .text-2 { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-brand { color: var(--brand) !important; }
.text-ink { color: var(--ink) !important; }
a { text-decoration: none; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand);
}
.app-title-sm {
  color: var(--faint);
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

/* ---------- Navbar ---------- */
.navbar-app {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  padding: 0.55rem 0;
}
.navbar-app .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
  color: var(--ink);
}
.navbar-app .brand-logo { height: 30px; width: auto; display: block; }
.navbar-app .brand-mark { height: 26px; width: auto; display: block; }
.navbar-app .brand-sub {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  border-left: 1px solid var(--line);
  padding-left: 0.6rem;
  white-space: nowrap;
}
.navbar-app .nav-link {
  color: var(--muted);
  font-weight: 550;
  font-size: 0.91rem;
  border-radius: var(--r-xs);
  padding: 0.4rem 0.8rem;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.navbar-app .nav-link:hover { color: var(--ink); background: var(--canvas-2); }
.navbar-app .nav-link.active { color: var(--brand); background: var(--brand-soft); }
.navbar-toggler { border: 0; box-shadow: none !important; }

/* ---------- Layout ---------- */
.app-main { padding-top: 2.25rem; padding-bottom: 5rem; }
.page-head { margin-bottom: 1.75rem; animation: ev-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.page-head h1 { font-size: clamp(1.65rem, 3vw, 2.1rem); margin: 0; }
.page-head .lead-text {
  color: var(--muted);
  margin: 0.4rem 0 0;
  font-size: 0.98rem;
  max-width: 62ch;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-section .card-body { padding: 1.5rem; }
.card-title { font-weight: 650; color: var(--ink-2); }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-lift { transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease; }
.card-lift:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-3px); }

/* A quiet code block, replacing scattered `border rounded p-3 bg-light`. */
.code-block {
  background: var(--canvas-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.code-block-title {
  border-bottom: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  background: var(--canvas);
  color: var(--muted);
  padding: 0.45rem 1rem;
  font-size: 0.78rem;
}

/* ---------- Hero — a soft, gently glowing panel ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 2.5rem;
  margin-bottom: 1.75rem;
}
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin-bottom: 0.6rem; }
.hero p { color: var(--muted); max-width: 58ch; font-size: 1.02rem; margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--r-xs);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 1.05rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
              box-shadow 0.18s ease, transform 0.18s ease;
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgba(23, 20, 42, 0.05), 0 4px 12px -5px rgba(109, 29, 232, 0.45);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--brand-hover) !important;
  border-color: var(--brand-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(23, 20, 42, 0.05), 0 9px 18px -6px rgba(109, 29, 232, 0.5);
}
.btn-outline-primary { color: var(--brand); border-color: var(--brand-line); background: #fff; }
.btn-outline-primary:hover, .btn-outline-primary:active {
  background: var(--brand-soft) !important;
  border-color: var(--brand-line) !important;
  color: var(--brand-hover) !important;
  transform: translateY(-1px);
}
.btn-outline-secondary { color: var(--ink-2); border-color: var(--line-strong); background: #fff; }
.btn-outline-secondary:hover, .btn-outline-secondary:active {
  background: var(--canvas-2) !important;
  border-color: var(--line-strong) !important;
  color: var(--ink) !important;
  transform: translateY(-1px);
}
.btn-success { background: var(--ok); border-color: var(--ok); }
.btn-success:hover, .btn-success:focus { background: #0c8b60; border-color: #0c8b60; }
.btn-danger { box-shadow: 0 1px 0 rgba(23, 20, 42, 0.05), 0 4px 12px -5px rgba(220, 38, 38, 0.4); }
.btn-lg { padding: 0.72rem 1.5rem; font-size: 0.98rem; border-radius: var(--r-sm); }
.btn-sm { padding: 0.32rem 0.75rem; font-size: 0.82rem; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; box-shadow: none; }

/* ---------- Badges / chips ---------- */
.badge {
  font-weight: 600;
  border-radius: var(--r-xs);
  padding: 0.4em 0.65em;
  font-size: 0.71em;
}
.badge.text-bg-secondary { background: var(--canvas-2) !important; color: var(--muted) !important; }
.badge.text-bg-light { background: #fff !important; color: var(--muted) !important; }
.badge.text-bg-success { background: var(--ok-soft) !important; color: #0a6f4e !important; }
.badge.text-bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }

.pill-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.74rem; font-weight: 600;
  padding: 0.26rem 0.6rem; border-radius: var(--r-xs);
  background: var(--canvas-2); color: var(--muted);
}
.pill-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-status.is-live { background: var(--ok-soft); color: #0a6f4e; }
.pill-status.is-draft { background: var(--canvas-2); color: var(--muted); }
.pill-status.is-closed { background: var(--warn-soft); color: var(--warn); }

.code-chip {
  display: inline-block;
  background: var(--canvas-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  color: var(--ink-2);
}
.var-chip {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--r-xs);
  padding: 0.26rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 0.15rem 0.3rem 0;
}

/* ---------- Stat cards ---------- */
.stat-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.stat-card .stat-icon.c-success { color: var(--ok); background: var(--ok-soft); }
.stat-card .stat-icon.c-danger  { color: var(--bad); background: var(--bad-soft); }
.stat-card .stat-icon.c-warning { color: var(--warn); background: var(--warn-soft); }
.stat-card .stat-icon.c-muted   { color: var(--muted); background: var(--canvas-2); }
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.stat-card .stat-label { color: var(--muted); font-size: 0.81rem; margin-top: 4px; }

/* ---------- Numbered steps ---------- */
.step {
  display: flex;
  gap: 0.95rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.step:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
/* A step used as a plain illustration — no floating shadow. */
.step-plain { box-shadow: none; }
.step-plain:hover { box-shadow: none; transform: none; }
.step .step-num {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: var(--r-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.step .step-num.done { background: var(--ok-soft); color: var(--ok); }
.step .step-title { font-weight: 650; color: var(--ink-2); margin-bottom: 2px; }
.step .step-desc { color: var(--muted); font-size: 0.91rem; margin: 0; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; }
.table thead th {
  color: var(--faint);
  font-weight: 650;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  padding: 0.9rem 0.75rem;
}
.table > :not(caption) > * > * { border-bottom-color: var(--line); }
.table tbody tr:hover { background: var(--brand-softer); }
.table td { vertical-align: middle; padding: 0.85rem 0.75rem; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--r-xs);
  border-color: var(--line-strong);
  padding: 0.58rem 0.85rem;
  color: var(--ink-2);
  font-size: 0.94rem;
  background-color: #fff;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.form-control::placeholder { color: #aeaabd; }
.form-control:focus, .form-select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(109, 29, 232, 0.14), 0 2px 8px -3px rgba(109, 29, 232, 0.2);
}
.form-control:disabled, .form-control[readonly] { background: var(--canvas-2); }
.form-label {
  font-weight: 600;
  font-size: 0.87rem;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}
.form-text { color: var(--muted); font-size: 0.81rem; }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(109, 29, 232, 0.14);
}
.form-switch .form-check-input { width: 2.4em; height: 1.3em; }
.input-group-text {
  background: var(--canvas-2);
  border-color: var(--line-strong);
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.85rem 1.05rem;
  font-size: 0.92rem;
  box-shadow: var(--shadow-xs);
}
.alert-success { background: var(--ok-soft); border-color: #cdeee1; color: #0a6f4e; }
.alert-danger  { background: var(--bad-soft); border-color: #f7d6d6; color: #a71d1d; }
.alert-warning { background: var(--warn-soft); border-color: #f4e4c8; color: var(--warn); }
.alert-info    { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-hover); }
.alert-secondary { background: var(--canvas-2); border-color: var(--line); color: var(--muted); }

/* ---------- Progress ---------- */
.progress {
  position: relative;
  overflow: hidden;
  border-radius: var(--pill);
  background: var(--canvas-2);
  height: 0.5rem;
}
.progress-bar {
  position: relative;
  border-radius: var(--pill);
  background: var(--brand);
}
.progress-lg { height: 1rem; }
.kbd-progress .progress { height: 0.45rem; }
.kbd-progress .progress-bar::after { display: none; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty-state .empty-icon {
  width: 58px; height: 58px; margin: 0 auto 0.9rem;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: var(--shadow-xs);
}

/* ---------- Drop zone ---------- */
.drop-zone {
  border: 1.5px dashed var(--brand-line);
  border-radius: var(--r-lg);
  background: var(--brand-softer);
  padding: 2.25rem;
  text-align: center;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}
.drop-zone:hover, .drop-zone:focus-within {
  border-color: var(--violet);
  background: var(--brand-soft);
  box-shadow: 0 0 0 4px rgba(109, 29, 232, 0.06);
}
.drop-zone .dz-icon { font-size: 2rem; color: var(--brand); }
#id_csv_file { font-size: 0.92rem; }

/* ---------- Footer ---------- */
.footer-app {
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.footer-app .footer-mark { font-weight: 650; color: var(--ink); }

/* ---------- Helpers ---------- */
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hr-soft { border-color: var(--line); opacity: 1; }
.limit-46 { max-width: 46ch; margin-left: auto; margin-right: auto; }
