/* ============================================================
   ScribeNex Publishing — Global Design System
   Premium literary aesthetic: charcoal, ivory, gold
   ============================================================ */

:root {
  /* Brand palette */
  --ink: #14110f;
  --ink-soft: #1e1a17;
  --ink-mute: #2b2622;
  --charcoal: #232020;
  --ivory: #faf7f0;
  --cream: #f3eee2;
  --paper: #fffdf8;
  --gold: #c9a44c;
  --gold-bright: #e0bd6a;
  --gold-deep: #a8853a;
  --gold-soft: rgba(201, 164, 76, 0.12);
  --burgundy: #6e1f2e;
  --burgundy-dark: #571825;
  --navy: #1b2a41;
  --white: #ffffff;
  --gray-100: #f5f3ef;
  --gray-200: #e8e4dc;
  --gray-300: #d3cec4;
  --gray-400: #a39d92;
  --gray-500: #7b756b;
  --gray-600: #5a554d;
  --gray-700: #3e3a34;
  --gray-750: #3d3830;
  --gray-650: #5f584e;
  --gray-550: #6a635a;
  --gray-450: #8a8378;

  /* Accent variants (toasts / hover / status) */
  --success-bright: #43b97a;
  --danger-bright: #e06666;
  --info-bright: #6aa7dd;
  --success-dark: #256742;
  --danger-dark: #963030;
  --success-strong: #2e7d32;
  --danger-strong: #b3261e;

  /* Decorative cover / hero surfaces */
  --cover-ink-1: #211b14;
  --cover-ink-2: #37291a;
  --cover-ink-3: #1b150f;
  --cover-navy-1: #101623;
  --cover-navy-3: #0d1420;
  --hero-ink-2: #1d1813;
  --hero-ink-3: #2a2015;
  --hero-deep: #33291c;
  --ink-warm: #2a2118;
  --ink-warm-2: #3a2e1d;
  --ink-warm-3: #33281a;
  --detail-ink-2: #241c12;
  --detail-ink-3: #302411;
  --vol-ink-1: #1c1712;
  --vol-ink-3: #3a2a1a;
  --vol-deep: #33271a;
  --bio-deep: #3d2f1c;
  --cert-paper-1: #fffdf6;
  --cert-paper-2: #f7f1e0;

  /* Semantics */
  --success: #2e7d4f;
  --success-bg: #e6f4ec;
  --warning: #b07a1f;
  --warning-bg: #fbf3e0;
  --warning-dark: #8a5a00;
  --success-text: #1e7e34;
  --info-text: #1a5da6;
  --alert-success-bg: #e8f5ec;
  --alert-warning-bg: #fdf3e0;
  --alert-danger-bg: #fdecec;
  --alert-info-bg: #e8f1fb;
  --gray-25: #fafafa;
  --danger: #b23a3a;
  --danger-bg: #fbe8e8;
  --info: #2b5f8f;
  --info-bg: #e7f0f8;

  /* Type */
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-serif: var(--font-display);
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace;

  /* Compatibility aliases (referenced across pages/JS) */
  --muted: var(--gray-500);
  --gray-50: #faf9f6;

  /* Layout */
  --container: 1200px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(20, 17, 15, 0.08);
  --shadow: 0 6px 24px rgba(20, 17, 15, 0.10);
  --shadow-lg: 0 18px 50px rgba(20, 17, 15, 0.16);
  --shadow-gold: 0 8px 30px rgba(201, 164, 76, 0.25);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 72px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); }
h4 { font-size: 1.1rem; }

::selection { background: var(--gold); color: var(--ink); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 3000;
  background: var(--gold); color: var(--ink); padding: 10px 18px; font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Layout utilities ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: 84px 0; }
.section--tight { padding: 56px 0; }
.section--dark { background: var(--ink); color: var(--ivory); }
.section--dark h2, .section--dark h3 { color: var(--ivory); }
.section--cream { background: var(--cream); }
/* page-level surface helpers (used by standalone pages) */
.page-cream { background: var(--cream); }
.onboarding-main { padding: 56px 20px; }
.section--gray { background: var(--gray-100); }

