/* Merged from variables.css — see the HTML <head> for the Google Fonts <link>, moved out of an @import so it's discovered in parallel instead of after this file. */
/* ==========================================================================
   Royal Heritage — Design Tokens
   Signature: "Ledger" system — deep ink navy + emerald growth + gold gains,
   set in Space Grotesk (display) / Inter (body) / JetBrains Mono (data).
   ========================================================================== */

:root {
  /* ---- Palette (dark = default) ---- */
  --ink-950: #070B14;
  --ink-900: #0B1220;
  --ink-800: #121B2E;
  --ink-700: #1A2438;
  --ink-600: #263149;
  --ink-500: #3A4763;

  --paper-000: #F7F5EF;
  --paper-100: #EDEAE0;

  --emerald-600: #14764C;
  --emerald-500: #1B8A5A;
  --emerald-400: #22C57C;
  --emerald-300: #5EE0A6;

  --gold-500: #C9973E;
  --gold-400: #E0B15C;

  --rose-500: #C24545;
  --rose-400: #E2685F;

  --slate-400: #8A93A6;
  --slate-300: #AAB2C2;
  --slate-200: #C7CDDA;

  /* ---- Semantic (dark theme default) ---- */
  --bg: var(--ink-900);
  --bg-elevated: var(--ink-800);
  --bg-card: var(--ink-800);
  --bg-inset: var(--ink-950);
  --border: var(--ink-600);
  --border-soft: var(--ink-700);

  --text-primary: var(--paper-000);
  --text-secondary: var(--slate-300);
  --text-muted: var(--slate-400);

  --accent: var(--emerald-500);
  --accent-bright: var(--emerald-400);
  --accent-soft: rgba(27, 138, 90, 0.14);

  --gain: var(--gold-400);
  --loss: var(--rose-400);

  --focus-ring: var(--emerald-300);

  /* ---- Type ---- */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  /* ---- Scale ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-card: 0 12px 32px rgba(4, 8, 16, 0.35);
  --shadow-pop: 0 20px 50px rgba(4, 8, 16, 0.5);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Light theme override ---- */
[data-theme="light"] {
  --bg: var(--paper-000);
  --bg-elevated: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-inset: var(--paper-100);
  --border: #DEDACB;
  --border-soft: #E9E6DB;

  --text-primary: var(--ink-900);
  --text-secondary: #4A5468;
  --text-muted: #757F92;

  --accent-soft: rgba(27, 138, 90, 0.09);
  --shadow-card: 0 10px 26px rgba(60, 50, 20, 0.08);
  --shadow-pop: 0 20px 46px rgba(60, 50, 20, 0.14);
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

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

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-400), var(--emerald-600));
  color: #06150E;
  box-shadow: 0 8px 22px rgba(27, 138, 90, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(27, 138, 90, 0.48); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #241705;
  box-shadow: 0 8px 22px rgba(201, 151, 62, 0.32);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-ghost:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

.btn-danger {
  background: transparent;
  border-color: var(--rose-500);
  color: var(--rose-400);
}
.btn-danger:hover { background: rgba(194, 69, 69, 0.1); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ---- Form fields ---- */
.field { margin-bottom: var(--space-4); text-align: left; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: var(--font-body);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.field .error-msg { font-size: 12px; color: var(--loss); margin-top: 6px; display: none; }
.field.has-error input { border-color: var(--loss); }
.field.has-error .error-msg { display: block; }
.input-row { display: flex; gap: var(--space-3); }
.input-row .field { flex: 1; }

/* ---- Ledger card: signature notched-corner card ---- */
.ledger-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(34, 197, 124, 0.14); color: var(--emerald-400); }
.badge-warning { background: rgba(224, 177, 92, 0.16); color: var(--gold-400); }
.badge-danger  { background: rgba(226, 104, 95, 0.14); color: var(--rose-400); }
.badge-neutral { background: rgba(138, 147, 166, 0.16); color: var(--slate-300); }

/* ---- Toast ---- */
#toast-root {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  min-width: 260px;
  max-width: 340px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-bright);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.25s var(--ease);
}
.toast.error { border-left-color: var(--loss); }
.toast.success { border-left-color: var(--accent-bright); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Loader ---- */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ---- Theme toggle ---- */
.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.theme-toggle:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.theme-toggle svg { display: block; }
.icon { display: block; }

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto var(--space-3); opacity: 0.6; }

/* ---- Preloader ---- */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.45s var(--ease), visibility 0.45s var(--ease);
}
.preloader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-inner { position: relative; width: 68px; height: 68px; display: flex; align-items: center; justify-content: center; }
.preloader-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--emerald-400), var(--emerald-600));
  color: #06150E; font-family: var(--font-display); font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  animation: preloader-pulse 1.6s ease-in-out infinite;
}
.preloader-ring {
  position: absolute; inset: 0;
  border: 2.5px solid var(--border-soft);
  border-top-color: var(--emerald-400);
  border-radius: 50%;
  animation: preloader-spin 0.9s linear infinite;
}
@keyframes preloader-spin { to { transform: rotate(360deg); } }
@keyframes preloader-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.92); opacity: 0.85; } }
body.preloading { overflow: hidden; }

/* ---- Scroll-reveal + entrance animations ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
[data-reveal].revealed { opacity: 1; transform: none; }

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.enter-anim { animation: fade-in-up 0.7s var(--ease) both; }
.enter-1 { animation-delay: 0.05s; }
.enter-2 { animation-delay: 0.15s; }
.enter-3 { animation-delay: 0.25s; }
.enter-4 { animation-delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .enter-anim { animation: none; }
  .preloader-mark, .preloader-ring { animation: none; }
}

@media (max-width: 720px) {
  .container { padding: 0 var(--space-4); }
  .input-row { flex-direction: column; gap: 0; }
}
