/* ============================================================
   Nuomininkas v2 — Warm Minimal
   Manrope · teal accent · stone neutrals · calm motion
   ============================================================ */

:root {
  /* ---- Stone neutrals ---- */
  --gray-25:  #FAFAF9;
  --gray-50:  #F5F5F4;
  --gray-100: #E7E5E4;
  --gray-150: #D6D3D1;
  --gray-200: #D1CCC7;
  --gray-300: #A8A29E;
  --gray-400: #78716C;
  --gray-500: #57534E;
  --gray-600: #44403C;
  --gray-700: #292524;
  --gray-800: #1C1917;
  --gray-900: #0C0A09;

  /* ---- Teal accent (aliased to purple-* for JS compat) ---- */
  --purple-50:  #F0FDFA;
  --purple-100: #CCFBF1;
  --purple-200: #99F6E4;
  --purple-300: #5EEAD4;
  --purple-400: #2DD4BF;
  --purple-500: #14B8A6;
  --purple-600: #0D9488;
  --purple-700: #0F766E;
  --purple-800: #115E59;
  --purple-900: #134E4A;

  /* ---- Pink accent (compat) ---- */
  --pink-50:  #F0FDFA;
  --pink-100: #CCFBF1;
  --pink-400: #2DD4BF;
  --pink-500: #14B8A6;
  --pink-600: #0D9488;

  /* ---- Semantic ---- */
  --success-50:  #F0FDF4;
  --success-600: #16A34A;
  --success-700: #15803D;

  --danger-50:  #FEF2F2;
  --danger-100: #FEE2E2;
  --danger-600: #DC2626;
  --danger-700: #B91C1C;

  --amber-50:  #FFFBEB;
  --amber-100: #FEF3C7;
  --amber-200: #FDE68A;
  --amber-400: #FBBF24;
  --amber-600: #D97706;
  --amber-700: #B45309;

  --green-50:  #F0FDF4;
  --green-100: #DCFCE7;
  --green-500: #22C55E;
  --green-600: #16A34A;

  --info-50:  #EFF6FF;
  --info-100: #DBEAFE;
  --info-600: #2563EB;
  --info-700: #1D4ED8;

  /* ---- Aliases ---- */
  --bg:         #FAFAF9;
  --surface:    #FFFFFF;
  --surface-2:  var(--gray-100);
  --sidebar-bg: #FFFFFF;
  --border:     #E7E5E4;
  --border-2:   #D6D3D1;

  --ink-900: #0C0A09;
  --ink-800: #1C1917;
  --ink-700: #292524;
  --ink-600: #44403C;
  --ink-500: #78716C;
  --ink-400: #A8A29E;
  --ink-300: #D6D3D1;
  --ink-50:  #FAFAF9;

  --accent:       var(--purple-600);
  --accent-hover: var(--purple-700);
  --accent-soft:  var(--purple-50);
  --accent-ink:   #FFFFFF;

  --gradient:      #0D9488;
  --gradient-soft: linear-gradient(135deg, rgba(13, 148, 136, 0.05) 0%, rgba(20, 184, 166, 0.07) 100%);

  --bg-50:  var(--gray-50);
  --bg-100: var(--gray-100);

  --emerald-50:  var(--purple-50);
  --emerald-200: var(--purple-200);
  --emerald-700: var(--purple-700);

  /* ---- Spacing ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* ---- Type scale (1.25 major third ratio from 16px base) ---- */
  --t-xs:   12px;
  --t-sm:   14px;
  --t-base: 16px;
  --t-lg:   18px;
  --t-xl:   20px;
  --t-2xl:  25px;
  --t-3xl:  32px;
  --t-4xl:  40px;

  /* ---- Radii ---- */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  22px;
  --r-pill: 999px;

  /* ---- Shadows (neutral, barely there) ---- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.10);

  --ring: 0 0 0 3px rgba(13, 148, 136, 0.30);

  --sidebar-w: 260px;

  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --mono: var(--font-mono);

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  /* keep --bounce as alias for JS-toggled transitions */
  --bounce: var(--ease);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }

body {
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink-700);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

::selection { background: var(--purple-100); color: var(--purple-900); }

a { color: var(--purple-600); text-decoration: none; }
a:hover { color: var(--purple-700); text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.no-sidebar .layout { grid-template-columns: 1fr; }
.no-sidebar .sidebar,
.no-sidebar .mobile-bar,
.no-sidebar .sidebar-backdrop { display: none !important; }

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  padding: var(--s-6) var(--s-5) var(--s-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  color: var(--ink-900);
  font-weight: 700;
  font-size: var(--t-lg);
  letter-spacing: -0.03em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--gradient);
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.brand-mark::after {
  content: "";
  width: 14px;
  height: 14px;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 12 L12 4 L21 12 L21 20 L15 20 L15 13 L9 13 L9 20 L3 20 Z' fill='black'/></svg>") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 12 L12 4 L21 12 L21 20 L15 20 L15 13 L9 13 L9 20 L3 20 Z' fill='black'/></svg>") center/contain no-repeat;
  background: white;
}

.brand-name {}
.brand-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gradient);
  margin-left: -2px;
  vertical-align: baseline;
}

