/* Bedspace v2 components. One pattern per job; every class here is used. */

/* ============ App layout ============ */
.app { min-height: 100%; }
.app__main {
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}
.content {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
@media (min-width: 768px) {
  .content { padding: var(--sp-6); gap: var(--sp-5); }
}
@media (min-width: 1024px) {
  .app__main { margin-left: var(--sidebar-w); padding-bottom: 0; }
}

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--dur) var(--ease);
}
.sidebar--open { transform: none; box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) {
  .sidebar { transform: none; box-shadow: none; }
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  font-weight: 650; font-size: var(--fs-16); color: var(--text);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: 0 0 auto;
}
.brand-mark svg { width: 18px; height: 18px; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.nav-group { margin-top: var(--sp-4); }
.nav-group:first-child { margin-top: var(--sp-1); }
.nav-group__label {
  padding: 0 var(--sp-3) var(--sp-1);
  font-size: var(--fs-12); font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.nav-link {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 40px; padding: 0 var(--sp-3);
  border-radius: var(--r);
  color: var(--text-2); font-size: var(--fs-14); font-weight: 500; text-align: left;
}
.nav-link svg { width: 18px; height: 18px; color: var(--text-muted); flex: 0 0 auto; }
.nav-link:hover { background: var(--surface-hover); text-decoration: none; }
.nav-link--active { background: var(--accent-weak); color: var(--accent-hover); }
.nav-link--active svg { color: var(--accent); }
.nav-link__count {
  margin-left: auto; min-width: 22px; padding: 0 6px; height: 20px;
  border-radius: var(--r-pill); background: var(--bad-weak); color: var(--bad);
  font-size: var(--fs-12); font-weight: 600; display: grid; place-items: center;
}
.sidebar__foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); font-size: var(--fs-13); color: var(--text-muted); }
.scrim {
  position: fixed; inset: 0; z-index: 35; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.scrim--open { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) { .scrim { display: none; } }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) var(--sp-4) 0;
  display: flex; align-items: center; gap: var(--sp-3);
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .topbar { padding-left: var(--sp-6); padding-right: var(--sp-6); } }
.topbar__menu { display: inline-flex; }
@media (min-width: 1024px) { .topbar__menu { display: none; } }
.topbar__titles { min-width: 0; flex: 1; }
.topbar__title { font-size: var(--fs-18); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub { font-size: var(--fs-13); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: var(--r);
  display: grid; place-items: center; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn__dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.profile-btn {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-2) 0 4px; border-radius: var(--r-pill);
}
.profile-btn:hover { background: var(--surface-hover); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-weak); color: var(--accent-hover);
  display: grid; place-items: center; font-size: var(--fs-13); font-weight: 700;
}
.profile-btn__name { font-size: var(--fs-14); font-weight: 500; display: none; }
@media (min-width: 768px) { .profile-btn__name { display: inline; } }

/* Popover menu (profile, notifications) */
.popover {
  position: fixed; z-index: 60;
  min-width: 240px; max-width: min(360px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
}
.popover__head { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-13); color: var(--text-muted); }
.popover__item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 40px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r); text-align: left; font-size: var(--fs-14); color: var(--text-2);
}
.popover__item:hover { background: var(--surface-hover); text-decoration: none; }
.popover__item svg { width: 18px; height: 18px; color: var(--text-muted); flex: 0 0 auto; }
.popover__item-main { flex: 1; min-width: 0; }
.popover__item-sub { font-size: var(--fs-13); color: var(--text-muted); }
.popover__sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }

