:root {
  --ink: #0f172a;
  --muted: #64748b;
  --muted-strong: #475569;
  --surface: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.66);
  --line-strong: rgba(148, 163, 184, 0.24);
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-soft: #d1fae5;
  --teal: #0f766e;
  --cyan-soft: #cffafe;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
  --shadow-tight: 0 12px 34px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(20, 184, 166, 0.22), transparent 30rem),
    radial-gradient(circle at 88% 12%, rgba(103, 232, 249, 0.22), transparent 28rem),
    linear-gradient(135deg, #ecfdf5 0%, #ffffff 46%, #ecfeff 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.74);
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  max-width: 100%;
  white-space: normal;
}

button:hover,
.button-link:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.11);
}

button:active,
.button-link:active {
  transform: scale(0.985);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button-link:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.34);
  outline-offset: 2px;
}

button.primary,
.button-link.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.24);
}

button.danger,
button[data-delete-obligation],
button[data-delete-record],
button[data-delete-head],
button[data-delete-payment],
button[data-delete-admin-note],
button[data-toggle-head][data-next-status="suspended"],
button[data-toggle-family-status][data-next-status="suspended"] {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

textarea {
  min-height: 118px;
  padding: 12px;
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

code {
  border-radius: 7px;
  padding: 2px 6px;
  background: rgba(15, 23, 42, 0.08);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 60;
  transform: translateY(-140%);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.workspace {
  width: 100%;
  margin: 0;
  padding: clamp(16px, 1.5vw, 28px);
}

.hidden {
  display: none !important;
}

.brand-mark {
  width: min(190px, 100%);
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.loading-view {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ecfdf5, #ffffff 52%, #ecfeff);
}

.loading-card,
.notice,
.auth-panel,
.setup-panel,
.tool-panel,
.ledger-panel,
.screen-panel,
.app-nav,
.mobile-bar,
.payment-dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(390px, 100%);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
}

.loading-card span,
.muted-copy {
  color: var(--muted);
  line-height: 1.65;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(148, 163, 184, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.notice {
  border-radius: 18px;
  padding: 18px 20px;
  line-height: 1.6;
}

.auth-panel,
.setup-panel {
  max-width: 720px;
  margin: 7vh auto 0;
  border-radius: var(--radius-xl);
  padding: 34px;
}

.panel-heading {
  display: grid;
  min-width: 0;
  gap: 10px;
  margin-bottom: 22px;
}

.panel-heading h1,
.panel-heading h2,
.panel-heading h3,
.topbar h2,
.app-nav h1 {
  margin: 0;
  color: var(--ink);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.panel-heading h1 {
  font-size: clamp(1.9rem, 4vw, 3.1rem);
}

.panel-heading h3 {
  font-size: 1.22rem;
}

.panel-heading.inline,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full,
.button-row {
  grid-column: 1 / -1;
}

.button-row,
.topbar-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-number-control {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.inline-number-control input {
  width: 78px;
  min-height: 44px;
}

.app-shell {
  display: grid;
  width: 100%;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.app-shell > *,
.topbar > *,
.stats-grid > *,
.content-grid > * {
  min-width: 0;
}

.mobile-bar {
  display: none;
}

.app-nav {
  position: sticky;
  top: 24px;
  z-index: 10;
  grid-column: 1;
  grid-row: 1 / span 20;
  display: grid;
  min-height: calc(100dvh - 48px);
  border-radius: 30px;
  padding: 20px;
}

.screen-panel {
  grid-column: 2;
}

.sidebar-brand,
.mobile-brand,
.mobile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand {
  justify-content: center;
}

.sidebar-logo {
  width: min(178px, 100%);
  height: auto;
  object-fit: contain;
}

.mobile-logo {
  flex: 0 0 auto;
  width: clamp(72px, 18vw, 100px);
  height: auto;
  object-fit: contain;
}

.sidebar-account {
  display: grid;
  align-content: start;
  gap: 9px;
  margin-top: 18px;
}

.workspace-picker {
  gap: 6px;
  margin-top: 4px;
  font-size: 0.76rem;
}

.workspace-picker select {
  min-height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.app-nav h1 {
  font-size: 1.35rem;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 24px 0;
}

.tab-button {
  justify-content: flex-start;
  width: 100%;
  border-radius: 16px;
  text-align: left;
  white-space: nowrap;
}

.tab-button.active {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(209, 250, 229, 0.74);
  color: #065f46;
  font-weight: 800;
}

.app-nav > .topbar-actions,
.sidebar-footer {
  display: grid;
  gap: 10px;
}

.sidebar-footer {
  align-self: end;
  color: var(--muted);
}

.sidebar-footer small {
  color: var(--muted);
  font-size: 0.78rem;
}

.drawer-close {
  display: none;
}

.screen-panel,
.tool-panel,
.ledger-panel {
  min-width: 0;
  border-radius: var(--radius-xl);
  padding: 24px;
}

.admin-account,
.mini-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: capitalize;
}

.admin-account {
  max-width: 340px;
  overflow-wrap: anywhere;
  text-transform: none;
}

.mini-badge.active,
.mini-badge.paid,
.mini-badge.members-unlocked,
.mini-badge.clear,
.mini-badge.on-track,
.mini-badge.registered {
  border-color: rgba(16, 185, 129, 0.22);
  background: rgba(209, 250, 229, 0.8);
  color: #047857;
}

.mini-badge.partial,
.mini-badge.due-soon,
.mini-badge.unpaid,
.mini-badge.payment-not-set,
.mini-badge.trial,
.mini-badge.expiring-soon {
  border-color: rgba(217, 119, 6, 0.2);
  background: rgba(254, 243, 199, 0.88);
  color: #b45309;
}

.mini-badge.not-registered {
  border-color: rgba(217, 119, 6, 0.2);
  background: rgba(254, 243, 199, 0.88);
  color: #b45309;
}

.mini-badge.overdue,
.mini-badge.suspended,
.mini-badge.inactive,
.mini-badge.expired {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(254, 242, 242, 0.9);
  color: #b91c1c;
}

.mini-badge.upcoming,
.mini-badge.free,
.mini-badge.free-signup,
.mini-badge.member-access-locked {
  border-color: rgba(14, 116, 144, 0.18);
  background: rgba(207, 250, 254, 0.72);
  color: #0e7490;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  min-width: 0;
  min-height: 142px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-tight);
}

.stat-label,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  max-width: 100%;
  margin: 11px 0 9px;
  color: var(--ink);
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.stat-card > .mini-badge,
#settingsMemberAccess,
#settingsEmail {
  font-size: clamp(0.95rem, 1.35vw, 1.3rem);
  line-height: 1.25;
  text-transform: none;
}

.dashboard-stats-grid {
  gap: 14px;
  margin-top: 24px;
}

.dashboard-stat {
  --stat-accent: #0f766e;
  position: relative;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  min-height: 132px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.065);
}

.dashboard-stat::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--stat-accent);
  content: "";
  opacity: 0.82;
}

.dashboard-stat-due {
  --stat-accent: #0f766e;
}

.dashboard-stat-outstanding {
  --stat-accent: #0284c7;
}

.dashboard-stat-overdue {
  --stat-accent: #dc2626;
}

.dashboard-stat-assigned {
  --stat-accent: #7c3aed;
}

.dashboard-stat .stat-label,
.dashboard-stat small,
.dashboard-stat strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat .stat-label {
  color: var(--muted-strong);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
}

.dashboard-stat strong {
  margin: 12px 0 8px;
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  line-height: 1.05;
  overflow-wrap: normal;
}

.dashboard-stat small {
  margin-top: auto;
  font-size: 0.72rem;
  line-height: 1.3;
}

.dashboard-stat .meter {
  height: 7px;
  margin-top: 1px;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #22d3ee);
  transition: width 220ms ease;
}

.small-meter {
  height: 7px;
  margin-top: 9px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr);
  gap: 22px;
  align-items: start;
}

.admin-users-layout {
  grid-template-columns: minmax(0, 1fr);
}

.record-list,
.breakdown-list {
  display: grid;
  gap: 12px;
}

.record-list {
  container-name: record-list;
  container-type: inline-size;
  min-width: 0;
}

.due-month-group {
  --month-border: rgba(14, 116, 144, 0.3);
  --month-surface: rgba(207, 250, 254, 0.32);
  display: grid;
  gap: 13px;
  min-width: 0;
  border: 2px solid var(--month-border);
  border-radius: 24px;
  padding: 14px;
  background: var(--month-surface);
}

.due-month-group.month-accent-0 {
  --month-border: rgba(16, 185, 129, 0.34);
  --month-surface: rgba(209, 250, 229, 0.36);
}

.due-month-group.month-accent-1 {
  --month-border: rgba(14, 116, 144, 0.32);
  --month-surface: rgba(207, 250, 254, 0.38);
}

.due-month-group.month-accent-2 {
  --month-border: rgba(217, 119, 6, 0.3);
  --month-surface: rgba(254, 243, 199, 0.36);
}

.due-month-group.month-accent-3 {
  --month-border: rgba(124, 58, 237, 0.26);
  --month-surface: rgba(237, 233, 254, 0.38);
}

.due-month-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 16px;
  padding: 2px 4px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.due-month-header:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
}

.due-month-header:disabled {
  cursor: default;
  opacity: 1;
}

.due-month-header > div {
  min-width: 0;
}

.due-month-header span,
.due-month-header small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.4;
}

