/* ATLAS Accounts Email Agent — Design Tokens */
:root {
  --navy: #00263A;
  --navy-800: #00344F;
  --navy-700: #004166;
  --teal: #00B2A9;
  --teal-light: #E6F7F7;
  --teal-600: #009990;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  --red-50: #FEF2F2;
  --red-100: #FEE2E2;
  --red-500: #EF4444;
  --red-600: #DC2626;
  --red-700: #B91C1C;
  --yellow-50: #FFFBEB;
  --yellow-100: #FEF3C7;
  --yellow-500: #F59E0B;
  --yellow-600: #D97706;
  --green-50: #F0FDF4;
  --green-500: #22C55E;
  --green-600: #16A34A;
  --blue-50: #EFF6FF;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --purple-500: #8B5CF6;
  --purple-600: #7C3AED;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  --sidebar-width: 220px;
  --topbar-height: 60px;
}

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

html, body, #root {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 14px;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo .logo-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.nav-item.active {
  background: var(--teal);
  color: var(--white);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red-600);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
}

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.topbar-meta {
  font-size: 12px;
  color: var(--gray-400);
}

.mock-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--yellow-50);
  border: 1px solid var(--yellow-500);
  color: var(--yellow-600);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.mock-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--yellow-500);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: white;
}
.btn-primary:hover { background: var(--teal-600); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-navy {
  background: var(--navy);
  color: white;
}
.btn-navy:hover { background: var(--navy-800); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-success {
  background: var(--green-500);
  color: white;
}
.btn-success:hover { background: var(--green-600); }

.btn-danger {
  background: var(--red-600);
  color: white;
}
.btn-danger:hover { background: var(--red-700); }

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

.btn-sm {
  padding: 4px 10px;
  font-size: 12.5px;
}

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
}

.card-body {
  padding: 20px;
}

/* Queue Cards */
.queue-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.queue-card:hover {
  box-shadow: var(--shadow-md);
}

.queue-card + .queue-card {
  margin-top: 12px;
}

.queue-card-header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.queue-card-body {
  padding: 0 16px 14px;
}

.queue-card-actions {
  padding: 12px 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggest-banner {
  background: var(--yellow-50);
  border-top: 1px solid var(--yellow-200);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--yellow-600);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13.5px;
  color: var(--gray-700);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.stat-card.danger .stat-value { color: var(--red-600); }
.stat-card.teal .stat-value { color: var(--teal); }
.stat-card.navy .stat-value { color: var(--navy); }

/* Bar chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-label {
  width: 130px;
  color: var(--gray-600);
  font-weight: 500;
  flex-shrink: 0;
  text-align: right;
  font-size: 12.5px;
}

.bar-track {
  flex: 1;
  height: 18px;
  background: var(--gray-100);
  border-radius: 9px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 9px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.bar-count {
  width: 28px;
  text-align: right;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 12.5px;
}

/* Activity feed */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  margin-top: 4px;
}

.activity-dot.scan { background: var(--navy); }
.activity-dot.queued { background: var(--yellow-500); }
.activity-dot.approved { background: var(--green-500); }
.activity-dot.overridden { background: var(--blue-500); }
.activity-dot.dismissed { background: var(--gray-400); }
.activity-dot.payment-updated { background: var(--purple-500); }
.activity-dot.forwarded { background: var(--teal); }

.activity-text {
  flex: 1;
  color: var(--gray-700);
  line-height: 1.4;
}

.activity-time {
  font-size: 11.5px;
  color: var(--gray-400);
  flex-shrink: 0;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,178,169,0.15);
}

select.form-input { cursor: pointer; }

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 10px;
  transition: 0.2s;
}

.toggle-slider:before {
  position: absolute;
  content: '';
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }
.toggle input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* Slider */
.slider-input {
  width: 100%;
  accent-color: var(--teal);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 320px;
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
.toast.warning { background: var(--yellow-600); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Search */
.search-input {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--gray-700);
  background: var(--white);
  width: 240px;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,178,169,0.15);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
  color: var(--gray-500);
}

/* Overdue styling */
.overdue-row td { background: var(--red-50) !important; }
.overdue-amount { color: var(--red-600); font-weight: 700; }

/* Color chips */
.color-chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 20px 0;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}

/* Attachment badge */
.attachment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: var(--blue-50);
  border: 1px solid #BFDBFE;
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--blue-600);
  font-weight: 500;
}

/* Confidence ring */
.conf-high { color: var(--green-600); font-weight: 700; }
.conf-mid { color: var(--yellow-600); font-weight: 700; }
.conf-low { color: var(--red-600); font-weight: 700; }