/* Bottom tabs (phone) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
}
@media (min-width: 1024px) { .tabbar { display: none; } }
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: var(--fs-12); font-weight: 500; color: var(--text-muted);
}
.tabbar__item svg { width: 22px; height: 22px; }
.tabbar__item--active { color: var(--accent); }

/* ============ Page header ============ */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); justify-content: space-between; }
.page-head__text { min-width: 0; }
.page-head__title { font-size: var(--fs-20); font-weight: 650; }
.page-head__sub { color: var(--text-muted); font-size: var(--fs-14); }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ============ Panels ============ */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  min-width: 0;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}
@media (min-width: 768px) { .panel__head { padding: var(--sp-4) var(--sp-5) var(--sp-3); } }
.panel__title { font-size: var(--fs-15); font-weight: 600; }
.panel__sub { font-size: var(--fs-13); color: var(--text-muted); }
.panel__body { padding: 0 var(--sp-4) var(--sp-4); }
@media (min-width: 768px) { .panel__body { padding: 0 var(--sp-5) var(--sp-5); } }
.panel__body--flush { padding: 0; }
.panel__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }

.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 900px) {
  .grid--2 { grid-template-columns: 1fr 1fr; }
  .grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}

/* ============ KPI tiles ============ */
.kpis { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left;
}
button.kpi:hover { border-color: var(--border-strong); }
.kpi__label { font-size: var(--fs-13); color: var(--text-muted); font-weight: 500; }
.kpi__value { font-size: var(--fs-24); font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__meta { font-size: var(--fs-13); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__value--bad { color: var(--bad); }
.kpi__value--ok { color: var(--ok); }

/* Progress */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--idle-weak); overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); border-radius: inherit; }