.section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.section-head--left { margin-left: 0; text-align: left; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-deep); margin-bottom: 14px;
}
.eyebrow::before { content: ''; width: 28px; height: 2px; background: var(--gold); }
.section--dark .eyebrow { color: var(--gold-bright); }
.section-head p { color: var(--gray-500); margin-top: 12px; font-size: 1.06rem; }
.section--dark .section-head p { color: var(--gray-300); }

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

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 10px; } .gap-md { gap: 18px; } .gap-lg { gap: 28px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-gold { color: var(--gold-deep); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.78rem; }
.hidden { display: none !important; }
.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; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 28px; border-radius: var(--radius-sm); border: 2px solid transparent;
  font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em;
  transition: all var(--transition); white-space: nowrap; line-height: 1.2;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--ink); box-shadow: var(--shadow-gold); }
.btn-gold:hover { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); transform: translateY(-2px); box-shadow: 0 12px 34px rgba(201,164,76,0.35); }
.btn-dark { background: var(--ink); color: var(--ivory); }
.btn-dark:hover { background: var(--ink-mute); transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--ivory); }
.btn-outline-light { border-color: rgba(250,247,240,0.5); color: var(--ivory); background: transparent; }
.btn-outline-light:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn-outline-gold { border-color: var(--gold); color: var(--gold-deep); background: transparent; }
.btn-outline-gold:hover { background: var(--gold); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--ink); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: var(--success-dark); }
.btn-sm { padding: 8px 16px; font-size: 0.84rem; }
.btn-lg { padding: 16px 38px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.6; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.2); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 100px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-gold { background: rgba(201,164,76,0.16); color: var(--gold-deep); border: 1px solid rgba(201,164,76,0.4); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-dark { background: var(--ink); color: var(--ivory); }
.badge-muted { background: var(--gray-200); color: var(--gray-600); }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 30px; transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--gray-300); }
.card--static:hover { transform: none; box-shadow: var(--shadow-sm); }
.card--dark { background: var(--ink-soft); border-color: var(--ink-mute); color: var(--ivory); }
.card--dark h3, .card--dark h4 { color: var(--ivory); }
.card-icon {
  width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(201,164,76,0.18), rgba(201,164,76,0.08));
  color: var(--gold-deep); font-size: 1.3rem; margin-bottom: 18px;
}

/* ---------- Announcement bar ---------- */
.announce-bar {
  background: linear-gradient(90deg, var(--ink), var(--ink-mute), var(--ink));
  color: var(--cream); text-align: center; padding: 9px 16px; font-size: 0.84rem;
  border-bottom: 1px solid rgba(201,164,76,0.35);
}
.announce-bar strong { color: var(--gold-bright); }
.announce-bar a { color: var(--gold-bright); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 900;
  background: rgba(255,253,248,0.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-200);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ink), var(--ink-mute));
  border: 1px solid var(--gold); color: var(--gold-bright);
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.brand small { display: block; font-family: var(--font-body); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold-deep); }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav > a, .nav-drop > button {
  padding: 9px 13px; border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 500; color: var(--gray-600);
  background: none; border: none; display: inline-flex; align-items: center; gap: 6px; transition: all var(--transition);
}
.main-nav > a:hover, .main-nav > a.active, .nav-drop > button:hover { color: var(--ink); background: var(--gray-100); }
.main-nav > a.active { color: var(--gold-deep); font-weight: 600; }

.nav-drop { position: relative; }
.nav-drop-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all 0.2s ease; z-index: 950;
}
.nav-drop:hover .nav-drop-menu, .nav-drop:focus-within .nav-drop-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-drop-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--gray-600); transition: all var(--transition); }
.nav-drop-menu a:hover { background: var(--gray-100); color: var(--ink); }
.nav-drop-menu a i { color: var(--gold-deep); width: 18px; text-align: center; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; color: var(--ink); padding: 8px; }

