/* ── Curriva — Design System v2 ─────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Archivo:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --navy:         #0E2A4A;
  --navy-mid:     #1E3D6E;
  --navy-light:   #2E527A;
  --gold:         #C4921A;
  --gold-warm:    #D4A828;
  --gold-faint:   #F5EDD9;
  --bg:           #F7F6F3;
  --surface:      #FFFFFF;
  --border:       #E5E1D8;
  --border-mid:   #D0CAC0;
  --text:         #0F1923;
  --text-secondary: #4A5568;
  --text-muted:   #8896A4;
  --danger:       #C0392B;
  --success:      #1A6B4A;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 4px rgba(14,42,74,0.06);
  --shadow:       0 2px 12px rgba(14,42,74,0.10);
  --shadow-lg:    0 8px 32px rgba(14,42,74,0.14);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Archivo', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

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

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

html { -webkit-font-smoothing: antialiased; 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;
}

/* Subtle noise texture on bg */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

main, header, footer, form { position: relative; z-index: 1; }

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

.curriva-mark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: 0.04em;
  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: 36px; }

/* ── App header ──────────────────────────────────────────────────────────────── */

.app-header {
  background: var(--surface);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header.static { position: static; }

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

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

.header-context {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.app-header h1 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}

.app-header a {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 0.18s;
}
.app-header a:hover { color: var(--navy); border-color: var(--border-mid); 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); }

/* Gold accent bar at bottom of header */
.app-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 60%);
  opacity: 0.6;
}

/* ── 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: 980px; }
.page-main.centered { max-width: 560px; 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.2;
}
.page-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ── 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 28px;
  box-shadow: var(--shadow-sm);
  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: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Form elements ───────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.18s, background 0.18s;
  appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-mid);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(30,61,110,0.07);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; }

.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: 14px; }
.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: none;
  border-radius: var(--radius-sm);
  padding: 11px 24px;
  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 0.18s, transform 0.1s;
  letter-spacing: 0.01em;
}
.btn-primary:hover    { background: var(--navy-light); }
.btn-primary:active   { transform: translateY(1px); }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; }

/* Gold variant */
.btn-gold {
  background: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 24px;
  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 0.18s;
}
.btn-gold:hover { background: var(--gold-warm); }

.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: all 0.18s;
}
.btn-secondary:hover { border-color: var(--navy-mid); color: var(--navy); background: var(--bg); }

/* ── Fixed bottom action bar ─────────────────────────────────────────────────── */

.form-actions {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  box-shadow: 0 -4px 20px rgba(14,42,74,0.07);
  z-index: 40;
}

/* ── Flash / alerts ──────────────────────────────────────────────────────────── */

.flash-error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 20px;
}

.flash-success {
  background: #F0FDF4;
  color: var(--success);
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ── Info boxes ──────────────────────────────────────────────────────────────── */

.info-box {
  background: var(--gold-faint);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 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: 10px; }

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  background: var(--bg);
}
.toggle-row:hover { border-color: var(--navy-mid); background: var(--surface); }
.toggle-row input[type="checkbox"] { display: none; }

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--border-mid);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  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: 13px; color: var(--navy); font-weight: 600; }
.toggle-label span   { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ── Segmented control ───────────────────────────────────────────────────────── */

.seg-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg);
}
.seg-tab {
  flex: 1; padding: 9px;
  text-align: center; cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all 0.18s;
  font-family: var(--font-body);
}
.seg-tab.active { background: var(--navy); color: #fff; }
.seg-tab:hover:not(.active) { background: var(--surface); color: var(--navy); }

/* ── Readonly block ──────────────────────────────────────────────────────────── */

.readonly-block {
  background: var(--gold-faint);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
}
.readonly-block p     { font-size: 13px; color: var(--navy); line-height: 1.7; }
.readonly-block .label {
  font-size: 10px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px;
}

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

.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
}
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.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: 4px; }
.entry-field label {
  font-size: 10px; color: var(--text-muted);
  margin-bottom: 0; text-transform: none; letter-spacing: 0;
}
.entry-field input { font-size: 12px; padding: 7px 10px; }

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

.add-btn {
  margin-top: 10px;
  background: none;
  border: 1.5px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--navy-mid);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.18s;
  font-family: var(--font-body);
}
.add-btn:hover { border-color: var(--gold); color: var(--gold); }

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

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}
.tab-btn {
  padding: 11px 26px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.18s;
  font-family: var(--font-body);
}
.tab-btn.active       { color: var(--navy); border-bottom-color: var(--gold); }
.tab-btn:hover:not(.active) { color: var(--navy); }

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

/* ── Loading overlay ─────────────────────────────────────────────────────────── */

.loading-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(14,42,74,0.92);
  backdrop-filter: blur(4px);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.loading-overlay.active { display: flex; }

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

.loading-overlay p     { font-size: 16px; font-weight: 600; }
.loading-overlay small { color: rgba(255,255,255,0.5); font-size: 13px; margin-top: 6px; }

/* ── Stepper (hanse legacy) ──────────────────────────────────────────────────── */

.hanse-stepper {
  background: var(--navy);
  padding: 0 32px;
}

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

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