/* ============ Key–value rows ============ */
.kv { display: flex; flex-direction: column; }
.kv__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border);
}
.kv__row:last-child { border-bottom: 0; }
.kv__label { color: var(--text-muted); font-size: var(--fs-14); }
.kv__value { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv__row--strong .kv__label { color: var(--text); font-weight: 600; }
.kv__row--strong .kv__value { font-weight: 650; }

/* ============ Lists (rows) ============ */
.rows { display: flex; flex-direction: column; }
.rowi {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 56px; padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border); text-align: left; color: var(--text);
}
.rows > .rowi:first-child { border-top: 0; }
@media (min-width: 768px) { .rowi { padding-left: var(--sp-5); padding-right: var(--sp-5); } }
button.rowi:hover, a.rowi:hover { background: var(--surface-2); text-decoration: none; }
.rowi__lead {
  width: 36px; height: 36px; border-radius: var(--r); flex: 0 0 auto;
  display: grid; place-items: center; background: var(--idle-weak); color: var(--text-2);
  font-size: var(--fs-13); font-weight: 650;
}
.rowi__lead svg { width: 18px; height: 18px; }
.rowi__lead--ok { background: var(--ok-weak); color: var(--ok); }
.rowi__lead--bad { background: var(--bad-weak); color: var(--bad); }
.rowi__lead--warn { background: var(--warn-weak); color: var(--warn); }
.rowi__lead--info { background: var(--info-weak); color: var(--info); }
.rowi__main { flex: 1; min-width: 0; }
.rowi__title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowi__sub { font-size: var(--fs-13); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowi__end { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.rowi__amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rowi__chev { width: 18px; height: 18px; color: var(--text-faint); flex: 0 0 auto; }

/* ============ Tables (desktop) → cards (phone) ============ */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th {
  text-align: left; font-weight: 600; font-size: var(--fs-13); color: var(--text-muted);
  padding: var(--sp-2) var(--sp-4); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort { display: inline-block; width: 12px; color: var(--accent); }
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover td { background: var(--surface-2); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table td .cell-sub { font-size: var(--fs-13); color: var(--text-muted); }
@media (min-width: 768px) {
  .table th:first-child, .table td:first-child { padding-left: var(--sp-5); }
  .table th:last-child, .table td:last-child { padding-right: var(--sp-5); }
}
@media (max-width: 767px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
  .table--stack tbody tr:first-child { border-top: 0; }
  .table--stack td { padding: 2px 0; border: 0; display: flex; justify-content: space-between; gap: var(--sp-3); text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--fs-13); text-align: left; }
  .table--stack td.cell-primary { font-weight: 600; text-align: left; padding-bottom: var(--sp-1); }
  .table--stack td.cell-primary::before { content: none; }
  .table--stack td:empty { display: none; }
}

/* ============ Status badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--fs-13); font-weight: 500; white-space: nowrap;
  border: 1px solid var(--idle-border); background: var(--idle-weak); color: var(--idle);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-weak); color: var(--ok); border-color: var(--ok-border); }
.badge--warn { background: var(--warn-weak); color: var(--warn); border-color: var(--warn-border); }
.badge--bad { background: var(--bad-weak); color: var(--bad); border-color: var(--bad-border); }
.badge--info { background: var(--info-weak); color: var(--info); border-color: var(--info-border); }
.badge--accent { background: var(--accent-weak); color: var(--accent-hover); border-color: var(--accent-border); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 40px; padding: 0 var(--sp-4); border-radius: var(--r);
  font-size: var(--fs-14); font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  text-decoration: none !important;
}
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn--danger-ghost { color: var(--danger); }
.btn--danger-ghost:hover:not(:disabled) { background: var(--bad-weak); }
.btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-13); }
.btn--lg { min-height: 48px; font-size: var(--fs-15); }
.btn--block { width: 100%; }
@media (pointer: coarse) { .btn, .btn--sm { min-height: var(--tap); } }
.link-btn { color: var(--accent); font-weight: 600; font-size: var(--fs-14); min-height: var(--tap); padding: 0 var(--sp-2); align-self: center; }
.link-btn:hover { text-decoration: underline; }

/* ============ Toolbar: search, filters, segmented ============ */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding: 0 var(--sp-4) var(--sp-3); }
@media (min-width: 768px) { .toolbar { padding: 0 var(--sp-5) var(--sp-3); } }
.search { position: relative; flex: 1 1 220px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); }
.search .input { padding-left: 38px; }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  min-height: 34px; padding: 0 var(--sp-3); border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--fs-13); font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.chip:hover { background: var(--surface-hover); }
.chip--on { background: var(--text); border-color: var(--text); color: #fff; }
.chip--on:hover { background: var(--text-2); }
.chip__n { opacity: .7; margin-left: 4px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--idle-weak); border-radius: var(--r); }
.segmented__item { min-height: 32px; padding: 0 var(--sp-3); border-radius: 6px; font-size: var(--fs-13); font-weight: 600; color: var(--text-muted); }
.segmented__item--on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.month-nav { display: inline-flex; align-items: center; gap: var(--sp-1); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 2px; }
.month-nav__label { min-width: 120px; text-align: center; font-weight: 600; font-size: var(--fs-14); }
.month-nav .icon-btn { width: 34px; height: 34px; }