.sidebar-cta {
  padding: var(--s-3) var(--s-4) var(--s-2);
}
.sidebar-cta .btn { width: 100%; }

.sidebar-section {
  padding: var(--s-2) var(--s-3) var(--s-3);
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.sidebar-section::-webkit-scrollbar { width: 5px; }
.sidebar-section::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--s-4) var(--s-3) var(--s-2);
}

.sidebar-apts {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-apt {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .15s var(--ease);
  color: var(--ink-600);
  text-decoration: none;
  font: inherit;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  min-width: 0;
}
.sidebar-apt:hover {
  background: var(--gray-50);
  color: var(--ink-900);
  text-decoration: none;
}
.sidebar-apt.active {
  background: var(--purple-50);
  color: var(--purple-800);
}
.sidebar-apt.active .sidebar-apt-name { font-weight: 600; }

.sidebar-apt-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--gray-50);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
}
.sidebar-apt.active .sidebar-apt-icon {
  background: var(--purple-100);
}

.sidebar-apt-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-apt-name {
  font-size: var(--t-sm);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.sidebar-apt-sub {
  font-size: 11px;
  color: var(--ink-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-apt-cost {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-800);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sidebar-apt.active .sidebar-apt-cost { color: var(--purple-700); }

.sidebar-search {
  display: block;
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
  background: var(--gray-25);
  outline: none;
  font-family: inherit;
  min-height: 36px;
}
.sidebar-search:focus { border-color: var(--purple-400); box-shadow: var(--ring); }

/* Sidebar status filter pills */
.sidebar-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 0 var(--s-1) var(--s-2);
}
.sidebar-filter-pill {
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  white-space: nowrap;
}
.sidebar-filter-pill:hover { border-color: var(--purple-300); color: var(--ink-700); }
.sidebar-filter-pill.active { background: var(--purple-600); color: white; border-color: var(--purple-600); }

/* Sidebar pending count badge */
.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--amber-600);
  color: white;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0;
}

.sidebar-apts-list {
  max-height: calc(8 * 48px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-apts-list::-webkit-scrollbar { width: 4px; }
.sidebar-apts-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* Compact mode — tighter items when many apartments */
.sidebar-apts-compact .sidebar-apt-compact {
  padding: 7px var(--s-3);
}
.sidebar-apts-compact .sidebar-apt-icon {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 6px;
}
.sidebar-apts-compact .sidebar-apt-name {
  font-size: var(--t-xs);
}
.sidebar-apts-compact .sidebar-apt-cost {
  font-size: 10px;
}

.sidebar-show-all {
  display: block;
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-xs);
  color: var(--purple-600);
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
  font-family: inherit;
}
.sidebar-show-all:hover { color: var(--purple-800); text-decoration: underline; }
.sidebar-show-all.hide { display: none; }

.sidebar-apt-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sidebar-apt-dot.paid { background: var(--green-500); }
.sidebar-apt-dot.approved { background: var(--amber-400); }
.sidebar-apt-dot.pending { background: var(--ink-300); }

.sidebar-nav-link { margin-top: var(--s-2); border-top: 1px solid var(--border); padding-top: var(--s-2); }

.sidebar-empty {
  padding: var(--s-5) var(--s-3);
  font-size: var(--t-sm);
  color: var(--ink-400);
  text-align: center;
  line-height: 1.5;
}

.sidebar-footer {
  padding: var(--s-4);
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-3);
  border-radius: var(--r-md);
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: var(--t-sm);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.sidebar-footer-row {
  display: flex;
  gap: var(--s-2);
}

/* ---- Icon buttons ---- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-width: 44px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--ink-600);
  transition: all .15s var(--ease);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
}
.icon-btn:hover { background: var(--gray-50); color: var(--ink-900); border-color: var(--border-2); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--purple-400); }
.lang-toggle { flex: 0; font-family: var(--font-mono); letter-spacing: 0.05em; min-width: 36px; padding: 0; }
.settings-btn { flex: 0; }
.logout-btn { flex: 0; }

/* ============================================================
   Mobile header
   ============================================================ */

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 52px;
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s-4);
  align-items: center;
  gap: var(--s-3);
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-900);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--t-base);
  letter-spacing: -0.02em;
}
.mobile-brand .brand-mark { width: 24px; height: 24px; }
.mobile-spacer { flex: 1; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 9, 0.25);
  backdrop-filter: blur(4px);
  z-index: 39;
}
.sidebar-backdrop.open { display: block; }

/* ============================================================
   Main content
   ============================================================ */

.main {
  min-width: 0;
  padding: var(--s-8) var(--s-7) var(--s-9);
}

