/* ============================================================
   SwaamLab Enterprise Expense Tracker — Design System
   Clean, modern enterprise SaaS visual architecture.
   Inter typography, curated slate palettes, accessible contrast.
   ============================================================ */

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

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Light Theme */
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-elevated: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-contrast: #ffffff;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

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

  --sidebar-w: 260px;
  --topbar-h: 64px;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-soft: #111827;
  --surface: #111827;
  --surface-2: #162032;
  --surface-elevated: #1a2438;
  --border: #243048;
  --border-strong: #334366;
  --text: #f9fafb;
  --text-2: #9ca3af;
  --text-3: #6b7280;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --accent-contrast: #ffffff;

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.14);
  --success-border: rgba(34, 197, 94, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --warning-border: rgba(245, 158, 11, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(239, 68, 68, 0.3);

  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.14);
  --info-border: rgba(56, 189, 248, 0.3);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

h1 { font-size: 1.35rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

p {
  margin: 0.25rem 0 0.75rem;
  color: var(--text-2);
}

.mono, .tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.muted { color: var(--text-2); }
.small { font-size: 12.5px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Lucide SVG Integration ---------- */
.lucide-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---------- App Shell Architecture ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.03em;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
}

.nav {
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.85rem 0.75rem 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: all 0.12s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-link .nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.user-profile-widget .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-profile-widget .info {
  flex: 1;
  min-width: 0;
}

.user-profile-widget .name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.user-profile-widget .role-tag {
  font-size: 11px;
  color: var(--text-3);
  text-transform: capitalize;
}

.user-profile-widget .actions {
  display: flex;
  gap: 2px;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.topbar .spacer { flex: 1; }

.content {
  padding: 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  cursor: pointer;
  color: var(--text);
  align-items: center;
  justify-content: center;
}

.theme-btn, .icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
}

.theme-btn:hover, .icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------- Cards & Layout Grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid.kpi { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }

/* ---------- KPI Cards ---------- */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.kpi-icon {
  color: var(--text-3);
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0.2rem 0;
}

.kpi-sub {
  font-size: 12.5px;
  color: var(--text-3);
}

/* ---------- Current Trip Component ---------- */
.trip-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}

.trip-banner-content {
  flex: 1;
  min-width: 240px;
}

.current-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}

.trip-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.trip-meta {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}

/* ---------- Buttons System ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}
.btn.danger:hover {
  background: #b91c1c;
}

.btn.success {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}
.btn.success:hover {
  background: #047857;
  border-color: #065f46;
  color: #ffffff;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.small {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  font-size: 12.5px;
  gap: 0.35rem;
}

.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Status Badges System ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  font-weight: 600;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.2;
}

.badge.pending {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.badge.approved {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge.paid {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge.rejected {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge.active {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge.completed {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge.archived {
  background: var(--bg-soft);
  color: var(--text-2);
  border-color: var(--border);
}

.badge.neutral {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}

/* ---------- Setup / Unconfigured Error Banner ---------- */
.setup-alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.setup-alert-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.setup-alert-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ---------- Toasts ---------- */
#toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  z-index: 200;
  pointer-events: none;
  max-width: 440px;
  width: calc(100% - 48px);
}

.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.8rem 1rem;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-left: 4px solid var(--accent);
  color: var(--text);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* ---------- Modals ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  z-index: 150;
  padding: 1.25rem;
}