.due-month-header span {
  text-transform: uppercase;
}

.due-month-header h4 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.2;
}

.due-month-header small {
  max-width: 52%;
  overflow-wrap: anywhere;
  text-align: right;
}

.due-month-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 58%;
}

.due-month-summary small {
  max-width: 100%;
}

.accordion-chevron {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted-strong);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 180ms ease;
}

[aria-expanded="true"] > .accordion-chevron,
[aria-expanded="true"] .accordion-chevron {
  transform: rotate(180deg);
}

.due-month-items {
  display: grid;
  gap: 10px;
}

.due-month-items[hidden],
.occurrence-card-details[hidden] {
  display: none;
}

.due-month-items .record-card {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.78);
}

.occurrence-card {
  display: block;
  padding: 0;
  overflow: hidden;
}

.occurrence-summary-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 13px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.occurrence-summary-button:hover {
  border-color: transparent;
  background: rgba(240, 253, 250, 0.52);
  box-shadow: none;
}

.occurrence-summary-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.occurrence-summary-copy .occurrence-name,
.occurrence-summary-meta,
.occurrence-summary-button .occurrence-amount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occurrence-summary-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.occurrence-summary-button .occurrence-amount {
  max-width: 150px;
  font-variant-numeric: tabular-nums;
}

.occurrence-card-details {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding: 13px;
  background: rgba(248, 250, 252, 0.66);
}