/* Mobile nav */
.mobile-nav {
  display: none; position: fixed; inset: 0; top: 0; z-index: 1200; background: var(--ink);
  overflow-y: auto; padding: 24px;
}
.mobile-nav.open { display: block; animation: fadeIn 0.25s ease; }
.mobile-nav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.mobile-nav-head .brand { color: var(--ivory); }
.mobile-nav-close { background: none; border: none; color: var(--ivory); font-size: 1.6rem; }
.mobile-nav a { display: block; padding: 14px 6px; font-size: 1.05rem; color: var(--gray-300); border-bottom: 1px solid rgba(255,255,255,0.07); }
.mobile-nav a:hover { color: var(--gold-bright); }
.mobile-nav .mobile-group { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--gold); padding: 20px 6px 6px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  background: linear-gradient(150deg, var(--ink) 0%, var(--ink-mute) 60%, var(--hero-deep) 100%);
  color: var(--ivory); padding: 76px 0 64px; position: relative; overflow: hidden;
}
.page-hero::after {
  content: '❝'; position: absolute; right: 4%; top: -30px; font-family: var(--font-display);
  font-size: 18rem; color: rgba(201,164,76,0.07); line-height: 1;
}
.page-hero h1 { color: var(--ivory); }
.page-hero p { color: var(--gray-300); max-width: 640px; margin-top: 14px; font-size: 1.08rem; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--gray-400); margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--gold-bright); }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 7px; color: var(--gray-700); }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 0.78rem; color: var(--gray-400); margin-top: 5px; }
.form-control {
  width: 100%; padding: 12px 15px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--white); font-size: 0.95rem; color: var(--ink); transition: all var(--transition);
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,76,0.18); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 110px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b756b' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.form-control.is-invalid { border-color: var(--danger); }
/* NOTE: .form-error is defined once in the FORM SYSTEM layer below. */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-size: 0.9rem; color: var(--gray-600); }
.form-check input { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--gold-deep); flex-shrink: 0; }
.input-group { position: relative; }
.input-group .toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--gray-400); font-size: 0.95rem; }
.input-group .toggle-pass:hover { color: var(--ink); }

.file-drop {
  border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--gray-500); font-size: 0.88rem; cursor: pointer; transition: all var(--transition); background: var(--gray-100);
}
.file-drop:hover, .file-drop.drag { border-color: var(--gold); background: rgba(201,164,76,0.06); }
.file-drop i { font-size: 1.6rem; color: var(--gold-deep); display: block; margin-bottom: 8px; }
.file-drop input { display: none; }
.file-drop .file-name { font-weight: 600; color: var(--success); margin-top: 6px; display: none; }
.file-drop.has-file .file-name { display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.data-table th {
  text-align: left; padding: 13px 16px; background: var(--gray-100); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-500); border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-100); }

/* ---------- Status timeline ---------- */
.status-timeline { position: relative; padding-left: 30px; }
.status-timeline::before { content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: var(--gray-200); }
.timeline-step { position: relative; padding-bottom: 26px; }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before {
  content: ''; position: absolute; left: -27px; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--gray-300);
}
.timeline-step.done::before { background: var(--success); border-color: var(--success); }
.timeline-step.current::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 5px rgba(201,164,76,0.25); }
.timeline-step h4 { font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; }
.timeline-step.done h4 { color: var(--success); }
.timeline-step.current h4 { color: var(--gold-deep); }
.timeline-step p { font-size: 0.82rem; color: var(--gray-500); }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 4000; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px; border-radius: var(--radius);
  background: var(--ink); color: var(--ivory); box-shadow: var(--shadow-lg); font-size: 0.9rem;
  animation: toastIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2); border-left: 4px solid var(--gold);
}
.toast.success { border-left-color: var(--success-bright); }
.toast.error { border-left-color: var(--danger-bright); }
.toast.info { border-left-color: var(--info-bright); }
.toast i { margin-top: 2px; }
.toast.success i { color: var(--success-bright); } .toast.error i { color: var(--danger-bright); } .toast.info i { color: var(--info-bright); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,17,15,0.62); z-index: 2000;
  display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--white); border-radius: var(--radius-lg); max-width: 560px; width: 100%; max-height: 88vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--gray-200); }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--gray-400); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 26px; }
.modal-foot { padding: 18px 26px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- Empty / skeleton states ---------- */
.empty-state { text-align: center; padding: 56px 24px; color: var(--gray-500); }
.empty-state i { font-size: 2.6rem; color: var(--gray-300); margin-bottom: 16px; display: block; }
.empty-state h4 { font-family: var(--font-body); color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 0.9rem; }

.skeleton { background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--gray-300); padding: 70px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1.2fr; gap: 40px; padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.footer-grid h4 { color: var(--ivory); font-family: var(--font-body); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 18px; }
.footer-grid a { display: block; padding: 5px 0; font-size: 0.88rem; color: var(--gray-400); transition: color var(--transition); }
.footer-grid a:hover { color: var(--gold-bright); }
.footer-brand p { font-size: 0.88rem; margin: 14px 0 18px; color: var(--gray-400); max-width: 280px; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; padding: 0;
}
.footer-social a:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(201,164,76,0.1); }
.footer-bottom { padding: 22px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--gray-500); }
.footer-bottom a { color: var(--gray-400); }
.footer-bottom a:hover { color: var(--gold-bright); }
.footer-contact-line { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; padding: 5px 0; color: var(--gray-400); }
.footer-contact-line i { color: var(--gold); width: 16px; }

