/* ============================================================
   SOURCELIST VAULT — design system
   Warm coral (#da7764) on deep, low-glare charcoal.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;450;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* brand */
  --primary:        #da7764;
  --primary-bright: #ea9a88;
  --primary-deep:   #b95643;
  --ink-on-primary: #24100b;
  --glow:           rgba(218, 119, 100, 0.45);

  /* warm dark surfaces */
  --bg:        #140f0e;
  --bg-2:      #1a1412;
  --surface:   #201814;
  --surface-2: #29201b;
  --surface-3: #33281f;

  /* lines */
  --border:      #392c26;
  --border-soft: rgba(218, 119, 100, 0.16);
  --border-lit:  rgba(218, 119, 100, 0.40);

  /* text */
  --ink:      #f7efeb;
  --ink-soft: #d9cbc3;
  --muted:    #b4a49a;
  --faint:    #8a7a70;

  /* semantic */
  --ok:      #7fce9e;   --ok-bg:   rgba(45, 106, 79, 0.22);   --ok-bd:   rgba(127, 206, 158, 0.30);
  --err:     #f19a97;   --err-bg:  rgba(140, 45, 45, 0.22);   --err-bd:  rgba(241, 154, 151, 0.30);
  --warn:    #f2cf7a;   --warn-bg: rgba(120, 95, 20, 0.20);   --warn-bd: rgba(242, 207, 122, 0.28);
  --info:    #8fc9e6;   --info-bg: rgba(35, 90, 120, 0.20);   --info-bd: rgba(143, 201, 230, 0.28);

  /* geometry */
  --r-sm: 9px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --ring: 0 0 0 3px rgba(218, 119, 100, 0.30);
  --shadow: 0 20px 50px -22px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.85);

  /* z-scale */
  --z-bg: 0;
  --z-base: 1;
  --z-nav: 40;
  --z-toast: 80;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);           /* out-quint */
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* --- animated 3D field lives behind everything --- */
#vault-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-bg);
  pointer-events: none;
  display: block;
}
.veil {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(218, 119, 100, 0.16), transparent 60%),
    radial-gradient(90% 70% at 100% 110%, rgba(185, 86, 67, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(20, 15, 14, 0.35) 0%, rgba(20, 15, 14, 0.72) 100%);
}
body[data-scene="app"] .veil {
  background:
    radial-gradient(100% 60% at 50% -20%, rgba(218, 119, 100, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(20, 15, 14, 0.60) 0%, rgba(20, 15, 14, 0.88) 100%);
}

/* ---------------------------------------------------------- */
/* Typography                                                 */
/* ---------------------------------------------------------- */
h1, h2, h3 {
  font-family: 'Fraunces', 'Inter', serif;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.55rem); margin-bottom: 4px; }
h3 { font-size: 1.05rem; }

a { color: var(--primary-bright); text-decoration: none; transition: color 0.18s var(--ease); }
a:hover { color: var(--ink); }

::selection { background: rgba(218, 119, 100, 0.35); color: #fff; }

/* ---------------------------------------------------------- */
/* Layout shell                                               */
/* ---------------------------------------------------------- */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 30px 22px 10px;
  position: relative;
  z-index: var(--z-base);
}
.container.narrow { max-width: 460px; }
.container.wide { max-width: 1240px; }

