/* ── Curriva — Design System v3 (B1 Precision + B2 Depth) ──────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,300;1,9..144,400;1,9..144,500;1,9..144,600&family=DM+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────────── */

:root {
  /* Brand — B1 Slate */
  --navy:           #1E2530;   /* Slate — B1's --ink */
  --navy-mid:       #2C3545;   /* B1's --ink2 */
  --navy-light:     #3D4D60;   /* B1's --ink3 */

  /* Signature — B1/B2 Ember */
  --gold:           #E8751A;   /* Ember */
  --gold-f:         rgba(232,117,26,0.08);
  --gold-b:         rgba(232,117,26,0.18);
  --gold-warm:      #F0923A;   /* Ember light */

  /* Surfaces */
  --bg:             #F7F8FA;   /* B1: cool precise bg */
  --bg2:            #F0F2F5;   /* B1: slightly deeper */
  --surface:        #FFFFFF;

  /* Borders — B1's cool hairline system */
  --border:         #DDE2E8;
  --border-mid:     #C8D0DA;

  /* Text */
  --text:           #1E2530;   /* Slate as primary text */
  --text-secondary: #2C3545;
  --text-muted:     #5C6B7D;   /* darkened for WCAG AA on --bg (4.8:1) */

  /* Semantic */
  --danger:         #C0392B;
  --danger-f:       rgba(192,57,43,0.08);
  --success:        #1A6B4A;
  --success-f:      rgba(26,107,74,0.08);

  /* Radius — B1 precision scale */
  --radius-xs:      2px;
  --radius-sm:      4px;
  --radius:         8px;
  --radius-lg:      14px;   /* B2 bento */

  /* Fonts — B1: Fraunces display, DM Sans body, IBM Plex Mono accent */
  --font-display:   'Fraunces', Georgia, serif;
  --font-body:      'DM Sans', -apple-system, sans-serif;
  --font-mono:      'IBM Plex Mono', monospace;

  /* Type scale — no half-pixels */
  --text-xs:        10px;   /* mono labels, tags, pills */
  --text-sm:        12px;   /* hints, small labels, captions */
  --text-base:      13px;   /* buttons, inputs, UI chrome */
  --text-body:      14px;   /* body copy, paragraphs */
  --text-label:     11px;   /* form labels, metric labels */

  /* Shadows — consistent elevation system */
  --shadow-sm:      0 1px 3px rgba(30,37,48,0.06);
  --shadow:         0 2px 8px rgba(30,37,48,0.08), 0 0 0 1px rgba(30,37,48,0.03);
  --shadow-lg:      0 8px 24px rgba(30,37,48,0.10), 0 2px 6px rgba(30,37,48,0.05);
  --shadow-xl:      0 20px 40px rgba(30,37,48,0.14), 0 4px 12px rgba(30,37,48,0.07);
  --shadow-inset:   inset 0 1px 2px rgba(30,37,48,0.06);
  --focus-ring:     0 0 0 2px var(--surface), 0 0 0 4px var(--navy-mid);
}

/* ── Reset ────────────────────────────────────────────────────────────────────── */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Global focus baseline ────────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--navy-mid);
  outline-offset: 2px;
}
/* Inputs use a border+shadow system instead */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ── Wordmark ──────────────────────────────────────────────────────────────────── */

.curriva-mark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
}
.curriva-mark em { font-style: italic; color: var(--gold); }
.curriva-mark.light { color: #fff; }
.curriva-mark.light em { color: var(--gold-warm); }
.curriva-mark.large { font-size: 32px; }

/* ── App Header — B1 precision + B2 backdrop ─────────────────────────────────── */

.app-header {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header.static { position: static; }

/* B1's gold accent gradient — bottom edge */
.app-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-warm) 30%, transparent 70%);
  opacity: 0.5;
}

.header-left  { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; gap: 6px; align-items: center; }

.header-divider { width: 1px; height: 18px; background: var(--border); }

