/* ==============================================================
   Rushing Partners — design system
   Editorial, refined, numeric-first. Serif display + clean sans
   + tabular figures. Warm off-white base with navy/gold accents.
   ============================================================== */

:root {
  /* Typography */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Colors — warm, editorial, not flashy */
  --bg: #FAF8F3;
  --bg-elevated: #FFFFFF;
  --bg-muted: #F3EFE7;
  --bg-card: #FFFFFF;

  --ink: #161414;
  --ink-soft: #3C3A37;
  --ink-muted: #7A7571;
  --ink-faint: #AEA9A3;

  --rule: #E5E0D5;
  --rule-strong: #C9C1B1;

  --navy: #1F3A5F;
  --navy-dark: #14263F;
  --navy-tint: #E9EDF3;
  --gold: #A67C2E;
  --gold-soft: #C9A961;

  --success: #3A6F47;
  --success-tint: #E4EFE3;
  --warn: #8A6D00;
  --warn-tint: #FCF2D4;
  --error: #9C2E2E;
  --error-tint: #FBE8E8;

  /* Spacing rhythm */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;

  /* Radii (small, to feel precise) */
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;

  --shadow-card: 0 1px 2px rgba(20, 18, 15, 0.04), 0 0 0 1px rgba(20, 18, 15, 0.03);
  --shadow-hover: 0 4px 12px rgba(20, 18, 15, 0.07), 0 0 0 1px rgba(20, 18, 15, 0.05);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tabular figures on every column-y thing */
.tnum, td.num, th.num, .big-num, input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s3);
  line-height: 1.15;
}

h1 { font-size: 36px; font-weight: 500; }
h2 { font-size: 24px; font-weight: 500; }
h3 { font-size: 18px; font-weight: 500; }
h4 { font-size: 15px; font-weight: 600; text-transform: uppercase;
     letter-spacing: 0.08em; font-family: var(--font-sans);
     color: var(--ink-muted); }

p { margin: 0 0 var(--s4); }

a {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(31, 58, 95, 0.3);
  transition: text-decoration-color 120ms;
}
a:hover { text-decoration-color: var(--navy); }

code, .mono { font-family: var(--font-mono); font-size: 13px; }

/* Forms */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: var(--s2);
  letter-spacing: 0.01em;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.12);
}

.form-row { margin-bottom: var(--s5); }
.form-row .hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: var(--s2);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s5);
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms, border-color 120ms, transform 80ms;
  letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--ink-muted); }
.btn-danger {
  background: var(--bg-elevated);
  color: var(--error);
  border-color: var(--error);
}
.btn-danger:hover { background: var(--error-tint); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px 10px; }

/* Flash messages */
.flash-list { margin: 0 0 var(--s5); padding: 0; list-style: none; }
.flash {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  margin-bottom: var(--s2);
  font-size: 14px;
  border-left: 3px solid;
}
.flash.success { background: var(--success-tint); border-color: var(--success); color: var(--success); }
.flash.error   { background: var(--error-tint);   border-color: var(--error);   color: var(--error); }
.flash.warning { background: var(--warn-tint);    border-color: var(--warn);    color: var(--warn); }
.flash.info    { background: var(--navy-tint);    border-color: var(--navy);    color: var(--navy); }

/* Tables — hairline, tabular, editorial */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}
.data-table thead th {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-strong);
  padding-top: 0;
  padding-bottom: 8px;
}
.data-table tbody tr:hover { background: var(--bg-muted); }
.data-table td.num, .data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table tfoot td {
  border-top: 1px solid var(--rule-strong);
  border-bottom: none;
  font-weight: 600;
  background: var(--bg-muted);
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: var(--s6);
  margin-bottom: var(--s5);
}
.card h2 { margin-top: 0; }
.card-tight { padding: var(--s5); }

/* Stat block — big number + small label */
.stat { padding: var(--s4) 0; }
.stat-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s2);
  font-weight: 600;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: var(--s2);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--bg-card);
}
.stat-grid .stat {
  padding: var(--s5);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat-grid .stat:last-child { border-right: none; }
/* Remove bottom border on last row */
@media (min-width: 960px) {
  .stat-grid .stat:nth-last-child(-n+4) { border-bottom: none; }
}

/* Status pills */
.pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 100px;
  letter-spacing: 0.02em;
  font-family: var(--font-sans);
}
.pill-open    { background: var(--success-tint); color: var(--success); }
.pill-capped  { background: var(--warn-tint); color: var(--warn); }
.pill-settled { background: var(--success-tint); color: var(--success); }
.pill-owed    { background: var(--warn-tint); color: var(--warn); }
.pill-neutral { background: var(--bg-muted); color: var(--ink-muted); }
.pill-red     { background: var(--error-tint); color: var(--error); }

/* Layout */
.page { max-width: 1200px; margin: 0 auto; padding: var(--s6) var(--s5); }
.page-narrow { max-width: 760px; margin: 0 auto; padding: var(--s7) var(--s5); }

