/* ============================================================
   Nodi — Design System & Component Styles
   Mobile-first PWA · Soft Pastel · Lembut & friendly
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Palette — Modern Blue Theme */
  --paper:        #F4F9FF; /* Light blueish tint */
  --paper-rgb:    244, 249, 255;
  --card:         #FFFFFF;
  --ink:          #0F172A; /* Slate 800 */
  --ink-light:    #475569; /* Slate 600 */
  --settled:      #007AFF; /* Apple Blue / Lunas */
  --settled-soft: #E5F1FF;
  --settled-text: #0056B3;
  --settled-contrast: #FFFFFF;
  --due:          #F59E0B; /* Amber - Warning */
  --due-soft:     #FEF3C7;
  --due-text:     #B45309;
  --overdue:      #EF4444; /* Red - Danger */
  --overdue-soft: #FEE2E2;
  --overdue-text: #B91C1C;
  --muted:        #94A3B8; /* Slate 400 */
  --line:         #E2E8F0; /* Slate 200 */
  --line-strong:  #CBD5E1; /* Slate 300 */

  /* Typography */
  --font-display: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Inter', monospace; /* or just stick to Inter for numbers */

  /* Safe areas */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h:       calc(58px + var(--safe-bottom));

  /* Elevation */
  --shadow-xs:  0 1px 2px rgba(15,23,42,.04);
  --shadow-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:  0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:  0 8px 28px rgba(15,23,42,.10);
  --shadow-xl:  0 20px 50px rgba(15,23,42,.14);

  /* Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   22px;
  --r-full: 100px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: #E2E8F0; /* Slate/Blue-gray muted background for desktop frame */
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv05", "ss01";
}

/* ============================================================
   App Shell
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  background: var(--paper);
  box-shadow: 0 0 40px rgba(15,23,42,.08);
}

/* ---------- Header ---------- */
.app-header {
  padding: calc(12px + var(--safe-top)) 20px 14px;
  background: var(--paper);
  position: relative;
  z-index: 10;
  flex: none;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  object-fit: cover;
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
}

.app-title .accent { color: var(--settled); }

.app-subtitle {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
}

/* Header stats badges */
.header-stats {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .01em;
  border: 1px solid transparent;
}

.stat-badge.warn  { background: var(--due-soft);     color: var(--due-text);     border-color: #f5dfc8; }
.stat-badge.danger{ background: var(--overdue-soft);  color: var(--overdue-text);  border-color: #f0c5cd; }
.stat-badge.ok    { background: var(--settled-soft);  color: var(--settled-text);  border-color: #e8cce0; }

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.stat-badge.warn   .stat-dot { background: var(--due); }
.stat-badge.danger .stat-dot { background: var(--overdue); }
.stat-badge.ok     .stat-dot { background: var(--settled); }

/* Icon button */
.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, transform .15s;
  flex: none;
}
.btn-icon:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-icon:active { transform: scale(.93); }
.btn-icon svg { width: 20px; height: 20px; }

/* ============================================================
   Main Scrollable Area
   ============================================================ */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.app-main::-webkit-scrollbar { width: 0; }

/* ============================================================
   Tab Panels
   ============================================================ */
.tab-panel {
  display: none;
  padding: 0 16px 120px;        /* bottom padding for nav */
  min-height: 100%;
}
.tab-panel.active {
  display: block;
}

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
  padding: 12px 0 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
}

.filter-bar .sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 4px;
  background: var(--line);
}

.filter-chip {
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--card);
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  line-height: 1.3;
  user-select: none;
}

.filter-chip:hover { border-color: var(--line-strong); color: var(--ink-light); }

.filter-chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.filter-chip.sm {
  padding: 4px 10px;
  font-size: .72rem;
}

/* ============================================================
   Bill Cards
   ============================================================ */
.bill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 17px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
}

/* Left accent stripe */
.bill-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3.5px;
  background: transparent;
  transition: background .2s;
}
.bill-card.warn::before    { background: var(--due); }
.bill-card.overdue::before { background: var(--overdue); }
.bill-card.paid::before    { background: var(--settled); }

.bill-card:hover  { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.bill-card:active { transform: scale(.985); box-shadow: none; }

.bill-card.paid { opacity: .55; }

/* Icon circle */
.bill-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex: none;
  background: var(--settled-soft);
  transition: background .2s;
}
.bill-card.warn    .bill-icon { background: var(--due-soft); }
.bill-card.overdue .bill-icon { background: var(--overdue-soft); }

