:root {
  color-scheme: light;
  /* Chef Educa brand tokens */
  --brand-950: #06111c;
  --brand-900: #102030;
  --brand-800: #102438;
  --brand-700: #173a5a;
  --brand-600: #1f5b86;
  --brand-blue: #102030;
  --brand-orange: #f87820;
  --brand-orange-dark: #c65012;
  --brand-orange-soft: #fff0e7;
  --accent-700: var(--brand-orange-dark);
  --accent-600: var(--brand-orange);
  --accent-500: #ff7a2f;
  --accent-100: var(--brand-orange-soft);
  --green-700: var(--brand-orange-dark);
  --green-600: var(--brand-orange);
  --green-500: #ff7a2f;
  --green-100: var(--brand-orange-soft);
  --blue-600: #1f75bb;
  --blue-100: #e6f2fb;
  --success-700: #247043;
  --success-100: #e5f6eb;
  --red-600: #c83d3d;
  --red-100: #fde8e8;
  --yellow-700: #9b6a00;
  --yellow-100: #fff4cf;
  --gray-950: #172033;
  --gray-800: #344054;
  --gray-700: #4d5b70;
  --gray-600: #667085;
  --gray-500: #8894a6;
  --gray-300: #d6dbe3;
  --gray-200: #e8ebf0;
  --gray-100: #f3f6f8;
  --gray-50: #f9fbfc;
  --app-bg: #eef3f6;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(7, 27, 47, 0.07), 0 8px 24px rgba(7, 27, 47, 0.04);
  --shadow-md: 0 18px 42px rgba(7, 27, 47, 0.16);
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: var(--radius-md);
  --topbar: 58px;
  --sidebar: 68px;
  --content-max: 1920px;
  --font-ui: Figtree, Inter, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand-950: #020814;
    --brand-900: #061427;
    --brand-800: #0a1d33;
    --brand-700: #103456;
    --brand-600: #24557f;
    --brand-blue: #071b2f;
    --brand-orange: #ff8744;
    --brand-orange-dark: #ff9b62;
    --brand-orange-soft: #3a2114;
    --accent-700: #ff9a4d;
    --accent-600: #f47a2a;
    --accent-500: #ff8a35;
    --accent-100: #3a2114;
    --green-700: #ff9a4d;
    --green-600: #f47a2a;
    --green-500: #ff8a35;
    --green-100: #3a2114;
    --blue-600: #62a9ee;
    --blue-100: #102a43;
    --success-700: #62d18f;
    --success-100: #123322;
    --red-600: #ff8181;
    --red-100: #3a171b;
    --yellow-700: #f2c15f;
    --yellow-100: #35280f;
    --gray-950: #f4f7fb;
    --gray-800: #d8dee8;
    --gray-700: #c3ccda;
    --gray-600: #9aa8bb;
    --gray-500: #748197;
    --gray-300: #354154;
    --gray-200: #253044;
    --gray-100: #111827;
    --gray-50: #0b1220;
    --app-bg: #070b13;
    --surface: #111a2a;
    --surface-raised: #151f31;
    --white: #111a2a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.42);
  }

  body {
    background: #070b13;
  }

  .app-shell {
    background: #0b111d;
  }

  .topbar {
    background: linear-gradient(90deg, #050c18 0%, #0a1a2e 58%, #102f45 100%);
    color: #f8fafc;
  }

  .sidebar {
    background: #071722;
  }

  .topbar .tenant-name,
  .topbar .user-chip,
  .topbar .icon-btn {
    color: #f8fafc;
  }

  .avatar {
    color: #07162a;
    background: #f8fafc;
  }

  .page,
  .drawer,
  .table-shell,
  .metric-card,
  .module-card,
  .report-card,
  .form-section,
  .combo-menu,
  .attachment-row,
  .installment-row,
  .ai-extraction-panel,
  .review-summary > div,
  .dashboard-drilldown-summary > div {
    background: var(--white);
  }

  .page-head,
  .filters,
  .category-filters,
  .statement-filters,
  .drawer-head,
  .drawer-foot,
  .data-table th,
  .data-table .column-filter-row td,
  .table-footer,
  .form-section h2,
  .installments-head,
  .combo-item:hover,
  .combo-item.active {
    background: var(--gray-50);
  }

  .input,
  .select,
  .textarea,
  .combo-input,
  input,
  select,
  textarea {
    color: var(--gray-950);
    background: #0b1424;
    border-color: var(--gray-300);
  }

  .input::placeholder,
  .textarea::placeholder,
  .combo-input::placeholder {
    color: var(--gray-500);
  }

  .metric-card.highlight,
  .alert-card.info,
  .ai-memory-list,
  .summary-box {
    background: #101b2c;
  }

  .ai-pending-actions,
  .alert-card.warning {
    background: #211a0f;
  }

  .status,
  .pill,
  .badge {
    border-color: rgba(255, 255, 255, 0.08);
  }

  .data-table tr:hover td,
  .data-table tr.highlight td {
    background: rgba(98, 169, 238, 0.12);
  }

  .data-table tr.selected td {
    background: rgba(98, 169, 238, 0.16);
  }

  .drawer-backdrop {
    background: rgba(0, 0, 0, 0.62);
  }

  .toast {
    color: #f8fafc;
    background: #07162a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--gray-950);
  background: var(--app-bg);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.35;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, #f7fafc 0%, var(--app-bg) 34%);
}

.startup-guard {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
}

.startup-guard-card {
  width: min(620px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.startup-guard-brand {
  width: 148px;
  height: 46px;
  object-fit: contain;
  object-position: left center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-900);
}

.startup-guard h1 {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.15;
}

.startup-guard p {
  margin: 0;
  color: var(--gray-700);
  font-size: 15px;
}

.startup-guard-actions {
  margin-top: 22px;
}

.startup-guard-help {
  margin-top: 18px;
  padding: 14px;
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.startup-guard-help code {
  font-size: 12px;
  color: var(--brand-800);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(360px, 520px);
  background:
    linear-gradient(135deg, rgba(3, 16, 29, 0.98) 0%, rgba(11, 42, 69, 0.96) 58%, rgba(15, 72, 104, 0.94) 100%);
  color: #f8fafc;
}

.login-screen.loading {
  grid-template-columns: minmax(320px, 460px);
  place-content: center;
  padding: 24px;
}

.login-brand-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 64px);
  position: relative;
  overflow: hidden;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.login-brand-lockup img {
  width: 154px;
  height: 52px;
  object-fit: contain;
  object-position: left center;
}

.login-brand-lockup span {
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy {
  max-width: 620px;
  position: relative;
  z-index: 1;
}

.login-copy h1 {
  margin: 0 0 14px;
  font-size: 56px;
  line-height: 0.95;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 520px;
  margin: 0;
  color: rgba(248, 250, 252, 0.76);
  font-size: 16px;
  line-height: 1.55;
}

.login-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  position: relative;
  z-index: 1;
}

.login-signal-grid > div {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

.login-signal-grid strong,
.login-signal-grid span {
  display: block;
}

.login-signal-grid strong {
  font-size: 13px;
}

.login-signal-grid span {
  margin-top: 4px;
  color: rgba(248, 250, 252, 0.64);
  font-size: 11px;
}

.login-card {
  align-self: center;
  width: min(420px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(12, 31, 52, 0.92), rgba(7, 22, 42, 0.92));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.login-card img {
  display: block;
  width: 158px;
  height: 58px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 18px;
}

.login-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.1;
}

.login-card p {
  margin: 8px 0 22px;
  color: rgba(248, 250, 252, 0.68);
  line-height: 1.5;
}

.login-form,
.login-form label {
  display: grid;
  gap: 8px;
}

.login-form {
  gap: 14px;
}

.login-form label span {
  color: rgba(248, 250, 252, 0.86);
  font-size: 12px;
  font-weight: 800;
}

.login-card .input {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

.login-card .input:focus {
  border-color: rgba(255, 135, 68, 0.9);
  box-shadow: 0 0 0 3px rgba(233, 95, 27, 0.22);
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field .input {
  width: 100%;
  padding-right: 86px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  border: 0;
  color: #ffd7c1;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.password-toggle:hover {
  color: #ffffff;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-secondary {
  border: 0;
  color: rgba(248, 250, 252, 0.86);
  background: transparent;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
}

.login-secondary:hover {
  color: var(--accent-300);
}

.login-message {
  padding: 10px 12px;
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.26);
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.12);
  font-weight: 800;
  line-height: 1.4;
}

.login-error {
  padding: 10px 12px;
  color: var(--red-600);
  border: 1px solid rgba(200, 61, 61, 0.24);
  border-radius: var(--radius-sm);
  background: var(--red-100);
  font-weight: 800;
}

.app-shell.sidebar-expanded {
  --sidebar: 232px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  color: var(--white);
  background: linear-gradient(90deg, var(--brand-950) 0%, var(--brand-900) 54%, var(--brand-800) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(3, 16, 29, 0.18);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 270px;
}

.brand-lockup img {
  display: block;
  width: 126px;
  height: 38px;
  object-fit: contain;
  object-position: left center;
}

.tenant-name {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.icon-btn,
.btn,
.nav-item,
.row-action,
.module-card {
  cursor: pointer;
}

.icon-btn.bordered {
  flex: 0 0 34px;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid #cfd5df;
}

.icon-btn.bordered:hover {
  color: var(--brand-orange);
  background: var(--brand-orange-soft);
  border-color: rgba(226, 83, 21, 0.35);
}

.user-chip {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 4px 4px 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  font-weight: 600;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.16);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--brand-900);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-menu-wrap {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 110;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--gray-950);
}

.account-menu-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 6px;
}

.account-menu-head strong,
.profile-preview strong {
  display: block;
  font-size: 14px;
  color: var(--gray-950);
}

.account-menu-head span,
.profile-preview span,
.account-menu-head small {
  display: block;
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.account-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--gray-800);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  text-align: left;
}

.account-menu button:hover {
  background: var(--gray-100);
  color: var(--accent-700);
}

.account-menu svg {
  width: 17px;
  height: 17px;
}

.account-avatar {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.table-avatar {
  width: 32px;
  height: 32px;
}

.person-cell,
.profile-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-preview {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.profile-avatar {
  width: 46px;
  height: 46px;
  font-size: 15px;
}

.sidebar {
  position: fixed;
  top: var(--topbar);
  bottom: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar);
  padding: 14px 9px;
  background: linear-gradient(180deg, #061427 0%, #082237 100%);
  color: #dcecf7;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.06) inset, 10px 0 30px rgba(7, 27, 47, 0.08);
}

.nav-item {
  position: relative;
  width: 50px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  color: #dcecf7;
  background: transparent;
}

.nav-toggle {
  margin-bottom: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-section {
  display: grid;
  gap: 7px;
}

.nav-section-title {
  display: none;
  margin: 10px 10px 2px;
  color: rgba(220, 236, 247, 0.5);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-label {
  display: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.app-shell.sidebar-expanded .nav-item {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
}

.app-shell.sidebar-expanded .nav-label {
  display: inline;
}

.app-shell.sidebar-expanded .nav-section-title {
  display: block;
}

.app-shell.sidebar-expanded .nav-item.tooltip::after {
  display: none;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-600), #ff8848);
  box-shadow: 0 10px 24px rgba(233, 95, 27, 0.26);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  width: 3px;
  height: 32px;
  border-radius: 3px;
  background: var(--accent-500);
}

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 200;
  left: calc(100% + 9px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 220px;
  padding: 6px 8px;
  color: var(--white);
  background: var(--brand-900);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

.row-action.tooltip::after,
.header-tools .tooltip::after {
  left: 50%;
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}

.row-action.tooltip:hover::after,
.header-tools .tooltip:hover::after {
  transform: translateX(-50%) translateY(-2px);
}

.main {
  min-height: 100vh;
  padding: calc(var(--topbar) + 18px) 18px 18px calc(var(--sidebar) + 18px);
}

.mobile-nav {
  display: none;
}

.workspace {
  width: min(100%, var(--content-max));
  min-height: calc(100vh - var(--topbar) - 32px);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.page-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(249, 251, 252, 0.94)),
    var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.page-title h1 {
  margin: 0;
  color: var(--brand-800);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.breadcrumb {
  margin-bottom: 4px;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 800;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--gray-600);
  font-size: 12px;
}

.header-tools,
.toolbar,
.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.content {
  padding: 18px 22px 22px;
}

.home-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
}

.home-summary {
  display: grid;
  gap: 10px;
  align-content: start;
}

.home-nav-panel {
  display: grid;
  gap: 14px;
}

.quick-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.quick-strip h2 {
  margin: 0 0 3px;
  color: var(--brand-800);
  font-size: 14px;
}

.quick-strip p {
  margin: 0;
  color: var(--gray-600);
}

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

.home-dashboard-grid .report-bars {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.review-list,
.comparison-bars {
  display: grid;
  gap: 10px;
}

.review-item,
.comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
}

.review-item:last-child,
.comparison-row:last-child {
  border-bottom: 0;
}

.review-item strong,
.comparison-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--gray-950);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-item span,
.comparison-row span {
  display: block;
  margin-top: 2px;
  color: var(--gray-500);
  font-size: 11px;
}

.comparison-row {
  grid-template-columns: minmax(170px, 0.8fr) minmax(160px, 1fr) auto;
}

.comparison-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-200);
}

.comparison-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.comparison-track .income {
  background: var(--success-700);
}

.comparison-track .expense {
  background: var(--accent-600);
}

.finance-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--gray-50);
}