.no-sidebar .main {
  max-width: 100%;
  padding: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: var(--t-4xl);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink-900);
}
.page-subtitle {
  margin: var(--s-2) 0 0;
  color: var(--ink-500);
  font-size: var(--t-base);
  max-width: 55ch;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: border-color .2s var(--ease);
}
.card:hover {
  border-color: var(--border-2);
}
.card + .card { margin-top: var(--s-5); }
.card-body { padding: var(--s-5) var(--s-6); }
.card-header {
  padding: var(--s-5) var(--s-6) var(--s-3);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  background: transparent;
  border: none;
}
.card-header + .card-body { padding-top: 0; }
.card-title {
  margin: 0;
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.015em;
}
.card-subtitle {
  margin: var(--s-1) 0 0;
  font-size: var(--t-sm);
  color: var(--ink-400);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font: inherit;
  font-weight: 600;
  font-size: var(--t-sm);
  padding: 10px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s var(--ease);
  min-height: 40px;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
  background: var(--gradient);
  color: var(--accent-ink);
  border: none;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink-800);
  border-color: var(--border-2);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost {
  background: var(--gray-50);
  color: var(--ink-700);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--ink-900); border-color: var(--border-2); }

.btn-danger {
  background: var(--surface);
  color: var(--danger-600);
  border-color: var(--border-2);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-50); border-color: var(--danger-600); }

.btn-sm { min-height: 36px; padding: 8px 14px; font-size: var(--t-xs); border-radius: var(--r-sm); }
.btn-lg { min-height: 48px; padding: 13px 28px; font-size: var(--t-base); }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */

.form-row { display: block; margin-bottom: var(--s-5); }
.label {
  display: block;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-2);
}
.input, .select, .textarea {
  width: 100%;
  font: inherit;
  font-size: var(--t-base);
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px var(--s-4);
  min-height: 44px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--ink-400); }
.input:hover { border-color: var(--border-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--purple-400);
  box-shadow: var(--ring);
}
.input[readonly] { background: var(--gray-50); color: var(--ink-500); cursor: default; }
.input[readonly]:hover { border-color: var(--border); }
.textarea { min-height: 88px; resize: vertical; font-family: inherit; }
.help-text {
  font-size: var(--t-sm);
  color: var(--ink-400);
  margin-top: var(--s-2);
  line-height: 1.5;
}
.error-text {
  font-size: var(--t-sm);
  color: var(--danger-600);
  margin-top: var(--s-2);
}

.form-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Auth screens
   ============================================================ */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-7) var(--s-5);
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-7);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  display: block;
  height: 3px;
  margin: calc(var(--s-7) * -1) calc(var(--s-7) * -1) var(--s-6);
  background: var(--gradient);
  opacity: 0.7;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--s-6);
  justify-content: center;
  letter-spacing: -0.03em;
}
.auth-title {
  margin: 0 0 var(--s-2);
  font-size: var(--t-3xl);
  font-weight: 700;
  color: var(--ink-900);
  text-align: center;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.auth-subtitle {
  margin: 0 0 var(--s-6);
  font-size: var(--t-sm);
  color: var(--ink-400);
  text-align: center;
  line-height: 1.5;
}
.auth-footer {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-400);
}
.auth-footer a { color: var(--purple-600); font-weight: 600; }
.auth-footer a:hover { color: var(--purple-700); }

/* ============================================================
   Summary cards
   ============================================================ */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-7);
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.summary-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--s-3);
}
.summary-value {
  font-size: var(--t-3xl);
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.summary-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--t-xs);
  font-weight: 600;
  margin-top: var(--s-2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--success-50);
  color: var(--success-700);
}

/* ============================================================
   Apartment cards (dashboard grid)
   ============================================================ */

.apt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.apt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  text-align: left;
  font: inherit;
  color: inherit;
}
.apt-card:hover {
  border-color: var(--purple-300);
  box-shadow: var(--shadow-sm);
}
.apt-card:active { transform: scale(0.995); }
.apt-card:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--purple-400); }

.apt-card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}
.apt-card-title-wrap {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}
.apt-emoji {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  display: grid;
  place-items: center;
}
.apt-name {
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--ink-900);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.apt-address {
  font-size: var(--t-xs);
  color: var(--ink-400);
  margin: 2px 0 0;
}
.apt-card-cost {
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}
.apt-cost {
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1;
}
.apt-cost-label {
  font-size: 10px;
  color: var(--ink-400);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.apt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ============================================================
   Pills
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 5px 12px;
  font-size: var(--t-xs);
  font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--gray-50);
  color: var(--ink-600);
  border: 1px solid var(--border);
}
.pill.active {
  background: var(--purple-50);
  color: var(--purple-700);
  border-color: var(--purple-200);
}
.pill.warn {
  background: var(--amber-50);
  color: var(--amber-700);
  border-color: var(--amber-100);
}
.pill.info {
  background: var(--info-50);
  color: var(--info-700);
  border-color: var(--info-100);
}
.pill.danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: var(--danger-100);
}