/* Info */
.bill-info { flex: 1; min-width: 0; }

.bill-name {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bill-due {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
  margin-top: 1px;
}

/* Right side */
.bill-right { text-align: right; flex: none; }

.bill-amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
}

/* ============================================================
   Status Pills
   ============================================================ */
.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  margin-top: 4px;
  line-height: 1.5;
}

.pill.due     { background: var(--due-soft);     color: var(--due-text); }
.pill.ok      { background: var(--settled-soft);  color: var(--settled-text); }
.pill.overdue { background: var(--overdue-soft);  color: var(--overdue-text); }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 24px 40px;
}

.empty-illustration {
  font-size: 3.2rem;
  margin-bottom: 4px;
  line-height: 1.3;
  opacity: .8;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--muted);
  font-size: .86rem;
  max-width: 260px;
  margin: 0 auto 22px;
  line-height: 1.55;
}

/* ============================================================
   Loading Skeleton
   ============================================================ */
.skeleton-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 8px;
}

.sk {
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 37%, var(--line) 63%);
  background-size: 400% 100%;
  border-radius: 6px;
  animation: shimmer 1.6s ease infinite;
}

.sk-icon  { width: 46px; height: 46px; border-radius: var(--r-md); flex: none; }
.sk-text  { height: 13px; margin-bottom: 7px; border-radius: 4px; }
.sk-w70   { width: 70%; }
.sk-w45   { width: 45%; }
.sk-w30   { width: 30%; }
.sk-amt   { width: 60px; height: 16px; margin-left: auto; flex: none; }

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ============================================================
   Rekap — Category Rows
   ============================================================ */
.rekap-content { padding-top: 2px; }

.cat-list {
  display: flex;
  flex-direction: column;
}

.cat-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: none; }

.cat-icon { font-size: 1.2rem; text-align: center; }

.cat-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-name {
  font-weight: 500;
  font-size: .88rem;
  line-height: 1.3;
}

.cat-count {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--muted);
}

.cat-amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .9rem;
  text-align: right;
  white-space: nowrap;
}

.cat-bar-wrap {
  grid-column: 1 / -1;
  height: 5px;
  background: var(--line);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: -4px;
}

.cat-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--settled);
  transform-origin: left;
}

/* Total */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 4px 0;
  margin-top: 10px;
  border-top: 2px solid var(--settled);
}

.total-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.total-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -.015em;
}

/* ============================================================
   Bottom Navigation
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: rgba(var(--paper-rgb), .82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(15,23,42,.06);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 9px 0 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  transition: color .2s;
  position: relative;
  min-height: 50px;
}

/* Top indicator bar */
.nav-btn::after {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  width: 28px;
  height: 3px;
  background: var(--settled);
  border-radius: 0 0 3px 3px;
  transform: translateX(-50%) scaleX(0);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.nav-btn.active         { color: var(--settled); }
.nav-btn.active::after  { transform: translateX(-50%) scaleX(1); }

.nav-icon { width: 22px; height: 22px; }

.nav-label {
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ============================================================
   Modals (Bottom Sheet)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.modal.open {
  pointer-events: all;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .3s;
}
.modal.open .modal-overlay { opacity: 1; }

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 6px 22px calc(24px + var(--safe-bottom));
  overflow-y: auto;
  transform: translateY(105%);
  transition: transform .38s cubic-bezier(.22,.9,.36,1);
  box-shadow: var(--shadow-xl);
}
.modal.open .modal-sheet { transform: translateY(0); }

.modal-sheet::-webkit-scrollbar { width: 0; }

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--line-strong);
  border-radius: var(--r-full);
  margin: 6px auto 18px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 20px;
}

/* ============================================================
   Form Elements
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-weight: 500;
  font-size: .86rem;
  margin-bottom: 3px;
}

.form-hint {
  font-size: .76rem;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.45;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-input::placeholder { color: var(--line-strong); }

.form-input:focus {
  border-color: var(--settled);
  box-shadow: 0 0 0 3px var(--settled-soft);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: var(--r-md);
  background: var(--settled);
  color: var(--settled-contrast);
  font-family: var(--font-body);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .15s;
  letter-spacing: .01em;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: var(--shadow-md); filter: brightness(1.1); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.full   { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { border-color: var(--ink); }

/* Toggle */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toggle {
  width: 48px;
  height: 28px;
  border: none;
  border-radius: var(--r-full);
  background: var(--line-strong);
  padding: 3px;
  cursor: pointer;
  transition: background .3s;
  flex: none;
}
.toggle[aria-checked="true"] { background: var(--settled); }