.modal-back.open { display: grid; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modalEnter 0.18s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-head {
  padding: 1.1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-head h3 {
  margin: 0;
  flex: 1;
  font-size: 16px;
}

.modal-body { padding: 1.35rem; }
.modal-foot {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: var(--surface-2);
}

/* ---------- Mobile Expense Cards ---------- */
.expense-list {
  display: grid;
  gap: 0.75rem;
}

.expense-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.expense-card .row1 {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.expense-card .cat {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.expense-card .amt {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
}

.expense-card .row2 {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 0.35rem;
}

.expense-card .row3 {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

/* ---------- Charts (Minimalist CSS/SVG) ---------- */
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem 0;
  font-size: 13px;
}

.bar-track {
  background: var(--bg-soft);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}

.bar-val {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.donut-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.legend {
  font-size: 13px;
  display: grid;
  gap: 0.45rem;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* ---------- Toolbar, Skeletons & Utilities ---------- */
.toolbar {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.85rem 0;
}
.toolbar .grow { flex: 1; min-width: 140px; }

.empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--text-2);
}
.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
  color: var(--text-3);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  min-height: 18px;
  animation: skeletonPulse 1.6s infinite ease-in-out;
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress > div {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.15rem 0;
}

.bottom-nav { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* ============================================================
   Dashboard enhancements — logo brand, KPI tones, status bar,
   bar-list shares, waiting list
   ============================================================ */
.brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  display: block;
  width: 100%;
  max-width: 190px;
  height: auto;
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
}
[data-theme="dark"] .brand-logo { box-shadow: 0 0 0 1px var(--border); }

.kpi-card { position: relative; overflow: hidden; }
.kpi-card.tone-warning .kpi-value { color: var(--warning); }
.kpi-card.tone-success .kpi-value { color: var(--success); }
.kpi-card.tone-accent .kpi-value { color: var(--accent); }
.kpi-card.tone-warning .kpi-icon { color: var(--warning); }
.kpi-card.tone-success .kpi-icon { color: var(--success); }
.kpi-card.tone-accent .kpi-icon { color: var(--accent); }
.kpi-card.hero { border-color: var(--warning-border); background: linear-gradient(180deg, var(--warning-bg), var(--surface) 70%); }
.kpi-card.hero .kpi-value { font-size: 30px; }
.kpi-card.tone-success.hero { border-color: var(--success-border); background: linear-gradient(180deg, var(--success-bg), var(--surface) 70%); }

.section-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.section-head h3 { margin: 0; flex: 1; }
.section-head .sub { font-size: 12.5px; color: var(--text-3); width: 100%; margin-top: -0.35rem; }

/* Stacked reimbursement status bar */
.reimb-track {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
}
.reimb-seg { height: 100%; min-width: 3px; }
.reimb-seg.paid { background: var(--success); }
.reimb-seg.pending { background: var(--warning); }
.reimb-seg.rejected { background: var(--text-3); }
.reimb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.85rem;
  font-size: 13px;
}
.reimb-item { display: flex; align-items: center; gap: 0.45rem; }
.reimb-dot {
  width: 20px; height: 20px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: #fff;
}
.reimb-item.paid .reimb-dot { background: var(--success); }
.reimb-item.pending .reimb-dot { background: var(--warning); }
.reimb-item.rejected .reimb-dot { background: var(--text-3); }
.reimb-name { color: var(--text-2); font-weight: 500; }
.reimb-val { font-weight: 700; color: var(--text); }
.reimb-pct { font-size: 12px; color: var(--text-3); }
.reimb-empty { padding: 0.5rem 0; }

/* Bar list: label + share */
.bar-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-share {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  min-width: 2.4em;
  text-align: right;
}
.bar-row:hover .bar-track { box-shadow: 0 0 0 2px var(--accent-soft); }

/* Oldest unpaid bills */
.wait-list { display: grid; gap: 0.5rem; }
.wait-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.wait-days {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.15;
  padding: 0.35rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.wait-days small { display: block; font-weight: 500; font-size: 10.5px; opacity: 0.85; }
.wait-days.old { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.wait-main { min-width: 0; }
.wait-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wait-meta { font-size: 12px; color: var(--text-3); }
.wait-amt { font-weight: 700; white-space: nowrap; }

/* "Your bills" personal strip */
.mine-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.mine-cell { padding: 0.9rem 1rem; border-right: 1px solid var(--border); }
.mine-cell:last-child { border-right: none; }
.mine-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.mine-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.15rem; }
.mine-sub { font-size: 12px; color: var(--text-3); }
.mine-cell.pending .mine-value { color: var(--warning); }
.mine-cell.paid .mine-value { color: var(--success); }
@media (max-width: 640px) {
  .mine-strip { grid-template-columns: 1fr; }
  .mine-cell { border-right: none; border-bottom: 1px solid var(--border); }
  .mine-cell:last-child { border-bottom: none; }
}

/* ============================================================
   Animated light/dark switch
   ============================================================ */

/* 1. Circular reveal (browsers with the View Transitions API) */
html.theme-reveal::view-transition-old(root),
html.theme-reveal::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html.theme-reveal::view-transition-old(root) { z-index: 1; }
html.theme-reveal::view-transition-new(root) {
  z-index: 2;
  animation: theme-circle 0.55s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes theme-circle {
  from { clip-path: circle(0 at var(--theme-x, 50%) var(--theme-y, 50%)); }
  to   { clip-path: circle(var(--theme-r, 150vmax) at var(--theme-x, 50%) var(--theme-y, 50%)); }
}

/* 2. Cross-fade fallback for other browsers */
html.theme-fade,
html.theme-fade *,
html.theme-fade *::before,
html.theme-fade *::after {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease,
              fill 0.4s ease, stroke 0.4s ease, box-shadow 0.4s ease !important;
}

/* 3. Sun/moon icon spins in on the toggle buttons */
.theme-spin svg { animation: theme-icon-spin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes theme-icon-spin {
  from { transform: rotate(-120deg) scale(0.4); opacity: 0; }
  to   { transform: rotate(0) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-reveal::view-transition-new(root) { animation: none; }
  .theme-spin svg { animation: none; }
}