.occurrence-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.occurrence-facts > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-radius: 12px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.occurrence-facts dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.occurrence-facts dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occurrence-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.record-card,
.breakdown-item {
  display: grid;
  min-width: 0;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
}

.record-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.record-card:has(> .date-chip),
.record-card:has(> .category-chip),
.record-card:has(> .avatar) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.admin-household-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-workspace-heading {
  align-items: flex-start;
}

.admin-workspace-heading .muted-copy {
  max-width: 760px;
  margin-top: 7px;
}

.admin-workspace-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-workspace-summary article {
  --workspace-summary-accent: #0f766e;
  position: relative;
  display: grid;
  min-width: 0;
  gap: 4px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

.admin-workspace-summary article::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--workspace-summary-accent);
  content: "";
}

.admin-workspace-summary article.personal {
  --workspace-summary-accent: #2563eb;
}

.admin-workspace-summary article.household {
  --workspace-summary-accent: #0f9f84;
}

.admin-workspace-summary article.business {
  --workspace-summary-accent: #7c3aed;
}

.admin-workspace-summary article.paid {
  --workspace-summary-accent: #d97706;
}

.admin-workspace-summary span,
.admin-workspace-summary small {
  color: var(--muted);
}

.admin-workspace-summary span {
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-workspace-summary strong {
  overflow: hidden;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workspace-summary small {
  overflow: hidden;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workspace-directory {
  display: grid;
  gap: 20px;
}

.admin-workspace-tools {
  display: grid;
  grid-template-columns: minmax(250px, 0.85fr) minmax(0, 2.15fr);
  align-items: end;
  gap: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding-bottom: 18px;
}

.admin-workspace-search,
.admin-workspace-filters label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
}

.admin-workspace-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(115px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.admin-workspace-filters select,
.admin-workspace-search input,
#adminWorkspaceReset {
  width: 100%;
  min-width: 0;
}

.admin-workspace-directory-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-workspace-directory-heading h3,
.admin-workspace-directory-heading p {
  margin-bottom: 0;
}

.admin-workspace-list {
  display: grid;
  gap: 11px;
  min-width: 0;
  container-name: admin-workspace-list;
  container-type: inline-size;
}

.admin-workspace-row {
  --workspace-type-accent: #2563eb;
  position: relative;
  display: grid;
  grid-template-columns: minmax(210px, 1.3fr) minmax(190px, 1.05fr) minmax(170px, 0.9fr) minmax(165px, 0.9fr) minmax(125px, auto);
  align-items: center;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 15px 15px 15px 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.admin-workspace-row::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--workspace-type-accent);
  content: "";
}

.admin-workspace-row.workspace-type-household {
  --workspace-type-accent: #0f9f84;
}

.admin-workspace-row.workspace-type-business {
  --workspace-type-accent: #7c3aed;
}

.admin-workspace-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-workspace-identity > div,
.admin-workspace-owner,
.admin-workspace-plan,
.admin-workspace-usage,
.admin-workspace-row-action {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.admin-workspace-type-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: color-mix(in srgb, var(--workspace-type-accent) 13%, white);
  color: var(--workspace-type-accent);
  font-size: 0.9rem;
  font-weight: 900;
}

.admin-workspace-field-label {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-workspace-row strong,
.admin-workspace-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workspace-row strong {
  font-size: 0.88rem;
}

.admin-workspace-row small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.admin-workspace-row .badge-row {
  flex-wrap: nowrap;
  overflow: hidden;
  margin-top: 2px;
}

.admin-workspace-row .mini-badge {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workspace-meter {
  height: 6px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}

.admin-workspace-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--workspace-type-accent);
}

.admin-workspace-row-action {
  justify-items: end;
  text-align: right;
}

.admin-workspace-row-action button {
  white-space: nowrap;
}

@container admin-workspace-list (max-width: 1050px) {
  .admin-workspace-row {
    grid-template-columns: minmax(230px, 1.3fr) minmax(190px, 1fr) minmax(170px, 0.9fr);
  }

  .admin-workspace-usage {
    grid-column: 1 / 3;
  }

  .admin-workspace-row-action {
    grid-column: 3;
  }
}

@container admin-workspace-list (max-width: 680px) {
  .admin-workspace-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    padding: 15px;
  }

  .admin-workspace-owner,
  .admin-workspace-plan,
  .admin-workspace-usage {
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding-top: 11px;
  }

  .admin-workspace-usage,
  .admin-workspace-row-action {
    grid-column: 1;
  }

  .admin-workspace-row-action {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: stretch;
    text-align: left;
  }
}