/* nav ------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 34px);
  background: rgba(20, 15, 14, 0.66);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 3px 10px var(--glow)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--primary);
  font-weight: 600;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: rgba(218, 119, 100, 0.12); }
.nav-user {
  color: var(--muted);
  font-size: 0.82rem;
  padding-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.nav-user::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

/* cards ----------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(41, 32, 27, 0.72), rgba(32, 24, 20, 0.80));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  position: relative;
}
.card.glass {
  background: rgba(32, 24, 20, 0.55);
  backdrop-filter: blur(26px) saturate(1.4);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
  border: 1px solid var(--border-lit);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head h1, .card-head h2 { margin: 0; }
.card p.lead { color: var(--muted); margin-bottom: 18px; }
.section-lead { color: var(--muted); font-size: 0.92rem; margin-bottom: 14px; max-width: 68ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--primary);
}

/* forms ----------------------------------------------------- */
label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
}
input[type="text"], input[type="password"], input[type="number"], input[type="file"] {
  width: 100%;
  padding: 13px 15px;
  margin-bottom: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.98rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
input::placeholder { color: var(--faint); }
input { caret-color: var(--primary-bright); }
input:focus {
  outline: none;
  border-color: var(--border-lit);
  box-shadow: var(--ring);
  background: var(--surface-2);
}
/* keep the dark theme through browser autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 40px var(--surface) inset;
  box-shadow: 0 0 0 40px var(--surface) inset;
  caret-color: var(--ink);
  transition: background-color 9999s ease-in-out 0s;
}
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 40px var(--surface-2) inset, var(--ring);
  box-shadow: 0 0 0 40px var(--surface-2) inset, var(--ring);
}
input[type="file"] { padding: 11px 14px; cursor: pointer; color: var(--muted); }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 7px 14px;
  background: var(--surface-3); color: var(--ink);
  border: 1px solid var(--border); border-radius: 7px;
  font: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: background 0.18s var(--ease);
}
input[type="file"]::file-selector-button:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }

.field-note { color: var(--muted); font-size: 0.82rem; margin: -8px 0 16px; }

/* buttons --------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  background: var(--btn-bg);
  color: var(--btn-fg);
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: var(--ink-on-primary);
  box-shadow: 0 10px 26px -12px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -14px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.3); }

.btn-outline { background: transparent; color: var(--primary-bright); border-color: var(--border-lit); }
.btn-outline:hover { background: rgba(218, 119, 100, 0.12); color: var(--ink); border-color: var(--primary); }

.btn-danger { background: rgba(140, 45, 45, 0.32); color: var(--err); border-color: var(--err-bd); }
.btn-danger:hover { background: rgba(180, 55, 55, 0.5); color: #fff; transform: translateY(-2px); }

.btn-warning { background: rgba(120, 95, 20, 0.32); color: var(--warn); border-color: var(--warn-bd); }
.btn-warning:hover { background: rgba(160, 125, 30, 0.5); color: #fff; transform: translateY(-2px); }

.btn-sm { padding: 7px 13px; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }

/* alerts ---------------------------------------------------- */
.alerts { position: relative; z-index: var(--z-base); }
.alert {
  padding: 13px 16px 13px 44px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: 0.92rem;
  border: 1px solid;
  position: relative;
  animation: alert-in 0.5s var(--ease) both;
}
.alert::before {
  position: absolute; left: 15px; top: 12px; font-size: 1rem; line-height: 1;
}
@keyframes alert-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.alert-success { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bd); }
.alert-success::before { content: "✓"; }
.alert-danger  { background: var(--err-bg);  color: var(--err);  border-color: var(--err-bd); }
.alert-danger::before { content: "!"; font-weight: 800; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.alert-warning::before { content: "△"; }
.alert-info    { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.alert-info::before { content: "i"; font-style: italic; font-weight: 700; }

/* tables ---------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 12px 15px; text-align: left; }
thead th {
  color: var(--faint); font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { color: var(--ink-soft); border-bottom: 1px solid rgba(57, 44, 38, 0.6); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover td { background: rgba(218, 119, 100, 0.06); }

/* badges ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok      { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bd); }
.badge-err     { background: var(--err-bg);  color: var(--err);  border-color: var(--err-bd); }
.badge-warn    { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.badge-primary { background: rgba(218, 119, 100, 0.14); color: var(--primary-bright); border-color: var(--border-lit); }
.badge-mono { font-family: 'JetBrains Mono', monospace; letter-spacing: 0; }

/* key chips ------------------------------------------------- */
.key-display {
  display: inline-block;
  background: var(--bg);
  border: 1px dashed var(--border-lit);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.86rem;
  color: var(--primary-bright);
  letter-spacing: 0.06em;
  user-select: all;
}

/* helpers --------------------------------------------------- */
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.mt-6 { margin-top: 6px; } .mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.divider { height: 1px; background: var(--border); margin: 22px 0; border: 0; }
.grid-cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* action cells in admin tables */
.col-actions { text-align: right; }
td.col-actions .actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------- */
/* Sourcelist editor                                          */
/* ---------------------------------------------------------- */
textarea {
  width: 100%;
  min-height: 56vh;
  padding: 16px 18px;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  tab-size: 2;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea:focus { outline: none; border-color: var(--border-lit); box-shadow: var(--ring); background: #100b0a; }
textarea.no-wrap { white-space: pre; overflow-x: auto; }
.editor-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* split-view editor */
.editor-toolbar-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  background: rgba(41, 32, 27, 0.6); border: 1px solid var(--border); border-radius: var(--r);
}
.mini-select {
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: 0.82rem; max-width: 200px; cursor: pointer;
}
.mini-select:focus { outline: none; border-color: var(--border-lit); box-shadow: var(--ring); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor-pane, .preview-pane {
  background: linear-gradient(180deg, rgba(41, 32, 27, 0.6), rgba(32, 24, 20, 0.7));
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px;
}
.pane-label {
  display: block; margin-bottom: 10px;
  color: var(--ink-soft); font-size: 0.86rem; font-weight: 600;
}
.pane-label .muted { font-weight: 400; }
.preview-tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 600; }
.editor-pane textarea { min-height: 60vh; margin-top: 0; }
.preview-body {
  min-height: 60vh; max-height: 68vh; overflow: auto;
  background: rgba(12, 8, 7, 0.55); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px;
}
.preview-body:empty::before { content: "Start typing to see the live preview…"; color: var(--faint); font-size: 0.9rem; }
.preview-body .section:last-child { margin-bottom: 0; }
#dirtyState.is-dirty { color: var(--warn); font-weight: 600; }
#dirtyState.is-saved { color: var(--ok); font-weight: 600; }
.kbd-hint {
  font-size: 0.68rem; font-weight: 600; opacity: 0.6; letter-spacing: 0.02em;
  padding: 2px 6px; border: 1px solid currentColor; border-radius: 5px; margin-left: 8px;
}

/* section manager chips */
.section-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.section-bar:empty { display: none; }
.sec-chip {
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(41, 32, 27, 0.7); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 4px 3px 4px;
}
.sec-jump {
  background: transparent; border: none; color: var(--ink-soft);
  font: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer;
  padding: 4px 8px; border-radius: 999px; max-width: 200px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sec-jump:hover { background: rgba(218, 119, 100, 0.14); color: var(--ink); }
.sec-op {
  background: transparent; border: none; color: var(--faint);
  cursor: pointer; font-size: 0.7rem; line-height: 1; padding: 5px 5px; border-radius: 6px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.sec-op:hover { background: rgba(218, 119, 100, 0.16); color: var(--ink); }
.sec-del:hover { background: rgba(180, 55, 55, 0.32); color: var(--err); }

/* draft restore bar */
.draft-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 11px 16px;
  background: var(--warn-bg); border: 1px solid var(--warn-bd); border-radius: var(--r);
  color: var(--warn); font-size: 0.9rem;
}
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-body { max-height: 50vh; min-height: 200px; }
  .editor-pane textarea { min-height: 44vh; }
}
.push-note {
  display: flex; gap: 11px; align-items: flex-start;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55;
}
.push-note-icon { color: var(--primary); flex: 0 0 auto; margin-top: 1px; }
.save-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px; margin-top: 14px;
  background: rgba(20, 15, 14, 0.82);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--border-lit); border-radius: var(--r);
  box-shadow: var(--shadow);
}
code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.85em;
  background: var(--bg); color: var(--primary-bright);
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
}