/* Amount display */
.amount-display {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

/* Grid helpers */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

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

/* ── Layout ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--gray-50); color: var(--gray-800); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar { width: 220px; flex-shrink: 0; background: var(--navy); display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #fff; flex-shrink: 0; }
.brand-name { font-size: 13px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item { all: unset; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; cursor: pointer; font-size: 13px; color: rgba(255,255,255,.65); border-radius: 0; transition: background .12s, color .12s; box-sizing: border-box; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(0,178,169,.2); color: var(--teal); font-weight: 600; }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); }
.nav-badge.urgent { background: #dc2626; color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 52px; border-bottom: 1px solid var(--gray-200); background: #fff; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 0; }
.topbar-spacer { flex: 1; }
.scan-status { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.scan-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.scan-dot.scanning { background: #d97706; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.btn-scan { display: flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--navy); color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-scan:hover { background: var(--navy-700); }
.btn-scan:disabled { opacity: .6; cursor: default; }
.main-content { flex: 1; overflow-y: auto; }
.main-inner { padding: 24px 28px 40px; max-width: 1100px; }

/* ── Page head ───────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
.page-sub { font-size: 13px; color: var(--gray-500); margin: 0; }
.section-title { font-size: 14px; font-weight: 700; color: var(--navy); margin: 0; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--navy); color: #fff; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--navy-700); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--gray-50); }
.btn-sm { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid; }
.btn-sm.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-sm.btn-ghost { background: #fff; color: var(--gray-600); border-color: var(--gray-300); }
.btn-sm.btn-teal { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-approve { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; background: #16a34a; color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-approve:hover { background: #15803d; }
.btn-approve:disabled { opacity: .6; cursor: default; }
.btn-override { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-dismiss { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; background: #fff; color: #dc2626; border: 1px solid #fecaca; border-radius: 6px; font-size: 12px; cursor: pointer; }

/* ── Queue cards ─────────────────────────────────────────────────────────── */
.queue-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.ai-suggest-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fefce8; border: 1px solid #fde047; border-radius: 6px; font-size: 12px; color: #854d0e; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.card-date { margin-left: auto; font-size: 11px; color: var(--gray-400); font-family: 'JetBrains Mono', monospace; }
.card-subject { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.card-from { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.card-snippet { font-size: 12px; color: var(--gray-600); background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 5px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--gray-600); margin-bottom: 8px; }
.card-action { font-size: 12.5px; color: var(--gray-700); background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 5px; padding: 8px 12px; margin-bottom: 10px; line-height: 1.5; }
.card-route { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--gray-600); margin-bottom: 10px; }
.route-tag { padding: 2px 8px; background: #dbeafe; color: #1d4ed8; border-radius: 4px; font-size: 11px; font-weight: 600; }
.route-reason { color: var(--gray-400); font-style: italic; }
.card-actions { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.attach-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 10px; font-size: 10px; font-weight: 700; }

/* ── KPI grid ────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 16px 18px; }
.kpi-card.kpi-warn { border-left: 3px solid #d97706; }
.kpi-card.kpi-danger { border-left: 3px solid #ea580c; }
.kpi-card.kpi-red { border-left: 3px solid #dc2626; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: 6px; }
.kpi-value { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1; margin-bottom: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--gray-400); }

/* ── Summary grid ────────────────────────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.summary-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 18px 20px; }
.summary-card h3 { font-size: 13px; font-weight: 700; color: var(--navy); margin: 0 0 14px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: 4px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
input, textarea, select { border: 1px solid var(--gray-300); border-radius: 5px; padding: 7px 10px; font-size: 13px; font-family: inherit; outline: none; width: 100%; color: var(--gray-800); }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0,178,169,.15); }
.filters-row { display: flex; gap: 10px; margin-bottom: 16px; }
.search-input { flex: 1; }
.cat-select { width: 200px; }
.add-form { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 8px; }
.field-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); margin-bottom: 5px; }
.email-tag { display: inline-block; padding: 2px 8px; background: #dbeafe; color: #1d4ed8; border-radius: 4px; font-size: 11px; margin-right: 4px; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-section { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 20px 22px; margin-bottom: 16px; }
.general-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }

/* ── States ──────────────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--gray-400); }
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--gray-400); }
--mono: 'JetBrains Mono', monospace;

/* ── Print styles ── */
@media print {
  .sidebar, .topbar, .topbar-spacer { display: none !important; }
  .main-wrap { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  .main-content { padding: 0 !important; }
  .main-inner { max-width: 100% !important; }
  button, .btn-ghost, .btn-primary, .btn-scan { display: none !important; }
  .print-only { display: block !important; }
  .no-print { display: none !important; }
  input[type="date"], input[type="text"] { display: none !important; }
  body { background: white !important; color: black !important; font-size: 10pt !important; }
  .data-table { font-size: 9pt !important; }
  @page { margin: 15mm; }
}