.record-card > *,
.record-side > *,
.row-actions > * {
  min-width: 0;
  max-width: 100%;
}

.record-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.record-main span,
.record-main small,
.breakdown-item span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.record-main strong,
.record-side strong,
.breakdown-item strong {
  overflow-wrap: anywhere;
}

.record-side {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 9px;
  justify-items: end;
  text-align: right;
}

.record-side strong {
  font-variant-numeric: tabular-nums;
}

.record-side .row-actions {
  justify-content: flex-end;
  max-width: 100%;
}

#headsList .record-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

#headsList .record-side {
  grid-column: 1 / -1;
  width: 100%;
  justify-items: stretch;
  text-align: left;
}

#headsList .row-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  align-items: end;
  width: 100%;
}

#headsList .row-actions > button,
#headsList .inline-number-control {
  width: 100%;
}

#headsList .inline-number-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
}

@container record-list (max-width: 760px) {
  .record-card:not(.occurrence-card) {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .record-card:not(.occurrence-card):has(> .date-chip),
  .record-card:not(.occurrence-card):has(> .category-chip),
  .record-card:not(.occurrence-card):has(> .avatar) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .record-card:not(.occurrence-card) > .record-side {
    grid-column: 1 / -1;
    width: 100%;
    justify-items: stretch;
    text-align: left;
  }

  .record-card:not(.occurrence-card) > .record-side .row-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .record-card:not(.occurrence-card) > .record-side button {
    flex: 1 1 132px;
  }
}

.date-chip,
.category-chip,
.avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: rgba(207, 250, 254, 0.78);
  color: #0e7490;
  font-weight: 900;
}

.date-chip {
  gap: 2px;
}

.date-chip strong {
  font-size: 1.2rem;
  line-height: 1;
}

.date-chip span {
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.avatar {
  border-radius: 50%;
  color: white;
}

.breakdown-item {
  grid-template-columns: auto minmax(0, 1fr);
}

.workload-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
}

.workload-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.workload-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workload-identity strong,
.workload-identity span,
.workload-next span,
.workload-detail-row > div strong,
.workload-detail-row > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-identity span,
.workload-next span,
.workload-progress > span,
.workload-detail-row span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.workload-status .mini-badge {
  white-space: nowrap;
}

.workload-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workload-metrics > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border-radius: 14px;
  padding: 9px 10px;
  background: rgba(241, 245, 249, 0.72);
}

.workload-metrics span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-metrics strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.workload-progress .small-meter {
  margin-top: 0;
}

.workload-progress > span {
  white-space: nowrap;
}

.workload-next {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 10px;
}

.workload-next > strong {
  color: var(--muted-strong);
  font-size: 0.76rem;
}

.workload-actions {
  display: flex;
  justify-content: flex-end;
}

.workload-actions button,
.workload-detail-row button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.workload-details {
  display: grid;
  gap: 7px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 10px;
}

.workload-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-radius: 13px;
  padding: 8px;
  background: rgba(248, 250, 252, 0.82);
}

.workload-detail-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workload-detail-row > strong {
  max-width: 110px;
  overflow: hidden;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters input,
.filters select,
.compact-input {
  min-width: 180px;
}

.empty-ledger {
  display: grid;
  gap: 6px;
  margin: 0;
  border: 1px dashed rgba(14, 116, 144, 0.22);
  border-radius: 20px;
  padding: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

.empty-ledger strong {
  color: var(--ink);
}

.payment-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  overflow: auto;
  border-radius: 28px;
  padding: 24px;
}

.notification-dialog {
  width: min(720px, calc(100vw - 32px));
}

.notification-dialog .panel-heading {
  margin-bottom: 16px;
}

.notification-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.notification-button,
.notification-sidebar-button {
  position: relative;
}

.notification-sidebar-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  text-align: left;
}

.notification-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 999px;
  padding: 0 5px;
  background: var(--danger);
  color: white;
  font-size: 0.67rem;
  font-weight: 900;
  line-height: 1;
}

.notification-button .notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
}

.settings-content-grid {
  grid-template-columns: minmax(0, 1fr);
}

.payments-list-panel {
  margin-top: 22px;
}

