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

:root {
  --ink:        #0A0E1A;
  --paper:      #FAFAF7;
  --deep:       #1A2B4C;
  --accent:     #C7A86A;
  --mute:       #5C6168;
  --line:       #E8E5DD;
  --success:    #2F7D4A;
  --error:      #8B1F2A;
  --warn-bg:    #FEF9C3;
  --warn-text:  #A16207;
  --success-bg: #DCFCE7;
  --error-bg:   #FEE2E2;

  /* legacy aliases used by confirm.html */
  --brand:      #1A2B4C;
  --brand-dark: #0A0E1A;
  --brand-light:#EEF2F8;
  --text:       #0A0E1A;
  --muted:      #5C6168;
  --border:     #E8E5DD;
  --bg:         #FAFAF7;
  --card:       #FFFFFF;
  --radius:     8px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── nav ─────────────────────────────────────────────── */
nav:not(.admin-nav) {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 48px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.nav-logo {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--ink);
}
.nav-actions { display: flex; gap: 12px; align-items: center; }
.nav-email { font-size: 13px; color: var(--mute); }

/* ── card ────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.card h1 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 22px; font-weight: 700; margin-bottom: 6px;
}
.card .subtitle { font-size: 14px; color: var(--mute); margin-bottom: 28px; }

/* ── form elements ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink); }
input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 14px;
  outline: none;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199,168,106,.15);
}
textarea { resize: vertical; min-height: 80px; }
.hint { font-size: 12px; color: var(--mute); margin-top: 4px; }

/* file input */
.file-drop {
  border: 1.5px dashed var(--line);
  border-radius: 5px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--accent); background: rgba(199,168,106,.04); }
.file-drop input[type="file"] { display: none; }
.file-drop .file-label { font-size: 13px; color: var(--mute); }
.file-drop .file-name { font-size: 13px; color: var(--ink); font-weight: 500; margin-top: 6px; }

/* ── buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--paper); width: 100%; padding: 12px; }
.btn-accent  { background: var(--accent); color: var(--ink); }
.btn-ghost   {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); font-size: 13px; padding: 7px 14px;
}
.btn-ghost:hover { background: var(--paper); border-color: var(--ink); opacity: 1; }
.btn-danger  { background: var(--error-bg); color: var(--error); border: 1px solid #FCA5A5; font-size: 13px; padding: 7px 14px; }
.btn-sm      { padding: 5px 12px; font-size: 12px; }

/* ── alerts ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 5px;
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #FCA5A5; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86EFAC; }
.alert-info    { background: #EEF2F8; color: var(--deep); border: 1px solid #C7D2FE; }
.alert-warn    { background: var(--warn-bg); color: var(--warn-text); border: 1px solid #FDE68A; }

/* ── tabs ────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tab {
  flex: 1; padding: 10px; text-align: center;
  font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--mute); border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── badges ──────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 5px 14px;
  border-radius: 99px; font-size: 11px; font-weight: 600;
  white-space: nowrap; text-align: center;
}
.badge-green  { background: var(--success-bg); color: #15803D; }
.badge-yellow { background: var(--warn-bg);    color: var(--warn-text); }
.badge-red    { background: var(--error-bg);   color: var(--error); }
.badge-blue   { background: #EEF2F8;           color: var(--deep); }
.badge-gray   { background: #F3F4F6;           color: #6B7280; }

/* ── spinner ─────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── divider ─────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--mute); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── confirm page ────────────────────────────────────── */
.confirm-icon { font-size: 48px; margin-bottom: 16px; text-align: center; }
.text-center  { text-align: center; }

/* ── dashboard layout ────────────────────────────────── */
.dashboard-wrap {
  width: 100%;
  max-width: 860px;
  padding-top: 96px;
  padding-bottom: 48px;
}
.dashboard-header { margin-bottom: 28px; }
.dashboard-header h1 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 24px; font-weight: 700;
}
.dashboard-header p { font-size: 14px; color: var(--mute); margin-top: 4px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 24px;
}
.stat-card .label {
  font-size: 11px; font-weight: 600; color: var(--mute);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--ink); }
.stat-card .sub   { font-size: 12px; color: var(--mute); margin-top: 4px; }

.info-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; margin-bottom: 16px;
}
.info-card h2 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
}
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .key { color: var(--mute); }
.info-row .val { font-weight: 500; }