.header-context {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.header-logo img { height: 32px; width: auto; }

/* Nav links in header */
.app-header a {
  color: var(--text-muted);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  white-space: nowrap;
}
.app-header a:hover {
  color: var(--navy);
  border-color: var(--border);
  background: var(--bg);
}
.app-header a.back-link { border-color: transparent; padding-left: 0; }
.app-header a.back-link:hover { border-color: transparent; background: none; color: var(--navy); }

/* ── B1 Monospace Tag Pill ───────────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}
.tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}
.tag.gold { color: var(--gold); border-color: var(--gold-b); background: var(--gold-f); }
.tag.navy { color: var(--navy); border-color: var(--border-mid); }

/* ── B1 Eyebrow — uppercase mono label ──────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
/* B2's line decoration */
.eyebrow.gold { color: var(--gold); }
.eyebrow.gold::before {
  content: '';
  width: 16px; height: 2px;
  background: var(--gold);
  border-radius: 1px;
  flex-shrink: 0;
}

/* ── B1 Metrics Bar ──────────────────────────────────────────────────────────── */

.metrics-bar {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}

.metric {
  flex: 1;
  min-width: 120px;
  padding: 18px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.metric:first-child { padding-left: 0; }
.metric:last-child  { border-right: none; }

.metric-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric-val em { font-style: normal; color: var(--gold); }

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

/* ── B2 Bento Grid ───────────────────────────────────────────────────────────── */

.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.bento.cols-2 { grid-template-columns: repeat(2, 1fr); }
.bento.cols-4 { grid-template-columns: repeat(4, 1fr); }

.bcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.bcard:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.bcard.wide  { grid-column: span 2; }
.bcard.tall  { grid-row: span 2; display: flex; flex-direction: column; }
.bcard.dark  { background: var(--navy); border-color: rgba(255,255,255,0.06); }

/* B2 Icon container inside bcard */
.bic {
  width: 36px; height: 36px;
  background: var(--gold-f);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  margin-bottom: 16px;
  border: 1px solid var(--gold-b);
  flex-shrink: 0;
}
.bic.navy {
  background: rgba(14,42,74,0.07);
  border-color: rgba(14,42,74,0.12);
  color: var(--navy);
}

.bcard h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.bcard.dark h3 { color: #fff; }

.bcard p {
  font-size: var(--text-body);
  color: var(--text-muted);
  line-height: 1.7;
  font-weight: 300;
}
.bcard.dark p { color: rgba(255,255,255,0.45); }

/* B2 Quote card inside tall bcard */
.bcard-quote {
  margin-top: auto;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.bcard-quote blockquote {
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  color: var(--navy);
  line-height: 1.5;
}
.bcard-quote cite {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: normal;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ── B1 Hairline Feature Grid ────────────────────────────────────────────────── */

.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.feat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.fcard {
  background: var(--surface);
  padding: 28px 24px;
  transition: background 0.15s;
}
.fcard:hover { background: var(--bg2); }

/* ── Page Layout ─────────────────────────────────────────────────────────────── */

.page-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}
.page-main.narrow   { max-width: 680px; }
.page-main.wide     { max-width: 1160px; }
.page-main.centered { max-width: 540px; text-align: center; margin-top: 60px; }

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.15;
}
.page-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.65;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-header h3 {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

/* ── Form Elements ───────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: var(--text-body);
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: auto;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: var(--focus-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; }

input:disabled, select:disabled, textarea:disabled {
  background: var(--bg);
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.field  { display: flex; flex-direction: column; gap: 4px; }
.field-group { display: grid; gap: 16px; }
.field-group.cols-2 { grid-template-columns: 1fr 1fr; }
.field-group.cols-3 { grid-template-columns: 2fr 1fr 2fr; }

@media (max-width: 580px) {
  .field-group.cols-2,
  .field-group.cols-3 { grid-template-columns: 1fr; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn-primary:hover  { background: var(--navy-mid); border-color: var(--navy-mid); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled,
.btn-primary[disabled] { background: var(--text-muted); border-color: var(--text-muted); cursor: not-allowed; }

/* Gold primary — e.g. CTA buttons */
.btn-gold {
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-gold:hover  { opacity: 0.88; }
.btn-gold:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-secondary:hover  { border-color: var(--navy-mid); color: var(--navy); }
.btn-secondary:active { transform: scale(0.97); }

/* Keyboard focus — all button variants */
.btn-primary:focus-visible,
.btn-gold:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Ghost — B1's btn-ghost */
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-ghost:hover  { border-color: var(--border-mid); color: var(--navy); background: var(--bg2); }
.btn-ghost:active { transform: scale(0.97); }

/* ── Fixed Bottom Action Bar ─────────────────────────────────────────────────── */

.form-actions {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 12px 40px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  z-index: 40;
}

/* ── Flash / Alerts ──────────────────────────────────────────────────────────── */

.flash-error {
  background: var(--danger-f);
  color: var(--danger);
  border: 1px solid rgba(192,57,43,0.22);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}

.flash-success {
  background: var(--success-f);
  color: var(--success);
  border: 1px solid rgba(26,107,74,0.22);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}

/* ── Info Boxes ──────────────────────────────────────────────────────────────── */

.info-box {
  background: var(--gold-f);
  border: 1px solid rgba(232,117,26,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.info-box strong { color: var(--navy); }

/* ── Toggle Switches ─────────────────────────────────────────────────────────── */

.toggles { display: flex; flex-direction: column; gap: 8px; }

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.toggle-row:hover { border-color: var(--border-mid); background: var(--bg); }
/* Visually hidden, but still in tab order */
.toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
/* Show focus ring on the label when checkbox is keyboard-focused */
.toggle-row input[type="checkbox"]:focus-visible ~ .toggle-switch {
  outline: 2px solid var(--navy-mid);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.toggle-switch {
  width: 34px; height: 18px;
  background: var(--border-mid);
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background 0.18s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-row input:checked ~ .toggle-switch          { background: var(--navy-mid); }
.toggle-row input:checked ~ .toggle-switch::after   { transform: translateX(16px); }

.toggle-label { display: flex; flex-direction: column; gap: 2px; }
.toggle-label strong { font-size: var(--text-base); color: var(--navy); font-weight: 600; }
.toggle-label span   { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.4; }

/* ── Segmented Control ───────────────────────────────────────────────────────── */

.seg-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg);
}
.seg-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: background-color 0.15s, color 0.15s;
  font-family: var(--font-body);
}
.seg-tab.active            { background: var(--navy); color: #fff; }
.seg-tab:hover:not(.active) { background: var(--surface); color: var(--navy); }
.seg-tab:focus-visible     { outline: none; box-shadow: inset 0 0 0 2px var(--navy-mid); }

/* ── Readonly Block ──────────────────────────────────────────────────────────── */

.readonly-block {
  background: var(--gold-f);
  border: 1px solid rgba(232,117,26,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.readonly-block p     { font-size: 13px; color: var(--navy); line-height: 1.7; }
.readonly-block .label {
  font-size: 10px;
  font-weight: 500;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

/* ── Entry List (profile edit) ───────────────────────────────────────────────── */

.entry-list { display: flex; flex-direction: column; gap: 8px; }

.entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
  transition: border-color 0.15s;
}
.entry:hover { border-color: var(--border-mid); }

.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-grid.three { grid-template-columns: 1.5fr 1fr 2fr; }
@media (max-width: 600px) {
  .entry-grid, .entry-grid.three { grid-template-columns: 1fr; }
}

.entry-field { display: flex; flex-direction: column; gap: 3px; }
.entry-field label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}
.entry-field input { font-size: var(--text-base); padding: 6px 10px; }

.remove-btn {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.remove-btn:hover { color: var(--danger); background: var(--danger-f); }

.add-btn {
  margin-top: 8px;
  background: none;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  color: var(--navy-mid);
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-body);
}
.add-btn:hover { border-color: var(--gold); color: var(--gold); border-style: solid; }

/* ── Tabs (profile edit) ─────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  gap: 0;
}
.tab-btn {
  padding: 10px 24px;
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-bottom-color 0.15s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-btn:hover:not(.active) { color: var(--navy); }
.tab-btn:focus-visible { outline: none; box-shadow: inset 0 -2px 0 var(--navy-mid); }

.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ── Loading Overlay ─────────────────────────────────────────────────────────── */

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed; inset: 0;
  background: rgba(30,37,48,0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}
.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 40px; height: 40px;
  border: 2.5px solid rgba(255,255,255,0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay p     { font-size: 15px; font-weight: 600; }
.loading-overlay small { color: rgba(255,255,255,0.45); font-size: var(--text-sm); margin-top: 6px; }

/* ── Plan / Status Badges ────────────────────────────────────────────────────── */

.plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  text-decoration: none;
}
.plan-pill.trial  { color: var(--text-muted); border: 1px solid var(--border); background: var(--bg); }
.plan-pill.starter { color: var(--gold); border: 1px solid var(--gold-b); background: var(--gold-f); }
.plan-pill.pro    { color: var(--navy); border: 1px solid var(--border-mid); background: var(--bg2); }
.plan-pill.agency { color: #fff; border: 1px solid var(--navy); background: var(--navy); }

/* ── Module Cards (Dashboard) ────────────────────────────────────────────────── */

.module-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-warm) 60%, transparent 100%);
  opacity: 0;
  transition: opacity 0.18s;
}
.module-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-mid);
}
.module-card:hover::before { opacity: 1; }
.module-card.disabled {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.3);
}
.module-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.module-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 16px;
}

/* ── Upgrade Banner ──────────────────────────────────────────────────────────── */

.upgrade-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
}
.upgrade-banner::before {
  content: '';
  position: absolute;
  top: -40%; right: -5%;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,117,26,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.upgrade-banner h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.upgrade-banner p {
  font-size: var(--text-base);
  color: rgba(255,255,255,0.5);
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */

code, .mono {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.text-muted    { color: var(--text-muted); }
.text-gold     { color: var(--gold); }
.text-navy     { color: var(--navy); }
.text-mono     { font-family: var(--font-mono); }
.text-display  { font-family: var(--font-display); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .app-header { padding: 0 20px; }
  .metrics-bar { padding: 0 20px; }
  .form-actions { padding: 12px 20px; }
  .bento { grid-template-columns: 1fr; }
  .bento.cols-2 { grid-template-columns: 1fr; }
  .bcard.wide, .bcard.tall { grid-column: auto; grid-row: auto; }
  .feat-grid { grid-template-columns: 1fr; }
  .module-card { padding: 20px; }
}

@media (max-width: 480px) {
  .page-main { padding: 24px 16px 80px; }
  .card { padding: 20px; }
}

/* ── Reduced Motion ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── CV Preview — Split Layout ───────────────────────────────────────────────── */

.edit-shell {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 0;
  min-height: calc(100vh - 58px);
  align-items: start;
}

.edit-form-col {
  padding: 36px 28px 120px;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 58px);
}

.edit-preview-col {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  background: #E8EBF0;
  display: flex;
  flex-direction: column;
}

/* Mobile: hide preview panel, full-width form */
@media (max-width: 860px) {
  .edit-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .edit-form-col {
    padding: 24px 16px 100px;
    border-right: none;
    min-height: auto;
  }
  .edit-preview-col { display: none; }
}

.preview-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.preview-col-header span {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted);
}
.preview-col-header .preview-tpl-name {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--navy);
}

.cv-preview-root {
  flex: 1;
  padding: 20px 16px 32px;
  overflow: hidden;
}

/* Paper container */
.cv-preview-inner { width: 100%; }
.cv-paper-sizer   { width: 100%; overflow: hidden; }
.cv-paper-wrap    {
  width: 595px;
  transform-origin: top left;
  transition: none;
  font-family: 'DM Sans', Helvetica, Arial, sans-serif;
}
.cv-paper {
  width: 595px;
  min-height: 842px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(30,37,48,0.22), 0 2px 8px rgba(30,37,48,0.12);
  overflow: hidden;
  position: relative;
}

/* ── Classic template ────────────────────────────────────────────── */
.pv-classic-header {
  background: #1E2530;
  padding: 20px 24px 16px;
}
.pv-classic-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; font-weight: 500; color: #fff;
  line-height: 1.15; letter-spacing: -0.02em;
}
.pv-classic-gold-bar { height: 4px; background: #E8751A; }

.pv-info-band {
  display: flex; background: #F0F2F5;
  padding: 8px 24px; gap: 28px;
  border-bottom: 1px solid #DDE2E8;
}
.pv-info-label {
  font-size: 6.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: #6B7A8D; margin-bottom: 2px;
}
.pv-info-val { font-size: 8.5px; font-weight: 500; color: #1E2530; }

.pv-body { padding: 12px 24px 0; }

.pv-section { margin-bottom: 11px; }
.pv-sec-title {
  font-size: 7px; font-weight: 700; color: #1E2530;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding-left: 8px; border-left: 2.5px solid #E8751A;
  margin-top: 10px; margin-bottom: 5px; line-height: 1.5;
}
.pv-sec-rule { display: none; }

.pv-body-text { font-size: 8px; color: #2C3545; line-height: 1.62; }
.pv-placeholder { color: #aab4c4 !important; font-style: italic; }

.pv-komps-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; margin-bottom: 2px;
}
.pv-komps-row span { font-size: 7.5px; color: #2C3545; line-height: 1.5; }

.pv-bullet { font-size: 8px; color: #2C3545; line-height: 1.62; }

.pv-exp-item { margin-bottom: 7px; padding-bottom: 7px; border-bottom: 0.5px solid #E8EBF0; }
.pv-exp-item:last-child { border-bottom: none; padding-bottom: 0; }
.pv-exp-header {
  font-size: 8.5px; font-weight: 700; color: #1E2530;
  line-height: 1.3; display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.pv-exp-zeit { font-size: 7px; color: #6B7A8D; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.pv-exp-desc { font-size: 7.5px; color: #2C3545; line-height: 1.55; margin-top: 2px; }

.pv-edu-item {
  font-size: 8px; color: #2C3545; line-height: 1.55;
  margin-bottom: 4px; display: flex; justify-content: space-between;
}

.pv-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #1E2530; padding: 6px 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 6.5px; color: rgba(255,255,255,0.4);
}
.pv-footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: #E8751A;
}

/* ── Modern template ─────────────────────────────────────────────── */
.pv-modern { position: relative; min-height: 842px; background: #fff; }
.pv-modern-gold-top { height: 4px; background: #E8751A; }
.pv-modern-columns { display: flex; min-height: 828px; }

.pv-modern-sidebar {
  width: 208px; flex-shrink: 0;
  background: #1E2530;
  padding: 18px 15px 64px;
}
.pv-modern-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px; font-weight: 400; color: #fff;
  line-height: 1.28; margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.pv-modern-gold-rule { height: 2px; background: #E8751A; margin-bottom: 14px; }

.pv-sb-section { margin-bottom: 13px; }
.pv-sb-title {
  font-size: 6.5px; font-weight: 700; color: #E8751A;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 5px;
}
.pv-sb-rule { height: 0.5px; background: rgba(255,255,255,0.1); margin-bottom: 6px; }
.pv-sb-bullet { font-size: 7.5px; color: rgba(255,255,255,0.78); line-height: 1.5; margin-bottom: 3px; }

.pv-sidebar-lang { margin-bottom: 6px; }
.pv-sb-lang-name { font-size: 8px; font-weight: 600; color: #fff; line-height: 1.3; }
.pv-sb-lang-niv  { font-size: 7px; color: rgba(255,255,255,0.42); line-height: 1.3; margin-top: 1px; }

.pv-modern-main { flex: 1; padding: 16px 18px 64px; }
.pv-main-section { margin-bottom: 12px; }
.pv-main-sec-title {
  font-size: 6.5px; font-weight: 700; color: #E8751A;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px;
}
.pv-main-sec-rule { height: 0.5px; background: #E8751A; opacity: 0.35; margin-bottom: 7px; }
.pv-main-body { font-size: 8px; color: #2C3545; line-height: 1.58; }

.pv-footer-modern { background: #1E2530; }

/* ── Executive template ──────────────────────────────────────────── */
.pv-executive { padding: 28px 28px 64px; min-height: 842px; position: relative; background: #fff; }
.pv-exec-header { margin-bottom: 8px; }
.pv-exec-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px; font-weight: 400; color: #1E2530;
  line-height: 1.1; letter-spacing: -0.03em;
}
.pv-exec-gold-rule { height: 1.5px; background: #E8751A; margin: 10px 0 8px; }

.pv-exec-section { margin-bottom: 12px; margin-top: 14px; }
.pv-exec-sec-label {
  font-size: 6.5px; font-weight: 700; color: #6B7A8D;
  text-transform: uppercase; letter-spacing: 0.11em; margin-bottom: 5px;
}
.pv-exec-sec-rule { height: 0.5px; background: #C8D0DA; margin-bottom: 9px; }
.pv-exec-body { font-size: 8.5px; color: #2C3545; line-height: 1.68; }

.pv-footer-exec { background: #1E2530; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .edit-shell { grid-template-columns: 1fr; }
  .edit-preview-col { display: none; }
}
