:root {
  --bg: #eef4fa;
  --surface: #ffffff;
  --surface-alt: #f6f9fe;
  --surface-hover: #fbfdff;
  --line: #d8e2f1;
  --line-soft: #e9eef7;
  --sidebar-bg: #26437e;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --nav: #24417a;
  --nav-active: rgba(255, 255, 255, 0.14);
  --text: #10284d;
  --text-soft: #8c9fc2;
  --label: #5e759d;
  --primary: #264987;
  --primary-dark: #1c3b73;
  --success: #1aaf6c;
  --warning: #f3a600;
  --danger: #ef5350;
  --info: #3483fa;
  --shadow: 0 16px 34px rgba(20, 43, 85, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --input-bg: #ffffff;
  --topbar-border: #edf2f8;
  --banner-warning-border: #f0d594;
  --banner-warning-bg: #fff6df;
  --banner-warning-text: #8d6517;
  --banner-info-border: #bfd6ff;
  --banner-info-bg: #edf5ff;
  --banner-info-text: #214f96;
  --status-paid-bg: #ecfdf4;
  --status-paid-border: #9be7bf;
  --status-pending-text: #b37200;
  --status-pending-bg: #fff7e8;
  --status-pending-border: #ffd485;
  --status-overdue-text: #c13636;
  --status-overdue-bg: #fff0ef;
  --status-overdue-border: #ffb8b4;
  --type-pill-bg: #f1f5fb;
  --type-pill-text: #5f7394;
  --status-track-bg: #edf2f8;
  --settings-tab-active-bg: #dde8f7;
  --modal-overlay: rgba(10, 23, 51, 0.44);
  --auth-tab-bg: #eef4fb;
  --auth-tab-text: #48618b;
  --mobile-menu-bg: #edf3fb;
  --star-inactive: #d7deec;
}

[data-theme="dark"] {
  --bg: #0f1626;
  --surface: #161f33;
  --surface-alt: #1c2740;
  --surface-hover: #1a2438;
  --line: #2a3550;
  --line-soft: #233047;
  --sidebar-bg: #0d1526;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --nav: #0d1526;
  --nav-active: rgba(255, 255, 255, 0.08);
  --text: #e7edf7;
  --text-soft: #8fa0c2;
  --label: #93a6cc;
  --primary: #4f7fd6;
  --primary-dark: #3d64ad;
  --success: #3ecf8e;
  --warning: #f4b93d;
  --danger: #f47066;
  --info: #5aa0ff;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  --input-bg: #131c30;
  --topbar-border: #212c46;
  --banner-warning-border: #6a521c;
  --banner-warning-bg: #2b2412;
  --banner-warning-text: #f0c96a;
  --banner-info-border: #294b82;
  --banner-info-bg: #16233c;
  --banner-info-text: #9dc3ff;
  --status-paid-bg: rgba(62, 207, 142, 0.14);
  --status-paid-border: rgba(62, 207, 142, 0.35);
  --status-pending-text: #f0c96a;
  --status-pending-bg: rgba(244, 185, 61, 0.12);
  --status-pending-border: rgba(244, 185, 61, 0.35);
  --status-overdue-text: #f88b83;
  --status-overdue-bg: rgba(244, 112, 102, 0.12);
  --status-overdue-border: rgba(244, 112, 102, 0.35);
  --type-pill-bg: #1c2740;
  --type-pill-text: #93a6cc;
  --status-track-bg: #202b45;
  --settings-tab-active-bg: #26365a;
  --modal-overlay: rgba(4, 9, 20, 0.6);
  --auth-tab-bg: #1c2740;
  --auth-tab-text: #93a6cc;
  --mobile-menu-bg: #1c2740;
  --star-inactive: #384766;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body,
.card,
.modal,
.topbar,
.sidebar,
input,
select,
textarea,
button,
.banner,
.status-pill,
.type-pill {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

input[readonly],
input:disabled {
  background: var(--bg, #f4f6fb);
  color: var(--text-soft);
  cursor: not-allowed;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 22px 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.42rem;
  padding: 0 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand.compact {
  font-size: 1.1rem;
}

.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

.brand-mark,
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
}

.brand-mark svg {
  width: 60%;
  height: 60%;
}

.avatar {
  border-radius: 50%;
  background: var(--primary);
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 16px;
}

.nav-item,
.sidebar-quiet {
  width: 100%;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  padding: 11px 14px;
  border-radius: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.98rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: var(--nav-active);
}

.nav-item.active .nav-icon {
  color: #fff;
}

.nav-item.locked {
  opacity: 0.45;
}

.nav-item.locked .nav-icon::after {
  content: "🔒";
  margin-left: 4px;
  font-size: 0.72rem;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-guest-note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  line-height: 1.4;
}

.company-switcher {
  margin-top: 18px;
}

.company-switcher-label {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.company-switcher-label select {
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.company-switcher-label select option {
  color: #10284d;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-quiet {
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.92rem;
}

.sidebar-quiet.secondary {
  background: rgba(255, 255, 255, 0.08);
}

.main {
  flex: 1;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 0;
  background: var(--surface);
  padding: 18px 26px 14px;
  border-bottom: 1px solid var(--topbar-border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 800;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.searchbox input,
.filter-input,
.record-form input,
.record-form select,
.record-form textarea,
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--input-bg);
  color: var(--text);
}

.searchbox input {
  width: 210px;
  height: 36px;
  color: var(--text-soft);
}

.icon-button,
.ghost-button,
.filter-pill,
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  padding: 11px 18px;
  box-shadow: 0 6px 16px rgba(39, 75, 140, 0.2);
  font-weight: 700;
}

.topbar-actions .primary-button {
  white-space: nowrap;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 700;
}

.user-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.banner {
  border: 1px solid var(--banner-warning-border);
  background: var(--banner-warning-bg);
  color: var(--banner-warning-text);
  padding: 14px 16px;
  border-radius: 18px;
  margin: 16px 22px 0;
}

.banner.info {
  border-color: var(--banner-info-border);
  background: var(--banner-info-bg);
  color: var(--banner-info-text);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.guest-empty {
  padding: 42px 22px 0;
}

.guest-hero {
  padding: 32px;
}

.guest-hero h2 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.05;
}

.guest-hero p {
  margin: 0 0 18px;
  color: var(--text-soft);
  max-width: 640px;
}

.guest-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

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

.guest-preview {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.guest-preview strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 22px 22px 0;
}

.two-column {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  padding: 16px 22px 0;
}

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

.metric-card,
.panel-card {
  padding: 20px 20px 18px;
}

.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  margin-bottom: 10px;
  background: var(--surface-alt);
}

.metric-value {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 6px;
}

.metric-label,
.muted,
.table-subtext,
.kpi-note {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.metric-trend.positive {
  color: var(--success);
  font-weight: 700;
}

.metric-trend.negative {
  color: var(--danger);
  font-weight: 700;
}

.card-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* The toolbar (filter pills + Create/Add button) sits directly at the top
   of Invoices/Clients/Payments/Expenses/Reports, unlike the metrics grid
   and tables below it which already carry their own 22px side margin/padding.
   Without this, the toolbar's buttons touch the browser edge on wide
   viewports. Matches the 22px used by .metrics-grid/.two-column/.table-card
   so everything lines up on one consistent left/right edge. */
.toolbar {
  padding: 18px 22px 0;
}

.toolbar:first-child {
  padding-top: 22px;
}

.card-title,
.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.toolbar {
  flex-wrap: wrap;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-paid,
.status-active,
.status-completed {
  color: var(--success);
  background: var(--status-paid-bg);
  border-color: var(--status-paid-border);
}

.status-pending,
.status-partial {
  color: var(--status-pending-text);
  background: var(--status-pending-bg);
  border-color: var(--status-pending-border);
}

.status-overdue,
.status-paused {
  color: var(--status-overdue-text);
  background: var(--status-overdue-bg);
  border-color: var(--status-overdue-border);
}

.type-pill {
  background: var(--type-pill-bg);
  color: var(--type-pill-text);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.86rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend-swatch.income {
  background: #2a4e90;
}

.legend-swatch.expense {
  background: #f39a00;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.logo-preview {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.3rem;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.logo-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  background: #fff;
}

.logo-label {
  font-weight: 700;
  margin-bottom: 2px;
}

.section-label {
  color: var(--label);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 4px;
}

.star-btn {
  background: transparent;
  border: 0;
  color: var(--star-inactive);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.star-btn.active {
  color: var(--warning);
}

.report-row .report-open {
  display: inline-flex;
  gap: 6px;
  margin-left: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.report-row:hover .report-open {
  opacity: 1;
}

.chart {
  height: 280px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 14px;
}

.chart-column {
  flex: 1;
  display: grid;
  gap: 10px;
  align-items: end;
}

.chart-pair {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
}

.bar {
  width: 24px;
  border-radius: 12px 12px 6px 6px;
}

.bar.income {
  background: linear-gradient(180deg, #2a4e90 0%, #4f74b5 100%);
}

.bar.expense {
  background: linear-gradient(180deg, #ffbe45 0%, #f39a00 100%);
}

.chart-label {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.status-list,
.list-stack {
  display: grid;
  gap: 14px;
}

.status-row,
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-track {
  height: 7px;
  background: var(--status-track-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.status-fill {
  height: 100%;
  border-radius: inherit;
}

.status-fill.success {
  background: var(--success);
}

.status-fill.warning {
  background: var(--warning);
}

.status-fill.danger {
  background: var(--danger);
}

.table-card {
  overflow: hidden;
  margin: 16px 22px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 18px;
  border-top: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--label);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

tbody tr:hover {
  background: var(--surface-hover);
}

.amount {
  font-weight: 800;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-soft);
}

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  padding: 22px;
}

.settings-tabs {
  display: grid;
  gap: 8px;
  align-content: start;
}

.settings-tab {
  background: transparent;
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  font-weight: 600;
}

.settings-tab.active {
  background: var(--settings-tab-active-bg);
  font-weight: 700;
}

.settings-panel + .settings-panel {
  margin-top: 16px;
}

.report-viewer .report-section + .report-section {
  margin-top: 18px;
}

.report-viewer .banner.info {
  margin: 10px 0 16px;
}

.record-form,
.form-grid {
  display: grid;
  gap: 14px;
}

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

.record-form label,
.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--label);
  font-size: 0.92rem;
}

.modal-shell {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 40;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 25px 60px rgba(11, 33, 74, 0.22);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.auth-card {
  width: min(1020px, 100%);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.auth-cancel-btn {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 420px);
}

.auth-hero {
  background: radial-gradient(circle at top left, #3c65ac 0%, #223f78 44%, #182d54 100%);
  color: #fff;
  padding: 34px;
}

.auth-hero h2 {
  margin: 30px 0 12px;
  font-size: 2.4rem;
  line-height: 1.1;
}

.hero-points {
  margin: 24px 0 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.88);
}

.auth-panel {
  padding: 32px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  background: var(--auth-tab-bg);
  color: var(--auth-tab-text);
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
}

.auth-feedback {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-soft, #5e759d);
}

.auth-feedback:empty {
  display: none;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-note {
  color: var(--text-soft);
  margin: 12px 0 0;
}

.auth-legal-note {
  color: var(--text-soft);
  font-size: 0.8rem;
  margin: 10px 0 0;
  text-align: center;
}

.auth-legal-note a {
  color: var(--primary);
}

.summary-callout {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface-alt);
}

.upgrade-lock {
  max-width: 440px;
  margin: 64px auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
}

.upgrade-lock-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  margin: 0 auto 16px;
}

.upgrade-lock h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.upgrade-lock p {
  color: var(--text-soft);
  margin: 0 0 20px;
  line-height: 1.55;
  font-size: 0.94rem;
}

.upgrade-lock-price {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.upgrade-lock-price span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
}

.upgrade-lock .primary-button {
  width: 100%;
  padding: 13px 18px;
  margin-bottom: 12px;
}

.upgrade-lock .muted {
  font-size: 0.84rem;
  margin: 0;
}

@media (max-width: 740px) {
  .upgrade-lock {
    margin: 32px 16px;
    padding: 28px 22px;
  }
}

.mobile-menu-button {
  display: none;
  margin-bottom: 10px;
  background: var(--mobile-menu-bg);
  color: var(--primary);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .metrics-grid,
  .two-column,
  .form-grid.two,
  .settings-layout,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    order: 1;
  }

  .auth-hero {
    order: 2;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 78vw;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 30;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    overflow-y: auto;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 9, 20, 0.5);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    min-width: 0;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar {
    padding: 16px;
  }

  .metrics-grid,
  .two-column,
  .settings-layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .table-card,
  .banner {
    margin-left: 16px;
    margin-right: 16px;
  }
}

@media (max-width: 740px) {
  .topbar,
  .topbar-actions,
  .toolbar,
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }

  .guest-actions,
  .guest-hero-actions,
  .guest-preview-grid {
    width: 100%;
  }

  .guest-preview-grid {
    grid-template-columns: 1fr;
  }

  .searchbox input {
    width: 100%;
  }

  .user-pill {
    justify-content: flex-start;
  }

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

  th,
  td {
    padding: 14px 12px;
    white-space: nowrap;
  }

  .table-card {
    overflow-x: auto;
  }

  .modal-shell {
    padding: 10px;
    align-items: flex-start;
  }

  .modal,
  .auth-card {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

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

  .auth-hero {
    padding: 24px;
  }

  .auth-hero h2 {
    margin: 16px 0 10px;
    font-size: 1.7rem;
  }

  .auth-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .auth-panel {
    padding: 24px;
  }
}