/* ---------- Auth layout ---------- */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(160deg, var(--ink), var(--ink-warm)); color: var(--ivory); padding: 60px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-side::after { content: '❝'; position: absolute; right: -20px; bottom: -80px; font-family: var(--font-display); font-size: 22rem; color: rgba(201,164,76,0.08); }
.auth-side h2 { color: var(--ivory); font-size: 2rem; margin: 18px 0 12px; }
.auth-side p { color: var(--gray-300); max-width: 380px; }
.auth-trust { display: flex; flex-direction: column; gap: 14px; margin-top: 34px; position: relative; z-index: 1; }
.auth-trust li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.92rem; color: var(--gray-300); }
.auth-trust i { color: var(--gold-bright); margin-top: 3px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--paper); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.85rem; margin-bottom: 8px; }
.auth-card > p { color: var(--gray-500); margin-bottom: 30px; font-size: 0.95rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.pagination button {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--gray-300);
  background: var(--white); font-size: 0.88rem; font-weight: 500; color: var(--gray-600); transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-deep); }
.pagination button.active { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Search / filter bar ---------- */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 30px; }
.filter-bar .form-control { width: auto; min-width: 160px; }
.filter-bar .search-box { position: relative; flex: 1; min-width: 220px; }
.filter-bar .search-box input { width: 100%; padding-left: 40px; }
.filter-bar .search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

/* ---------- Countdown ---------- */
.countdown { display: flex; gap: 12px; }
.countdown .cd-box { text-align: center; background: rgba(255,255,255,0.06); border: 1px solid rgba(201,164,76,0.3); border-radius: var(--radius); padding: 12px 8px; min-width: 68px; }
.countdown .cd-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--gold-bright); line-height: 1.1; }
.countdown .cd-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gray-400); }
.countdown--light .cd-box { background: var(--cream); border-color: var(--gray-300); }
.countdown--light .cd-num { color: var(--ink); }
.countdown--light .cd-label { color: var(--gray-500); }

/* ---------- Misc ---------- */
.divider-quill { text-align: center; color: var(--gold); font-size: 1.2rem; margin: 32px 0; display: flex; align-items: center; gap: 18px; justify-content: center; }
.divider-quill::before, .divider-quill::after { content: ''; height: 1px; width: 80px; background: var(--gray-300); }

.progress-bar { height: 8px; background: var(--gray-200); border-radius: 100px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); border-radius: 100px; transition: width 0.6s ease; }

.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--gray-200); }
.avatar-lg { width: 90px; height: 90px; }
.avatar-initials {
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: linear-gradient(135deg, var(--ink), var(--ink-mute)); color: var(--gold-bright); font-family: var(--font-display);
}

[data-animate] { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
[data-animate].in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-animate] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .main-nav { display: none; }
  .nav-toggle { display: block; }
  .header-actions .btn { display: none; }
  .header-actions .btn.keep-mobile { display: inline-flex; }
}
@media (max-width: 720px) {
  .section { padding: 60px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  #toast-root { left: 16px; right: 16px; max-width: none; }
}

/* ---------- Form + button aliases (used by SPA views & store pages) ---------- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.btn-primary { background: var(--burgundy); color: var(--ivory); box-shadow: 0 8px 24px rgba(110,31,46,0.28); }
.btn-primary:hover { background: var(--burgundy-dark); color: var(--ivory); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(110,31,46,0.36); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(20,17,15,0.12);
  background: transparent; color: inherit; cursor: pointer; font-size: 0.9rem;
  transition: all .2s ease;
}
.btn-icon:hover { background: rgba(201,164,76,0.14); border-color: var(--gold); color: var(--gold-deep); }
.btn-icon.active { color: var(--burgundy); border-color: var(--burgundy); }
@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ============ FIX LAYER: alerts, muted, tables, states ============ */
.muted { color: var(--gray-500); }
.alert { display: block; padding: 12px 16px; border-radius: var(--radius-sm, 10px); font-size: 0.9rem; line-height: 1.5; border: 1px solid transparent; }
.alert i { margin-right: 6px; }
.alert-success { background: var(--success-bg, var(--alert-success-bg)); color: var(--success, var(--success-text)); border-color: rgba(30,126,52,.25); }
.alert-warning { background: var(--warning-bg, var(--alert-warning-bg)); color: var(--warning-dark); border-color: rgba(176,124,0,.3); }
.alert-danger  { background: var(--danger-bg, var(--alert-danger-bg)); color: var(--danger); border-color: rgba(179,38,30,.25); }
.alert-info    { background: var(--info-bg, var(--alert-info-bg)); color: var(--info, var(--info-text)); border-color: rgba(26,93,166,.25); }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

/* simple .table (used by portal SPA) — mirrors .data-table */
table.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; padding: 12px 16px; background: var(--gray-100); color: var(--gray-600); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50, var(--gray-25)); }