/* ---------------------------------------------------------- */
/* Responsive tables → stacked cards on phones                */
/* ---------------------------------------------------------- */
@media (max-width: 760px) {
  .table-wrap { overflow: visible; border: none; }
  table.responsive thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.responsive tbody { display: block; }
  table.responsive tr {
    display: block;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 4px 2px;
    margin-bottom: 12px;
  }
  table.responsive td {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 10px 15px; border: none; text-align: right;
  }
  table.responsive td + td { border-top: 1px solid rgba(57, 44, 38, 0.55); }
  table.responsive td::before {
    content: attr(data-label);
    color: var(--faint); font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    text-align: left; flex: 0 0 auto;
  }
  table.responsive td.col-actions { display: block; text-align: left; }
  table.responsive td.col-actions::before { display: block; margin-bottom: 10px; }
  td.col-actions .actions { flex-direction: column; align-items: stretch; gap: 8px; justify-content: flex-start; }
  td.col-actions .actions > a.btn { width: 100%; }
  td.col-actions .actions form { display: flex; gap: 6px; width: 100%; }
  td.col-actions .actions form input { flex: 1 1 auto; width: auto; }
  td.col-actions .actions form:not(.flex) .btn { flex: 1 1 auto; }
  .save-bar { flex-direction: column; align-items: stretch; }
  .save-bar .flex { justify-content: stretch; }
  .save-bar .flex .btn { flex: 1 1 auto; }
}