.finance-tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--gray-700);
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
}

.finance-tab:hover {
  color: var(--brand-800);
  background: var(--white);
}

.finance-tab.active {
  color: var(--white);
  background: var(--brand-700);
}

.finance-tab svg {
  width: 17px;
  height: 17px;
}

.compact-card,
.panel,
.module-card,
.metric-card,
.alert-card {
  background: var(--surface-raised);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.compact-card {
  padding: 12px;
}

.compact-card h3,
.panel h3,
.module-card h3,
.alert-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--brand-800);
}

.compact-card p,
.module-card p,
.alert-card p {
  margin: 0;
  color: var(--gray-600);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 14px;
}

.home-modules {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.module-card {
  min-height: 156px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: inherit;
  text-decoration: none;
}

.module-card:hover {
  border-color: rgba(233, 95, 27, 0.45);
  box-shadow: 0 0 0 1px rgba(233, 95, 27, 0.14), var(--shadow-sm);
}

.module-card.featured {
  border-color: rgba(244, 122, 32, 0.45);
  background: linear-gradient(180deg, var(--accent-100) 0%, var(--surface-raised) 72%);
}

.module-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  border-radius: var(--radius-sm);
  background: var(--brand-700);
}

.module-card.featured .module-icon {
  background: var(--accent-600);
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--gray-500);
  font-size: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 98px;
  padding: 13px 14px;
  border-top: 3px solid var(--blue-600);
}