/* compact timeline variant */
.timeline.compact .timeline-item { padding-bottom: 0.8rem; }
.timeline.compact .timeline-dot { width: 14px; height: 14px; border-width: 2px; left: 3px; }
.timeline.compact::before { left: 9px; }

/* disabled form state */
.is-disabled { opacity: 0.6; pointer-events: none; }
form.is-disabled input, form.is-disabled select, form.is-disabled textarea { background: var(--gray-100); }

/* ============================================================
   FORM SYSTEM — base layer
   Guarantees a premium, consistent look for EVERY control, even
   when a page omits the .form-control class. Low specificity so
   component classes can still override.
   ============================================================ */
:root { --control-h: 48px; --control-radius: 9px; }

/* ---- Text-like inputs: premium base for EVERY control ----
   Uses :where() so specificity is 0 — any component class or inline
   style still wins, but an accidentally unclassed control is never
   left as raw browser default. Allow-list keeps checkbox / radio /
   file / range / colour / buttons untouched. ---- */
:where(input:not([type])),
:where(input[type="text"]), :where(input[type="email"]), :where(input[type="password"]),
:where(input[type="number"]), :where(input[type="search"]), :where(input[type="tel"]),
:where(input[type="url"]), :where(input[type="date"]), :where(input[type="datetime-local"]),
:where(input[type="month"]), :where(input[type="time"]), :where(input[type="week"]),
.form-control {
  width: 100%;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 15px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--control-radius);
  background: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
:where(input:not([type])):hover,
:where(input[type="text"]):hover, :where(input[type="email"]):hover, :where(input[type="password"]):hover,
:where(input[type="number"]):hover, :where(input[type="search"]):hover, :where(input[type="tel"]):hover,
:where(input[type="url"]):hover, :where(input[type="date"]):hover, :where(input[type="datetime-local"]):hover,
:where(input[type="month"]):hover, :where(input[type="time"]):hover, :where(input[type="week"]):hover,
.form-control:hover { border-color: var(--gray-400); }
:where(input:not([type])):focus,
:where(input[type="text"]):focus, :where(input[type="email"]):focus, :where(input[type="password"]):focus,
:where(input[type="number"]):focus, :where(input[type="search"]):focus, :where(input[type="tel"]):focus,
:where(input[type="url"]):focus, :where(input[type="date"]):focus, :where(input[type="datetime-local"]):focus,
:where(input[type="month"]):focus, :where(input[type="time"]):focus, :where(input[type="week"]):focus,
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,164,76,0.18);
}
:where(input)::placeholder,
:where(textarea)::placeholder,
.form-control::placeholder { color: var(--gray-400); }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
/* colour / range keep their intrinsic sizing */
:where(input[type="color"]) { width: 52px; height: 40px; padding: 2px; border: 1.5px solid var(--gray-300); border-radius: 8px; background: var(--white); }
:where(input[type="range"]) { width: 100%; accent-color: var(--gold-deep); }

/* ---- Textarea ---- */
:where(textarea),
textarea.form-control {
  width: 100%;
  height: auto;
  min-height: 128px;
  padding: 13px 15px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--control-radius);
  background: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--transition), box-shadow var(--transition);
}
:where(textarea):hover { border-color: var(--gray-400); }
:where(textarea):focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,76,0.18); }