/* ============================================================
   Back link
   ============================================================ */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--ink-400);
  font-size: var(--t-sm);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: var(--s-4);
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  transition: all .15s var(--ease);
}
.back-link:hover { color: var(--ink-900); background: var(--gray-50); text-decoration: none; }

/* ============================================================
   Metered utility cards
   ============================================================ */

.util-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.util-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  transition: border-color .15s var(--ease);
}
.util-card:hover {
  border-color: var(--purple-200);
}
.util-head {
  display: flex;
  gap: var(--s-3);
  align-items: center;
}
.util-emoji {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  display: grid;
  place-items: center;
}
.util-name-wrap { flex: 1; min-width: 0; }
.util-kind {
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.util-value {
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.util-unit {
  color: var(--ink-400);
  font-weight: 500;
  font-size: var(--t-sm);
}
.util-meta { font-size: var(--t-xs); color: var(--ink-400); }

/* ============================================================
   Table
   ============================================================ */

.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--s-3) var(--s-4);
  border-bottom: 2px solid var(--border);
}
.table td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  color: var(--ink-600);
  font-variant-numeric: tabular-nums;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-25); }

/* ============================================================
   Info list
   ============================================================ */

.info-list { margin: 0; padding: 0; }
.info-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row:first-child { padding-top: 0; }
.info-label {
  margin: 0;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  align-self: center;
}
.info-value {
  margin: 0;
  color: var(--ink-800);
  font-size: var(--t-base);
  word-break: break-word;
}
@media (max-width: 560px) {
  .info-row { grid-template-columns: 1fr; gap: var(--s-1); padding: var(--s-3) 0; }
}

/* ============================================================
   Bill summary
   ============================================================ */

.bill-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.bill-line:first-child { padding-top: 0; }
.bill-line:last-of-type { border-bottom: none; }
.bill-line-left {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  min-width: 0;
}
.bill-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--purple-50);
  border-radius: var(--r-md);
  border: 1px solid var(--purple-100);
}
.bill-name {
  color: var(--ink-800);
  font-weight: 600;
  font-size: var(--t-base);
  letter-spacing: -0.01em;
}
.bill-detail {
  font-size: var(--t-xs);
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.bill-detail.pending { color: var(--amber-700); font-weight: 500; }
.bill-unit { font-weight: 600; color: var(--ink-600); }
.bill-cost {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-900);
  text-align: right;
  font-size: var(--t-base);
  letter-spacing: -0.015em;
  min-width: 90px;
}
.bill-cost.pending { color: var(--ink-400); font-weight: 400; }

.bill-total {
  margin-top: var(--s-5);
  padding: var(--s-5);
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  border-radius: var(--r-lg);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.bill-total-label {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--purple-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.bill-total-value {
  font-size: var(--t-3xl);
  font-weight: 800;
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

/* Bill action bar */
.bill-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--border);
  background: var(--gray-25);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* Bill sections */
.bill-section {
  background: white;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.bill-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  background: var(--gray-25);
}
.bill-section-title {
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--ink-800);
}
.bill-section-subtitle {
  font-size: var(--t-xs);
  color: var(--ink-400);
  margin-top: 2px;
  font-weight: 400;
}
.bill-section-lines { padding: var(--s-3) var(--s-5); }
.bill-due-badge {
  display: inline-block;
  font-size: var(--t-xs);
  color: var(--amber-700);
  background: var(--amber-50);
  border: 1px solid var(--amber-200);
  border-radius: 999px;
  padding: 2px 10px;
  margin-top: 4px;
  font-weight: 600;
}
.bill-section-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-5);
  background: var(--purple-50);
  border-top: 1px solid var(--border);
  font-weight: 800;
  font-size: var(--t-lg);
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
}
.bill-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--gradient);
  border-radius: var(--r-lg);
  font-weight: 800;
  font-size: var(--t-xl);
  color: white;
  letter-spacing: -0.02em;
}

/* Payment card */
.payment-card {
  margin-top: var(--s-4);
  background: white;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.payment-card-header {
  padding: var(--s-3) var(--s-5);
  background: var(--purple-50);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.payment-card-title {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--purple-700);
  letter-spacing: 0.02em;
}
.payment-card-body { padding: var(--s-4) var(--s-5); }

.payment-bank-details {
  background: var(--gray-25);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
}
.payment-bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: var(--t-sm);
}
.payment-bank-row + .payment-bank-row { border-top: 1px solid var(--border); }
.payment-bank-label { color: var(--ink-400); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.payment-bank-value { font-weight: 600; color: var(--ink-800); text-align: right; }
.payment-iban { font-family: var(--font-mono); font-size: var(--t-sm); letter-spacing: 0.05em; }

.payment-items { display: grid; gap: var(--s-4); }
.payment-items-multi { grid-template-columns: 1fr 1fr; }

.payment-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  text-align: center;
}
.payment-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.payment-item-label { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-400); }
.payment-item-amount { font-size: var(--t-xl); font-weight: 800; color: var(--ink-900); }
.payment-item-ref { text-align: left; margin-bottom: var(--s-3); font-size: var(--t-xs); line-height: 1.5; }
.payment-item-ref-text { display: block; color: var(--ink-700); font-weight: 500; margin-top: 2px; }
.payment-item-qr { margin: var(--s-3) 0; }
.payment-item-qr canvas, .payment-item-qr img { border-radius: var(--r-md); border: 1px solid var(--border); max-width: 160px; height: auto; }
.payment-qr-hint { font-size: var(--t-xs); color: var(--ink-400); margin-top: var(--s-2); }
.payment-item-revolut { margin-top: var(--s-2); }