/* footer ---------------------------------------------------- */
.footer {
  text-align: center;
  padding: 34px 20px 40px;
  color: var(--faint);
  font-size: 0.8rem;
  position: relative;
  z-index: var(--z-base);
}
.footer .lock { color: var(--primary); }

/* ---------------------------------------------------------- */
/* Auth (login / register) — the wow surface                  */
/* ---------------------------------------------------------- */
.auth-wrap {
  min-height: calc(100vh - 8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  position: relative;
  z-index: var(--z-base);
}
.auth-hero { text-align: center; margin-bottom: 26px; }
.cupid-wrap {
  display: inline-block;
  perspective: 720px;
  animation: cupid-float 6s ease-in-out infinite;
  will-change: transform;
}
.cupid {
  --rx: 0deg; --ry: 0deg;
  width: clamp(84px, 16vw, 118px);
  height: auto;
  display: block;
  filter: drop-shadow(0 16px 34px var(--glow));
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
}
@keyframes cupid-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}
.auth-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-top: 14px;
  line-height: 1.02;
}
.auth-title em { font-style: italic; color: var(--primary-bright); }
.auth-sub { color: var(--muted); margin-top: 10px; font-size: 1rem; max-width: 42ch; margin-inline: auto; }
.auth-card { width: 100%; max-width: 420px; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 0.92rem; }

.trust-row {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  margin-top: 26px; color: var(--muted); font-size: 0.8rem;
}
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }

/* ---------------------------------------------------------- */
/* Dashboard — sourcelist rendering (logic preserved)         */
/* ---------------------------------------------------------- */
.status-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  border-radius: var(--r);
  font-size: 0.92rem; font-weight: 500;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.status-strip.ok   { color: var(--ok);   border-color: var(--ok-bd);   background: var(--ok-bg); }
.status-strip.bad  { color: var(--err);  border-color: var(--err-bd);  background: var(--err-bg); }
.status-strip.wait { color: var(--warn); border-color: var(--warn-bd); background: var(--warn-bg); }