/* ---- Select (custom chevron, no native control) ---- */
:where(select),
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 42px 0 15px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--control-radius);
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b756b' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  max-width: 100%;
}
:where(select):focus,
select.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,76,0.18); }
:where(select):hover,
select.form-control:hover { border-color: var(--gray-400); }
:where(select):disabled,
select.form-control:disabled { background-color: var(--gray-100); color: var(--gray-500); cursor: not-allowed; }

/* ---- Search box with icon ---- */
.search-box { position: relative; }
.search-box input { padding-left: 42px; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.search-box input:focus ~ i { color: var(--gold-deep); }

/* ---- Input + button rows (track / verify) ---- */
.input-btn-row { display: flex; gap: 10px; align-items: stretch; }
.input-btn-row > input { flex: 1 1 auto; min-width: 0; }
.input-btn-row .btn { flex: 0 0 auto; height: var(--control-h); padding-top: 0; padding-bottom: 0; }

/* ---- Labels: premium base for EVERY field label ----
   :where() keeps specificity 0 so .checkbox-label / .toggle-switch /
   .anth-choice keep their own layout. ---- */
:where(label),
.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  margin-bottom: 7px;
  color: var(--gray-700);
}
/* an unclassed label that WRAPS a checkbox/radio behaves like a checkbox row */
:where(label:has(> input[type="checkbox"])),
:where(label:has(> input[type="radio"])) {
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 500; color: var(--gray-600); margin-bottom: 10px;
}
.form-label .req,
:where(label) .req,
.req { color: var(--danger); font-weight: 700; margin-left: 3px; }

/* ---- Checkbox / radio: intentional, not native ---- */
input[type="checkbox"],
input[type="radio"] {
  width: 18px; height: 18px; flex-shrink: 0;
  accent-color: var(--gold-deep);
  cursor: pointer;
}
.form-check input, .checkbox-label input, .anth-choice-check { margin-top: 2px; }
.checkbox-label,
.form-check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: var(--gray-600); line-height: 1.55; cursor: pointer; }
.checkbox-label a { color: var(--gold-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Field rhythm / hints / errors ---- */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-hint, .form-note { font-size: 0.8rem; color: var(--gray-500); margin-top: 6px; line-height: 1.5; }
.form-error { display: none; font-size: 0.78rem; color: var(--danger); margin-top: 6px; font-weight: 600; }
.form-error.show, .form-error[style*="block"] { display: block; }
.form-control.is-invalid, form .is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(178,58,58,0.14); }
.form-control:disabled, form input:disabled, form select:disabled, form textarea:disabled {
  background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; opacity: 1;
}

/* ---- Buttons: unified height + focus ring ---- */
.btn { min-height: 46px; }
.btn-sm { min-height: 38px; }
.btn-lg { min-height: 54px; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-primary { background: var(--burgundy); color: var(--ivory); }
.btn-primary:hover { background: var(--burgundy-dark); }

/* ---- Store filter controls match the system ---- */
.store-filters select, .store-filters input { height: 44px; padding: 0 15px; border-radius: var(--control-radius); border: 1.5px solid var(--gray-300); font-size: 0.9rem; }
.store-filters select { padding-right: 40px; }
.filter-bar .form-control, .filter-bar select, .filter-bar input { height: 44px; }

/* ---- Compact controls for panels / tables / toolbars ---- */
.select-sm, .input-sm {
  height: 38px; padding: 0 34px 0 12px; border: 1.5px solid var(--gray-300);
  border-radius: 8px; background-color: var(--white); font-size: 0.8rem; color: var(--ink);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b756b' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.select-sm:focus, .input-sm:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,76,0.18); }
.select-sm:hover, .input-sm:hover { border-color: var(--gray-400); }
table .select-sm { height: 34px; font-size: 0.76rem; }
.search-inline {
  height: 40px; min-width: 240px; padding: 0 16px 0 38px; border: 1.5px solid var(--gray-300);
  border-radius: 100px; font-size: 0.84rem; background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 512 512' fill='%237b756b'%3E%3Cpath d='M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 15px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-inline:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,76,0.18); }
.search-inline::placeholder { color: var(--gray-400); }
@media (max-width: 720px) { .search-inline { min-width: 0; width: 100%; } }

/* NOTE: .check-list / .cross-list are defined once in components.css (component layer). */

@media (max-width: 560px) {
  .input-btn-row { flex-direction: column; }
  .input-btn-row .btn { width: 100%; }
}
