/* ============================================================
   AchievaReq — Achieva IT Brand Design System
   Achieva Teal · Purple · Gold · Green · Red
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  --teal:         #006269;
  --teal-dark:    #004d52;
  --teal-light:   #007d86;
  --purple:       #72246c;
  --purple-light: #8a3082;
  --gold:         #ffb81c;
  --gold-dark:    #e6a418;
  --green:        #7a9a01;
  --green-light:  #8eb002;
  --red:          #ba0c2f;
  --red-light:    #d00e36;
  --soft-teal:    #b6cfd0;
  --soft-gray:    #d9d9d6;
  --gray-100:     #f7f8f9;
  --gray-200:     #eef0f2;
  --gray-300:     #d9d9d6;
  --gray-400:     #b0b3b8;
  --gray-600:     #6b7280;
  --gray-800:     #1f2937;
  --white:        #ffffff;

  --sidebar-w:    264px;
  --topbar-h:     64px;
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:       0 4px 12px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.08);
  --transition:   0.2s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }
img { max-width: 100%; display: block; }

/* ── Layout Shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--teal);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo-link { display: inline-block; }
.sidebar-logo img {
  height: 34px;
  width: auto;
}
.sidebar-brand {
  margin-top: 14px;
}
.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  letter-spacing: 0.01em;
}
.sidebar-brand-req {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
}
.sidebar-brand-sub {
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.82);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.10);
  color: var(--white);
  border-left-color: rgba(255,255,255,0.3);
}
.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

/* Gold Needs-Action count pill on a nav item (e.g. Invoice Mailbox). */
.nav-count-pill {
  margin-left: auto;
  background: var(--gold);
  color: #3a2c00;
  font-size: 10.5px;
  font-weight: 800;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.5;
}