.toggle-thumb {
  display: block;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.toggle[aria-checked="true"] .toggle-thumb {
  transform: translateX(20px);
  background: var(--settled-contrast);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0;
}

/* ============================================================
   Author Section (Settings)
   ============================================================ */
.about-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-top: 24px;
}

.author-card {
  text-align: center;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.author-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.author-role {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.author-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.author-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  text-decoration: none;
  font-size: 1rem;
  transition: transform .2s, border-color .2s;
}

.author-links a:hover {
  transform: translateY(-2px);
  border-color: var(--settled);
}

/* ============================================================
   Detail Modal Content
   ============================================================ */
.detail-header {
  text-align: center;
  padding: 8px 0 22px;
}

.detail-icon {
  font-size: 2.8rem;
  line-height: 1.2;
  margin-bottom: 4px;
}

.detail-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.detail-amount {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--settled);
  margin-top: 2px;
  letter-spacing: -.02em;
}

.detail-pill { margin-top: 10px; }

.detail-rows {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  font-size: .86rem;
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .74rem;
  flex: none;
}

.detail-value {
  font-weight: 500;
  text-align: right;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  border-radius: var(--r-full);
  font-size: .82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform .4s cubic-bezier(.22,.9,.36,1), opacity .3s;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes growBar {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.bill-card {
  animation: fadeSlideUp .45s cubic-bezier(.22,.9,.36,1) backwards;
}

/* Staggered entrance: applied via inline style animation-delay */

.cat-bar {
  animation: growBar .8s cubic-bezier(.22,.9,.36,1) backwards;
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Focus Visible
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--settled);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   Utilities
   ============================================================ */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   Desktop Enhancements (≥768px)
   ============================================================ */
@media (min-width: 768px) {
  .bottom-nav {
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(15,23,42,.06);
  }

  .bill-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  .bill-card:active { transform: translateY(0); }
}
/* ============================================================
   Lock Screen
   ============================================================ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-screen.hidden {
  display: none;
}
.lock-card {
  background: var(--card);
  padding: 30px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--line);
}
.lock-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.lock-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}
.lock-card p {
  font-size: .9rem;
  color: var(--muted);
}

/* ============================================================
   Sync Status
   ============================================================ */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--line-strong);
}
.sync-dot.green { background-color: #34C759; }
.sync-dot.red { background-color: #FF3B30; }
.sync-dot.yellow { background-color: #FFCC00; }
.pulsing {
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   Dark Mode overrides
   ============================================================ */
html.dark {
  --paper:        #0F172A; /* Slate 900 */
  --paper-rgb:    15, 23, 42;
  --card:         #1E293B; /* Slate 800 */
  --ink:          #F8FAFC; /* Slate 50 */
  --ink-light:    #CBD5E1; /* Slate 300 */
  --settled:      #3B82F6; /* Lighter blue */
  --settled-soft: rgba(59, 130, 246, 0.15);
  --settled-text: #93C5FD;
  --due:          #F59E0B; 
  --due-soft:     rgba(245, 158, 11, 0.15);
  --due-text:     #FCD34D;
  --overdue:      #EF4444; 
  --overdue-soft: rgba(239, 68, 68, 0.15);
  --overdue-text: #FCA5A5;
  --muted:        #94A3B8; /* Slate 400 */
  --line:         #1E293B; /* Slate 800 (subtle) */
  --line-strong:  #334155; /* Slate 700 */
}

html.dark body {
  background: #020617; /* Slate 950 for desktop background */
}

html.dark .stat-badge.warn { border-color: rgba(245, 158, 11, 0.3); }
html.dark .stat-badge.danger { border-color: rgba(239, 68, 68, 0.3); }
html.dark .stat-badge.ok { border-color: rgba(59, 130, 246, 0.3); }

/* Make dark mode buttons blend better */
html.dark .btn-icon { border-color: var(--line-strong); }
html.dark .filter-chip { border-color: var(--line-strong); }
html.dark .bill-card { border-color: var(--line-strong); }