/* ==========================
   Top nav
   ========================== */
.topnav {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--rule);
  padding: 0 var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 58px;
}
.topnav-brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.topnav-brand .swoosh { color: var(--gold); font-style: italic; }
.topnav-links {
  display: flex;
  gap: var(--s1);
  margin-left: var(--s5);
  flex: 1;
}
.topnav-links a {
  padding: 8px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--r-sm);
  transition: background 120ms;
  font-weight: 500;
}
.topnav-links a:hover { background: var(--bg-muted); color: var(--ink); }
.topnav-links a.active {
  background: var(--navy-tint);
  color: var(--navy);
  font-weight: 600;
}
.topnav-user {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: 13px;
  color: var(--ink-muted);
}
.topnav-user form { display: inline; margin: 0; }

/* ==========================
   Login page
   ========================== */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) { .login-shell { grid-template-columns: 1fr; } }

.login-left {
  background: var(--navy);
  background-image:
    radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.06), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(198, 169, 97, 0.1), transparent 60%);
  color: #F5EFE0;
  padding: var(--s9) var(--s7);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-left .brand-mark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #FAF6EB;
}
.login-left .brand-mark em {
  font-style: italic;
  color: var(--gold-soft);
}
.login-left .tagline {
  font-size: 14px;
  color: rgba(245, 239, 224, 0.6);
  margin-top: var(--s3);
  letter-spacing: 0.02em;
}
.login-left .quote {
  max-width: 440px;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.4;
  color: rgba(245, 239, 224, 0.85);
  font-style: italic;
  font-weight: 300;
}
.login-left .quote-attr {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(245, 239, 224, 0.5);
  margin-top: var(--s4);
  text-transform: uppercase;
}
.login-left .meta {
  font-size: 12px;
  color: rgba(245, 239, 224, 0.45);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-right {
  padding: var(--s9) var(--s7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.login-right h1 { font-size: 30px; margin-bottom: var(--s2); }
.login-right .sub {
  color: var(--ink-muted);
  margin-bottom: var(--s7);
}

/* Agent dashboard — editorial layout */
.agent-hero {
  padding: var(--s8) 0 var(--s6);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s7);
}
.agent-hero .eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: var(--s3);
}
.agent-hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 64px;
  line-height: 1;
  margin: 0 0 var(--s3);
  letter-spacing: -0.03em;
}
.agent-hero .sub {
  font-size: 16px;
  color: var(--ink-muted);
}

.section-lead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin-bottom: var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
  letter-spacing: -0.01em;
}

/* Progress bar */
.progress {
  height: 6px;
  background: var(--bg-muted);
  border-radius: 100px;
  overflow: hidden;
  margin-top: var(--s2);
}
.progress-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 100px;
  transition: width 300ms;
}
.progress-fill.warn { background: var(--warn); }
.progress-fill.success { background: var(--success); }

/* Utilities */
.mt1 { margin-top: var(--s1); } .mt2 { margin-top: var(--s2); }
.mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); }
.mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); }
.mt7 { margin-top: var(--s7); } .mt8 { margin-top: var(--s8); }
.mb1 { margin-bottom: var(--s1); } .mb2 { margin-bottom: var(--s2); }
.mb3 { margin-bottom: var(--s3); } .mb4 { margin-bottom: var(--s4); }
.mb5 { margin-bottom: var(--s5); } .mb6 { margin-bottom: var(--s6); }
.text-muted { color: var(--ink-muted); }
.text-small { font-size: 13px; }
.text-tiny  { font-size: 12px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-success { color: #2E7D32; }
.text-danger  { color: #C62828; }
.fw-600 { font-weight: 600; }
.ff-display { font-family: var(--font-display); }
.ff-mono { font-family: var(--font-mono); }

.flex { display: flex; align-items: center; gap: var(--s3); }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-gap-4 { gap: var(--s4); }
.flex-gap-5 { gap: var(--s5); }

.divider-thin {
  border: none;
  border-top: 1px solid var(--rule);
  margin: var(--s5) 0;
}

/* Info callout */
.callout {
  padding: var(--s4) var(--s5);
  border-left: 2px solid var(--gold);
  background: rgba(201, 169, 97, 0.08);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: var(--s5);
  font-size: 14px;
}
.callout h4 {
  margin: 0 0 var(--s2);
  color: var(--gold);
  font-size: 11px;
}

/* Action bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s4);
  margin-bottom: var(--s5);
  flex-wrap: wrap;
}
.action-bar .title-group h1 { margin: 0; }
.action-bar .title-group .sub {
  color: var(--ink-muted);
  margin-top: var(--s2);
  font-size: 14px;
}

/* Print optimization */
@media print {
  .topnav, .action-bar .btn, form button { display: none; }
  body { background: white; font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid var(--rule); break-inside: avoid; }
  .page { padding: 0; }
  .agent-hero { padding-top: 0; }
}