.metric-card.warning {
  border-top-color: var(--yellow-700);
}

.metric-card.danger {
  border-top-color: var(--red-600);
}

.metric-card.info {
  border-top-color: var(--blue-600);
}

.metric-label {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
}

.metric-value {
  margin-top: 7px;
  color: var(--gray-950);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.metric-sub {
  margin-top: 4px;
  color: var(--gray-500);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 390px;
  gap: 14px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--gray-50), rgba(249, 251, 252, 0.7));
  border-bottom: 1px solid var(--gray-200);
}

.panel-head h2 {
  margin: 0;
  color: var(--brand-800);
  font-size: 14px;
  font-weight: 900;
}

.panel-body {
  padding: 12px;
}

.chart {
  height: 260px;
  display: grid;
  grid-template-columns: 42px repeat(6, 1fr);
  align-items: end;
  gap: 10px;
  padding: 16px 10px 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-raised) 0%, var(--gray-50) 100%);
}

.chart-scale {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--gray-500);
  font-size: 10px;
  text-align: right;
}

.bar-group {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 4px;
}

.bar {
  min-height: 8px;
  border-radius: 3px 3px 0 0;
}

.bar.in {
  background: var(--success-700);
}

.bar.out {
  background: var(--accent-600);
}

.bar-label {
  grid-column: 1 / -1;
  margin-top: 6px;
  color: var(--gray-500);
  font-size: 10px;
  text-align: center;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  color: var(--gray-600);
  font-size: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.in {
  background: var(--success-700);
}

.legend-dot.out {
  background: var(--accent-600);
}

.legend-dot.income {
  background: var(--success-700);
}

.legend-dot.expense {
  background: var(--accent-600);
}

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

.saved-mcp-url {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.saved-mcp-url strong,
.saved-mcp-url span {
  display: block;
}

.saved-mcp-url .btn {
  white-space: nowrap;
}

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

.mini-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
}

.mini-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.mcp-product-row {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--gray-100);
}

.mcp-product-row span {
  color: var(--gray-600);
  font-size: 12px;
}

.integration-summary {
  display: grid;
  gap: 10px;
}

.integration-summary > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.integration-summary code {
  width: 100%;
  overflow: hidden;
  display: block;
  color: var(--brand-800);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-preview-scroll {
  min-height: 180px;
  max-height: 320px;
}

.compact-table {
  min-width: 720px;
}

.error-text {
  margin: 8px 0 0;
  color: var(--red-600);
  font-weight: 700;
}

.alert-stack {
  display: grid;
  gap: 8px;
}

.alert-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-left: 3px solid var(--yellow-700);
}

.alert-card.danger {
  border-left-color: var(--red-600);
}

.alert-card.info {
  border-left-color: var(--blue-600);
}

.alert-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--yellow-100);
  color: var(--yellow-700);
}

.alert-card.danger .alert-icon {
  background: var(--red-100);
  color: var(--red-600);
}

.alert-card.info .alert-icon {
  background: var(--blue-100);
  color: var(--blue-600);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr)) minmax(210px, 1.15fr) minmax(210px, auto);
  gap: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, var(--gray-50), var(--surface-raised));
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.category-filters {
  grid-template-columns: 160px 210px minmax(240px, 1fr) minmax(310px, auto);
}

.statement-filters {
  grid-template-columns: 140px minmax(210px, 1.1fr) 140px minmax(190px, 1fr) minmax(150px, 0.8fr) minmax(220px, 1fr) minmax(240px, auto);
}

.dashboard-filters {
  grid-template-columns: 140px minmax(210px, 1.2fr) 135px 135px minmax(190px, 1fr) minmax(190px, 1fr);
  align-items: end;
}

.dashboard-filters .filter-summary {
  grid-column: span 2;
  min-width: 260px;
}

.dashboard-filters .status {
  margin-left: 4px;
}

