/* ============================================================
   Tallied — Custom Stylesheet
   ============================================================ */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a2340;
  --sidebar-hover: #2a3558;
  --sidebar-active: #3b82f6;
  --topbar-h: 60px;
  --brand-color: #3b82f6;
  --brand-dark: #1d4ed8;
}

/* ── Body & layout ─────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  font-size: 14px;
  color: #1e293b;
  overflow-x: hidden;
}

#app-wrapper { min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 8px 20px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  font-size: 13.5px;
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: var(--brand-color);
  color: #fff;
  font-weight: 600;
}
.sidebar-link svg { flex-shrink: 0; }

.sidebar-footer { background: rgba(0,0,0,0.2); }

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar { height: var(--topbar-h); min-height: var(--topbar-h); }
.page-body { min-height: calc(100vh - var(--topbar-h) - 56px); }

/* ── Avatar ────────────────────────────────────────────────── */
.avatar-circle {
  width: 32px;
  height: 32px;
  background: var(--brand-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
}

/* ── Stat cards ────────────────────────────────────────────── */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 3px; }

/* ── Tables ────────────────────────────────────────────────── */
.table { font-size: 13.5px; }
.table thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f8fafc; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: 13px; color: #374151; margin-bottom: 4px; }
.form-control, .form-select {
  font-size: 13.5px;
  border-color: #d1d5db;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.btn-primary { background: var(--brand-color); border-color: var(--brand-color); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ── Invoice wizard steps ──────────────────────────────────── */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
}
.wizard-step {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 12px 8px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}
.wizard-step::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -1px;
  width: 100%;
  height: 3px;
  background: #e2e8f0;
  z-index: 0;
}
.wizard-step:last-child::after { display: none; }
.wizard-step .step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  font-weight: 700;
  font-size: 14px;
  position: relative; z-index: 1;
}
.wizard-step.active .step-num { background: var(--brand-color); color: white; }
.wizard-step.done .step-num   { background: #10b981; color: white; }
.wizard-step.active { color: var(--brand-color); }
.wizard-step.done   { color: #10b981; }

/* ── Invoice item row ──────────────────────────────────────── */
.item-row { background: #f8fafc; border-radius: 10px; padding: 16px; margin-bottom: 12px; border: 1px solid #e2e8f0; }
.item-row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* ── Scenario tester ───────────────────────────────────────── */
.scenario-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.scenario-card:hover { border-color: var(--brand-color); background: #eff6ff; }
.scenario-card.testing { border-color: #f59e0b; background: #fffbeb; }
.scenario-card.pass    { border-color: #10b981; background: #ecfdf5; }
.scenario-card.fail    { border-color: #ef4444; background: #fef2f2; }
.scenario-id { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }

/* ── FBR status indicator ──────────────────────────────────── */
.fbr-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.fbr-status-indicator.valid   { background: #ecfdf5; color: #059669; }
.fbr-status-indicator.invalid { background: #fef2f2; color: #dc2626; }
.fbr-status-indicator.pending { background: #eff6ff; color: #3b82f6; }

/* ── Login page ────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2340 0%, #2a3558 50%, #1a2340 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.login-brand {
  width: 56px; height: 56px;
  background: var(--brand-color);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 900; font-size: 28px;
  margin: 0 auto 20px;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; }

/* ── Responsive: hide sidebar on mobile ────────────────────── */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 1050;
  }
  .sidebar.show { transform: translateX(0); }
}

/* ── Utilities ─────────────────────────────────────────────── */
.text-muted { color: #64748b !important; }
.border-dashed { border-style: dashed !important; }
.cursor-pointer { cursor: pointer; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.gap-1 { gap: 4px; }
.rounded-xl { border-radius: 12px !important; }

/* ── Loading spinner overlay ───────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