/* ── transfer table ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: var(--paper); padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--mute); border-bottom: 2px solid var(--line);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,.01); }

/* ── toggle ──────────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
}
.toggle-label { font-size: 14px; }
.toggle-sub   { font-size: 12px; color: var(--mute); margin-top: 2px; }
.toggle {
  position: relative; width: 40px; height: 22px; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; background: var(--line);
  border-radius: 99px; transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--deep); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* ── onboarding steps ────────────────────────────────── */
.step-indicator {
  display: flex; gap: 8px; margin-bottom: 28px; align-items: center;
}
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid var(--line); color: var(--mute);
  transition: all .2s;
}
.step-dot.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-dot.done   { background: var(--success); border-color: var(--success); color: #fff; }
.step-line { flex: 1; height: 1px; background: var(--line); }

/* ── product cards (onboarding) ──────────────────────── */
.product-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.product-option { position: relative; }
.product-option input[type="radio"] { position: absolute; opacity: 0; }
.product-option label {
  display: block; border: 1.5px solid var(--line); border-radius: 7px;
  padding: 18px 20px; cursor: pointer; transition: border-color .15s, background .15s;
  margin: 0;
}
.product-option input:checked + label {
  border-color: var(--accent); background: rgba(199,168,106,.06);
}
.product-option .prod-name {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 15px; font-weight: 700; margin-bottom: 2px;
}
.product-option .prod-rate {
  font-size: 22px; font-weight: 700; color: var(--ink);
  margin: 8px 0 2px; letter-spacing: -0.02em;
}
.product-option .prod-min { font-size: 12px; color: var(--mute); }

/* ── pending / status panels ─────────────────────────── */
.status-panel {
  text-align: center; padding: 48px 24px;
}
.status-icon { font-size: 44px; margin-bottom: 16px; }
.status-panel h2 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 20px; font-weight: 700; margin-bottom: 8px;
}
.status-panel p { font-size: 14px; color: var(--mute); max-width: 380px; margin: 0 auto; }

/* ── admin layout ────────────────────────────────────── */
.admin-shell {
  display: flex; min-height: 100vh; background: var(--paper);
}
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  z-index: 20;
}
.admin-logo {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  padding: 24px 24px 8px; color: var(--paper);
}
.admin-logo-sub { font-size: 10px; color: #6B7A99; padding: 0 24px 20px; letter-spacing: .08em; text-transform: uppercase; }
.admin-nav { flex: 1; padding: 8px 0; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px; font-size: 14px; font-weight: 500;
  color: #9AABB8; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  transition: color .15s, background .15s;
  border-left: 3px solid transparent;
}
.admin-nav-item:hover { color: var(--paper); background: rgba(255,255,255,.06); }
.admin-nav-item.active {
  color: var(--paper); background: rgba(255,255,255,.1);
  border-left-color: var(--accent);
}
.admin-nav-icon { font-size: 16px; width: 20px; text-align: center; }
.admin-footer-item {
  padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.08);
}
.admin-main {
  flex: 1; padding: 32px 40px;
  min-height: 100vh; min-width: 0;
}
.admin-page { display: none; }
.admin-page.active { display: block; }

.admin-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.admin-page-header h1 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 22px; font-weight: 700;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.admin-stat {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.admin-stat .a-val { font-size: 28px; font-weight: 700; color: var(--ink); }
.admin-stat .a-lbl { font-size: 11px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

.admin-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.admin-card-header h2 { font-size: 14px; font-weight: 600; }
.admin-card-body { padding: 0; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  background: var(--paper); padding: 10px 16px; text-align: left;
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--mute); border-bottom: 1px solid var(--line);
}
.admin-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(0,0,0,.012); }
.admin-table .actions { display: flex; gap: 6px; }

.filter-bar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-btn {
  padding: 5px 14px; border-radius: 99px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--line); background: #fff; color: var(--mute);
  cursor: pointer; transition: all .15s;
}
.filter-btn.active { background: var(--deep); color: var(--paper); border-color: var(--deep); }

/* ── modal ───────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,14,26,.5); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h2 {
  font-family: 'Iowan Old Style','Hoefler Text',Charter,Georgia,serif;
  font-size: 18px; font-weight: 700; margin-bottom: 20px;
}
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

/* ── cashflow embed ──────────────────────────────────── */
.cashflow-frame {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 600px; background: #fff;
}

/* ── empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--mute); font-size: 14px;
}

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

@media (max-width: 700px) {
  .product-picker { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
