:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eff3f2;
  --ink: #17211d;
  --muted: #69736f;
  --line: #d8dedb;
  --accent: #087f6f;
  --accent-dark: #065f54;
  --accent-soft: #dcefeb;
  --warning: #a95512;
  --danger: #b3261e;
  --shadow: 0 16px 40px rgba(23, 33, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1380px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.login-screen .auth-panel { width: min(440px, 100%); min-width: 0; padding: 32px; }
.login-screen .auth-form { min-width: 0; }
.login-screen .form-row { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.login-screen .form-row button { max-width: 100%; white-space: normal; }
.login-screen .auth-form { grid-template-columns: 1fr; gap: 20px; }
.login-logo { display: block; width: min(200px, 100%); height: auto; object-fit: contain; margin: 0 auto 4px; }
.sidebar-logo { display: block; width: min(132px, 100%); height: auto; object-fit: contain; margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.login-screen h1 { font-size: 25px; line-height: 1.25; }
#loginStatus { color: var(--muted); line-height: 1.5; }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 24px 12px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 8px 24px; font-size: 15px; }
.brand svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.sidebar nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 14px; color: var(--muted); }
.sidebar nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav button:hover { background: #f1f4f6; }
.sidebar nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.nav-divider { border-top: 1px solid var(--line); margin: 16px 8px; }
.nav-group { margin: 16px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.module-group + .module-group { margin-top: 28px; }
.module-group h2 { margin: 0 0 12px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.workspace { min-width: 0; padding: 28px; }
.household-picker { max-width: 320px; margin-bottom: 24px; }
.module-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.module-tile { display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 18px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 15px; font-weight: 700; }
.module-tile:hover { border-color: var(--accent); }
.module-tile svg { width: 24px; height: 24px; flex-shrink: 0; color: var(--accent); }
.module-tile:nth-child(3n+2) svg { color: #a04466; }
.module-tile:nth-child(3n) svg { color: #3275a5; }
.profile-form { max-width: 560px; display: grid; gap: 20px; }
#catalogForm { margin: 20px 0; }
#catalogForm input[type="checkbox"] { width: 20px; height: 20px; min-height: 20px; padding: 0; accent-color: var(--accent); }
.view-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.view-tabs button { display: inline-flex; gap: 8px; align-items: center; padding: 12px 8px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; }
.view-tabs button[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--accent); }
.view-tabs svg { width: 18px; height: 18px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
th,td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
th { font-size: 12px; color: var(--muted); background: var(--surface-2); }
td select { min-width: 135px; font-size: 13px; }
.allow-user-form { display: grid; grid-template-columns: minmax(0,1fr) 170px auto; align-items: end; gap: 12px; margin-bottom: 24px; }
.user-search { max-width: 360px; }
.empty-state { padding: 24px 0; color: var(--muted); }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 2rem, 2.2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.05rem;
}

.actions,
.form-row,
.quick-capture {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-button,
.secondary-button,
.capture-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.icon-button {
  width: 44px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.capture-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 16px;
  margin-bottom: 16px;
}

.auth-panel.hidden {
  display: none;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.movement-form {
  display: grid;
  gap: 18px;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 1px 2px rgba(23, 33, 29, 0.08);
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 112px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 111, 0.16);
}

.amount-field input {
  font-size: 1.4rem;
  font-weight: 800;
}

.full-width {
  width: 100%;
}

.quick-capture {
  flex-wrap: wrap;
}

.capture-button {
  flex: 1 1 120px;
  background: var(--accent-soft);
  border-color: #b9dcd5;
  color: var(--accent-dark);
  font-weight: 800;
}

.primary-button,
.secondary-button {
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.footer-actions {
  justify-content: flex-end;
}

.recent {
  margin-top: 16px;
  padding: 16px 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

#recentCount {
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

#recentList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-title {
  color: var(--ink);
  font-weight: 800;
}

.recent-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

.recent-amount {
  text-align: right;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(120px);
  max-width: min(480px, calc(100vw - 32px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

/* Friendly layer: summary, feeds, recurrence cards, sheet and mobile navigation */
.summary-hero { background: linear-gradient(135deg, var(--accent) 0%, #0a9a86 100%); color: white; border-radius: 18px; padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow); }
.summary-hero .eyebrow { color: rgba(255,255,255,.85); text-transform: none; letter-spacing: 0; font-size: 14px; margin: 0 0 14px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.summary-card { background: rgba(255,255,255,.14); border-radius: 14px; padding: 14px; display: grid; gap: 4px; min-width: 0; }
.summary-card span { font-size: 13px; opacity: .9; }
.summary-card strong { font-size: 20px; overflow-wrap: anywhere; }
.summary-card small { font-size: 12px; opacity: .85; }
.summary-card.is-late { background: rgba(255, 214, 196, .24); }
.home-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.panel + .panel, .recurrence-list + .panel { margin-top: 18px; }
.panel .section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel h2 { font-size: 16px; margin: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item[data-page] { cursor: pointer; }
.feed-main, .recurrence-main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.feed-main strong, .recurrence-main strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-main span, .recurrence-main span { font-size: 13px; color: var(--muted); }
.feed-side, .recurrence-side { display: grid; justify-items: end; gap: 4px; text-align: right; flex-shrink: 0; }
.feed-side strong, .recurrence-side strong { font-size: 15px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: white; flex-shrink: 0; }
.avatar svg { width: 18px; height: 18px; }
.tone-0 { background: #087f6f; } .tone-1 { background: #a04466; } .tone-2 { background: #3275a5; }
.tone-3 { background: #b06a12; } .tone-4 { background: #6a55a8; } .tone-5 { background: #4f7a2b; }
.movement-out { background: #fdebe7; color: var(--danger); } .movement-in { background: var(--accent-soft); color: var(--accent-dark); }
.movement-neutral { background: var(--surface-2); color: var(--muted); }
.amount-out { color: var(--danger); } .amount-in { color: var(--accent-dark); }
.is-overdue { color: var(--danger) !important; font-weight: 600; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.chip-active, .chip-paid { background: var(--accent-soft); color: var(--accent-dark); }
.chip-pending, .chip-partial, .chip-review { background: #fff2dc; color: var(--warning); }
.chip-overdue { background: #fdebe7; color: var(--danger); }
.chip-paused, .chip-ended, .chip-cancelled, .chip-archived { background: var(--surface-2); color: var(--muted); }
.empty-state { color: var(--muted); padding: 18px 4px; text-align: center; list-style: none; }
.link-button { border: 0; background: transparent; color: var(--accent-dark); font-weight: 600; padding: 4px 0; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search-field { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; }
.search-field svg { width: 18px; height: 18px; color: var(--muted); }
.search-field input { border: 0; outline: 0; background: transparent; min-height: 44px; width: 100%; padding: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip-row button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--ink); }
.chip-row button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.count-badge { margin-left: auto; color: var(--muted); font-size: 13px; }
.recurrence-list { display: grid; gap: 10px; }
.recurrence-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.recurrence-card:hover, .recurrence-card:focus-visible { border-color: var(--accent); box-shadow: 0 6px 18px rgba(8,127,111,.12); outline: none; }
.recurrence-card.is-archived { opacity: .7; }
.due-line { font-weight: 600; color: var(--accent-dark) !important; }
.secondary-button.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.generate-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 6px 0 4px; }
.generate-row label { max-width: 200px; }
.danger-button { min-height: 44px; border: 1px solid #f1c9c4; border-radius: 8px; background: var(--surface); color: var(--danger); display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 600; }
.danger-button svg { width: 18px; height: 18px; }
.sheet { border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgba(23,33,29,.25); }
.sheet::backdrop { background: rgba(23, 33, 29, .45); }
.sheet-form { display: grid; gap: 14px; padding: 20px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; }
.sheet-header h2 { margin: 0; font-size: 19px; }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; position: sticky; bottom: 0; background: inherit; padding-top: 8px; }
.sheet-actions .primary-button { flex: 1; max-width: 220px; margin-left: auto; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.fab { position: fixed; right: 28px; bottom: 28px; z-index: 20; min-height: 56px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent); color: white; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 12px 28px rgba(8,127,111,.35); }
.fab svg { width: 22px; height: 22px; }
.fab:hover { background: var(--accent-dark); }
.bottom-nav { display: none; }

.notice { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.notice > svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.notice > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
.notice span { font-size: 13px; color: var(--muted); }
.notice-warning { background: #fff7ea; border-color: #f2d6a8; }
.notice-warning > svg { color: var(--warning); }
.small-button { min-height: 36px; padding: 0 14px; }
.pay-button { border: 1px solid var(--accent); background: var(--surface); color: var(--accent-dark); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.pay-button svg { width: 14px; height: 14px; }
.pay-button:hover { background: var(--accent-soft); }
.status-select { min-height: 30px; width: auto; padding: 2px 26px 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid transparent; background-color: var(--surface-2); color: var(--muted); }
.status-pending { background-color: #fff2dc; color: var(--warning); }
.status-overdue { background-color: #fdebe7; color: var(--danger); }
.status-paid { background-color: var(--accent-soft); color: var(--accent-dark); }
.status-standby { background-color: #e8eef7; color: #3a5a8c; }
.status-cancelled { background-color: var(--surface-2); color: var(--muted); }
.chip-standby { background: #e8eef7; color: #3a5a8c; }
.sheet-small { width: min(440px, calc(100% - 32px)); }

.page-description { margin: 6px 0 0; max-width: 640px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.toolbar-end { justify-content: flex-end; }
.feed-item.is-void { opacity: .6; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
#movementDialog .movement-form { border: 0; box-shadow: none; }

.annual-panel { margin-top: 18px; }
.annual-panel .hint { margin: 0 0 8px; }
.annual-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.annual-table th, .annual-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.annual-table td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.annual-table .num { text-align: right; white-space: nowrap; }
.annual-table tfoot td { border-bottom: 0; font-weight: 700; }
.annual-table tr.is-expired td { color: var(--muted); }
.annual-table .link-button { padding: 0; text-align: left; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions .icon-button { width: 34px; height: 34px; min-height: 34px; }

.heading-group { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.heading-group .count-badge { margin-left: 0; }

input[readonly] { background: var(--surface-2); color: var(--muted); cursor: default; }

.stacked-actions { flex-direction: column; align-items: stretch; }
.stacked-actions > button { width: 100%; justify-content: center; max-width: none; margin: 0; }

.eff { font-weight: 700; white-space: nowrap; }
.eff-ok, input.eff-ok { color: #1f7a3a; }
.eff-warning, input.eff-warning { color: #b8610a; }
.eff-alert, input.eff-alert { color: var(--danger); }

#moduleData td { white-space: nowrap; }
#moduleData th { white-space: normal; min-width: 72px; }

.evidence-section { display: grid; gap: 8px; }
.field-title { margin: 0; font-weight: 600; font-size: 14px; }
.evidence-section .quick-capture { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.evidence-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.evidence-list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.evidence-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evidence-list svg { width: 16px; height: 16px; flex-shrink: 0; }
.evidence-list .icon-button { width: 30px; height: 30px; min-height: 30px; }

.feed-item.is-clickable { cursor: pointer; border-radius: 10px; }
.feed-item.is-clickable:hover, .feed-item.is-clickable:focus-visible { background: var(--surface-2); outline: none; }
.row-link { border: 0; background: transparent; padding: 0; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.row-link:hover, .row-link:focus-visible { text-decoration: underline; outline: none; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }
.filters summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary svg { width: 18px; height: 18px; }
.filters[open] summary { margin-bottom: 10px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.filter-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filter-grid label, .user-create-grid label { display: grid; gap: 6px; font-size: 13px; min-width: 0; }
/* Same box for every filter: dates, text and selects line up in width and height. */
.filter-grid input, .filter-grid select, .user-create-grid input, .user-create-grid select { width: 100%; height: 44px; min-height: 44px; margin: 0; padding: 0 12px; font-size: 14px; line-height: 1.2; -webkit-appearance: none; appearance: none; }
.filter-grid select, .user-create-grid select { padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.filter-inline { margin-bottom: 12px; }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.sheet-wide { width: min(860px, calc(100% - 32px)); }
.filter-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.generate-box { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; margin: 4px 0 12px; }
.generate-box .hint { margin-top: 6px; }
.inline-icon { width: 14px; height: 14px; vertical-align: -2px; }
.feed-item.is-clickable .status-select { cursor: pointer; }

.period-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.period-list label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.period-list input { width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--accent); }
.period-list .period-name { flex: 1; font-weight: 600; }
.period-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.toolbar-end { gap: 10px; flex-wrap: wrap; }

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

  .sidebar { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav button { border: 0; background: transparent; display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav button[aria-current="page"] { color: var(--accent-dark); font-weight: 700; }
  .fab { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 0; width: 56px; justify-content: center; }
  .fab span { display: none; }
  .summary-hero { padding: 18px; border-radius: 16px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card.is-paid { grid-column: 1 / -1; }
  .home-columns { grid-template-columns: 1fr; }
  .recurrence-card { padding: 12px; gap: 10px; }
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .sheet-form { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .filter-grid-3, .filter-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar nav { display: flex; overflow-x: auto; gap: 4px; }
  .sidebar nav button { width: auto; white-space: nowrap; }
  #moduleNav { display: flex; }
  .nav-divider, .nav-group { display: none; }
  .brand { padding-bottom: 12px; }
  .workspace { padding: 20px 16px 104px; }
  .module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .module-tile { flex-direction: column; align-items: flex-start; gap: 10px; min-height: 116px; font-size: 14px; }
  .allow-user-form { grid-template-columns: 1fr; }

  .topbar {
    align-items: flex-start;
  }

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

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

  .footer-actions {
    justify-content: stretch;
  }

  .footer-actions button {
    flex: 1;
  }
}
.detail-list .inline-action { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 0; font-size: 0.9em; }
.detail-list .inline-action svg { width: 14px; height: 14px; }
/* Gastos compartidos */
.split-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.split-nav { padding: 10px; }
.split-nav button[data-split-kind] { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-left: 4px solid transparent; border-radius: 6px; background: transparent; text-align: left; font-size: 15px; color: var(--ink); }
.split-nav button[data-split-kind] svg { width: 16px; height: 16px; color: var(--muted); }
.split-nav button[aria-current="page"] { border-left-color: var(--accent); color: var(--accent-dark); font-weight: 700; background: var(--accent-soft); }
.split-all { font-weight: 600; }
.split-nav-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 4px 4px; padding: 4px 6px; background: var(--surface-2); border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.split-nav-head .link-button { font-size: 12px; text-transform: none; letter-spacing: 0; padding: 0; }
.split-nav-list { list-style: none; margin: 0; padding: 0; }
.split-nav-list .hint { padding: 6px 10px; }
.split-heading > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.split-main h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.split-totals { display: flex; gap: 24px; flex-wrap: wrap; padding: 10px 0; }
.split-totals div { display: grid; gap: 2px; }
.split-totals strong { font-size: 20px; }
.split-balance-list, .split-activity, .split-member-list { list-style: none; margin: 0; padding: 0; }
.split-balance-list li, .split-member-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.split-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.split-item > div { display: grid; gap: 2px; min-width: 0; }
.split-item > svg { color: var(--muted); }
.split-amount { font-weight: 600; text-align: right; white-space: nowrap; }
.split-owed { color: var(--accent-dark); font-weight: 600; }
.split-owes { color: var(--danger); font-weight: 600; }
.split-settled { color: var(--muted); }
.split-fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.split-fieldset legend { font-weight: 600; padding: 0 4px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check-row input { width: auto; }
@media (max-width: 760px) {
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .split-main .toolbar { flex-wrap: wrap; }
  .split-main .toolbar button { flex: 1 1 auto; }
  .split-item { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .split-item .split-amount { grid-column: 2; text-align: left; }
}
/* Administración de usuarios */
.users-heading { align-items: flex-start; gap: 12px; }
.users-heading h2 { display: flex; align-items: center; gap: 8px; }
.users-heading h2 svg { color: var(--danger); }
.users-heading p { margin: 4px 0 0; }
.user-create-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr .9fr 1fr 1fr; gap: 10px; align-items: end; margin-top: 14px; }
.user-create-actions { grid-column: 1 / -1; }
.users-subhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.users-subhead h3, #usersOnlinePanel h3, #sessionsPanel h3 { margin: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.users-subhead input { max-width: 260px; }
.user-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.user-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.user-card > div:first-child { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.user-card-pending { border-color: #f2d6a8; background: #fffaf0; }
.user-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip-user-active { background: var(--accent-soft); color: var(--accent-dark); }
.chip-user-pending { background: #fff2dc; color: var(--warning); }
.chip-user-suspended { background: #fdebe7; color: var(--danger); }
.online-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22a55b; margin-right: 6px; vertical-align: middle; }
.sessions-table td { vertical-align: top; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#passwordForm .hint { margin: 0; }
@media (max-width: 1100px) { .user-create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .user-cards, .form-grid-3, .user-create-grid { grid-template-columns: minmax(0, 1fr); }
  .user-card { flex-direction: column; align-items: stretch; }
  .user-card-actions { justify-content: flex-start; }
}
#userEditTitle, .users-heading .link-button { display: inline-flex; align-items: center; gap: 8px; }
.users-heading-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
#createUserTitle { display: inline-flex; align-items: center; gap: 8px; }
.signup-fields { display: grid; gap: 12px; }
.signup-fields .hint { margin: 0; }
.signup-fields .link-button { justify-self: start; }
/* Perfil y Configuración */
.avatar-button { border: 0; background: transparent; padding: 0; border-radius: 50%; cursor: pointer; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 15px; border: 2px solid white; box-shadow: 0 0 0 1px var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-large { width: 72px; height: 72px; font-size: 24px; }
.avatar-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.profile-hero { display: flex; align-items: center; gap: 14px; }
.profile-hero > div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.profile-hero strong { font-size: 18px; }
.profile-photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; margin-bottom: 4px; font-size: 13px; }
.back-link svg { width: 16px; height: 16px; }
.tile-text { display: grid; gap: 4px; }
.module-tile .hint { font-weight: 400; font-size: 12px; text-align: left; }
.form-grid-3 .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid-3 .span-2 { grid-column: auto; } }
/* Métodos de división */
.split-methods { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; justify-self: start; }
.split-methods button { min-width: 48px; height: 38px; border: 0; border-right: 1px solid var(--line); background: var(--surface); font-weight: 700; color: var(--ink); display: inline-grid; place-items: center; }
.split-methods button:last-child { border-right: 0; }
.split-methods button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-dark); }
.split-methods svg { width: 18px; height: 18px; }
.split-method-title { margin: 4px 0 0; font-size: 16px; }
.split-member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.split-member-row .hint { grid-column: 1 / -1; font-weight: 400; }
.check-row.split-member-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.check-row.split-member-row .hint { grid-column: auto; }
.split-input { display: inline-flex; align-items: center; gap: 6px; }
.split-input input { width: 120px; text-align: right; }
.split-input span { color: var(--muted); font-weight: 400; min-width: 42px; }
.split-items { width: 100%; border-collapse: collapse; }
.split-items th, .split-items td { padding: 4px; text-align: left; font-size: 13px; }
.split-items td input:not([type="checkbox"]) { width: 100%; min-width: 90px; }
.split-item-check { text-align: center; }
.split-total { margin: 0; font-weight: 600; }
.split-item-check label { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 400; }
.split-item-check input[type="checkbox"], .split-member-row input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; }
.split-modes { display: grid; gap: 6px; justify-items: center; }
.split-modes button { width: min(100%, 320px); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: var(--surface-2); color: var(--ink); font-size: 14px; }
.split-modes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.split-method-box { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.occurrence-edit { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.occurrence-edit .hint { margin: 0; }
/* Brand slogan: geometric corporate face available on the device (no web font download), brand green. */
.brand-slogan { margin: 0 0 16px; text-align: center; font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); }
.brand .brand-slogan { margin: 0; font-size: 10.5px; letter-spacing: .06em; }
.brand-description { text-align: center; font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-weight: 400; color: var(--brand-text, #111); }
.auth-panel .signup-hint { margin: -6px 0 18px; }
.login-status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.login-status-row #loginStatus { margin: 0; }
.login-status-row .link-button { padding: 0; font-size: 13px; }
/* Always leave room between the login texts (status, hints) and the first field below them. */
.login-status-row { margin-bottom: 16px; }
.login-screen #mfaPanel, .login-screen #passwordForm { margin-top: 16px; }
/* Soportes de vencimientos y gastos compartidos */
.capture-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.evidence-files { display: grid; gap: 6px; }
.evidence-file { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-start; text-align: left; overflow-wrap: anywhere; }
.evidence-file svg { width: 16px; height: 16px; flex-shrink: 0; }
.split-item .evidence-count { position: relative; }
.split-item .evidence-count span { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: white; font-size: 10px; line-height: 16px; text-align: center; padding: 0 3px; }
.split-item { grid-template-columns: 24px minmax(0, 1fr) auto auto auto; }
@media (max-width: 760px) { .split-item { grid-template-columns: 20px minmax(0, 1fr) auto auto; } }
.list-total { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); text-align: right; font-weight: 700; font-size: 15px; }
/* Inicio: summary cards are buttons that open the matching records */
button.summary-card { border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .2s ease; }
button.summary-card:hover { transform: translateY(-1px); }
button.summary-card:active { transform: scale(.98); }
button.summary-card:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.summary-card.is-soon { grid-column: 1 / -1; background: rgba(255, 236, 200, .20); }
.summary-card.is-soon span { display: inline-flex; align-items: center; gap: 6px; }
.summary-card.is-soon svg { width: 15px; height: 15px; }

/* ---------- Inicio: alignment and Análisis ---------- */
/* Both home cards start at the same height (the generic .panel + .panel gap does not apply side by side) */
.home-columns { align-items: start; }
.home-columns > .panel + .panel { margin-top: 0; }
.home-columns + .panel { margin-top: 18px; }

/* Chart roles (validated categorical slots 1-2 + recessive chrome), light and dark */
:root { --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-grid: #e1e0d9; --viz-base: #c3c2b7; --viz-muted: #6f6d67; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --viz-s1: #3987e5; --viz-s2: #d95926; --viz-grid: #2c3531; --viz-base: #3d4843; --viz-muted: #9aa39f; }
}
:root[data-theme="dark"] { --viz-s1: #3987e5; --viz-s2: #d95926; --viz-grid: #2c3531; --viz-base: #3d4843; --viz-muted: #9aa39f; }

.analytics-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 6px 0 16px; }
.multi-field { display: grid; gap: 6px; font-size: 13px; min-width: 0; position: relative; }
.multi-label { color: var(--muted); font-weight: 700; font-size: 0.88rem; }
.multi-select summary { list-style: none; cursor: pointer; height: 44px; display: flex; align-items: center; padding: 0 34px 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-control, 8px); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select summary::-webkit-details-marker { display: none; }
.multi-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: max(280px, 100%); max-height: 340px; display: grid; grid-template-rows: auto auto 1fr; gap: 8px;
  padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .35); }
.multi-actions { display: flex; justify-content: space-between; }
.multi-options { overflow-y: auto; display: grid; gap: 2px; min-height: 0; }
.multi-options .check-row { padding: 6px 4px; border-radius: 8px; font-size: 14px; color: var(--ink); }
.multi-options .check-row:hover { background: var(--surface-2); }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-tile { display: grid; gap: 4px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 60%, transparent); border: 1px solid var(--line); min-width: 0; }
.kpi-tile span { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-tile strong { font-size: 18px; overflow-wrap: anywhere; color: var(--ink); }
.kpi-tile small { color: var(--muted); font-size: 12px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-card { margin: 0; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 60%, transparent); min-width: 0; }
.chart-card figcaption { font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.chart-wide { grid-column: 1 / -1; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-base { stroke: var(--viz-base); }
.viz-axis { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-s1 { fill: var(--viz-s1); background: var(--viz-s1); }
.viz-s2 { fill: var(--viz-s2); background: var(--viz-s2); }
.viz-hit:hover path { filter: brightness(1.12); }
.viz-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar-list, .budget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bar-value, .budget-list small { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; font-size: 12px; }
.bar-track, .budget-track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); overflow: visible; }
.bar-fill, .budget-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 5px 5px 0; background: var(--viz-s1); }
.budget-list li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.budget-target { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.analytics-subtitle { margin: 18px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pivot-table { font-variant-numeric: tabular-nums; }
.pivot-table th, .pivot-table td { white-space: nowrap; text-align: right; }
.pivot-table th:first-child, .pivot-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.pivot-table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.viz-tooltip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: 12px; font-size: 12px; line-height: 1.45;
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 10px 28px -8px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.viz-tooltip strong { display: block; margin-bottom: 2px; }
.viz-tooltip span { color: var(--muted); }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .kpi-grid, .chart-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .analytics-filters { grid-template-columns: minmax(0, 1fr); }
  .budget-list li { grid-template-columns: 90px minmax(0, 1fr) auto; }
}
.filter-grid .multi-options input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; -webkit-appearance: checkbox; appearance: auto; flex: 0 0 auto; accent-color: var(--accent); }
.filter-grid .multi-panel input[type="search"] { height: 38px; min-height: 38px; }
.filter-grid .multi-options .check-row { display: flex; align-items: center; gap: 10px; font-weight: 500; }
/* Inicio: dashboard switch */
.dashboard-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.dashboard-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.dashboard-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 13px; }
.dashboard-switch button svg { width: 16px; height: 16px; }
.dashboard-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-hidden { display: none !important; }
.planning-periods { grid-template-columns: repeat(2, minmax(0, 200px)); margin: 4px 0 14px; }
@media (max-width: 760px) { .dashboard-label { width: 100%; } .dashboard-switch button { flex: 1 1 calc(50% - 8px); justify-content: center; } }
/* Configuración · Idioma */
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; margin-top: 12px; }
.language-code { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.language-options [aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .language-options { grid-template-columns: minmax(0, 1fr); } }

/* Offline sync indicator and pending changes */
.sync-status { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.sync-status[data-state="offline"] .sync-dot { background: var(--muted); }
.sync-status[data-state="offline"] { color: var(--ink); }
.sync-status[data-state="syncing"] .sync-dot { background: var(--accent); animation: sync-pulse 1s ease-in-out infinite; }
.sync-status[data-state="pending"] .sync-dot { background: var(--warning); }
.sync-status[data-state="attention"] .sync-dot { background: var(--danger); }
@keyframes sync-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .sync-status[data-state="syncing"] .sync-dot { animation: none; } }
@media (max-width: 640px) { .sync-status { padding: 0 10px; } .sync-status[data-state="synced"] .sync-label { display: none; } }
.sync-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sync-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.sync-item p { margin: 0; }
.sync-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sync-conflict { border-color: var(--danger); }
.sync-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Product name under the Vaqora logo (the logo itself is shared by every Vaqora app). */
.brand-product { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto 6px; width: min(200px, 100%);
  font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-size: 15px; font-weight: 600;
  letter-spacing: .32em; text-transform: uppercase; color: var(--brand-product, #1f8ea6); padding-left: .32em; }
.brand-product::before, .brand-product::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: currentColor; opacity: .85; }
.brand .brand-product { width: min(132px, 100%); font-size: 11px; gap: 8px; margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand-product: #4fc3d9; } }
:root[data-theme="dark"] { --brand-product: #4fc3d9; }

/* Vaqora Premium: plan marks, notices and Plan page */
.premium-badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  background: #f6ead2; color: #8a5a0b; vertical-align: middle; }
.premium-notice > svg { color: #b7791f; }
.premium-notice .primary-button { flex-shrink: 0; }
.premium-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.premium-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 17px; }
.premium-card h2 svg { width: 20px; height: 20px; color: #b7791f; }
.premium-card p { margin: 0; }
.plan-free [data-dash="obligations"], .plan-free [data-dash="planning"], .plan-free #pushPrompt { display: none !important; }
.plan-panel h2 { margin: 2px 0 6px; font-size: 26px; }
.plan-panel h2[data-plan="premium"] { color: #8a5a0b; }
.plan-panel h3 { margin: 18px 0 8px; font-size: 15px; }
.plan-features { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.plan-features li { position: relative; padding-left: 24px; }
.plan-features li::before { content: ""; position: absolute; left: 3px; top: .45em; width: 9px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.plan-activate { margin-top: 18px; display: grid; gap: 10px; justify-items: start; }
.plan-activate a, #premiumDialog a.primary-button { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.chip-premium { background: #f6ead2; color: #8a5a0b; }
.membership-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.danger-link { color: var(--danger); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .premium-badge, :root:not([data-theme="light"]) .chip-premium { background: rgba(240, 180, 80, .16); color: #f2c46d; } :root:not([data-theme="light"]) .plan-panel h2[data-plan="premium"] { color: #f2c46d; } }
:root[data-theme="dark"] .premium-badge, :root[data-theme="dark"] .chip-premium { background: rgba(240, 180, 80, .16); color: #f2c46d; }
:root[data-theme="dark"] .plan-panel h2[data-plan="premium"] { color: #f2c46d; }
#membershipList table { min-width: 680px; }
#membershipList td, #membershipList th { vertical-align: top; }
#membershipList .chip { white-space: nowrap; }
.renewal-notice { border-color: #e8c27a; }
.renewal-notice > svg { color: #b7791f; }
.renewal-notice a.primary-button { flex-shrink: 0; text-decoration: none; }
@media (max-width: 640px) { .renewal-notice { flex-wrap: wrap; } .renewal-notice > div { flex-basis: calc(100% - 80px); } }

/* "Forgot my password" under the password field */
.forgot-row { display: flex; justify-content: flex-end; margin: -4px 0 6px; }
.forgot-row .link-button { font-size: 13.5px; padding: 2px 0; }

/* Membership administration: owner opens the household detail */
.owner-link { display: grid; gap: 2px; text-align: left; border: 0; background: transparent; padding: 4px 6px; margin: -4px -6px; border-radius: 10px; color: inherit; font: inherit; cursor: pointer; }
.owner-link strong { color: var(--accent-dark); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.owner-link:hover { background: var(--surface-2); }
.owner-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.membership-history-title { margin: 14px 0 6px; font-size: 15px; }
.membership-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.membership-history li { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.membership-history li.is-cancelled { opacity: .7; }
#membershipList table { min-width: 620px; }