/* ============ Forms ============ */
.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form-grid { display: grid; gap: var(--sp-4); }
@media (min-width: 560px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-14); font-weight: 500; color: var(--text-2); }
.field__hint { font-size: var(--fs-13); color: var(--text-muted); }
.field__error { font-size: var(--fs-13); color: var(--bad); }
.field--error .input, .field--error .select { border-color: var(--bad); }
.input, .select {
  width: 100%; min-height: 42px; padding: 0 var(--sp-3);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: var(--fs-15); color: var(--text);
  box-shadow: var(--shadow-sm);
}
textarea.input { padding: var(--sp-2) var(--sp-3); min-height: 72px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input--readonly { background: var(--surface-2); color: var(--text-2); display: flex; align-items: center; }
.input--money { font-size: var(--fs-20); font-weight: 600; min-height: 52px; font-variant-numeric: tabular-nums; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input--sm, .select--sm { min-height: 36px; font-size: var(--fs-14); }
.form__actions { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; padding-top: var(--sp-2); }
.form__actions .spacer { flex: 1; }
.details { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.details > summary { cursor: pointer; font-size: var(--fs-14); font-weight: 600; color: var(--text-2); list-style: none; }
.details > summary::-webkit-details-marker { display: none; }
.details > summary::before { content: "+ "; color: var(--accent); }
.details[open] > summary::before { content: "− "; }
.details[open] > .form { margin-top: var(--sp-3); }
.choice-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.choice-chips input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chips label { cursor: pointer; }
.choice-chips label span {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 var(--sp-3);
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--fs-14); font-weight: 500;
}
.choice-chips input:checked + span { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-hover); }
.choice-chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.callout { border-radius: var(--r); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-14); border: 1px solid var(--border); background: var(--surface-2); }
.callout--warn { background: var(--warn-weak); border-color: var(--warn-border); color: #7A2E0E; }
.callout--info { background: var(--info-weak); border-color: var(--info-border); color: #194185; }

/* ============ Dialog (sheet on phone, modal on desktop) ============ */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 70; background: var(--overlay);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.dialog-backdrop--open { opacity: 1; }
.dialog {
  position: fixed; z-index: 71; left: 0; right: 0; bottom: 0;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform var(--dur) var(--ease);
  padding-bottom: var(--safe-bottom);
}
.dialog--open { transform: none; }
@media (min-width: 640px) {
  .dialog {
    left: 50%; top: 50%; bottom: auto; right: auto;
    width: min(560px, calc(100vw - 48px)); max-height: 86vh;
    border-radius: var(--r-lg);
    transform: translate(-50%, -46%); opacity: 0;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  }
  .dialog--open { transform: translate(-50%, -50%); opacity: 1; }
}
.dialog__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.dialog__title { flex: 1; font-size: var(--fs-16); font-weight: 650; }
.dialog__body { padding: var(--sp-5); overflow-y: auto; }

/* ============ Toasts ============ */
#toast-host {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: center;
  width: min(440px, calc(100vw - 24px)); pointer-events: none;
}
@media (min-width: 1024px) { #toast-host { bottom: 24px; left: auto; right: 24px; transform: none; align-items: flex-end; } }
.toast {
  pointer-events: auto; width: 100%;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r);
  background: var(--text); color: #fff; font-size: var(--fs-14); box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(6px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast--show { opacity: 1; transform: none; }
.toast--success { background: #054F31; }
.toast--error { background: #912018; }
.toast--warn { background: #93370D; }

/* ============ Empty / loading ============ */
.empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-muted); font-size: var(--fs-14); }
.empty__title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: var(--sp-3); }
.skeleton { background: linear-gradient(90deg, var(--idle-weak), #F8F9FB, var(--idle-weak)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: var(--r); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton--kpi { height: 84px; border-radius: var(--r-lg); }
.skeleton--panel { height: 220px; border-radius: var(--r-lg); }
.error-panel { padding: var(--sp-6); text-align: center; }
.error-panel p { margin-bottom: var(--sp-3); color: var(--text-2); }

/* ============ Bunk map ============ */
.bunks { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.bunks--compact { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
@media (max-width: 640px) { .bunks--compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.bunk { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); padding: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); }
.bunk__label { display: flex; align-items: center; justify-content: space-between; padding: 2px var(--sp-1) 0; font-size: var(--fs-13); font-weight: 650; color: var(--text-2); }
.bunk__label span { font-weight: 500; color: var(--text-muted); }
.bunk__frame { display: flex; flex-direction: column; gap: 6px; border-left: 3px solid var(--border-strong); border-right: 3px solid var(--border-strong); padding: 0 4px; }
.space {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; min-height: 64px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--border);
  text-align: left; position: relative;
}
.space:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.space__top { display: flex; align-items: center; gap: 6px; width: 100%; font-size: var(--fs-12); font-weight: 650; color: var(--text-muted); }
.space__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle-border); margin-left: auto; }
.space__name { font-size: var(--fs-14); font-weight: 600; color: var(--text); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space__meta { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.space--vacant { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.space--vacant .space__name { color: var(--text-muted); font-weight: 500; }
.space--ok .space__dot { background: var(--ok); }
.space--due .space__dot { background: var(--info); }
.space--bad { border-color: var(--bad-border); background: var(--bad-weak); }
.space--bad .space__dot { background: var(--bad); }
.space--bad .space__meta { color: var(--bad); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: var(--fs-13); color: var(--text-muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============ Profile (tenant) ============ */
.profile-head { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.profile-head .avatar { width: 52px; height: 52px; font-size: var(--fs-18); }
.profile-head__main { flex: 1; min-width: 0; }
.profile-head__name { font-size: var(--fs-20); font-weight: 650; }
.profile-head__meta { color: var(--text-muted); font-size: var(--fs-14); }
.profile-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.headline { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-15); }
.headline strong { font-size: var(--fs-24); font-variant-numeric: tabular-nums; }
.month-strip { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 4px; }
.month-cell { flex: 0 0 auto; min-width: 96px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); text-align: left; }
.month-cell__m { font-size: var(--fs-13); font-weight: 600; }
.month-cell__a { font-size: var(--fs-13); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.month-cell--ok { border-color: var(--ok-border); background: var(--ok-weak); }
.month-cell--bad { border-color: var(--bad-border); background: var(--bad-weak); }
.month-cell--warn { border-color: var(--warn-border); background: var(--warn-weak); }

/* ============ Settings / tabs ============ */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs__item { min-height: 42px; padding: 0 var(--sp-3); font-size: var(--fs-14); font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs__item:hover { color: var(--text); }
.tabs__item--on { color: var(--accent-hover); border-bottom-color: var(--accent); }
.settings-section + .settings-section { margin-top: var(--sp-5); }
.settings-section__title { font-weight: 600; margin-bottom: 2px; }
.settings-section__desc { color: var(--text-muted); font-size: var(--fs-14); margin-bottom: var(--sp-3); }
.prefix { position: relative; }
.prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.prefix > .input { padding-left: 28px; }

/* Bar chart (reports) */
.bars { display: flex; align-items: flex-end; gap: var(--sp-3); height: 160px; padding-top: var(--sp-2); }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bars__pair { display: flex; align-items: flex-end; gap: 3px; height: 130px; width: 100%; justify-content: center; }
.bars__bar { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; }
.bars__bar--in { background: var(--accent); }
.bars__bar--out { background: var(--border-strong); }
.bars__lbl { font-size: var(--fs-12); color: var(--text-muted); }

/* ============ Login / setup ============ */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: var(--sp-8) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-18); font-weight: 650; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.auth-title { font-size: var(--fs-24); font-weight: 650; letter-spacing: -0.01em; }
.auth-sub { color: var(--text-muted); }
.auth-error { color: var(--bad); font-size: var(--fs-14); }
.auth-error:empty { display: none; }
.wizard__progress { display: flex; align-items: center; gap: var(--sp-2); }
.wizard__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.wizard__dot--active { background: var(--accent); width: 20px; border-radius: 4px; }
.wizard__dot--done { background: var(--accent); }
.wizard__progress-label { margin-left: auto; font-size: var(--fs-13); color: var(--text-muted); }
.wizard__step { display: flex; flex-direction: column; gap: var(--sp-4); }
.wizard__title { font-size: var(--fs-20); font-weight: 650; }
.wizard__actions { display: flex; gap: var(--sp-2); justify-content: space-between; }
.wizard__actions .btn--primary { flex: 1; }
.checklist { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-14); color: var(--text-muted); }
.checklist__item::before { content: "○ "; }
.checklist__item--ok { color: var(--ok); }
.checklist__item--ok::before { content: "✓ "; }
.summary { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-2) var(--sp-4); }
.summary__row { display: flex; justify-content: space-between; padding: var(--sp-2) 0; }
.save-key { display: flex; flex-direction: column; gap: var(--sp-3); }
.keybox { padding: var(--sp-4); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r); font-family: var(--font-mono); font-size: var(--fs-16); font-weight: 600; letter-spacing: .08em; text-align: center; line-height: 1.8; user-select: all; }
.keybox__actions { display: flex; gap: var(--sp-2); }
.keybox__actions .btn { flex: 1; }
.check-confirm { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer; font-weight: 500; }
.check-confirm input { width: 20px; height: 20px; accent-color: var(--accent); }
.check-confirm:has(input:checked) { background: var(--accent-weak); border-color: var(--accent-border); }

/* Files (backups) */
.file-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.file-list__item { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.file-list__item:first-child { border-top: 0; }
.file-list__main { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; }
.file-list__name { font-weight: 500; }
.file-list__date { font-size: var(--fs-13); color: var(--text-muted); }
.file-list__buttons { display: flex; gap: var(--sp-2); }

.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.row-gap { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.text-bad { color: var(--bad); }
.text-ok { color: var(--ok); }
.pre-line { white-space: pre-line; }
@media (pointer: coarse) { .chip { min-height: 40px; } .segmented__item { min-height: 38px; } }
/* Phone: topbar action buttons become icon-only so the page title keeps its room. */
@media (max-width: 639px) {
  .topbar__right .btn .btn__label { display: none; }
  .topbar__right .btn { width: 40px; padding: 0; }
}
/* Names in bed tiles wrap to two lines instead of being cut off. */
.space__name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.rowi__sub { white-space: normal; }
.kpi__meta { white-space: normal; }

/* ---- Receipts ------------------------------------------------------------ */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plain-list { margin: 0; padding-left: 1.1em; display: grid; gap: var(--sp-2); color: var(--text-2); font-size: var(--fs-14); }

.scan-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1);
  width: 100%; min-height: 148px; padding: var(--sp-5) var(--sp-4); text-align: center;
  border: 1.5px dashed var(--accent-border); border-radius: var(--r-lg); background: var(--accent-weak);
  color: var(--text); font: inherit; cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.scan-drop svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: var(--sp-1); }
.scan-drop:hover { border-color: var(--accent); }
.scan-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scan-preview { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.scan-preview img { max-width: 100%; max-height: 300px; border-radius: var(--r); border: 1px solid var(--border); box-shadow: var(--shadow-sm); object-fit: contain; background: var(--surface-2); }
.scan-preview__file { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); font-size: var(--fs-14); }
.scan-status { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); color: var(--text-2); }
.scan-status::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-border); border-top-color: var(--accent); animation: bs-spin .8s linear infinite; }
@keyframes bs-spin { to { transform: rotate(360deg); } }
.scan-choose p { margin: 0 0 var(--sp-2); }
.scan-choose__btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.scan-choose__btns .btn { flex-direction: column; height: auto; padding: var(--sp-3) var(--sp-2); gap: var(--sp-1); }
@media (max-width: 380px) { .scan-choose__btns { grid-template-columns: 1fr; } .scan-choose__btns .btn { flex-direction: row; } }

.scan-banner { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--r); background: var(--accent-weak); border: 1px solid var(--accent-border); }
.scan-banner__head { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); font-weight: 600; color: var(--accent); }
.scan-banner__head svg { flex: none; width: 18px; height: 18px; }
.scan-banner__facts { font-size: var(--fs-14); color: var(--text-2); font-variant-numeric: tabular-nums; }

