:root {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-card: #151e2e;
  --bg-input: #0f1624;
  --border: #243044;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #10b981;
  --primary-hover: #059669;
  --accent-cyan: #06b6d4;
  --secondary: #1e293b;
  --secondary-hover: #293548;
  --positive: #34d399;
  --negative: #f87171;
  --warning: #fbbf24;
  --silas: #38bdf8;
  --isabella: #c084fc;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --radius: 14px;
  --radius-sm: 10px;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #059669;
  --primary-hover: #047857;
  --accent-cyan: #0891b2;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --positive: #059669;
  --negative: #dc2626;
  --warning: #d97706;
  --silas: #0284c7;
  --isabella: #9333ea;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.brand-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-subtitle {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.brand-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.sync-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--positive);
  box-shadow: 0 0 8px var(--positive);
}
.sync-badge.offline .dot {
  background: var(--negative);
  box-shadow: none;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--text);
}
.user-role-badge.is-admin {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.42);
  color: var(--positive);
}
.user-role-badge.is-member {
  background: rgba(192, 132, 252, 0.14);
  border-color: rgba(192, 132, 252, 0.4);
  color: var(--isabella);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  color: var(--text);
  background: var(--secondary);
}
.btn:hover { background: var(--secondary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--secondary);
  border-color: var(--border);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--secondary);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--negative);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
}
.btn-warning {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--warning);
}
.btn-warning:hover {
  background: rgba(251, 191, 36, 0.26);
}
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.icon-btn { padding: 8px 10px; min-width: 36px; }

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-card);
  padding: 5px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.view-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px;
}
.month-pill {
  background: transparent;
  border: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 5px 10px;
  cursor: pointer;
  min-width: 84px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.card-header p { margin: 2px 0 0; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--text);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi-card { display: flex; flex-direction: column; gap: 6px; }
.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.kpi-sub { font-size: 0.8rem; color: var(--text-muted); }

/* Couple Panel */
.couple-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.couple-card { border-color: rgba(56, 189, 248, 0.35); }
.proportion-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
  display: flex;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
}
.prop-silas { background: var(--silas); transition: width 0.25s ease; }
.prop-isabella { background: var(--isabella); transition: width 0.25s ease; }
.couple-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
}
.legend-item { display: flex; align-items: center; gap: 7px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-silas { background: var(--silas); }
.swatch-isabella { background: var(--isabella); }
.splits-body { font-size: 0.9rem; }
.settlement-highlight {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}

/* Analytics & Budgets */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.donut-layout {
  display: flex;
  align-items: center;
  gap: 18px;
}
.donut-wrap {
  flex: 0 0 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bars-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
}
.bar-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.budgets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.budget-ok { background: var(--positive); }
.budget-warn { background: var(--warning); }
.budget-over { background: var(--negative); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* Transactions Section */
.tx-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.tx-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tx-title-group h2 { margin: 0; font-size: 1rem; }
.tx-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.tx-filters input, .tx-filters select {
  width: auto;
  min-width: 135px;
  max-width: 220px;
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
}
.tx-item:hover { border-color: var(--primary); }
.tx-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tx-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.tx-desc {
  font-weight: 600;
  font-size: 0.94rem;
}
.tx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.pill {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 600;
}
.tx-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tx-amount {
  font-weight: 800;
  font-size: 0.98rem;
  text-align: right;
  white-space: nowrap;
}

/* Consolidated Privacy Card (View: Tudo) */
.privacy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.06));
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.privacy-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.32);
}
.privacy-card h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}
.privacy-card p {
  margin: 0;
  max-width: 620px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.privacy-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

/* Forms & Inputs */
input, select {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}
input:disabled, select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 8px 0 14px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
}
.checkbox-label input { width: auto; }
.form-error {
  color: var(--negative);
  font-size: 0.84rem;
  margin: 6px 0 10px;
}

/* Modals & Lock Overlay */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}
.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 780px; }

textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--bg-input);
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.modal-tab {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.modal-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.of-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-bottom: 12px;
}
.of-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border);
}
.status-pill.ok {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--positive);
}
.status-pill.pending {
  background: var(--secondary);
  color: var(--text-muted);
}
.status-pill.warn {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--warning);
}
.status-pill.err {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--negative);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
}

.preview-table-wrap {
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.preview-table th, .preview-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 700;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-header h3 { margin: 0; font-size: 1.08rem; }
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.footer-right { display: flex; gap: 8px; margin-left: auto; }
.inline-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.entity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}

/* Security / Admin Panel inside PIN Modal */
.profile-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.admin-access-card {
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-top: 14px;
}
.admin-access-card h4 {
  margin: 0 0 8px;
  font-size: 0.94rem;
}
.admin-alert-box {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--warning);
  font-size: 0.83rem;
  margin-bottom: 10px;
}
.admin-status-box {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  margin-bottom: 10px;
}
.admin-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Lock Overlay & Onboarding */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background:
    radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.14), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1), transparent 50%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.lock-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}
.lock-logo {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.22);
}
.lock-brand-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lock-brand-sub {
  margin: 2px 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}
.lock-desc {
  margin: 4px 0 12px;
}
.bootstrap-hint {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: var(--positive);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 0.82rem;
  margin-bottom: 12px;
  line-height: 1.4;
}
.onboarding-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.42);
  color: var(--positive);
  margin-bottom: 8px;
}
.onboarding-title {
  margin: 0 0 6px;
  font-size: 1.06rem;
  font-weight: 700;
}
.onboarding-field {
  text-align: left;
  margin-bottom: 10px;
}
.lock-card .pin-code-input {
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.28em;
  margin: 4px 0 10px;
}
.onboarding-field .pin-code-input {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0.22em;
}
.onboarding-back-btn {
  margin-top: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}
.toast.error { border-left-color: var(--negative); }
.toast.info { border-left-color: var(--accent-cyan); }

/* Responsive */
@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .couple-grid, .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .brand-subtitle { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 1.22rem; }
  .donut-layout { flex-direction: column; align-items: stretch; }
  .donut-wrap { flex: none; }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .tx-filters { justify-content: stretch; }
  .tx-filters input, .tx-filters select { max-width: none; flex: 1 1 46%; }
  .tx-item { flex-direction: column; align-items: stretch; }
  .tx-right { justify-content: space-between; }
}