/* ── Main content area ────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top Navigation Bar ───────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  flex: 1;
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--gray-800);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Notification Bell */
.notif-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: var(--gray-600);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
}
.notif-btn:hover { background: var(--gray-100); color: var(--teal); }
.notif-btn svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* User chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.user-chip:hover { background: var(--gray-100); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { line-height: 1.3; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); }
.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-requester        { background: #e8f4f5; color: var(--teal); }
.role-approver         { background: #f0e8f0; color: var(--purple); }
.role-budget_manager   { background: #fff8e1; color: #b8860b; }
.role-accounts_payable { background: #e8f5e9; color: var(--green); }
.role-auditor          { background: var(--gray-200); color: var(--gray-600); }

.btn-signout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-signout:hover { background: var(--gray-100); color: var(--red); border-color: var(--red); }

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: 2px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
}
.card-body { padding: 20px 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-100);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: transform var(--transition), box-shadow var(--transition);
  /* Lets .stat-value size itself against this card's width (see below),
     and min-width:0 lets the card actually shrink as a grid item instead
     of being forced wider by its own content. */
  container-type: inline-size;
  min-width: 0;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.stat-value {
  /* Scales with the card so a long value — a currency total like
     $54,434.84 — shrinks to fit instead of spilling into the next tile.
     Capped at 2rem, so a wide card looks exactly as it always has; the
     flat value is the fallback for anything without container queries. */
  font-size: 2rem;
  font-size: clamp(1.2rem, 11cqi, 2rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 4px;
  /* Digits line up column-to-column, and a very long value wraps rather
     than overflowing once it has shrunk as far as it will go. */
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.stat-card.teal   .stat-value { color: var(--teal); }
.stat-card.gold   .stat-value { color: var(--gold-dark); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.purple .stat-value { color: var(--purple); }
.stat-card.gray   .stat-value { color: var(--gray-600); }

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-draft    { background: var(--gray-200); color: var(--gray-600); }
.badge-submitted,
.badge-pending  { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.badge-in_review{ background: #ede3f5; color: var(--purple); border: 1px solid #d8bff5; }
.badge-approved,
.badge-exported { background: #e8f5e9; color: var(--green); border: 1px solid #c3e6cb; }
.badge-denied   { background: #fde8ec; color: var(--red); border: 1px solid #f5c6cb; }
.badge-returned { background: #fff0d6; color: #c67300; border: 1px solid #fdd8a3; }
.badge-cancelled{ background: var(--gray-200); color: var(--gray-600); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Busy buttons ──────────────────────────────────────────
   A button whose action takes a visible moment (parsing a statement,
   generating an export) swaps its label for a spinning circle, so the
   delay reads as work rather than as a dead click. Opt in with
   data-busy on the button; base.html wires the rest. */
.btn-busy {
  pointer-events: none;   /* also blocks a second submit */
  opacity: 0.9;
  /* .btn is inline-flex with the default flex-start, so once the label is
     gone and the width is held at its original size the spinner would sit
     against the left padding edge. Center it for the swap. */
  justify-content: center;
}
.btn-spinner {
  display: inline-block;
  /* Matches .btn svg exactly, so replacing the icon+label with the spinner
     doesn't change the button's height. */
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -3px;   /* only applies when used outside a flex button */
  animation: spin 0.6s linear infinite;
}
/* Feather's loader glyph is drawn static; spin it wherever it's used. */
.feather-loader { animation: spin 1.2s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-primary    { background: var(--teal); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); color: var(--white); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,98,105,0.3); }

.btn-secondary  { background: var(--purple); color: var(--white); }
.btn-secondary:hover:not(:disabled) { background: var(--purple-light); color: var(--white); }

.btn-success    { background: var(--green); color: var(--white); }
.btn-success:hover:not(:disabled) { background: var(--green-light); color: var(--white); }

.btn-danger     { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: var(--red-light); color: var(--white); }

.btn-warning    { background: var(--gold); color: #333; }
.btn-warning:hover:not(:disabled) { background: var(--gold-dark); }

.btn-outline    {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
}
.btn-outline:hover:not(:disabled) { background: var(--teal); color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--gray-800); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 3px; }

/* ── AI settings: confidence sliders + section helpers ─────────────────────── */
.ai-subhead {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0 0 14px;
}
input[type="range"].ai-slider {
  width: 100%;
  accent-color: var(--teal);   /* teal fill + thumb natively */
  cursor: pointer;
  margin: 8px 0 2px;
}
.ai-slider-row { display: flex; align-items: center; gap: 14px; }
.ai-slider-row .ai-slider { flex: 1; }
.ai-slider-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal);
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Greyed (context-inactive) control. NOT `disabled` — a disabled input is
   dropped from the POST, which would overwrite the stored value on save. */
.ai-locked { opacity: 0.45; pointer-events: none; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--soft-teal);
  box-shadow: 0 0 0 3px rgba(0,98,105,0.12);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--red); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint {
  font-size: 0.77rem;
  color: var(--gray-600);
  margin-top: 4px;
}
.form-error {
  font-size: 0.77rem;
  color: var(--red);
  margin-top: 4px;
}

/* Form grid */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tables ───────────────────────────────────────────────── */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.875rem;
}
table.data-table th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
table.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr {
  transition: background var(--transition);
}
table.data-table tbody tr:hover { background: #f5fbfb; }

.table-actions { display: flex; gap: 6px; align-items: center; }
.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.table-empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.4; }

/* ── Age indicator (overdue highlight) ───────────────────── */
.age-ok     { color: var(--green); font-weight: 600; }
.age-warn   { color: var(--gold-dark); font-weight: 600; }
.age-danger { color: var(--red); font-weight: 700; }

/* ── Alerts / Flash messages ──────────────────────────────── */
.flash-container {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 1100;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.flash-container .alert {
  pointer-events: auto;
  margin-bottom: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #edf7ee; border-color: var(--green); color: #2d5a00; }
.alert-error   { background: #fde8ec; border-color: var(--red); color: #7a0020; }
.alert-warning { background: #fff8e1; border-color: var(--gold); color: #856000; }
.alert-info    { background: #e8f4f5; border-color: var(--teal); color: var(--teal-dark); }
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.alert-close:hover { opacity: 1; }

/* ── Approval Timeline Stepper ────────────────────────────── */
.approval-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 20px 0;
}
.stepper-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.stepper-step::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(-50%);
  right: calc(50%);
  height: 2px;
  background: var(--gray-300);
}
.stepper-step:first-child::before { display: none; }
.stepper-step.done::before   { background: var(--green); }
.stepper-step.active::before { background: var(--teal); }

.stepper-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 1;
  background: var(--gray-300);
  color: var(--gray-600);
  transition: all var(--transition);
}
.stepper-step.done   .stepper-dot { background: var(--green); color: var(--white); }
.stepper-step.active .stepper-dot { background: var(--teal); color: var(--white); box-shadow: 0 0 0 4px rgba(0,98,105,0.2); }
.stepper-step.denied .stepper-dot { background: var(--red); color: var(--white); }

.stepper-label {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  text-align: center;
}
.stepper-step.active .stepper-label { color: var(--teal); }
.stepper-step.done   .stepper-label { color: var(--green); }

/* ── Line Items (requisition form) ────────────────────────── */
.line-items-wrapper { margin-bottom: 16px; }
.line-item-row {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  transition: border-color var(--transition);
}
.line-item-row:hover { border-color: var(--soft-teal); }
.line-item-remove {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.line-item-remove:hover { opacity: 1; }


/* ── File Upload ──────────────────────────────────────────── */
.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.file-upload-area:hover, .file-upload-area.drag-over {
  border-color: var(--teal);
  background: #f0f9f9;
}
.file-upload-area input[type="file"] { display: none; }
.file-upload-icon { color: var(--gray-400); margin-bottom: 10px; }
.file-upload-icon svg { width: 40px; height: 40px; }
.file-upload-text { font-size: 0.875rem; color: var(--gray-600); }
.file-upload-text strong { color: var(--teal); }
.file-upload-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 4px; }

.attachment-list { list-style: none; margin-top: 12px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.attachment-icon { color: var(--teal); flex-shrink: 0; }
.attachment-icon svg { width: 20px; height: 20px; }
.attachment-name { flex: 1; font-weight: 500; color: var(--gray-800); }
.attachment-size { color: var(--gray-400); font-size: 0.78rem; }

/* ── Notification Dropdown ────────────────────────────────── */
.notif-dropdown {
  position: absolute;
  top: calc(var(--topbar-h) - 8px);
  right: 20px;
  width: 360px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.notif-dropdown.open { display: block; animation: slideDown 0.15s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.notif-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.83rem;
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--gray-100); }
.notif-item.unread { background: #edf7f7; }
.notif-item.unread .notif-msg { font-weight: 600; }
.notif-msg { color: var(--gray-800); margin-bottom: 3px; line-height: 1.4; }
.notif-time { color: var(--gray-400); font-size: 0.75rem; }
.notif-empty { padding: 28px; text-align: center; color: var(--gray-400); font-size: 0.875rem; }
.notif-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.82rem;
  color: var(--teal);
  font-weight: 600;
}

/* ── Charts ───────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.chart-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 14px;
}
canvas { max-height: 240px; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--teal); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: scale(0.96) translateY(-8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: 4px;
  font-size: 20px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--gray-800); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Search Box ───────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-box:focus-within {
  border-color: var(--soft-teal);
  box-shadow: 0 0 0 3px rgba(0,98,105,0.1);
}
.search-box svg { color: var(--gray-400); width: 16px; height: 16px; flex-shrink: 0; }
.search-box input {
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-800);
  background: transparent;
  width: 200px;
}

/* ── Intake type toggle ───────────────────────────────────── */
.intake-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.intake-btn {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}
.intake-btn.active {
  border-color: var(--teal);
  background: #edf7f7;
}
.intake-btn-title { font-size: 0.875rem; font-weight: 700; color: var(--gray-800); }
.intake-btn.active .intake-btn-title { color: var(--teal); }
.intake-btn-sub { font-size: 0.75rem; color: var(--gray-600); margin-top: 2px; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.filter-bar .form-control { width: auto; min-width: 140px; }

/* ── Dev Login Page ───────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 50%, #007a82 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}
.login-logo { margin-bottom: 28px; text-align: center; }
.login-logo img { height: 44px; margin: 0 auto; }
.login-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--teal);
  margin-bottom: 6px;
  text-align: center;
}
.login-sub {
  font-size: 0.83rem;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 28px;
}
.dev-badge {
  display: inline-block;
  background: var(--gold);
  color: #333;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}

/* ── Utilities ────────────────────────────────────────────── */
.text-teal    { color: var(--teal); }
.text-purple  { color: var(--purple); }
.text-gold    { color: var(--gold-dark); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-muted   { color: var(--gray-600); }
.text-sm      { font-size: 0.83rem; }
.text-xs      { font-size: 0.75rem; }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mt-1         { margin-top: 4px; }
.mt-2         { margin-top: 8px; }
.mt-3         { margin-top: 12px; }
.mt-4         { margin-top: 16px; }
.mb-3         { margin-bottom: 12px; }
.mb-4         { margin-bottom: 16px; }
.mb-5         { margin-bottom: 20px; }
.w-full       { width: 100%; }
.truncate     { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ── System Banner ────────────────────────────────────────── */
.system-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-bottom: 1px solid transparent;
}
.system-banner-info    { background: #e0f2f4; color: #004d52; border-color: #b3dde0; }
.system-banner-warning { background: #fff8e1; color: #6b4c00; border-color: #ffd875; }
.system-banner-danger  { background: #fde8ec; color: var(--red); border-color: #f5b7b1; }
.system-banner-success { background: #f0f7e2; color: #4a5c00; border-color: #c5dc68; }
.system-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.system-banner-text { flex: 1; }
.system-banner-link { font-weight: 600; text-decoration: underline; margin-left: 8px; color: inherit; }
.system-banner-link:hover { color: inherit; opacity: 0.75; }
.system-banner-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
  opacity: 0.45;
  transition: opacity var(--transition), background var(--transition);
  color: inherit;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.system-banner-close:hover { opacity: 1; background: rgba(0,0,0,0.08); }

/* ── Splash Screen ────────────────────────────────────────── */
.splash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: splashFadeIn 0.2s ease;
}
.splash-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  padding: 40px;
  text-align: center;
  animation: splashSlideUp 0.28s ease;
}
.splash-logo { height: 44px; margin: 0 auto 22px; width: auto; }
.splash-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  line-height: 1.3;
}
.splash-body {
  color: var(--gray-600);
  font-size: 0.925rem;
  line-height: 1.75;
  margin-bottom: 28px;
}
.splash-body a { color: var(--teal); }
.splash-actions { display: flex; justify-content: center; }
@keyframes splashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes splashSlideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar (webkit) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }


/* ═══════════════════════════════════════════════════════════
   CREDIT CARD RECONCILIATION
   The reconciliation grid puts one card transaction per row with
   its purpose, coding, and receipt inline. It is deliberately a
   real grid rather than a stack of cards: a cardholder works down
   a month of charges, and the columns stay in the same place.
   ═══════════════════════════════════════════════════════════ */
.cc-grid-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.cc-grid { min-width: 1290px; }

/* Header + row share one template so the columns line up. */
.cc-row {
  display: grid;
  grid-template-columns:
    72px            /* date */
    minmax(170px, 1.4fr)  /* merchant */
    100px           /* amount */
    minmax(190px, 1.6fr)  /* purpose */
    minmax(170px, 1.2fr)  /* GL */
    minmax(140px, 1.1fr)  /* department */
    minmax(120px, 1fr)    /* source */
    minmax(120px, 1fr)    /* sub */
    160px;          /* receipt / check */
  gap: 9px;
  align-items: start;
  /* Tight: a cardholder works down a month of charges, and every pixel of
     row height is a pixel of scrolling they didn't ask for. */
  padding: 7px 14px;
  border-bottom: 1px solid var(--gray-200);
}
.cc-row:last-child { border-bottom: none; }
.cc-row-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  align-items: center;
  padding-top: 9px;
  padding-bottom: 9px;
}
.cc-row-body:nth-child(even) { background: #fcfcfb; }
.cc-row-body:hover { background: #f7fbfb; }

/* Row state accents — a flagged row must be findable while scrolling. */
.cc-row-body { border-left: 3px solid transparent; }
.cc-row-flag  { border-left-color: var(--red); background: #fff8f8; }
.cc-row-todo  { border-left-color: var(--gold); }
.cc-row-done  { border-left-color: var(--green); }
.cc-row-excluded {
  border-left-color: var(--gray-300);
  background: var(--gray-100);
  color: var(--gray-500);
}

.cc-cell { min-width: 0; }
.cc-cell .form-control {
  margin-bottom: 0;
  font-size: 0.8rem;
  padding: 6px 8px;
}
.cc-cell textarea.form-control { resize: vertical; min-height: 32px; line-height: 1.3; }
/* Starts one line tall, matching the selects beside it, and grows only if
   the cardholder drags it. */
.cc-purpose { height: 32px; }
.cc-date { font-size: 0.75rem; color: var(--gray-600); line-height: 1.35; padding-top: 7px; }
.cc-date strong { display: block; color: var(--gray-800); font-size: 0.8rem; }
.cc-merchant { padding-top: 5px; font-size: 0.82rem; line-height: 1.35; }
.cc-merchant-name { font-weight: 600; color: var(--gray-800); word-break: break-word; }
.cc-merchant-meta { font-size: 0.7rem; color: var(--gray-500); margin-top: 2px; }
.cc-amount {
  padding-top: 7px;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gray-800);
}
.cc-amount-credit { color: var(--green); }
.cc-amount-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── Receipt cell ─────────────────────────────────────────── */
.cc-receipt { display: flex; flex-direction: column; gap: 5px; font-size: 0.72rem; }
.cc-receipt-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  text-align: center;
  line-height: 1.25;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cc-receipt-drop:hover,
.cc-receipt-drop.dragover {
  border-color: var(--teal);
  background: #eef7f7;
  color: var(--teal);
}
.cc-receipt-drop svg { width: 14px; height: 14px; flex: none; }
.cc-receipt-file {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cc-receipt-file a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.cc-receipt-actions { display: flex; gap: 4px; margin-left: auto; flex: none; }
.cc-receipt-actions button {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--gray-500);
  display: inline-flex;
  line-height: 1;
}
.cc-receipt-actions button:hover { color: var(--teal); }
.cc-receipt-actions button.cc-danger:hover { color: var(--red); }
.cc-receipt-actions svg { width: 13px; height: 13px; }

/* ── AI check pill ────────────────────────────────────────── */
.cc-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  max-width: 100%;
}
.cc-check svg { width: 11px; height: 11px; flex: none; }
.cc-check-ok    { background: #e8f5e9; color: var(--green); border-color: #c3e6cb; }
.cc-check-bad   { background: #fde8ec; color: var(--red);   border-color: #f5c6cb; }
.cc-check-wait  { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-300); }
.cc-check-warn  { background: #fff0d6; color: #c67300; border-color: #fdd8a3; }
.cc-check-note {
  font-size: 0.66rem;
  color: var(--gray-500);
  line-height: 1.35;
  word-break: break-word;
  /* A verbose receipt reading would otherwise set the height of the whole
     row; the full text stays available as a tooltip. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Required-but-empty ───────────────────────────────────────
   Purpose, all four coding segments and the receipt are required. Rather
   than spelling that out in words on every row, the box that still needs
   something is tinted — the eye finds it without anything to read. */
.cc-need,
.cc-need .ts-control {
  border-color: #e9a2ae !important;
  background: #fffafb;
}
.cc-need:focus,
.cc-need.ts-wrapper.focus .ts-control {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(186, 12, 47, 0.12);
}
.cc-receipt-drop.cc-need {
  border-color: #e9a2ae;
  background: #fffafb;
  color: #a4485a;
}
.cc-receipt-drop.cc-need:hover {
  border-color: var(--teal);
  background: #eef7f7;
  color: var(--teal);
}

/* ── Splits (mirrors the requisition form's split rows) ───── */
.cc-splits {
  grid-column: 1 / -1;
  margin: 6px 0 2px;
  padding: 8px 10px;
  background: #f4f9f9;
  border: 1px solid #cfe4e5;
  border-radius: var(--radius-sm);
}
.cc-splits-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cc-split-row {
  display: grid;
  /* department, source, sub, corp, amount, remove */
  grid-template-columns: 1.2fr 1.1fr 1.1fr 90px 110px 28px;
  gap: 6px;
  margin-bottom: 5px;
  align-items: center;
}
.cc-split-row .form-control { margin-bottom: 0; font-size: 0.76rem; padding: 5px 7px; }
.cc-split-labels {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 1.1fr 90px 110px 28px;
  gap: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 3px;
}
.cc-split-total { margin-left: auto; font-size: 0.7rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
.cc-split-total.cc-off { color: var(--red); }
.cc-split-total.cc-on  { color: var(--green); }

/* One line per row carrying its actions and whatever is still missing.
   These used to be three stacked full-width rows, which tripled the height
   of every transaction. */
.cc-row-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
  min-height: 16px;
}
.cc-row-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}
.cc-linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--teal);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cc-linkbtn:hover { color: var(--teal-dark); text-decoration: underline; }
.cc-linkbtn svg { width: 12px; height: 12px; }

/* ── Sticky action bar for the reconciliation form ────────── */
.cc-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.07);
}
.cc-actionbar .cc-actionbar-spacer { margin-left: auto; }

/* ── Progress meter (packet lists) ────────────────────────── */
.cc-meter {
  height: 6px;
  width: 100%;
  min-width: 90px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.cc-meter-fill { height: 100%; background: var(--teal); border-radius: 3px; }
.cc-meter-fill.cc-full { background: var(--green); }

/* ── Cardholder group card on the finance review screen ───── */
.cc-group {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  margin-bottom: 12px;
  overflow: hidden;
}
.cc-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
}
.cc-group-unmapped .cc-group-head { background: #fff6e5; border-bottom-color: #fdd8a3; }
/* Mapped to a person, but nobody is set to approve them — same "needs your
   attention before distributing" weight as an unmapped name. */
.cc-group-unrouted .cc-group-head { background: #fdf3f5; border-bottom-color: #f5c6cb; }
.cc-group-name { font-weight: 700; color: var(--gray-800); }
.cc-group-sub { font-size: 0.72rem; color: var(--gray-500); }
.cc-group-body { padding: 0; }
.cc-group-body[hidden] { display: none; }

/* Narrow screens: the grid scrolls horizontally rather than reflowing —
   the column alignment is the point of it. Splits do reflow, since they
   sit inside the row and would otherwise force a second scroll. */
@media (max-width: 900px) {
  .cc-split-row,
  .cc-split-labels { grid-template-columns: 1fr 1fr; }
  .cc-split-labels { display: none; }
  .cc-actionbar { flex-direction: column; align-items: stretch; }
  .cc-actionbar .cc-actionbar-spacer { margin-left: 0; }
}