.filter-summary {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 7px;
  padding: 6px 10px;
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.category-filters .filter-summary {
  flex-wrap: wrap;
}

.filter-summary strong {
  color: var(--brand-800);
  font-size: 13px;
  white-space: nowrap;
}

.statement-filters .filter-summary {
  min-width: 230px;
}

.statement-filters .filter-summary strong:nth-of-type(2) {
  font-size: 15px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  color: var(--gray-700);
  font-size: 11px;
  font-weight: 800;
}

.field-hint {
  margin: 5px 0 0;
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--gray-950);
  background: var(--surface-raised);
  border: 1px solid #cfd5df;
  border-radius: var(--radius-sm);
  outline: none;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.large-textarea {
  min-height: 180px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-600);
  box-shadow: 0 0 0 3px rgba(233, 95, 27, 0.13);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  color: var(--gray-600);
  background: var(--gray-100);
}

.inline-field-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-field-action .select,
.inline-field-action .input {
  flex: 1 1 auto;
  min-width: 0;
}

.combo-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.combo-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  max-height: min(280px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.combo-field:focus-within .combo-menu,
.combo-menu:hover {
  display: block;
}

.combo-option {
  width: 100%;
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  color: var(--gray-950);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.combo-option:hover,
.combo-option.active {
  background: var(--gray-100);
}

.combo-option[hidden] {
  display: none;
}

.combo-option span {
  color: var(--gray-500);
  font-size: 10px;
}

.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  color: var(--brand-800);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-weight: 900;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn.compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

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

.button-row.compact .btn {
  min-height: 34px;
  padding: 7px 12px;
}

.page-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
  margin-right: 4px;
  border-right: 1px solid #dfe5ec;
}

.btn:disabled,
.btn.disabled,
.row-action:disabled,
.module-card.disabled-card {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn:disabled:hover,
.row-action:disabled:hover {
  transform: none;
  box-shadow: none;
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px dashed #cfd5df;
  border-radius: var(--radius-md);
}

.empty-state strong {
  color: var(--gray-950);
}

.empty-state p {
  margin: 0;
}

.btn:hover {
  background: var(--brand-orange-soft);
  transform: translateY(-1px);
}

.btn.primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--accent-600), #ff8640);
  border-color: rgba(233, 95, 27, 0.85);
  box-shadow: 0 10px 24px rgba(233, 95, 27, 0.22);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--accent-700), var(--accent-600));
}

.btn.secondary {
  color: var(--brand-800);
  background: var(--surface-raised);
  border-color: var(--gray-300);
}

.btn.secondary:hover {
  background: var(--gray-50);
}

.btn.orange {
  color: var(--white);
  background: var(--accent-600);
  border-color: var(--accent-600);
}

.btn.square {
  width: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.table-shell {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.table-shell.flat {
  border: 0;
  border-radius: 0;
}

.compact-table-shell {
  margin-top: 14px;
}

.compact-shell {
  margin-top: 14px;
}

.table-options {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--gray-50), var(--surface-raised));
  border-bottom: 1px solid var(--gray-200);
}

.column-mock {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gray-600);
  font-size: 11px;
}

.column-mock span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-scroll {
  overflow: auto;
  min-height: 360px;
  max-height: calc(100vh - 310px);
}

.compact-scroll {
  min-height: 250px;
  max-height: 520px;
}

.data-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  height: 36px;
  padding: 7px 9px;
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--gray-700);
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 900;
  text-align: left;
}

.resizable-table th {
  position: sticky;
}

.resizable-table th .th-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer:hover,
.column-resizer.active {
  background: rgba(28, 117, 188, 0.22);
}

.data-table tbody tr:hover {
  background: rgba(31, 117, 187, 0.06);
}

.data-table tbody tr.selected {
  background: #eef5fb;
}

.data-table .money,
.data-table th.money {
  text-align: right;
}

.data-table .row-note {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}

.table-cell-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}

.table-cell-stack strong,
.table-cell-stack span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-cell-stack strong {
  font-size: 12px;
  font-weight: 900;
}

.table-subtext {
  font-size: 11px;
  font-weight: 700;
}

.table-cell-stack.compact strong {
  font-size: 12px;
}

.representation-table {
  min-width: 1040px;
}

.money.positive {
  color: var(--success-700);
}

.money.negative {
  color: var(--red-600);
}

.money-positive {
  color: var(--success-700) !important;
}

.money-negative {
  color: var(--red-600) !important;
}

.table-filter-row th {
  top: 36px;
  height: 28px;
  padding: 4px 8px;
  color: var(--gray-500);
  background: var(--white);
  font-weight: 500;
}

.mini-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gray-500);
  font-size: 10px;
}

.column-filter {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
}

.column-filter svg {
  width: 14px;
  height: 14px;
}

.column-filter input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--gray-700);
  font: inherit;
  font-size: 11px;
  outline: none;
}

.column-filter input::placeholder {
  color: var(--gray-500);
}

.column-filter:focus-within {
  color: var(--accent-700);
}

.table-foot {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  color: var(--gray-600);
  background: linear-gradient(180deg, var(--surface-raised), var(--gray-50));
  border-top: 1px solid var(--gray-200);
  font-size: 11px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 7px;
}

.page-dot {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--accent-600);
  font-size: 11px;
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  font-size: 11px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status.open {
  color: var(--blue-600);
  background: var(--blue-100);
}

.status.overdue {
  color: var(--red-600);
  background: var(--red-100);
}

.status.paid,
.status.received,
.status.matched,
.status.success {
  color: var(--success-700);
  background: var(--success-100);
}

.status.scheduled,
.status.partial,
.status.pending,
.status.warning {
  color: var(--yellow-700);
  background: var(--yellow-100);
}