.payment-item-dialog {
  width: min(760px, calc(100vw - 32px));
}

.invite-member-dialog {
  width: min(680px, calc(100vw - 32px));
}

.currency-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 14px;
}

.currency-picker legend {
  padding: 0 6px;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 800;
}

.currency-picker > small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.74rem;
}

.family-overview {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 0.55fr);
  align-items: center;
  gap: 24px;
  margin: 22px 0;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(209, 250, 229, 0.68), rgba(255, 255, 255, 0.68));
  box-shadow: var(--shadow-tight);
}

.family-overview-copy,
.family-overview-actions {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.family-overview-copy h3 {
  margin: 0;
  font-size: 1.4rem;
}

.family-overview-copy p,
.family-overview-actions small {
  margin: 0;
}

.family-overview-actions {
  justify-items: end;
  text-align: right;
}

.family-overview-actions small {
  max-width: 240px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.family-overview-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 8px;
}

.family-overview-stats > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-left: 1px solid rgba(15, 118, 110, 0.18);
  padding: 5px 14px;
}

.family-overview-stats strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.family-overview-stats span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.family-overview-actions .row-actions {
  justify-content: flex-end;
}

.subscription-history-panel {
  margin-top: 22px;
}

.admin-details-dialog {
  width: min(880px, calc(100vw - 32px));
}

.admin-details-shell,
.admin-details-body,
.admin-detail-section,
.admin-detail-stack {
  display: grid;
  gap: 14px;
}

.admin-details-body {
  margin-top: 18px;
}

.admin-detail-section {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.66);
}

.admin-detail-section h4 {
  margin: 0;
  font-size: 1.02rem;
}

.admin-detail-list {
  display: grid;
  margin: 0;
}

.admin-detail-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
  gap: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding: 11px 0;
}

.admin-detail-list > div:first-child {
  border-top: 0;
}

.admin-detail-list dt {
  color: var(--muted);
  font-weight: 750;
}

.admin-detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-radius: 16px;
  padding: 14px;
  background: rgba(241, 245, 249, 0.72);
}

.admin-detail-card > div,
.admin-detail-note {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-detail-card span,
.admin-detail-card small,
.admin-detail-note span {
  color: var(--muted);
  line-height: 1.45;
}

.admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.family-management-grid,
.family-roster-grid {
  display: grid;
  gap: 22px;
  align-items: start;
}

.family-management-grid {
  grid-template-columns: minmax(0, 1fr);
}

.family-roster-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.family-creation-notice {
  margin-bottom: 12px;
}

.family-management-grid.single-action {
  grid-template-columns: minmax(0, 1fr);
}

.family-management-grid.single-action .family-create-column {
  display: none;
}

.family-action-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.family-roster-grid {
  margin-top: 22px;
}

.compact-form-grid {
  align-items: end;
}

.report-topbar {
  align-items: flex-end;
  margin-bottom: 22px;
}

.report-filter-controls {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr);
  gap: 0.75rem;
  width: min(470px, 100%);
}

.report-workspace-control,
.report-month-control {
  min-width: 0;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.report-kpi {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.055);
}

.report-kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), #22d3ee);
  content: "";
}

.report-kpi span,
.report-kpi small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-kpi strong {
  display: block;
  margin: 9px 0 7px;
  overflow: hidden;
  font-size: clamp(1.05rem, 2vw, 1.6rem);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.report-history-panel {
  grid-column: 1 / -1;
}

.collection-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.collection-progress-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  place-content: center;
  width: 118px;
  height: 118px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--progress), rgba(148, 163, 184, 0.17) 0);
  text-align: center;
}

.collection-progress-ring::after {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #f8fffd;
  content: "";
}

.collection-progress-ring strong,
.collection-progress-ring span {
  position: relative;
  z-index: 1;
}

.collection-progress-ring strong {
  font-size: 1.45rem;
}

.collection-progress-ring span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.collection-progress-copy {
  min-width: 0;
}

.collection-progress-copy > strong {
  font-size: 1.05rem;
}

.collection-progress-copy p {
  margin: 6px 0 0;
}

.status-analysis-list,
.trend-list {
  display: grid;
  gap: 11px;
}

.status-analysis-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
}

.status-analysis-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.status-analysis-row small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: right;
}

.status-analysis-row.partial .meter span { background: #f59e0b; }
.status-analysis-row.overdue .meter span { background: #ef4444; }
.status-analysis-row.upcoming .meter span { background: #0ea5e9; }

.trend-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 42px 34px;
  align-items: center;
  gap: 9px;
  font-size: 0.76rem;
}

.trend-row > span,
.trend-row > strong {
  font-weight: 800;
}

.trend-row > small {
  color: var(--muted);
  text-align: right;
}

.report-context-list,
.account-details-list {
  margin: 0;
}

.report-context-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 15px 0;
}

.report-context-list > div:last-child {
  border-bottom: 0;
}

.report-context-list dt {
  color: var(--muted-strong);
  font-weight: 700;
}

.report-context-list dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
}