@media (max-width: 700px) {
  .payment-items-multi { grid-template-columns: 1fr; }
}

/* ============================================================
   Modal
   ============================================================ */

.modal-host {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: var(--s-5);
  background: rgba(12, 10, 9, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 60;
}
.modal-host[aria-hidden="false"] { display: grid; }

.modal {
  background: var(--surface);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-in .2s var(--ease);
  border: 1px solid var(--border);
}
@keyframes modal-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-head {
  padding: var(--s-5) var(--s-6) var(--s-4);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  border: none;
}
.modal-title {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.025em;
}
.modal-body { padding: 0 var(--s-6) var(--s-5); overflow-y: auto; }
.modal-foot {
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
  background: var(--gray-25);
}

/* Page-level tabs */
.page-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--s-5);
  background: var(--gray-50);
  border-radius: var(--r-md);
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  border: none;
  background: none;
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-400);
  cursor: pointer;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: all 0.15s var(--ease);
  font-family: inherit;
}
.page-tab:hover { color: var(--ink-700); }
.page-tab.active {
  color: var(--ink-900);
  background: white;
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}
.tab-content { min-height: 200px; }

/* Analytics controls */
.analytics-controls {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  flex-wrap: wrap;
}
.analytics-apt-select-wrap {
  position: relative;
  background: white;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s;
}
.analytics-apt-select-wrap:hover { border-color: var(--border-2); }
.analytics-apt-select-wrap:focus-within { border-color: var(--purple-400); box-shadow: var(--ring); }
.analytics-apt-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding: var(--s-2) 36px var(--s-2) var(--s-4);
  font-size: var(--t-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-800);
  cursor: pointer;
  min-width: 200px;
  outline: none;
  line-height: 1.6;
}
.analytics-apt-select option { padding: var(--s-2) var(--s-3); font-size: var(--t-sm); }