.status.unmatched {
  color: var(--gray-700);
  background: var(--gray-200);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-green {
  color: var(--success-700);
  background: var(--success-100);
}

.badge-yellow {
  color: var(--yellow-700);
  background: var(--yellow-100);
}

.badge-gray {
  color: var(--gray-700);
  background: var(--gray-200);
}

.badge-red {
  color: var(--red-600);
  background: var(--red-100);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  color: var(--brand-800);
  background: var(--blue-100);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.source-badge.mcp {
  color: var(--success-700);
  background: var(--success-100);
}

.source-badge.manual {
  color: var(--gray-700);
  background: var(--gray-200);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-actions-text {
  flex-wrap: wrap;
}

.row-action {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-700);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.row-action:hover {
  background: var(--brand-orange-soft);
}

.row-action.text-action {
  width: auto;
  min-width: 0;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 11px;
  font-weight: 800;
}

.row-action.text-action span {
  display: inline;
}

.row-action.text-action:hover {
  border-color: rgba(242, 111, 27, 0.35);
}

.danger-action {
  color: var(--red-600);
}

.danger-action:hover {
  background: var(--red-100);
}

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

.form-section {
  margin-bottom: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.form-section h2 {
  margin: 0;
  padding: 11px 13px;
  color: var(--brand-800);
  background: linear-gradient(180deg, var(--gray-50), var(--surface-raised));
  border-bottom: 1px solid var(--gray-200);
  font-size: 14px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-4 {
  grid-column: 1 / -1;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 12px 12px;
  padding: 10px 12px;
  color: var(--gray-700);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
}

.notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--accent-600);
}

.notice.danger {
  color: var(--red-600);
  background: var(--red-100);
  border-color: rgba(220, 38, 38, 0.26);
}

.notice.danger svg {
  color: var(--red-600);
}

.permission-summary {
  display: grid;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 12px;
  color: var(--gray-700);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
}

.permission-summary strong {
  color: var(--gray-950);
}

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

.diagnostic-card,
.diagnostic-recommendations {
  padding: 12px;
  color: var(--gray-700);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.diagnostic-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--gray-950);
}

.diagnostic-lines {
  display: grid;
  gap: 7px;
  font-size: 12px;
  line-height: 1.45;
}

.diagnostic-line {
  display: grid;
  grid-template-columns: 58px auto 1fr;
  align-items: center;
  gap: 8px;
}

.diagnostic-line small {
  color: var(--gray-600);
}

.diagnostic-recommendations {
  margin: 0 12px 12px;
}

.diagnostic-records {
  display: grid;
  gap: 10px;
  margin: 0 12px 12px;
  padding: 12px;
  color: var(--gray-700);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.diagnostic-records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--gray-950);
}

.diagnostic-record {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.5fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.diagnostic-record > div:first-child {
  display: grid;
  gap: 3px;
}

.diagnostic-record > div:first-child span {
  font-size: 12px;
  line-height: 1.35;
}

.diagnostic-record-values {
  display: grid;
  gap: 6px;
}

.diagnostic-record-values span {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  font-size: 12px;
}

.diagnostic-record-values code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 6px;
  color: var(--gray-950);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.35;
}

.btn.small-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.diagnostic-recommendations ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.diagnostic-recommendations li {
  margin: 4px 0;
}

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

.choice-card {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 14px;
  color: var(--gray-800);
  text-align: left;
  background: var(--surface-raised);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.choice-card:hover {
  border-color: rgba(233, 95, 27, 0.45);
  box-shadow: var(--shadow-sm);
}

.choice-card strong {
  color: var(--brand-800);
  font-size: 16px;
}

.choice-card span:last-child {
  color: var(--gray-600);
  font-size: 13px;
  line-height: 1.35;
}

.choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--brand-800);
  background: var(--blue-100);
  border-radius: 999px;
}

.side-actions {
  min-height: 430px;
  padding: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.side-actions .btn {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
}

.representation-tabs {
  margin-top: 10px;
  background: var(--gray-50);
}

.installment-generator {
  align-items: end;
}

.installments-editor {
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.installments-head,
.installment-row {
  display: grid;
  grid-template-columns: 72px minmax(145px, 1fr) minmax(125px, 0.8fr) minmax(145px, 1fr) minmax(150px, 1fr) 56px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--gray-200);
}

.installments-head {
  color: var(--gray-600);
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.installment-row:last-child {
  border-bottom: 0;
}

.installment-row small {
  display: block;
  margin-top: 2px;
  color: var(--gray-600);
  font-size: 11px;
}

.attachments-list {
  display: grid;
  gap: 8px;
}

.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-raised), var(--gray-50));
}

.attachment-row strong,
.attachment-row small {
  display: block;
}

.attachment-row small {
  margin-top: 2px;
  color: var(--gray-600);
  font-size: 11px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.attachment-actions .text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.text-link svg {
  width: 14px;
  height: 14px;
}

.ai-extraction-panel {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--blue-600);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-raised), #f8fbff);
  box-shadow: var(--shadow-sm);
}

.ai-extraction-panel.warning {
  border-left-color: var(--yellow-700);
}

.ai-extraction-panel.danger {
  border-left-color: var(--red-600);
}

.ai-extraction-head {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
}

.ai-extraction-head strong,
.ai-extraction-head p {
  display: block;
  margin: 0;
}

.ai-extraction-head p {
  margin-top: 2px;
  color: var(--gray-600);
  font-size: 12px;
}

.ai-confidence {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--brand-800);
  background: var(--blue-100);
  font-size: 12px;
  font-weight: 900;
}

.ai-instruction-field {
  display: grid;
  gap: 6px;
}

.ai-instruction-field span,
.ai-memory-list strong {
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 800;
}

.ai-instruction-field .textarea {
  min-height: 74px;
}

.check-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.check-row input {
  margin-top: 2px;
}

.ai-memory-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  background: var(--blue-100);
}

.ai-memory-list ul {
  margin: 0;
  padding-left: 18px;
  color: var(--gray-700);
  font-size: 12px;
}

.ai-pending-actions {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(155, 106, 0, 0.2);
  border-radius: var(--radius-sm);
  background: var(--yellow-100);
}

.ai-pending-actions strong {
  color: var(--yellow-700);
  font-size: 12px;
}

.ai-pending-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--gray-700);
  font-size: 12px;
}

.ai-registration-hint {
  display: block;
  margin-top: 3px;
  color: var(--success-700);
  font-size: 11px;
  font-weight: 800;
}

.ai-registration-hint.warning {
  color: var(--yellow-700);
}

.btn.compact {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

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

.ai-extraction-actions .select {
  max-width: 320px;
}

.ai-warning-list {
  margin: 0;
  padding-left: 18px;
  color: var(--gray-700);
  font-size: 12px;
}

.text-link {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--accent-700);
  cursor: pointer;
  font-weight: 800;
  padding: 0;
  text-decoration: none;
}

.tab {
  min-height: 38px;
  padding: 8px 13px;
  color: var(--gray-600);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 900;
}

.tab.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--accent-600), #ff8640);
  border-color: rgba(233, 95, 27, 0.62);
  box-shadow: 0 8px 18px rgba(233, 95, 27, 0.16);
}

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