.account-details-panel {
  margin: 20px 0 24px;
  padding: 4px 2px 0;
}

.account-detail-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.38fr) minmax(0, 1fr);
  gap: 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding: 17px 2px;
}

.account-detail-row:first-child {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.account-detail-row dt {
  color: var(--muted);
  font-weight: 700;
}

.account-detail-row dd {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
  margin: 0;
}

.account-detail-row dd strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.account-detail-row dd small {
  color: var(--muted);
  line-height: 1.45;
}

.notification-deep-link-target {
  border-color: rgba(13, 148, 136, 0.72);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18), var(--shadow);
}

.paid-label {
  align-self: center;
  color: #047857;
  font-size: 0.82rem;
  font-weight: 800;
}

.file-field small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

input[type="file"] {
  min-height: 52px;
  padding: 8px;
}

.payment-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.92);
  color: white;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  padding: 0 13px;
}

.icon-button svg {
  display: block;
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-bar {
    position: sticky;
    top: 12px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 24px;
    padding: 12px;
  }

  .mobile-brand {
    min-width: 0;
  }

  .mobile-brand div {
    display: grid;
    min-width: 0;
  }

  .mobile-brand strong,
  .mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .mobile-actions {
    flex: 0 0 auto;
  }

  .app-nav {
    position: fixed;
    inset: 12px auto 12px 12px;
    z-index: 30;
    width: min(330px, calc(100vw - 24px));
    min-height: auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    transform: translateX(calc(-100% - 24px));
    transition: transform 220ms ease;
  }

  .drawer-open .app-nav {
    transform: translateX(0);
  }

  .drawer-open .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
  }

  .drawer-close {
    display: inline-flex;
  }

  .screen-panel {
    grid-column: 1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .family-overview {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .family-overview-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
  }

  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-workspace-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-workspace-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 12px;
  }

  .auth-panel,
  .setup-panel,
  .screen-panel,
  .tool-panel,
  .ledger-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .topbar,
  .panel-heading.inline {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-workspace-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-workspace-summary article {
    padding: 13px;
  }

  .admin-workspace-summary article.paid {
    grid-column: 1 / -1;
  }

  .admin-workspace-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminWorkspaceReset {
    grid-column: 1 / -1;
  }

  .admin-workspace-directory-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .family-management-grid,
  .family-roster-grid,
  .report-analysis-grid {
    grid-template-columns: 1fr;
  }

  .family-overview {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 17px;
  }

  .family-overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .family-overview-stats > div:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .family-overview-actions {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .family-overview-actions button {
    width: 100%;
  }

  .family-overview-actions .row-actions,
  .admin-detail-card {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .admin-detail-list > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .admin-detail-card button,
  .admin-detail-actions button {
    width: 100%;
  }

  .report-history-panel {
    grid-column: auto;
  }

  .report-topbar {
    align-items: stretch;
  }

  .report-filter-controls {
    width: 100%;
  }

  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .report-kpi {
    padding: 13px;
  }

  .report-kpi strong {
    font-size: clamp(0.92rem, 4.2vw, 1.18rem);
  }

  .report-kpi span,
  .report-kpi small {
    font-size: 0.66rem;
  }

  .collection-progress {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .account-detail-row {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 14px 2px;
  }

  .record-card,
  .admin-household-card,
  .notification-card {
    grid-template-columns: 1fr;
  }

  .record-side {
    justify-items: stretch;
    text-align: left;
  }

  .record-side .row-actions,
  .topbar-actions,
  .filters {
    width: 100%;
  }

  #headsList .row-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .row-actions button,
  .topbar-actions button,
  .filters input,
  .filters select,
  .button-row button {
    flex: 1 1 160px;
  }

  .stat-card strong {
    font-size: clamp(1.35rem, 9vw, 2.1rem);
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
  }

  .dashboard-stats-grid .dashboard-stat {
    min-height: 112px;
    border-radius: 18px;
    padding: 12px;
  }

  .dashboard-stats-grid .stat-label,
  .dashboard-stats-grid .stat-card small,
  .dashboard-stats-grid .stat-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-stats-grid .stat-label,
  .dashboard-stats-grid .stat-card small {
    font-size: clamp(0.62rem, 2.7vw, 0.7rem);
  }

  .dashboard-stats-grid .stat-card strong {
    margin: 9px 0 7px;
    font-size: clamp(1rem, 5.4vw, 1.28rem);
    line-height: 1.05;
    overflow-wrap: normal;
  }

  .dashboard-stats-grid .meter {
    height: 6px;
  }

  .notification-dialog {
    padding: 18px;
  }

  .due-month-group {
    border-radius: 20px;
    padding: 11px;
  }

  .due-month-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .due-month-header small {
    max-width: 100%;
    text-align: left;
  }

  .due-month-summary {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
  }

  .due-month-header span,
  .due-month-header h4,
  .due-month-header small {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .due-month-items .record-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
    border-radius: 17px;
    padding: 10px;
  }

  .due-month-items .occurrence-card {
    display: block;
    padding: 0;
  }

  .occurrence-summary-button {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px;
  }

  .occurrence-summary-button > .accordion-chevron {
    grid-column: 3;
    grid-row: 2;
    width: 20px;
    height: 20px;
  }

  .occurrence-summary-button .occurrence-amount {
    grid-column: 3;
    grid-row: 1;
    max-width: 105px;
    font-size: clamp(0.72rem, 3.3vw, 0.88rem);
    text-align: right;
  }

  .occurrence-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .occurrence-detail-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .occurrence-detail-footer .row-actions {
    width: 100%;
  }

  .occurrence-detail-footer .row-actions button {
    flex: 1 1 120px;
  }

  .currency-picker {
    grid-template-columns: 1fr;
  }

  .currency-picker > small {
    grid-column: auto;
  }

  .due-month-items .date-chip {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .due-month-items .record-main {
    gap: 3px;
  }

  .due-month-items .occurrence-name,
  .due-month-items .occurrence-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .due-month-items .occurrence-name {
    font-size: 0.88rem;
  }

  .due-month-items .occurrence-meta {
    font-size: 0.72rem;
  }

  .due-month-items .badge-row {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .due-month-items .badge-row::-webkit-scrollbar {
    display: none;
  }

  .due-month-items .badge-row .mini-badge {
    flex: 0 0 auto;
    min-height: 24px;
    font-size: 0.66rem;
    white-space: nowrap;
  }

  .due-month-items .record-side {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
  }

  .due-month-items .occurrence-amount {
    flex: 0 1 42%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .due-month-items .row-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: auto;
  }

  .due-month-items .row-actions button {
    flex: 0 1 auto;
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .due-month-items .row-actions button[data-edit-obligation] {
    display: none;
  }

  .due-month-header .accordion-chevron {
    width: 26px;
  }

  .due-month-items .occurrence-detail-footer .row-actions {
    flex: 1 1 auto;
    width: 100%;
  }

  .due-month-items .occurrence-detail-footer .row-actions button {
    display: inline-flex;
    flex: 1 1 120px;
  }

  .workload-card {
    gap: 10px;
    border-radius: 18px;
    padding: 11px;
  }

  .workload-header {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .workload-header .avatar {
    width: 40px;
    height: 40px;
    font-size: 0.78rem;
  }

  .workload-identity strong {
    font-size: 0.85rem;
  }

  .workload-identity span,
  .workload-next span,
  .workload-progress > span {
    font-size: 0.68rem;
  }

  .workload-status .mini-badge {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.64rem;
  }

  .workload-metrics {
    gap: 6px;
  }

  .workload-metrics > div {
    padding: 7px 8px;
  }

  .workload-metrics strong {
    font-size: 0.82rem;
  }

  .workload-progress {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .workload-detail-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .workload-detail-row button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 360px) {
  .dashboard-stats-grid {
    gap: 7px;
  }

  .dashboard-stats-grid .stat-card {
    min-height: 106px;
    padding: 9px;
  }

  .dashboard-stats-grid .stat-label,
  .dashboard-stats-grid .stat-card small {
    font-size: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* Workspace subscriptions */
.subscription-topbar,
.subscription-review-panel { margin-bottom: 1.25rem; }

.subscription-details-panel {
  margin-bottom: 1.25rem;
  border-top: 1px solid rgba(100, 116, 139, 0.22);
}

.plan-card,
.invoice-summary {
  border: 1px solid rgba(15, 118, 110, 0.17);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 22px;
}

.subscription-details-list {
  margin: 0;
}

.subscription-details-list > div {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
  padding: 1rem 0.2rem;
}

.subscription-details-list dt {
  color: var(--muted);
  font-weight: 700;
}

.subscription-details-list dd {
  display: grid;
  justify-items: start;
  gap: 0.25rem;
  min-width: 0;
  margin: 0;
}

.subscription-details-list strong {
  max-width: 100%;
  color: var(--ink);
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.subscription-details-list small,
.plan-card p,
.plan-price-list span { color: var(--muted); }

.subscription-details-list small {
  line-height: 1.45;
}

.plan-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 1rem;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  padding: 1.15rem;
}

.plan-card.current {
  border-color: rgba(16, 185, 129, 0.62);
  background: linear-gradient(145deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.94));
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.13);
}

.plan-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.plan-card h4 { margin: 0; color: var(--ink); font-size: 1.2rem; }
.plan-card p { min-height: 3.4em; margin: 0; line-height: 1.55; }
.plan-card dl, .plan-price-list { display: grid; gap: 0.55rem; margin: 0; }

.plan-card dl div,
.plan-price-list div,
.invoice-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.plan-card dt { color: var(--muted); }
.plan-card dd { margin: 0; color: var(--ink); font-weight: 800; text-align: right; }
.plan-card button { margin-top: auto; }

#workspacePlanList {
  container-name: workspace-plan-list;
  container-type: inline-size;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid rgba(100, 116, 139, 0.22);
}

#workspacePlanList .plan-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1fr) minmax(180px, 0.48fr) auto;
  align-items: center;
  gap: 1.25rem;
  border: 0;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 0;
  padding: 1.1rem 0.2rem;
  background: transparent;
  box-shadow: none;
}

#workspacePlanList .plan-card.current {
  border-color: rgba(16, 185, 129, 0.32);
  background: linear-gradient(90deg, rgba(236, 253, 245, 0.72), transparent);
  box-shadow: none;
}

#workspacePlanList .plan-card-heading {
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
}

#workspacePlanList .plan-card p {
  min-height: 0;
}

#workspacePlanList .plan-card dl {
  min-width: 0;
}

#workspacePlanList .plan-card button {
  width: min(170px, 100%);
  margin: 0;
}

#workspacePlanList .plan-availability-note {
  display: block;
  max-width: 180px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

@container workspace-plan-list (max-width: 820px) {
  #workspacePlanList .plan-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.85rem;
  }

  #workspacePlanList .plan-card-heading {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  #workspacePlanList .plan-card button {
    width: 100%;
  }
}