/* Analytics KPI */
.analytics-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.analytics-kpi {
  background: white;
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--border);
}
.analytics-kpi-value { font-size: var(--t-2xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.analytics-kpi-label { font-size: var(--t-xs); color: var(--ink-400); margin-top: var(--s-1); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.analytics-kpi-sub { font-size: var(--t-xs); color: var(--ink-400); margin-top: 2px; }

/* Analytics charts */
.analytics-content { display: flex; flex-direction: column; gap: var(--s-4); }
.analytics-chart-wrap {
  background: white;
  border-radius: var(--r-lg);
  padding: var(--s-5);
  border: 1px solid var(--border);
  position: relative;
}
.analytics-chart-lg canvas { height: 320px !important; }
.analytics-chart-sm canvas { height: 180px !important; }
.analytics-chart-title {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--ink-600);
  margin-bottom: var(--s-4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
@media (max-width: 900px) { .analytics-two-col { grid-template-columns: 1fr; } }

.analytics-util-row { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.analytics-util-row:last-child { border-bottom: none; }
.analytics-util-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.analytics-util-name { font-size: var(--t-sm); color: var(--ink-600); min-width: 100px; font-weight: 500; }
.analytics-util-bar-wrap { flex: 1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.analytics-util-bar { height: 100%; border-radius: 3px; transition: width 0.4s var(--ease); }
.analytics-util-val { font-size: var(--t-sm); font-weight: 700; color: var(--ink-800); min-width: 70px; text-align: right; }
.analytics-util-pct { font-size: var(--t-xs); color: var(--ink-400); min-width: 40px; text-align: right; }

.analytics-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.analytics-table th { padding: var(--s-2) var(--s-3); text-align: right; font-weight: 700; color: var(--ink-400); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid var(--border); white-space: nowrap; }
.analytics-table th:first-child { text-align: left; }
.analytics-table td { padding: var(--s-2) var(--s-3); text-align: right; color: var(--ink-600); border-bottom: 1px solid var(--border); white-space: nowrap; }
.analytics-table-name { text-align: left !important; font-weight: 600; color: var(--ink-800) !important; }
.analytics-table-total { font-weight: 800 !important; color: var(--ink-900) !important; }
.analytics-table tbody tr:hover { background: var(--gray-25); }

.analytics-pay-summary { display: flex; flex-direction: column; gap: var(--s-3); background: white; border-radius: var(--r-lg); padding: var(--s-5); border: 1px solid var(--border); }
.analytics-pay-item { display: flex; flex-direction: column; gap: var(--s-1); }
.analytics-pay-bar { height: 5px; border-radius: 3px; transition: width 0.4s var(--ease); }
.analytics-pay-label { font-size: var(--t-sm); color: var(--ink-500); }

/* Modal-level tabs */
.tabs {
  display: flex;
  gap: var(--s-4);
  margin: 0 calc(var(--s-6) * -1) 0;
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--border);
}
.tab {
  border: none;
  background: none;
  padding: var(--s-3) 0;
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.tab:hover { color: var(--ink-800); }
.tab.active { color: var(--purple-600); border-color: var(--purple-500); }

/* ============================================================
   Utilities modal rows
   ============================================================ */

.util-row {
  display: grid;
  grid-template-columns: auto 1fr 110px 110px;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.util-row:last-child { border-bottom: none; }
.util-row-main {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  min-width: 0;
}
.util-row-emoji {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--purple-50);
  border-radius: var(--r-sm);
  border: 1px solid var(--purple-100);
}
.util-row-name {
  font-weight: 600;
  color: var(--ink-800);
  display: block;
  font-size: var(--t-sm);
}
.util-row-kind {
  font-size: 10px;
  color: var(--ink-400);
  margin-top: 2px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.util-row-price .input {
  text-align: right;
  padding-right: var(--s-3);
  min-height: 36px;
  font-size: var(--t-sm);
}
@media (max-width: 640px) {
  .util-row { grid-template-columns: auto 1fr; row-gap: var(--s-2); }
  .util-row-price { grid-column: 1 / -1; }
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: var(--r-pill);
  transition: .2s var(--ease);
  cursor: pointer;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .switch-slider { background: var(--gradient); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* ============================================================
   Toast
   ============================================================ */

.toast-host {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
  max-width: calc(100% - var(--s-6));
}
.toast {
  background: var(--gray-800);
  color: white;
  padding: 12px var(--s-5);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--t-sm);
  font-weight: 500;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-in .25s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  transition: opacity .3s var(--ease);
}
.toast.success { background: var(--success-700); }
.toast.error { background: var(--danger-600); }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ============================================================
   Empty state
   ============================================================ */

.empty {
  text-align: center;
  padding: var(--s-9) var(--s-5);
  color: var(--ink-400);
}
.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--s-5);
  border-radius: 50%;
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  display: grid;
  place-items: center;
  font-size: 32px;
}
.empty-title {
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--ink-800);
  margin: 0 0 var(--s-2);
  letter-spacing: -0.02em;
}
.empty-text {
  margin: 0 auto var(--s-5);
  color: var(--ink-400);
  max-width: 44ch;
  line-height: 1.6;
  font-size: var(--t-sm);
}

/* ============================================================
   Welcome hero
   ============================================================ */

.welcome-hero {
  text-align: center;
  padding: var(--s-9) var(--s-5) var(--s-7);
}
.welcome-hero .empty-icon {
  width: 88px;
  height: 88px;
  font-size: 42px;
  background: var(--gradient);
  border: none;
  color: white;
  margin-bottom: var(--s-6);
}
.welcome-hero .page-title { margin-bottom: var(--s-3); }
.welcome-hero .page-subtitle { margin: 0 auto var(--s-6); max-width: 50ch; }

/* ============================================================
   Credentials callout
   ============================================================ */

.credentials {
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin: var(--s-3) 0;
}
.credentials-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--s-2);
}
.credentials-value {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--ink-900);
  background: var(--surface);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  word-break: break-all;
  font-weight: 500;
}
.credentials-hint {
  font-size: 11px;
  color: var(--ink-400);
  margin: var(--s-2) 0 0;
  line-height: 1.5;
}

/* ============================================================
   Photo upload
   ============================================================ */

.prev-reading-hint {
  font-size: var(--t-sm);
  color: var(--ink-500);
  background: var(--gray-50);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
}
.prev-reading-hint strong { color: var(--ink-800); }
.prev-reading-date { color: var(--ink-400); font-size: var(--t-xs); }

.photo-drop {
  border: 2px dashed var(--border-2);
  border-radius: var(--r-lg);
  padding: var(--s-7);
  text-align: center;
  color: var(--ink-400);
  cursor: pointer;
  transition: all .15s var(--ease);
  background: var(--gray-25);
  display: block;
  font-size: var(--t-sm);
}
.photo-drop:hover {
  border-color: var(--purple-400);
  color: var(--purple-600);
  background: var(--purple-50);
}
.photo-drop input[type=file] { display: none; }
.photo-preview {
  display: block;
  margin-top: var(--s-3);
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

/* Revolut button */
.btn-revolut {
  background: #191C1F;
  color: #ffffff;
  border: none;
  border-radius: 100px;
  font-weight: 500;
  font-size: 16px;
  padding: 0 32px;
  min-height: 52px;
  height: 52px;
  gap: 12px;
  transition: background .15s, transform .1s;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--font-sans);
  line-height: 1;
}
.btn-revolut:hover { background: #2c3035; text-decoration: none; color: #fff; }
.btn-revolut:active { transform: scale(0.98); }
.btn-revolut .revolut-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; text-transform: uppercase; }
.btn-revolut .revolut-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.2); flex-shrink: 0; }
.btn-revolut .revolut-amount { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }

.qr-container { display: flex; justify-content: center; padding: var(--s-4) 0; }

.reading-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  transition: transform .15s var(--ease);
}
.reading-thumb:hover { transform: scale(1.4); z-index: 10; position: relative; }
.reading-photo-link { display: inline-block; line-height: 0; }
.reading-no-photo { color: var(--ink-400); }

/* ============================================================
   Per-utility colors
   ============================================================ */

.util-color-elektra .util-emoji,
.util-color-elektra .bill-emoji,
.util-color-elektra .util-row-emoji,
.util-color-elektra .sidebar-apt-icon,
.util-color-elektra .apt-emoji { background: #FEF9C3; border-color: #FDE68A; }

.util-color-saltas_vanduo .util-emoji,
.util-color-saltas_vanduo .bill-emoji,
.util-color-saltas_vanduo .util-row-emoji,
.util-color-saltas_vanduo .sidebar-apt-icon,
.util-color-saltas_vanduo .apt-emoji { background: #DBEAFE; border-color: #BFDBFE; }

.util-color-karstas_vanduo .util-emoji,
.util-color-karstas_vanduo .bill-emoji,
.util-color-karstas_vanduo .util-row-emoji,
.util-color-karstas_vanduo .sidebar-apt-icon,
.util-color-karstas_vanduo .apt-emoji { background: #FFEDD5; border-color: #FED7AA; }

.util-color-sildymas .util-emoji,
.util-color-sildymas .bill-emoji,
.util-color-sildymas .util-row-emoji,
.util-color-sildymas .sidebar-apt-icon,
.util-color-sildymas .apt-emoji { background: #EDE9FE; border-color: #DDD6FE; }

.util-color-internetas .util-emoji,
.util-color-internetas .bill-emoji,
.util-color-internetas .util-row-emoji,
.util-color-internetas .sidebar-apt-icon,
.util-color-internetas .apt-emoji { background: #CFFAFE; border-color: #A5F3FC; }

.util-color-civinity .util-emoji,
.util-color-civinity .bill-emoji,
.util-color-civinity .util-row-emoji,
.util-color-civinity .sidebar-apt-icon,
.util-color-civinity .apt-emoji { background: #D1FAE5; border-color: #A7F3D0; }

.util-color-draudimas .util-emoji,
.util-color-draudimas .bill-emoji,
.util-color-draudimas .util-row-emoji,
.util-color-draudimas .sidebar-apt-icon,
.util-color-draudimas .apt-emoji { background: #E0E7FF; border-color: #C7D2FE; }

.util-color-administravimas .util-emoji,
.util-color-administravimas .bill-emoji,
.util-color-administravimas .util-row-emoji,
.util-color-administravimas .sidebar-apt-icon,
.util-color-administravimas .apt-emoji { background: #FCE7F3; border-color: #FBCFE8; }

.util-color-atliekos .util-emoji,
.util-color-atliekos .bill-emoji,
.util-color-atliekos .util-row-emoji,
.util-color-atliekos .sidebar-apt-icon,
.util-color-atliekos .apt-emoji { background: #F1F5F9; border-color: #E2E8F0; }

/* ============================================================
   Utility helpers
   ============================================================ */

.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-4 { margin-bottom: var(--s-4); }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row-between { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; }
.spacer { flex: 1; }
.hide { display: none !important; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .mobile-bar { display: flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: var(--s-5) var(--s-4) var(--s-8); }
  .page-title { font-size: var(--t-3xl); }
  .page-header { margin-bottom: var(--s-6); }
  .card-body, .card-header { padding-left: var(--s-5); padding-right: var(--s-5); }
  .modal-head, .modal-body, .modal-foot { padding-left: var(--s-5); padding-right: var(--s-5); }
  .tabs { margin-left: calc(var(--s-5) * -1); margin-right: calc(var(--s-5) * -1); padding: 0 var(--s-5); }
}

@media (max-width: 560px) {
  .apt-grid { grid-template-columns: 1fr; }
  .page-title { font-size: var(--t-2xl); }
  .summary-value { font-size: var(--t-2xl); }
}

/* Filter pills */
.filter-row { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.filter-pills { display: flex; gap: var(--s-1); flex-wrap: wrap; }
.filter-pill {
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: var(--t-xs);
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--purple-300); color: var(--ink-700); background: var(--purple-50); }
.filter-pill.active { background: var(--purple-600); color: white; border-color: var(--purple-600); }

/* Reading review */
.reading-review-row {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.reading-review-row:last-child { border-bottom: none; }
.reading-review-info { flex: 1; min-width: 200px; }
.reading-review-header { display: flex; align-items: center; margin-bottom: var(--s-2); }
.reading-review-value { font-size: var(--t-sm); color: var(--ink-500); }
.reading-review-photo {
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s var(--ease);
}
.reading-review-photo:hover { border-color: var(--purple-400); }
.reading-review-actions { display: flex; gap: var(--s-2); align-items: center; }

/* Handover acts */
.handover-item { padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.handover-item:last-child { border-bottom: none; }
.handover-item-header { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.handover-item-header strong { font-size: var(--t-sm); }
.handover-photo-grid { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.handover-photo-item { position: relative; }
.handover-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); cursor: pointer; }
.handover-photo-add { display: flex; align-items: center; }

/* Print */
@media print {
  .sidebar, .mobile-bar, .sidebar-backdrop, .toast-host, .modal-host,
  .back-link, .page-header .row, .btn { display: none !important; }
  .layout { display: block; }
  .main { margin: 0; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .handover-thumb { width: 120px; height: 120px; }
}

/* Catalog */
.catalog-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.catalog-cat-label { font-size: var(--t-xs); font-weight: 700; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.04em; }
.catalog-items { display: flex; flex-wrap: wrap; gap: 8px; }
.catalog-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: var(--t-sm); background: white; transition: all 0.15s; user-select: none; font-family: inherit; }
.catalog-chip:hover { border-color: var(--purple-400); background: var(--purple-50); }
.catalog-chip input[type="checkbox"] { margin: 0; cursor: pointer; }
.catalog-chip:has(input:checked) { border-color: var(--purple-500); background: var(--purple-100); font-weight: 600; }

/* Compact handover rows */
.handover-rows { display: flex; flex-direction: column; }
.handover-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--border); min-height: 44px; }
.handover-row:first-child { border-top: 0; }
.handover-row-name { flex: 1; min-width: 0; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; }
.handover-row-name strong { font-weight: 600; }
.pill-sm { font-size: 11px; padding: 2px 8px; }
.handover-photo-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.handover-thumb-mini { position: relative; width: 34px; height: 34px; border-radius: 6px; overflow: hidden; display: block; border: 1px solid var(--border); flex-shrink: 0; }
.handover-thumb-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.handover-thumb-del { position: absolute; top: 0; right: 0; background: rgba(220,38,38,0.9); color: white; border: 0; width: 16px; height: 16px; font-size: 11px; line-height: 1; cursor: pointer; padding: 0; border-radius: 0 0 0 6px; }
.handover-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn-sm { width: 32px; height: 32px; font-size: 16px; padding: 0; background: transparent; border: 0; border-radius: 6px; cursor: pointer; transition: background 0.15s; }
.icon-btn-sm:hover { background: var(--gray-50); }

/* ============================================================
   Accessibility & UX Enhancements
   ============================================================ */

/* Skip-to-content link (a11y) */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--s-4);
  background: var(--gradient);
  color: white;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--t-sm);
  z-index: 200;
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus {
  top: var(--s-4);
  outline: none;
  box-shadow: var(--ring);
}

/* Reduced motion — respect user preference (Nielsen H7, Apple HIG) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Button loading state (Nielsen H1: System Status) */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .5s linear infinite;
}
.btn-primary.btn-loading::after { border-color: rgba(255,255,255,0.4); border-right-color: transparent; border-top-color: white; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Better disabled states (UI/UX Pro Max: state-clarity) */
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Focus-visible for all interactive elements */
a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}
.sidebar-apt:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.page-tab:focus-visible,
.tab:focus-visible,
.filter-pill:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Stronger active tab indicator */
.page-tab.active {
  color: var(--purple-700);
  background: white;
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* Sidebar active item — left accent bar for strong "you are here" (Nielsen H4, Krug Trunk Test) */
.sidebar-apt.active {
  background: var(--purple-50);
  color: var(--purple-800);
  position: relative;
}
.sidebar-apt.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
}

/* Better link underline for a11y */
a:not(.brand):not(.mobile-brand):not(.back-link):not(.sidebar-apt):not(.btn):not(.btn-revolut) {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Improve table row hover for data readability */
.table tbody tr { transition: background .1s var(--ease); }

/* Auth card — subtle entry animation */
.auth-card {
  animation: auth-in .3s var(--ease);
}
@keyframes auth-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Better bill-actions spacing on mobile */
@media (max-width: 900px) {
  .bill-actions {
    padding: var(--s-3) var(--s-4);
    gap: var(--s-2);
  }
  .bill-actions .btn {
    font-size: var(--t-xs);
    padding: 8px 14px;
    min-height: 36px;
  }
}

/* Ensure number inputs don't get iOS zoom (base font >= 16px already handles this) */
.input[type="number"] {
  -moz-appearance: textfield;
}
.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