.review-summary > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.review-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.review-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-toggle {
  display: inline-flex;
  gap: 6px;
  margin: 12px 12px 10px;
  padding: 4px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.provider-option {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  color: var(--gray-700);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 800;
}

.provider-option.active {
  color: var(--white);
  background: var(--accent-600);
  box-shadow: var(--shadow-sm);
}

.reconciliation-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 320px minmax(300px, 1fr);
  gap: 12px;
}

.reconciliation-grid.two-columns {
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
}

.match-list {
  display: grid;
  gap: 8px;
}

.match-list.dense {
  gap: 7px;
}

.match-item {
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
}

.match-item.suggested {
  border-color: rgba(36, 112, 67, 0.22);
  background: linear-gradient(90deg, var(--success-100), var(--surface-raised) 58%);
}

.match-item.unmatched {
  border-style: dashed;
  background: var(--gray-50);
}

.match-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.match-grid {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 126px auto;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
  color: var(--gray-600);
  font-size: 12px;
}

.compact-field {
  margin: 8px 0;
}

.compact-select {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.operational-summary,
.wallet-audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.operational-summary > div,
.wallet-audit-grid > div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.operational-summary strong,
.wallet-audit-grid strong {
  display: block;
  color: var(--brand-900);
  font-size: 18px;
  line-height: 1.2;
}

.operational-summary span,
.wallet-audit-grid span,
.small-note {
  color: var(--gray-600);
  font-size: 12px;
}

.help-list {
  margin: 8px 0 12px 18px;
  padding: 0;
  color: var(--gray-700);
  font-size: 12px;
  line-height: 1.45;
}

.help-list li + li {
  margin-top: 4px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.technical-summary code {
  display: block;
  overflow-wrap: anywhere;
}

.balance-audit-panel {
  margin: 14px 0;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.category-badge.income {
  color: var(--success-700);
  background: var(--success-100);
}

.category-badge.expense {
  color: var(--accent-700);
  background: var(--accent-100);
}

.category-table {
  min-width: 820px;
}

.tree-table .group-row {
  background: var(--gray-50);
}

.tree-table .group-row:hover {
  background: var(--gray-100);
}

.tree-table .group-row td {
  font-weight: 800;
}

.category-item-row td:first-child {
  color: var(--gray-800);
}

.group-toggle {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  color: var(--brand-800);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-xs);
  background: var(--white);
  vertical-align: middle;
}

.group-toggle:hover {
  border-color: var(--accent-600);
  background: var(--accent-100);
}

.tree-indent {
  display: inline-block;
  width: 34px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--gray-300);
}

.bank-table {
  min-width: 1160px;
}

.statement-table {
  min-width: 1540px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
  color: var(--gray-700);
  font-weight: 700;
}

.drawer-action-strip {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 12px 12px;
}

.muted {
  color: var(--gray-500);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.report-card {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-raised), var(--gray-50));
  box-shadow: var(--shadow-sm);
}

.report-card[data-route] {
  cursor: pointer;
}

.report-card[data-route]:hover {
  border-color: rgba(242, 111, 27, 0.45);
  box-shadow: 0 0 0 1px rgba(233, 95, 27, 0.12), var(--shadow-sm);
}

.report-card h3 {
  margin: 0 0 8px;
  color: var(--brand-800);
  font-size: 14px;
  font-weight: 900;
}

.report-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--gray-950);
  font-size: 22px;
  line-height: 1.1;
}

.report-card p {
  margin: 0 0 12px;
  color: var(--gray-600);
}

.reports-dashboard {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.report-bars {
  display: grid;
  gap: 12px;
}

.report-bar-row {
  display: grid;
  gap: 6px;
}

.report-bar-row.clickable {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.report-bar-row.clickable:hover .report-bar-head strong,
.report-bar-row.clickable:focus-visible .report-bar-head strong {
  color: var(--accent-700);
  text-decoration: underline;
}

.report-bar-row.clickable:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 4px;
  border-radius: 6px;
}

.report-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gray-700);
}

.report-bar-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-bar-head span {
  flex: 0 0 auto;
  font-weight: 800;
}

.report-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-200);
}

.report-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.report-bar-track span.income {
  background: var(--success-700);
}

.report-bar-track span.expense {
  background: var(--accent-600);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(3, 16, 29, 0.42);
  backdrop-filter: blur(2px);
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(760px, 94vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -18px 0 52px rgba(3, 16, 29, 0.24);
}

.drawer-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--gray-50), var(--surface));
  border-bottom: 1px solid var(--gray-200);
}

.drawer-head h2 {
  margin: 0;
  color: var(--brand-800);
  font-size: 19px;
  font-weight: 900;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 18px;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  background: linear-gradient(180deg, var(--surface), var(--gray-50));
  border-top: 1px solid var(--gray-200);
}

.dashboard-drilldown-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-drilldown-table td {
  vertical-align: middle;
}

.dashboard-drilldown-table td:nth-child(2),
.dashboard-drilldown-table td:nth-child(3),
.dashboard-drilldown-table td:nth-child(4) {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
}

.summary-box strong {
  display: block;
  color: var(--gray-950);
}

.summary-box span {
  color: var(--gray-500);
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  min-width: 260px;
  padding: 12px 14px;
  color: var(--white);
  border-radius: var(--radius-md);
  background: var(--brand-800);
  box-shadow: var(--shadow-md);
}