.subscription-history-grid, .subscription-admin-grid { margin-top: 1.25rem; }
.subscription-review-card .record-side { min-width: min(100%, 290px); }
.renewal-dialog { width: min(760px, calc(100vw - 2rem)); }

.invoice-summary { display: grid; gap: 0.65rem; padding: 1rem; }
.invoice-summary .invoice-total {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(100, 116, 139, 0.22);
  color: var(--ink);
  font-size: 1.08rem;
}

.locked-feature-panel {
  max-width: 720px;
  margin: 2rem auto;
  padding: clamp(1.25rem, 4vw, 2.4rem);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.94));
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.09);
  text-align: center;
}

.locked-feature-panel h3 { margin: 0.35rem 0 0.75rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.locked-feature-panel p:not(.eyebrow) { max-width: 58ch; margin: 0 auto 1.15rem; color: var(--muted); line-height: 1.6; }

@media (max-width: 560px) {
  .report-filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .subscription-details-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
    padding: 0.9rem 0;
  }

  .subscription-details-list small { font-size: 0.75rem; }
  .plan-card { border-radius: 18px; }
  .plan-card p { min-height: 0; }
  .subscription-review-card .record-side { min-width: 0; }
}

/* Multi-currency settings, reporting, and Admin Finance */
.exchange-rate-panel,
.currency-settings-panel {
  margin-bottom: 1.25rem;
}