.section { margin-bottom: 30px; }
.section-header {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem; font-weight: 600; color: var(--primary-bright);
  padding-bottom: 9px; margin-bottom: 16px;
  border-bottom: 2px solid var(--border-lit);
  display: flex; align-items: center; gap: 10px;
}
.sub-h {
  color: var(--primary); font-weight: 700; font-size: 0.76rem;
  text-transform: uppercase; letter-spacing: 0.14em; margin: 20px 0 9px;
}
.supplier { margin-bottom: 15px; line-height: 1.6; }
.supplier:last-child { margin-bottom: 0; }
.supplier-name { font-weight: 600; color: var(--ink); font-size: 1.02rem; }
.supplier-desc { color: var(--ink-soft); font-size: 0.94rem; }
.supplier-contact { color: var(--info); font-size: 0.96rem; }
.supplier-link {
  color: var(--primary-bright); text-decoration: none;
  border-bottom: 1px solid var(--border-lit);
  font-size: 0.92rem; transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.supplier-link:hover { color: var(--ink); border-color: var(--primary); }
.auto-link {
  color: var(--primary-bright);
  text-decoration: underline;
  text-decoration-color: var(--border-lit);
  text-underline-offset: 2px;
  word-break: break-word;
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}
.auto-link:hover { color: var(--ink); text-decoration-color: var(--primary); }
.note { color: var(--faint); font-style: italic; font-size: 0.86rem; padding: 2px 0; }

/* ---- branded, protected sourcelist ---- */
.list-shell {
  background: rgba(12, 8, 7, 0.62);
  position: relative;
  overflow: hidden;
  padding: 22px 26px 26px;
}
.list-shell::before {   /* large faint Cupid behind the list */
  content: "";
  position: absolute; top: 26px; left: 50%; transform: translateX(-50%);
  width: 320px; height: 320px;
  background: url('/static/cupid.png') center / contain no-repeat;
  opacity: 0.05; pointer-events: none; z-index: 0;
}
.list-shell > * { position: relative; z-index: 1; }

.list-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-lit);
}
.list-logo {
  width: 46px; height: 46px; flex: 0 0 auto;
  filter: drop-shadow(0 4px 12px var(--glow));
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
.list-head-text { flex: 1 1 auto; min-width: 0; }
.list-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.2rem; color: var(--ink); letter-spacing: -0.01em; }
.list-owner { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.list-owner strong { color: var(--primary-bright); }
.list-badge {
  flex: 0 0 auto; align-self: flex-start;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--primary-bright); background: rgba(218, 119, 100, 0.12);
  border: 1px solid var(--border-lit); border-radius: 999px; padding: 5px 12px;
}
.list-note {
  color: var(--faint); font-size: 0.8rem; line-height: 1.5;
  margin-bottom: 22px; padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25); border: 1px dashed var(--border);
  border-radius: var(--r-sm);
}
.spot-hint { color: var(--primary-bright); font-weight: 600; }
.list-canary {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--faint); font-size: 0.78rem; line-height: 1.55;
}
.list-canary strong { color: var(--muted); }

/* Spotlight reveal: the list is blurred except a band that follows the pointer,
   so a single screenshot only ever captures a sliver. Gated on data-protect
   (server-rendered) so disabling JS can't un-blur it — it only removes the reveal. */
body[data-protect] #sourcelistContainer .section-header,
body[data-protect] #sourcelistContainer .sub-h,
body[data-protect] #sourcelistContainer .supplier {
  filter: blur(5.5px);
  opacity: 0.68;
  transition: filter 0.13s var(--ease), opacity 0.13s var(--ease);
}
body[data-protect] #sourcelistContainer .spot-on {
  filter: none;
  opacity: 1;
}

/* selection / copy lockdown on the list */
body[data-protect] #sourcelistContainer {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
body[data-protect] #sourcelistContainer a { -webkit-user-drag: none; }

/* forensic identity watermark, tiled over the whole viewport */
.wm {
  position: fixed; inset: 0; z-index: 30;
  pointer-events: none;
  background-repeat: repeat;
  background-position: 0 0;
  opacity: 0.9;
}

/* blur veil shown when the window is inactive or a capture key is hit */
body.is-hidden #sourcelistContainer,
body.is-hidden .list-head,
body.is-hidden .list-note,
body.is-hidden .wm { filter: blur(18px); transition: filter 0.12s ease; }
.protect-veil {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 11, 10, 0.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity 0.16s ease, visibility 0.16s ease;
}
body.is-hidden .protect-veil { opacity: 1; visibility: visible; }
.protect-veil-box {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-soft); font-size: 0.98rem; font-weight: 500;
  padding: 16px 22px; border: 1px solid var(--border-lit); border-radius: var(--r);
  background: rgba(32, 24, 20, 0.7);
}
.protect-veil-mark { color: var(--primary); font-size: 1.1rem; }

@media print {
  body * { visibility: hidden !important; }
  body::after {
    content: "This sourcelist is confidential and cannot be printed.";
    visibility: visible; position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; font-size: 18px; color: #000; background: #fff;
  }
}

/* ---------------------------------------------------------- */
/* Motion / responsive                                        */
/* ---------------------------------------------------------- */
.reveal { animation: reveal 0.7s var(--ease) both; }
.reveal-2 { animation-delay: 0.08s; }
.reveal-3 { animation-delay: 0.16s; }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .container { padding: 20px 15px 8px; }
  .card { padding: 19px; border-radius: var(--r); }
  .nav { padding: 12px 15px; }
  .nav-user { display: none; }
  .brand-sub { display: none; }
  .copy-bar { top: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .cupid { animation: none; }
}