.hidden {
  display: none !important;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

@media (max-width: 1280px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .dashboard-grid,
  .home-grid,
  .quick-strip,
  .form-page,
  .reconciliation-grid,
  .reconciliation-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .quick-strip {
    display: grid;
    align-items: start;
  }

  .filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .filter-summary {
    grid-column: 1 / -1;
  }

  .module-grid,
  .report-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 920px) {
  :root {
    --sidebar: 0px;
  }

  .sidebar {
    display: none;
  }

  .brand-lockup {
    min-width: auto;
  }

  .tenant-name {
    display: none;
  }

  .topbar {
    padding-right: 10px;
  }

  .top-actions .icon-btn:nth-child(n + 3) {
    display: none;
  }

  .main {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 86px;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    background: rgba(6, 20, 39, 0.94);
    box-shadow: 0 18px 44px rgba(3, 16, 29, 0.28);
    backdrop-filter: blur(14px);
  }

  .mobile-nav-item {
    min-width: 0;
    min-height: 48px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 5px 3px;
    color: rgba(248, 250, 252, 0.78);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-600), #ff8640);
    box-shadow: 0 8px 18px rgba(233, 95, 27, 0.24);
  }

  .metrics-grid,
  .module-grid,
  .home-modules,
  .home-dashboard-grid,
  .report-grid,
  .mini-grid,
  .filters,
  .category-filters,
  .statement-filters,
  .form-grid,
  .diagnostic-grid {
    grid-template-columns: 1fr;
  }

  .diagnostic-line,
  .diagnostic-record,
  .diagnostic-record-values span {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .form-grid .span-2,
  .form-grid .span-4 {
    grid-column: auto;
  }

  .review-summary {
    grid-template-columns: 1fr;
  }

  .attachment-row,
  .attachment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .attachment-actions .text-link,
  .attachment-actions .row-action {
    justify-content: center;
  }

  .installments-head {
    display: none;
  }

  .installment-row {
    grid-template-columns: 1fr;
  }

  .drawer {
    width: 100vw;
  }

  .drawer-foot {
    padding-bottom: max(13px, env(safe-area-inset-bottom));
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #070b13;
  }

  .app-shell {
    background: linear-gradient(180deg, #070b13 0%, #0b111d 42%, #070b13 100%);
  }

  .startup-card,
  .page,
  .metric-card,
  .module-card,
  .report-card,
  .table-shell,
  .form-section,
  .drawer,
  .combo-menu,
  .attachment-row,
  .installment-row,
  .ai-extraction-panel,
  .review-summary > div,
  .summary-box,
  .dashboard-drilldown-summary > div,
  .dashboard-drilldown-table,
  .alert-card,
  .info-card,
  .settings-card,
  .bank-card,
  .account-card,
  .diagnostic-card,
  .diagnostic-recommendations,
  .diagnostic-records,
  .diagnostic-record,
  .permission-summary {
    background: var(--white);
    border-color: var(--gray-200);
  }

  .page-header,
  .page-head,
  .filters,
  .category-filters,
  .statement-filters,
  .drawer-head,
  .drawer-foot,
  .data-table th,
  .data-table .column-filter-row td,
  .table-footer,
  .form-section h2,
  .installments-head,
  .combo-item:hover,
  .combo-item.active,
  .empty-state,
  .upload-zone {
    background: var(--gray-50);
    border-color: var(--gray-200);
  }

  .page-header,
  .drawer-head,
  .drawer-foot,
  .filters {
    background: linear-gradient(180deg, #0d1726, #0b1220);
  }

  .workspace {
    background: var(--surface);
    border-color: var(--gray-200);
  }

  .data-table td,
  .data-table th {
    border-color: var(--gray-200);
  }

  .data-table tr:hover td,
  .data-table tr.highlight td {
    background: rgba(98, 169, 238, 0.12);
  }

  .data-table tr.selected td {
    background: rgba(98, 169, 238, 0.16);
  }

  .metric-card.highlight,
  .ai-memory-list,
  .alert-card.info {
    background: #101b2c;
  }

  .module-card.featured,
  .chart,
  .match-item.suggested {
    background: linear-gradient(180deg, #101b2c 0%, var(--surface-raised) 100%);
  }

  .match-item.unmatched {
    background: var(--surface-raised);
  }

  .ai-pending-actions,
  .alert-card.warning {
    background: #211a0f;
  }

  .input,
  .select,
  .textarea,
  .combo-input,
  input,
  select,
  textarea {
    color: var(--gray-950);
    background: #0b1424;
    border-color: var(--gray-300);
  }

  .input:disabled,
  .select:disabled,
  .textarea:disabled,
  input:disabled,
  select:disabled,
  textarea:disabled {
    color: var(--gray-500);
    background: #121a29;
  }

  .input::placeholder,
  .textarea::placeholder,
  .combo-input::placeholder {
    color: var(--gray-500);
  }

  .primary,
  .btn.primary {
    color: #fff;
  }

  .tooltip::after,
  .finance-tab.active,
  .module-icon,
  .btn.primary,
  .btn.orange,
  .tab.active,
  .page-dot,
  .provider-option.active,
  .toast {
    color: #fff;
  }

  .page-title h1,
  .quick-strip h2,
  .compact-card h3,
  .panel h3,
  .module-card h3,
  .alert-card h3,
  .panel-head h2,
  .filter-summary strong,
  .btn.secondary,
  .finance-tab:hover,
  .form-section h2 {
    color: var(--gray-950);
  }

  .drawer-backdrop {
    background: rgba(0, 0, 0, 0.62);
  }

  .topbar,
  .topbar .tenant-name,
  .topbar .user-chip,
  .topbar .icon-btn {
    color: #f8fafc;
  }

  .avatar {
    color: #07162a;
    background: #f8fafc;
  }

  .drawer-head h2,
  .page-head h1,
  .page-header h1,
  .form-section h2,
  .panel-head h2,
  .choice-card strong,
  .data-table td strong {
    color: #f8fafc;
  }

  .field span,
  .data-table th,
  .table-options,
  .column-mock,
  .mini-filter,
  .muted {
    color: #b8c4d6;
  }

  .data-table td {
    color: #e7edf6;
    background: #111a2a;
  }

  .data-table th,
  .table-filter-row th {
    color: #cbd6e6;
    background: #0d1726;
  }

  .data-table tbody tr:nth-child(even) td {
    background: #132033;
  }

  .data-table tbody tr:hover td {
    background: rgba(98, 169, 238, 0.14);
  }

  .data-table tbody tr.selected td {
    background: rgba(98, 169, 238, 0.16);
  }

  .btn.secondary,
  .icon-btn.bordered {
    color: #f8fafc;
    background: #142238;
    border-color: #40516b;
  }

  .btn.secondary:hover,
  .icon-btn.bordered:hover,
  .choice-card:hover {
    background: #1a2a43;
    border-color: #ff8744;
  }

  .row-action {
    color: #ff9b62;
  }

  .row-action:disabled {
    color: #6c7a90;
    opacity: 0.5;
  }

  .choice-card {
    color: #dce6f3;
    background: #111a2a;
    border-color: #354154;
  }

  .choice-card span:last-child,
  .alert-card p,
  .review-summary span,
  .summary-box span,
  .diagnostic-line small {
    color: #aebbd0;
  }

  .account-menu,
  .profile-preview,
  .permission-summary {
    color: #e7edf6;
    background: #111a2a;
    border-color: #354154;
  }

  .account-menu button {
    color: #e7edf6;
  }

  .account-menu button:hover {
    color: #ffb083;
    background: #1a2a43;
  }

  .account-menu-head strong,
  .profile-preview strong,
  .metric-value,
  .permission-summary strong {
    color: #f8fafc;
  }

  .account-menu-head span,
  .account-menu-head small,
  .profile-preview span,
  .metric-label,
  .metric-sub,
  .field-hint,
  .table-subtext {
    color: #b8c4d6;
  }

  .diagnostic-record-values code {
    color: #f4f7fb;
    background: #0b1424;
    border-color: #354154;
  }

  .status.open,
  .status.pending,
  .status.warning {
    color: #ffd58a;
    background: rgba(242, 193, 95, 0.16);
    border-color: rgba(242, 193, 95, 0.32);
  }

  .status.paid,
  .status.received,
  .status.matched,
  .status.success {
    color: #8af0b0;
    background: rgba(98, 209, 143, 0.14);
    border-color: rgba(98, 209, 143, 0.34);
  }

  .status.overdue,
  .status.unmatched {
    color: #ffaaaa;
    background: rgba(255, 129, 129, 0.14);
    border-color: rgba(255, 129, 129, 0.32);
  }

  /* Dark mode readability pass: keep dense finance tables legible without light-mode bleed. */
  body,
  .app-shell {
    color: #e7edf6;
    background: #070d18;
  }

  .sidebar {
    background: linear-gradient(180deg, #071321 0%, #082036 100%);
    border-right-color: #1e2b3d;
  }

  .nav-section-title,
  .nav-label,
  .topbar-muted,
  .breadcrumb,
  .muted,
  .field-hint,
  .metric-sub,
  .table-subtext {
    color: #aebbd0;
  }

  .page,
  .workspace,
  .metric-card,
  .module-card,
  .report-card,
  .table-shell,
  .form-section,
  .drawer,
  .combo-menu,
  .attachment-row,
  .installment-row,
  .ai-extraction-panel,
  .review-summary > div,
  .summary-box,
  .dashboard-drilldown-summary > div,
  .dashboard-drilldown-table,
  .alert-card,
  .info-card,
  .settings-card,
  .bank-card,
  .account-card,
  .diagnostic-card,
  .diagnostic-recommendations,
  .diagnostic-record,
  .permission-summary {
    color: #e7edf6;
    background: #111a2a;
    border-color: #2b3a50;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  }

  .page-header,
  .page-head,
  .filters,
  .category-filters,
  .statement-filters,
  .drawer-head,
  .drawer-foot,
  .form-section h2,
  .installments-head,
  .table-options,
  .table-foot,
  .empty-state,
  .upload-zone {
    color: #e7edf6;
    background: #0c1524;
    border-color: #2b3a50;
  }

  .page-title h1,
  .page-head h1,
  .page-header h1,
  .drawer-head h2,
  .metric-value,
  .module-card h3,
  .report-card h3,
  .panel-head h2,
  .form-section h2,
  .filter-summary strong,
  .data-table td strong {
    color: #f8fafc;
  }

  .input,
  .select,
  .textarea,
  .combo-input,
  input,
  select,
  textarea {
    color: #f4f7fb;
    background: #091322;
    border-color: #384a63;
  }

  .input:focus,
  .select:focus,
  .textarea:focus,
  .combo-input:focus,
  input:focus,
  select:focus,
  textarea:focus {
    border-color: #ff8744;
    box-shadow: 0 0 0 2px rgba(255, 135, 68, 0.18);
  }

  .input::placeholder,
  .textarea::placeholder,
  .combo-input::placeholder,
  input::placeholder,
  textarea::placeholder {
    color: #7f8da3;
  }

  .data-table {
    color: #e7edf6;
    background: #0f1828;
  }

  .data-table th,
  .table-filter-row th,
  .data-table .column-filter-row td {
    color: #cfd8e6;
    background: #0b1423;
    border-color: #2b3a50;
  }

  .data-table td {
    color: #e7edf6;
    background: #111a2a;
    border-color: #2b3a50;
  }

  .data-table tbody tr:nth-child(even) td {
    background: #141f32;
  }

  .data-table tbody tr:hover td,
  .data-table tr.highlight td {
    color: #f8fafc;
    background: #182a43;
  }

  .data-table tbody tr.selected td,
  .data-table tr.selected td {
    color: #f8fafc;
    background: #1f3654;
  }

  .data-table tbody tr.row-warning td,
  .data-table tbody tr.warning td {
    background: #221c12;
  }

  .data-table tbody tr.row-danger td,
  .data-table tbody tr.danger td {
    background: #27151b;
  }

  .column-filter,
  .column-filter input,
  .mini-filter {
    color: #9fb0c8;
  }

  .column-filter input {
    background: transparent;
  }

  .source-badge,
  .badge,
  .status,
  .pill {
    font-weight: 800;
    border-color: rgba(255, 255, 255, 0.14);
  }

  .source-badge.mcp,
  .badge-green,
  .status.success,
  .status.matched,
  .status.received,
  .status.paid {
    color: #8af0b0;
    background: rgba(98, 209, 143, 0.16);
    border-color: rgba(98, 209, 143, 0.34);
  }

  .badge-yellow,
  .status.open,
  .status.pending,
  .status.warning {
    color: #ffd58a;
    background: rgba(242, 193, 95, 0.17);
    border-color: rgba(242, 193, 95, 0.36);
  }

  .badge-red,
  .status.overdue,
  .status.unmatched {
    color: #ffb4b4;
    background: rgba(255, 129, 129, 0.15);
    border-color: rgba(255, 129, 129, 0.34);
  }

  .btn.secondary,
  .icon-btn.bordered,
  .compact-select {
    color: #f4f7fb;
    background: #142238;
    border-color: #3b4e68;
  }

  .btn.secondary:hover,
  .icon-btn.bordered:hover {
    background: #1b2d49;
    border-color: #ff8744;
  }

  .money.positive,
  .money-positive {
    color: #7fe2a5 !important;
  }

  .money.negative,
  .money-negative {
    color: #ff9292 !important;
  }
}

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: auto;
    padding: 24px 20px 10px;
  }

  .login-copy h1 {
    font-size: 38px;
  }

  .login-signal-grid {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .login-card {
    width: calc(100% - 32px);
    margin: 18px auto 28px;
    padding: 22px;
  }
}