.exchange-rate-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 1rem 0 1.25rem;
  border-block: 1px solid rgba(100, 116, 139, 0.18);
}

.exchange-rate-status-grid > div {
  min-width: 0;
  padding: 0.9rem;
  border-bottom: 1px solid rgba(100, 116, 139, 0.12);
}

.exchange-rate-status-grid dt,
.exchange-rate-status-grid dd {
  margin: 0;
}

.exchange-rate-status-grid dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.exchange-rate-status-grid dd {
  margin-top: 0.3rem;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.currency-settings-form select[multiple] {
  min-height: 10rem;
  padding: 0.55rem;
}

.currency-settings-form select[multiple] option {
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
}

.admin-finance-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.15rem;
}

.currency-rate-copy,
.finance-currency-summary,
.report-rate-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 16px;
  background: rgba(240, 253, 250, 0.72);
  color: var(--muted);
}

.finance-currency-summary strong,
.report-rate-panel strong {
  color: var(--ink);
}

.report-rate-panel > div:first-child {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.report-rate-panel[data-level="warning"],
.notice[data-level="warning"] {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(255, 251, 235, 0.9);
}

.report-rate-panel[data-level="danger"],
.report-rate-panel[data-level="missing"],
.notice[data-level="danger"],
.notice[data-level="missing"] {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(254, 242, 242, 0.9);
}

@media (max-width: 760px) {
  .admin-finance-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .exchange-rate-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-rate-panel,
  .finance-currency-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .report-rate-panel .button-row,
  .report-rate-panel button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .admin-finance-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .exchange-rate-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  body[data-print-view] .app-sidebar,
  body[data-print-view] .mobile-topbar,
  body[data-print-view] button,
  body[data-print-view] dialog,
  body[data-print-view] .toast,
  body[data-print-view] .report-filter-controls {
    display: none !important;
  }

  body[data-print-view] .app-shell,
  body[data-print-view] .app-content,
  body[data-print-view] .screen-panel {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body[data-print-view="reports"] [data-family-panel]:not([data-family-panel="reports"]),
  body[data-print-view="admin-finance"] [data-admin-panel]:not([data-admin-panel="finance"]) {
    display: none !important;
  }
}