.receipt-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.receipt-list { display: contents; }
.receipt-thumb { position: relative; width: 64px; height: 64px; }
.receipt-thumb__open { width: 100%; height: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; cursor: zoom-in; display: flex; align-items: center; justify-content: center; }
.receipt-thumb__open img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.receipt-thumb__pdf { display: flex; flex-direction: column; align-items: center; font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.receipt-thumb__remove { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.receipt-thumb__remove svg { width: 14px; height: 14px; }
.receipt-thumb__remove:hover { color: var(--danger); border-color: var(--danger); }
.receipt-row .btn svg { width: 16px; height: 16px; }

.ref-cell { display: inline-flex; align-items: center; gap: var(--sp-2); }
.clip-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-sm); background: var(--accent-weak); color: var(--accent); cursor: pointer; flex: none; }
.clip-btn svg { width: 15px; height: 15px; }
.clip-btn:hover { background: var(--accent-border); }
@media (pointer: coarse) { .clip-btn { width: 34px; height: 34px; } }
.scan-dup { display: grid; gap: var(--sp-2); justify-items: start; }
.scan-dup .btn svg { width: 16px; height: 16px; }

/* Receipt check: does the record agree with its receipt? */
.receipt-check { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); border: 1px solid var(--border); font-size: var(--fs-14); }
.receipt-check--ok { background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--surface)); }
.receipt-check--bad { background: var(--warn-weak, #FFFAEB); border-color: var(--warn-border, #FEC84B); }
.receipt-check__head { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; }
.receipt-check--ok .receipt-check__head { color: var(--ok); }
.receipt-check--bad .receipt-check__head { color: #7A2E0E; }
.receipt-check__head svg { width: 18px; height: 18px; flex: none; }
.receipt-check__rows { display: grid; gap: 4px; }
.receipt-check__row { display: grid; grid-template-columns: minmax(90px, auto) 1fr 1fr; gap: var(--sp-2); font-variant-numeric: tabular-nums; color: var(--text-2); }
.receipt-check__row--bad { color: var(--text); font-weight: 500; }
.receipt-check__label { color: var(--text-muted); }
@media (max-width: 420px) { .receipt-check__row { grid-template-columns: 1fr 1fr; } .receipt-check__label { grid-column: 1 / -1; } }
.receipt-check__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.clip-btn { position: relative; }
.clip-btn__mark { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; color: #fff; }
.clip-btn--ok .clip-btn__mark { background: var(--ok); }
.clip-btn--bad { background: var(--warn-weak, #FFFAEB); color: #B54708; }
.clip-btn--bad .clip-btn__mark { background: var(--bad); }

/* Suggestions from a just-attached receipt */
.receipt-suggest { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--accent-weak); border: 1px solid var(--accent-border); font-size: var(--fs-14); }
.receipt-suggest__head { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; color: var(--accent); }
.receipt-suggest__head svg { width: 18px; height: 18px; flex: none; }
.receipt-suggest__head span { flex: 1; }
.receipt-suggest__rows { display: grid; gap: 2px; }
.receipt-suggest__row { display: grid; grid-template-columns: minmax(88px, auto) 1fr auto auto; align-items: center; gap: var(--sp-2); padding: 4px 0; border-top: 1px solid var(--accent-border); font-variant-numeric: tabular-nums; }
.receipt-suggest__row:first-child { border-top: 0; }
.receipt-suggest__new { font-weight: 600; color: var(--text); }
.receipt-suggest__old { color: var(--text-muted); font-size: var(--fs-13); }
.receipt-suggest__row--done .receipt-suggest__old { text-decoration: line-through; }
.receipt-suggest__used { color: var(--ok); display: inline-flex; }
.receipt-suggest__used svg { width: 18px; height: 18px; }
@media (max-width: 420px) { .receipt-suggest__row { grid-template-columns: 1fr auto; } .receipt-suggest__row .receipt-check__label { grid-column: 1 / -1; } .receipt-suggest__old { grid-column: 1; } }
.receipt-ok { color: var(--ok); }

/* Similar / already-recorded records */
.similar { display: grid; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--surface); border: 1px solid var(--warn-border); }
.similar__title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: var(--fs-14); color: #7A2E0E; }
.similar__title svg { width: 18px; height: 18px; }
.similar__row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); }
.similar__why { color: var(--text-muted); font-size: var(--fs-13); }
.similar__row .btn svg { width: 16px; height: 16px; }
@media (max-width: 480px) { .similar__row { grid-template-columns: auto 1fr; } .similar__row .btn { grid-column: 1 / -1; justify-self: start; } }

/* Payment view */
.pview { display: grid; gap: var(--sp-4); }
.pview__head { display: grid; gap: 4px; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.pview__who { display: flex; align-items: baseline; gap: var(--sp-2); font-weight: 600; font-size: var(--fs-16); }
.pview__month { font-weight: 400; color: var(--text-muted); font-size: var(--fs-14); }
.pview__amount { font-size: var(--fs-30); font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pview__facts { color: var(--text-2); font-size: var(--fs-14); }
.pview__notes { color: var(--text-muted); font-size: var(--fs-13); }
.pview__check:empty { display: none; }
.pview__media { display: grid; gap: var(--sp-3); justify-items: center; }
.pview__img { display: block; width: 100%; border-radius: var(--r); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.pview__img img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }

/* Repeating bills */
.repeat-tag { display: inline-flex; color: var(--info); }
.repeat-tag svg { width: 15px; height: 15px; }
.repeat-on { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-3); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); font-size: var(--fs-14); }

/* Duplicate safeguards */
.dup-check { display: grid; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--warn-weak); border: 1px solid var(--warn-border); font-size: var(--fs-14); }
.dup-check__head { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; color: #7A2E0E; }
.dup-check__head svg { width: 18px; height: 18px; }
.dup-check__row { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2); align-items: start; }
.dup-check__title { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dup-check__detail { color: var(--text-2); font-size: var(--fs-13); }
.dup-check__why { color: var(--text-muted); font-size: var(--fs-13); }
.dup-group { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r); }
.dup-group__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); }
.dup-group__rec { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); align-items: center; padding: var(--sp-2); border-radius: var(--r-sm); background: var(--surface-2); }
.dup-group__rec--keep { background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.dup-group__rec .btn svg { width: 16px; height: 16px; }
.dup-group__actions { display: flex; justify-content: flex-end; }
.dup-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.dup-banner > svg { width: 20px; height: 20px; }
@media (max-width: 480px) { .dup-group__rec { grid-template-columns: 1fr; } }

/* Appliances */
.space__plug { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; margin-right: 6px; padding: 0 5px; height: 18px; border-radius: 9px; background: var(--info-weak, #EFF8FF); color: var(--info); font-size: 11px; font-weight: 600; }
.space__plug svg { width: 12px; height: 12px; }
.space__plug--high { background: var(--warn-weak); color: var(--warn); }
.space__top { display: flex; align-items: center; }
.fee-grid { display: grid; gap: 6px; }
.fee-grid__head, .fee-grid__row { display: grid; grid-template-columns: 1fr 150px 96px; gap: var(--sp-3); align-items: center; }
.fee-grid__head { font-size: var(--fs-12); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fee-grid__row { padding: 6px 0; border-top: 1px solid var(--border); font-size: var(--fs-14); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--text-2); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 520px) { .fee-grid__head { display: none; } .fee-grid__row { grid-template-columns: 1fr auto; } .fee-grid__row > span:first-child { grid-column: 1 / -1; } }

/* Month breakdown (Reports) */
.breakdown__top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.breakdown__net { font-size: var(--fs-30); font-weight: 700; font-variant-numeric: tabular-nums; }
.breakdown__sum { color: var(--text-2); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.breakdown__list { display: grid; gap: var(--sp-3); }
.breakdown__group { display: grid; gap: 2px; }
.breakdown__row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.breakdown__row--head { font-weight: 600; padding-bottom: 2px; border-bottom: 1px solid var(--border); }
.breakdown__row--item { color: var(--text-2); padding-left: var(--sp-3); }
.breakdown__row--item span:first-child, .breakdown__row--owed span:first-child { min-width: 0; overflow-wrap: anywhere; }
.breakdown__row--owed { color: var(--bad); padding-left: var(--sp-3); }
.bars__col { cursor: pointer; }
