:root {
  --font-sans: "Segoe UI", Aptos, Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-size-page-title: 25px;
  --line-height-page-title: 32px;
  --font-weight-page-title: 700;
  --font-size-section-title: 18px;
  --line-height-section-title: 24px;
  --font-weight-section-title: 650;
  --font-size-body: 13px;
  --line-height-body: 19px;
  --font-weight-body: 500;
  --font-size-label: 11px;
  --line-height-label: 15px;
  --font-weight-label: 700;
  --font-size-helper: 12.5px;
  --line-height-helper: 18px;
  --font-weight-helper: 500;
  --font-size-nav: 13px;
  --line-height-nav: 19px;
  --font-weight-nav: 500;
  --font-weight-nav-active: 700;
  --font-size-table: 12.5px;
  --line-height-table: 17px;
  --font-weight-table: 500;
  --font-weight-table-header: 650;
  --font-weight-amount: 700;
  --font-size-card-title: 12.5px;
  --line-height-card-title: 17px;
  --font-weight-card-title: 650;
  --font-size-card-meta: 11px;
  --line-height-card-meta: 15px;
  --font-weight-card-meta: 625;
  --font-size-card-value: 16px;
  --line-height-card-value: 22px;
  --font-weight-card-value: 650;
  --font-size-button: 12.5px;
  --line-height-button: 17px;
  --font-weight-button: 700;
  --font-size-tab: 12.5px;
  --line-height-tab: 17px;
  --font-weight-tab: 700;
  --font-size-badge: 11.5px;
  --line-height-badge: 15px;
  --font-weight-badge: 500;
  --font-size-row-action: 11.5px;
  --line-height-row-action: 15px;
  --font-weight-row-action: 650;
  --background: var(--xb-app-background);
  --surface: var(--xb-color-surface);
  --surface-muted: var(--xb-color-surface-container);
  --surface-soft: var(--xb-color-primary-container);
  --page-bg: var(--xb-page-background);
  --sidebar-bg: var(--xb-sidebar-container);
  --sidebar-bg-active: var(--xb-sidebar-active-container);
  --sidebar-border: var(--xb-sidebar-border);
  --sidebar-surface: color-mix(in srgb, var(--xb-color-surface-container-low) 86%, transparent);
  --sidebar-surface-strong: var(--xb-color-surface-container-lowest);
  --sidebar-line: var(--xb-color-outline-variant);
  --sidebar-text: var(--xb-sidebar-content);
  --sidebar-text-strong: var(--xb-color-on-surface);
  --sidebar-heading: var(--xb-color-outline);
  --sidebar-icon: var(--xb-color-on-surface-variant);
  --sidebar-hover-bg: color-mix(in srgb, var(--xb-color-on-surface) 8%, transparent);
  --sidebar-active-bg: var(--xb-sidebar-active-container);
  --sidebar-active-border: var(--xb-color-primary);
  --sidebar-active-shadow: var(--xb-elevation-1);
  --z-sidebar-rail: 2147482000;
  --z-sidebar-flyout: 2147483000;
  --primary: var(--xb-color-primary);
  --primary-hover: color-mix(in srgb, var(--xb-color-primary) 88%, var(--xb-color-on-surface));
  --primary-soft: var(--xb-color-primary-container);
  --primary-ink: var(--xb-color-on-primary);
  --dashboard-blue: var(--xb-color-primary);
  --dashboard-blue-light: var(--xb-color-primary-fixed-dim);
  --dashboard-blue-soft: var(--xb-color-primary-container);
  --dashboard-gradient: var(--xb-color-primary);
  --secondary-bg: var(--xb-color-surface-container-lowest);
  --secondary-border: var(--xb-color-outline-variant);
  --secondary-ink: var(--xb-color-on-surface);
  --border: var(--xb-color-outline-variant);
  --border-soft: color-mix(in srgb, var(--xb-color-outline-variant) 62%, transparent);
  --table-header-bg: var(--xb-table-header-container);
  --text-primary: var(--xb-color-on-surface);
  --text-secondary: var(--xb-color-on-surface-variant);
  --text-muted: var(--xb-color-outline);
  --success: var(--xb-amount-received);
  --success-bg: var(--xb-badge-complete-container);
  --success-ink: var(--xb-badge-complete-content);
  --warning: var(--xb-color-tertiary);
  --warning-bg: var(--xb-badge-warning-container);
  --warning-ink: var(--xb-badge-warning-content);
  --danger: var(--xb-color-error);
  --danger-bg: var(--xb-badge-error-container);
  --danger-ink: var(--xb-badge-error-content);
  --income: var(--xb-amount-received);
  --expense: var(--xb-amount-spent);
  --review-bg: var(--xb-badge-review-container);
  --review-ink: var(--xb-badge-review-content);
  --pending-bg: var(--xb-badge-pending-container);
  --pending-ink: var(--xb-badge-pending-content);
  --source-bg: var(--xb-badge-source-container);
  --source-ink: var(--xb-badge-source-content);
  --accent-badge-bg: var(--xb-badge-accent-container);
  --accent-badge-ink: var(--xb-badge-accent-content);
  --neutral-bg: var(--xb-badge-neutral-container);
  --neutral-ink: var(--xb-badge-neutral-content);
  --focus-ring: var(--xb-focus-ring);
  --shadow-soft: var(--xb-elevation-1);
  --shadow-panel: var(--xb-elevation-3);
  --radius-sm: var(--xb-shape-sm);
  --radius-md: var(--xb-shape-md);
  --radius-lg: var(--xb-shape-lg);
  --surface-warm: var(--surface-muted);
  --deep-green: var(--primary);
  --muted: var(--text-secondary);
  font-family:
    var(--font-sans);
  background: var(--page-bg);
  color: var(--text-primary);
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--page-bg);
  overflow-y: hidden;
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 96px 1fr;
  overflow: hidden;
}

.accountant-invite-standalone .shell {
  grid-template-columns: 1fr;
}

.accountant-invite-standalone .sidebar,
.accountant-invite-standalone .mobile-menu-button {
  display: none !important;
}

.accountant-invite-standalone .content {
  padding: 0;
  background: var(--xb-color-surface-container-low);
}

.sidebar {
  position: relative;
  z-index: var(--z-sidebar-rail);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: visible;
  overflow-x: hidden;
  padding: 14px 8px 18px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--xb-color-on-surface-variant) 34%, transparent) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--xb-color-on-surface-variant) 28%, transparent);
  background-clip: padding-box;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
}

[data-theme="dark"] .sidebar {
  background: var(--sidebar-bg);
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 54px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

.brand strong {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  padding-left: 0;
  overflow: hidden;
  border-radius: 13px;
  background: var(--xb-color-surface-container-high);
  color: var(--sidebar-text-strong);
  font-size: 0;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 0;
  box-shadow: var(--xb-elevation-1);
}

.brand strong::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 22px;
  border-radius: 999px;
  background: var(--xb-color-primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--xb-color-primary) 10%, transparent);
  transform: translate(-50%, -50%);
}

.brand span {
  display: none;
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--xb-color-primary) 13%, var(--xb-color-outline-variant));
  border-radius: 999px;
  background: var(--xb-color-surface-container-high);
  color: var(--xb-color-on-surface-variant);
  font-size: 11px;
  font-weight: var(--font-weight-badge);
  line-height: 1;
  box-shadow: var(--xb-elevation-1);
  white-space: nowrap;
}

.workspace-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--xb-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--xb-color-primary) 10%, transparent);
}

.workspace-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--xb-color-primary) 10%, transparent), transparent 38%),
    linear-gradient(180deg, var(--xb-color-surface-container-lowest), var(--xb-color-surface-container));
}

.workspace-chooser-active .shell {
  display: none;
}

.workspace-dialog {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(520px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--xb-shape-dialog, 16px);
  background:
    linear-gradient(var(--xb-color-surface-container-lowest), var(--xb-color-surface-container-lowest)) padding-box,
    conic-gradient(
      from var(--workspace-beam-angle, 0deg),
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent),
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent) 58%,
      color-mix(in srgb, var(--xb-color-primary) 20%, transparent) 68%,
      color-mix(in srgb, var(--xb-color-primary) 92%, white) 75%,
      color-mix(in srgb, #38bdf8 70%, var(--xb-color-primary)) 80%,
      color-mix(in srgb, var(--xb-color-primary) 20%, transparent) 88%,
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent)
    ) border-box;
  box-shadow: var(--xb-elevation-3);
  animation: workspace-border-beam 8s linear infinite;
}

.workspace-dialog:focus {
  outline: none;
}

.workspace-dialog > * {
  position: relative;
  z-index: 1;
}

@property --workspace-beam-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes workspace-border-beam {
  to {
    --workspace-beam-angle: 360deg;
  }
}

.workspace-dialog-header,
.workspace-dialog-body,
.workspace-dialog-footer {
  padding: 20px;
}

.workspace-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.workspace-dialog-body {
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.workspace-dialog-footer {
  border-top: 1px solid var(--border);
}

.workspace-dialog-header h2,
.workspace-manager-card h2 {
  margin: 0;
  font-size: var(--font-size-section-title);
  line-height: var(--line-height-section-title);
}

.workspace-dialog-header p,
.workspace-manager-card p,
.workspace-choice-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--font-size-helper);
}

.workspace-choice-list,
.workspace-manager-list {
  display: grid;
  gap: 10px;
}

/* The workspace picker is intentionally outside the mobile app root. Give it
   the same Professional palette and present it as a full mobile surface rather
   than a desktop dialog sitting in a second, oversized container. */
@media (max-width: 767px) {
  body.workspace-chooser-active {
    --xb-color-primary: #315f3b;
    --xb-color-on-primary: #ffffff;
    --xb-color-primary-container: #d5ead7;
    --xb-color-on-primary-container: #102116;
    --xb-color-secondary: #59645b;
    --xb-color-on-secondary: #ffffff;
    --xb-color-secondary-container: #e1e7e1;
    --xb-color-on-secondary-container: #1b211c;
    --xb-color-tertiary: #28666c;
    --xb-color-on-tertiary: #ffffff;
    --xb-color-tertiary-container: #d0e9ec;
    --xb-color-on-tertiary-container: #102124;
    --xb-color-surface: #fafbfa;
    --xb-color-surface-container-lowest: #ffffff;
    --xb-color-surface-container-low: #f5f6f4;
    --xb-color-surface-container: #eff1ee;
    --xb-color-surface-container-high: #e9ebe8;
    --xb-color-surface-container-highest: #e2e5e1;
    --xb-color-on-surface: #1a1c1a;
    --xb-color-on-surface-variant: #444844;
    --xb-color-outline: #747874;
    --xb-color-outline-variant: #c4c8c3;
    --xb-field-border: var(--xb-color-outline);
    --xb-field-container: var(--xb-color-surface-container-lowest);
    --xb-field-content: var(--xb-color-on-surface);
    --xb-field-label: var(--xb-color-on-surface-variant);
    --xb-menu-item-hover-container: var(--xb-color-primary-container);
    --surface: var(--xb-color-surface);
    --text: var(--xb-color-on-surface);
    --text-muted: var(--xb-color-on-surface-variant);
    --text-primary: var(--xb-color-on-surface);
    --border: var(--xb-color-outline-variant);
    --primary: var(--xb-color-primary);
    background: var(--xb-color-surface);
  }

  .workspace-dialog-backdrop {
    display: block;
    padding: 0;
    overflow-y: auto;
    background: var(--xb-color-surface);
  }

  .workspace-dialog {
    display: block;
    width: 100%;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: var(--xb-color-surface);
    box-shadow: none;
    animation: none;
  }

  .workspace-dialog-header,
  .workspace-dialog-footer {
    background: var(--xb-color-surface);
  }

  .workspace-dialog-body {
    overflow: visible;
    scrollbar-gutter: auto;
  }
}

.workspace-choice,
.workspace-manager-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--xb-shape-card, var(--radius-lg));
  background: var(--surface);
  text-align: left;
}

.workspace-choice {
  cursor: pointer;
}

.workspace-choice:hover {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}

.workspace-choice:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--xb-color-primary) 38%, transparent);
  outline-offset: 2px;
  border-color: color-mix(in srgb, var(--xb-color-primary) 54%, var(--xb-color-outline-variant));
}

.workspace-choice strong,
.workspace-manager-row strong {
  display: block;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.workspace-choice-current,
.workspace-subscription-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--font-size-badge);
}

.workspace-create-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.workspace-create-form .field {
  flex: 1;
}

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

.workspace-purchase-form > p {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-helper);
  line-height: 1.45;
}

.workspace-purchase-form > p strong {
  color: var(--text-primary);
}

.workspace-create-error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
  font-size: var(--font-size-helper);
  line-height: 1.4;
}

@media (max-width: 760px) {
  .workspace-purchase-form,
  .workspace-create-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-purchase-form .small-primary,
  .workspace-create-form .small-primary {
    width: 100%;
  }
}

.workspace-manager-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.workspace-manager-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
}

.workspace-details-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.workspace-detail-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.workspace-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  font-size: var(--font-size-helper);
}

.workspace-detail-row span:first-child {
  color: var(--muted);
}

.workspace-detail-row strong {
  max-width: 180px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-manager-heading,
.workspace-manager-page {
  width: min(100%, 1080px);
  margin-inline: auto;
}

.workspace-manager-intro {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--font-size-helper);
  line-height: 1.5;
}

.workspace-manager-heading .small-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding-inline: 18px;
  gap: 8px;
}

.workspace-manager-heading .small-primary i {
  width: 16px;
  height: 16px;
}

.workspace-manager-page {
  margin-top: 18px;
}

.workspace-manager-list {
  gap: 14px;
}

.workspace-card {
  position: relative;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.workspace-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: 0 4px 12px rgb(0 0 0 / 5%);
  transform: translateY(-1px);
}

.workspace-card.is-current {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
}

.workspace-card.is-current::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: -1px;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.workspace-card-header,
.workspace-card-bottom,
.workspace-card-footer,
.workspace-card-identity,
.workspace-card-actions,
.workspace-card-rename-actions {
  display: flex;
  align-items: center;
}

.workspace-card-header { justify-content: space-between; align-items: flex-start; gap: 16px; }
.workspace-card-identity { min-width: 0; flex: 1; gap: 12px; }
.workspace-card-avatar { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 17px; font-weight: 700; }
.workspace-card-name-block { min-width: 0; flex: 1 1 auto; max-width: 1080px; }
.workspace-card-name-block h2 { display: -webkit-box; margin: 0; overflow: hidden; color: var(--text-primary); font-size: 18px; font-weight: 650; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.workspace-card-profile { display: grid; gap: 3px; margin-top: 4px; font-size: 13px; line-height: 1.35; }
.workspace-card-profile strong { color: var(--text-secondary); font-size: 14px; font-weight: 550; }
.workspace-card-profile span { color: var(--muted); }
.workspace-card-current { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; }
.workspace-card-current span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.workspace-card.is-renaming .workspace-card-header { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 0; }
.workspace-card.is-renaming .workspace-card-name-block { max-width: none; }
.workspace-card.is-renaming .workspace-card-current { justify-self: end; }
.workspace-card-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: end; gap: 24px; margin: 20px 0 0 56px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent); }
.workspace-card-metadata { display: grid; grid-template-columns: .8fr 1.1fr .8fr; gap: 16px; margin: 0; }
.workspace-card-metadata div { min-width: 0; }
.workspace-card-metadata dt { color: var(--muted); font-size: 12px; }
.workspace-card-metadata dd { margin: 4px 0 0; overflow: hidden; color: var(--text-primary); font-size: 14px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.workspace-card-footer { justify-content: flex-start; min-height: 40px; }
.workspace-card-actions, .workspace-card-rename-actions { width: 100%; gap: 8px; }
.workspace-card-actions .compact, .workspace-card-rename-actions .compact { min-height: 40px; }
.workspace-card-name-input { display: grid; gap: 4px; }
.workspace-card-name-input label { display: block; }
.workspace-card-name-input input { width: 100%; max-width: 1080px; min-height: 40px; padding: 0 10px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 650; }
.workspace-card-name-counter { color: var(--muted); font-size: 11px; line-height: 1.2; }
.workspace-card-name-counter.is-near-limit { color: var(--primary); font-weight: 650; }
.workspace-manager-empty { display: grid; justify-items: start; gap: 10px; padding: 36px 24px; border: 1px dashed var(--border); border-radius: 16px; background: var(--surface); }
.workspace-manager-empty i { width: 24px; height: 24px; color: var(--primary); }
.workspace-manager-empty h2, .workspace-manager-empty p { margin: 0; }
.workspace-manager-empty p { color: var(--muted); }

@media (max-width: 760px) {
  .workspace-card { padding: 18px; }
  .workspace-card-header { align-items: flex-start; }
  .workspace-card.is-renaming .workspace-card-header { display: flex; gap: 16px; }
  .workspace-card-bottom { grid-template-columns: 1fr; gap: 14px; margin-left: 0; }
  .workspace-card-metadata { grid-template-columns: 1fr; gap: 12px; }
  .workspace-card-footer { justify-content: stretch; }
  .workspace-card-actions, .workspace-card-rename-actions { flex: 1; flex-direction: column; align-items: stretch; }
  .workspace-card-actions button, .workspace-card-rename-actions button { width: 100%; }
}

.dashboard-workspace-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--font-size-helper);
}

.nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end;
  font-family: var(--font-sans);
  min-height: 0;
  min-width: 0;
}

.nav-section {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-heading,
.nav-toggle,
.nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 62px;
  padding: 7px 4px;
  border-left: 0;
  border-radius: 16px;
  line-height: 16px;
}

.nav-heading,
.nav-toggle {
  width: 100%;
  margin-top: 0;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

.nav-heading .nav-icon,
.nav-toggle .nav-icon {
  color: var(--sidebar-icon);
  opacity: 1;
}

.nav-toggle {
  flex-direction: column;
  cursor: pointer;
}

.nav-toggle:hover {
  color: var(--sidebar-text-strong);
}

.nav-toggle:hover .nav-icon,
.nav-toggle:hover .nav-caret {
  color: var(--sidebar-text-strong);
}

.nav-caret {
  width: 14px;
  height: 14px;
  margin-left: 0;
  color: var(--sidebar-heading);
  transition: transform 160ms ease, color 160ms ease;
}

.nav-flyout-parent .nav-caret {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
}

.nav-flyout-parent:hover .nav-caret,
.nav-flyout-parent:focus-within .nav-caret,
.nav-flyout-parent[data-open="true"] .nav-caret {
  color: var(--sidebar-active-border);
}

.nav a {
  flex-direction: column;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.nav a span,
.nav-heading span,
.nav-toggle span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
  stroke-width: 1.9;
}

.nav .nav-icon {
  width: 22px;
  height: 22px;
  color: var(--sidebar-icon);
  stroke-width: 1.85;
}

.nav > .nav-section:first-child > a {
  color: var(--sidebar-text-strong);
  font-weight: 600;
}

.nav-sub {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-sub a {
  min-height: 34px;
  padding: 0 11px;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.nav-sub a .nav-icon {
  display: none;
}

.nav-flyout-parent {
  position: relative;
}

.nav-flyout {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 96px;
  z-index: var(--z-sidebar-flyout);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 240px;
  padding: 24px 14px 28px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--xb-menu-container);
  box-shadow: var(--xb-elevation-3);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-12px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.nav-flyout::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -24px;
  width: 24px;
}

.nav-flyout-parent:hover > .nav-flyout,
.nav-flyout-parent:focus-within > .nav-flyout,
.nav-flyout[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.nav-flyout-parent[data-selection-complete="true"] > .nav-flyout,
.nav-flyout-parent[data-selection-complete="true"]:hover > .nav-flyout,
.nav-flyout-parent[data-selection-complete="true"]:focus-within > .nav-flyout,
.nav-flyout-parent[data-selection-complete="true"] > .nav-flyout[data-open="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-12px);
}

.nav-flyout-title {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 0 0 12px;
  padding: 0 10px;
  color: var(--sidebar-text-strong);
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-section-title);
  line-height: var(--line-height-section-title);
}

.nav a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-strong);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--xb-color-surface-bright) 5%, transparent);
}

.nav-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--xb-color-on-surface) 4%, transparent);
  color: var(--sidebar-text-strong);
}

.nav a:hover .nav-icon {
  color: var(--sidebar-text-strong);
}

.nav a[aria-current="page"],
.nav-toggle[aria-current="page"] {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-border);
  font-weight: 700;
  box-shadow: var(--sidebar-active-shadow);
}

.nav a[aria-current="page"] .nav-icon,
.nav-toggle[aria-current="page"] .nav-icon,
.nav-toggle[aria-current="page"] .nav-caret {
  color: var(--sidebar-active-border);
}

.nav a[aria-current="page"]:hover,
.nav-toggle[aria-current="page"]:hover {
  background: color-mix(in srgb, var(--xb-color-primary) 10%, var(--sidebar-active-bg));
  color: var(--sidebar-active-border);
}

.nav a[aria-current="page"]:hover .nav-icon,
.nav-toggle[aria-current="page"]:hover .nav-icon,
.nav-toggle[aria-current="page"]:hover .nav-caret {
  color: var(--sidebar-active-border);
}

.sidebar-utility {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.me-menu-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 56px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: var(--xb-shape-lg);
  background: transparent;
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0;
  transition:
    background-color var(--xb-motion-state),
    border-color var(--xb-motion-state),
    color var(--xb-motion-state),
    box-shadow var(--xb-motion-state);
}

.me-menu-button:hover,
.me-menu-button[aria-expanded="true"] {
  background: var(--sidebar-hover-bg);
  border-color: color-mix(in srgb, var(--xb-color-outline-variant) 60%, transparent);
  color: var(--sidebar-text-strong);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--xb-color-surface-bright) 5%, transparent);
}

.me-menu-button:hover .me-avatar,
.me-menu-button[aria-expanded="true"] .me-avatar {
  box-shadow:
    var(--xb-elevation-1),
    0 0 0 3px color-mix(in srgb, var(--xb-color-primary) 10%, transparent);
}

.me-avatar {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(
      color-mix(in srgb, var(--xb-color-primary) 16%, var(--xb-color-surface-container-high)),
      color-mix(in srgb, var(--xb-color-primary) 16%, var(--xb-color-surface-container-high))
    ) padding-box,
    conic-gradient(
      from var(--workspace-beam-angle, 0deg),
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent),
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent) 58%,
      color-mix(in srgb, var(--xb-color-primary) 20%, transparent) 68%,
      color-mix(in srgb, var(--xb-color-primary) 92%, white) 75%,
      color-mix(in srgb, #38bdf8 70%, var(--xb-color-primary)) 80%,
      color-mix(in srgb, var(--xb-color-primary) 20%, transparent) 88%,
      color-mix(in srgb, var(--xb-color-outline-variant) 78%, transparent)
    ) border-box;
  color: var(--sidebar-active-border);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--xb-elevation-1);
  animation: workspace-border-beam 8s linear infinite;
}

.me-menu-button .me-avatar::before,
.me-avatar-trigger .me-avatar::before {
  content: none;
}

.me-avatar svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.1;
}

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

@media (prefers-reduced-motion: reduce) {
  .workspace-dialog,
  .me-avatar {
    animation: none;
  }
}

.me-menu-button > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-popover {
  position: fixed;
  left: 104px;
  bottom: 10px;
  z-index: var(--z-sidebar-flyout);
  display: grid;
  gap: 8px;
  width: 286px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--xb-menu-border);
  border-radius: var(--xb-shape-lg);
  background: var(--xb-menu-container);
  color: var(--xb-menu-content);
  box-shadow: var(--xb-elevation-3);
}

.me-popover[hidden] {
  display: none;
}

.me-popover-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--xb-menu-border);
}

.me-popover .me-avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.me-avatar-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.me-avatar-trigger:hover .me-avatar,
.me-avatar-trigger[aria-expanded="true"] .me-avatar {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--xb-color-primary) 13%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--xb-color-primary) 34%, transparent);
}

.me-user {
  display: grid;
  min-width: 0;
  gap: 2px;
}

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

.me-user strong {
  color: var(--xb-color-on-surface);
  font-size: 13px;
  font-weight: 650;
}

.me-user span {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
}

.me-menu-list {
  display: grid;
  gap: 4px;
}

.me-avatar-popover {
  position: absolute;
  top: 62px;
  left: 10px;
  right: 10px;
  z-index: calc(var(--z-sidebar-flyout) + 1);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--xb-menu-border);
  border-radius: var(--xb-shape-md);
  background: var(--xb-menu-container);
  box-shadow: var(--xb-elevation-3);
  max-height: min(440px, calc(100vh - 132px));
  overflow-y: auto;
}

.me-avatar-popover[hidden] {
  display: none;
}

.me-avatar-popover > span {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 650;
}

.me-avatar-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.me-avatar-option {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 50px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--xb-menu-border);
  border-radius: 999px;
  background: var(--xb-color-surface-container-low);
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition:
    background-color var(--xb-motion-state),
    border-color var(--xb-motion-state),
    color var(--xb-motion-state),
    box-shadow var(--xb-motion-state),
    transform var(--xb-motion-state);
}

.me-avatar-option:hover {
  color: var(--xb-color-primary);
  transform: translateY(-1px);
}

.me-avatar-option[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--xb-color-primary) 48%, var(--xb-menu-border));
  background: var(--xb-button-tonal-container);
  color: var(--xb-button-tonal-content);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--xb-color-primary) 10%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--xb-color-primary) 16%, transparent);
}

.me-avatar-option i,
.me-avatar-option svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.me-avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

.me-menu-section-label {
  padding: 6px 9px 1px;
  color: var(--xb-color-on-surface-variant);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.me-menu-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--xb-menu-border);
}

.me-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--xb-shape-sm);
  background: transparent;
  color: var(--xb-menu-content);
  cursor: pointer;
  font-size: var(--font-size-button);
  font-weight: 600;
  text-align: left;
  transition:
    background-color var(--xb-motion-state),
    box-shadow var(--xb-motion-state),
    color var(--xb-motion-state);
}

a.me-menu-item {
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
}

.me-menu-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.me-menu-label i,
.me-menu-label svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 2;
}

.me-menu-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-menu-workspace {
  min-height: 46px;
}

.me-menu-workspace .me-menu-label {
  align-items: center;
}

.me-menu-workspace-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.me-menu-workspace-name {
  color: var(--xb-color-on-surface);
  font-size: var(--font-size-button);
  font-weight: 650;
  line-height: 1.2;
}

.me-menu-workspace-meta {
  color: var(--xb-color-on-surface-variant);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
}

.me-menu-workspace-arrow {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--xb-color-on-surface-variant);
  stroke-width: 2;
}

.me-menu-item[disabled] {
  cursor: default;
  opacity: 0.52;
}

.me-menu-item:hover {
  background: color-mix(in srgb, var(--sidebar-hover-bg) 70%, transparent);
}

.me-menu-item:not([disabled]):hover,
.me-menu-item:not([disabled]):focus-visible {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-strong);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--xb-color-surface-bright) 5%, transparent);
}

.me-menu-item:not([disabled]):hover .me-menu-label i,
.me-menu-item:not([disabled]):hover .me-menu-label svg,
.me-menu-item:not([disabled]):focus-visible .me-menu-label i,
.me-menu-item:not([disabled]):focus-visible .me-menu-label svg {
  color: var(--sidebar-text-strong);
}

.me-menu-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--xb-color-primary) 36%, transparent);
  outline-offset: 2px;
}

.me-menu-item[disabled]:hover {
  opacity: 0.68;
  background: color-mix(in srgb, var(--sidebar-hover-bg) 52%, transparent);
}

.me-menu-meta {
  color: var(--xb-color-on-surface-variant);
  font-size: 11px;
  font-weight: 500;
}

.me-theme-row {
  display: grid;
  gap: 8px;
  padding: 8px 9px 10px;
  border-radius: var(--xb-shape-sm);
}

.me-theme-row > span {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 650;
}

.me-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--xb-menu-border);
  border-radius: var(--xb-shape-sm);
}

.me-theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--xb-menu-content);
  font-size: var(--font-size-button);
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.me-theme-option i,
.me-theme-option svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: currentColor;
  stroke-width: 2;
}

.me-theme-option + .me-theme-option {
  border-left: 1px solid var(--xb-menu-border);
}

.me-theme-option[aria-pressed="true"] {
  background: var(--xb-button-tonal-container);
  color: var(--xb-button-tonal-content);
}

[data-theme="dark"] .brand {
  border-color: color-mix(in srgb, var(--xb-color-primary) 14%, var(--xb-color-outline-variant));
  box-shadow: var(--xb-elevation-2);
}

[data-theme="dark"] .brand strong {
  color: var(--sidebar-text-strong);
}

[data-theme="dark"] .brand span {
  color: var(--sidebar-text);
}

[data-theme="dark"] .workspace-badge {
  border-color: color-mix(in srgb, var(--xb-color-primary) 20%, var(--xb-color-outline-variant));
  background: color-mix(in srgb, var(--xb-color-primary) 12%, var(--xb-color-surface));
  color: var(--sidebar-text-strong);
  box-shadow: var(--xb-elevation-1);
}

[data-theme="dark"] .nav-heading,
[data-theme="dark"] .nav-heading .nav-icon {
  color: var(--sidebar-heading);
}

[data-theme="dark"] .nav a,
[data-theme="dark"] .nav-sub a {
  color: var(--sidebar-text);
}

[data-theme="dark"] .nav .nav-icon {
  color: var(--sidebar-icon);
}

[data-theme="dark"] .nav a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-strong);
}

[data-theme="dark"] .nav a:hover .nav-icon {
  color: var(--sidebar-text-strong);
}

[data-theme="dark"] .nav a[aria-current="page"]:hover,
[data-theme="dark"] .nav a[aria-current="page"] {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: var(--sidebar-active-border);
}

[data-theme="dark"] .nav a[aria-current="page"] .nav-icon,
[data-theme="dark"] .nav a[aria-current="page"]:hover .nav-icon {
  color: var(--sidebar-active-border);
}

@media (max-height: 760px) and (min-width: 721px) {
  .sidebar {
    padding: 8px 7px 10px;
  }

  .brand {
    height: 42px;
    margin-bottom: 4px;
  }

  .brand strong {
    width: 30px;
    height: 30px;
    border-radius: 12px;
  }

  .brand strong::before {
    width: 9px;
    height: 19px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--xb-color-primary) 10%, transparent);
  }

  .nav {
    gap: 4px;
  }

  .nav-heading,
  .nav-toggle,
  .nav a {
    min-height: 52px;
    padding: 4px 3px;
    border-radius: 14px;
    font-size: 11.5px;
    line-height: 14px;
  }

  .nav .nav-icon {
    width: 20px;
    height: 20px;
  }

  .nav-flyout-parent .nav-caret {
    right: 5px;
    width: 12px;
    height: 12px;
  }

  .sidebar-utility {
    margin-top: 5px;
  }

  .me-menu-button {
    min-height: 46px;
    gap: 3px;
    padding: 4px 3px;
    border-radius: 14px;
    font-size: 11.5px;
    line-height: 14px;
  }

  .me-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .me-popover {
    bottom: 10px;
  }
}

@media (min-height: 1101px) and (min-width: 721px) {
  .nav {
    flex: 0 0 auto;
    justify-content: flex-start;
    margin-top: clamp(130px, 18vh, 260px);
  }

  .nav-flyout {
    justify-content: center;
  }

  .sidebar-utility {
    margin-top: auto;
  }
}

.content {
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 28px 30px;
  background: var(--xb-color-surface-container-low);
}

.mobile-menu-button {
  display: none;
  width: fit-content;
  margin-bottom: 14px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.workspace {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

.status {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
}

.status[data-kind="error"] {
  border-color: var(--danger);
  color: var(--danger-ink);
}

.status[data-kind="ok"] {
  border-color: var(--success);
  color: var(--success-ink);
}

.status[data-kind="busy"] {
  border-color: var(--primary);
  color: var(--primary);
}

.toast-viewport {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: calc(var(--z-sidebar-flyout) + 2);
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 48px));
  pointer-events: none;
  transform: translateX(-50%);
}

.app-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--xb-menu-border);
  border-radius: var(--xb-shape-md);
  background: var(--xb-menu-container);
  color: var(--xb-menu-content);
  box-shadow: var(--xb-elevation-3);
  pointer-events: auto;
  transform: translateY(8px);
  animation: toast-in 160ms ease forwards;
}

.app-toast-main {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  gap: 10px;
}

.app-toast-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  color: var(--xb-color-success, var(--success));
}

.app-toast-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.25;
}

.app-toast[data-type="success"] {
  border-color: color-mix(in srgb, var(--xb-color-success, var(--success)) 22%, var(--xb-menu-border));
}

.app-toast[data-exiting="true"] {
  animation: toast-out 140ms ease forwards;
}

.app-toast-content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.app-toast-title {
  color: var(--xb-color-on-surface);
  font-size: var(--font-size-body);
  font-weight: 650;
  line-height: var(--line-height-body);
}

.app-toast-description {
  overflow: hidden;
  color: var(--xb-color-on-surface-variant);
  font-size: var(--font-size-helper);
  font-weight: 500;
  line-height: var(--line-height-helper);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-toast-action {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--xb-shape-sm);
  background: transparent;
  color: var(--xb-color-primary);
  font-size: var(--font-size-button);
  font-weight: 700;
  line-height: var(--line-height-button);
  white-space: nowrap;
}

.app-toast-action:hover {
  background: color-mix(in srgb, var(--xb-color-primary) 8%, transparent);
}

.app-toast-action:disabled {
  cursor: default;
  opacity: 0.55;
}

@keyframes toast-in {
  to {
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

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

.metric {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.expense-summary {
  margin-bottom: 0;
}

.expense-summary .metric {
  min-height: 86px;
  box-shadow: none;
}

.expense-summary .metric strong {
  margin-top: 7px;
  font-size: 21px;
}

.metric span {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
  letter-spacing: 0;
}

.dashboard-view {
  display: grid;
  gap: 16px;
}

.dashboard-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-topbar h1 {
  margin: 0;
  font-size: var(--font-size-page-title);
  line-height: 1.2;
  letter-spacing: 0;
}

.dashboard-period-filter,
.dashboard-hero-period-filter {
  display: grid;
  gap: 5px;
  min-width: 220px;
}

.dashboard-period-filter span,
.dashboard-hero-period-filter span {
  color: var(--xb-field-label);
  font-size: var(--font-size-label);
  font-weight: 650;
}

.dashboard-hero-period-filter {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 6;
  pointer-events: auto;
}

.dashboard-hero-period-filter span {
  color: color-mix(in srgb, var(--xb-color-on-primary) 86%, transparent);
}

.dashboard-loading-indicator {
  position: absolute;
  right: 24px;
  bottom: 20px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-on-primary) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--xb-color-on-primary) 12%, transparent);
  color: color-mix(in srgb, var(--xb-color-on-primary) 88%, transparent);
  font-size: 12px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--xb-color-on-primary) 12%, transparent);
}

.dashboard-loading-indicator[hidden] {
  display: none;
}

.dashboard-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--xb-color-on-primary) 30%, transparent);
  border-top-color: var(--xb-color-on-primary);
  border-radius: 999px;
  animation: dashboard-spin 0.8s linear infinite;
}

@keyframes dashboard-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 170px;
  padding: 24px 28px;
  border-radius: 18px;
  background: var(--xb-color-primary);
  color: var(--xb-color-on-primary);
  box-shadow: var(--xb-elevation-2);
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: -42px -24px -54px auto;
  z-index: 1;
  width: min(1344px, 104%);
  background-image: url("data:image/svg+xml,%3Csvg width='104' height='90' viewBox='0 0 104 90' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='white' stroke-opacity='.29' stroke-width='1.2'%3E%3Cpath d='M26 1 51 15.5v29L26 59 1 44.5v-29L26 1Z'/%3E%3Cpath d='M78 1 103 15.5v29L78 59 53 44.5v-29L78 1Z'/%3E%3Cpath d='M52 45 77 59.5v29L52 103 27 88.5v-29L52 45Z'/%3E%3C/g%3E%3Cg fill='white' fill-opacity='.025'%3E%3Cpath d='M78 1 103 15.5v29L78 59 53 44.5v-29L78 1Z'/%3E%3Cpath d='M52 45 77 59.5v29L52 103 27 88.5v-29L52 45Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 83px;
  background-position: right center;
  opacity: 0.29;
  transform: skewY(-6deg);
  mask-image:
    radial-gradient(920px circle at 72% 42%, rgb(0 0 0 / 100%) 0 52%, transparent 92%),
    linear-gradient(90deg, transparent 0%, rgb(0 0 0 / 12%) 10%, rgb(0 0 0 / 38%) 30%, rgb(0 0 0 / 72%) 52%, rgb(0 0 0 / 100%) 70%);
  pointer-events: none;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(680px circle at 88% 18%, color-mix(in srgb, var(--xb-color-on-primary) 22%, transparent), transparent 52%),
    linear-gradient(118deg, color-mix(in srgb, var(--xb-color-primary) 92%, #2f1e75) 0%, var(--xb-color-primary) 46%, color-mix(in srgb, var(--xb-color-primary) 74%, #111827) 100%);
  pointer-events: none;
}

.dashboard-hero-main,
.dashboard-hero-meta {
  position: relative;
  z-index: 2;
}

.dashboard-hero h1 {
  margin: 0;
  padding-right: 260px;
  font-size: 22px;
  letter-spacing: 0;
}

.dashboard-hero-value {
  margin-top: 22px;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}

.dashboard-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: color-mix(in srgb, var(--xb-color-on-primary) 82%, transparent);
  font-size: 13px;
}

.dashboard-hero-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--xb-color-on-primary) 14%, transparent);
}

.dashboard-period-select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--radius-sm);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-weight: 650;
}

.dashboard-status {
  justify-content: center;
  background: var(--xb-color-surface-container-lowest);
}

.dashboard-hero-trend {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px 8px;
  align-items: baseline;
  width: fit-content;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-on-primary) 20%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--xb-color-on-primary) 12%, transparent);
  color: color-mix(in srgb, var(--xb-color-on-primary) 88%, transparent);
  font-size: 13px;
  font-weight: 650;
}

.dashboard-hero-trend strong {
  color: var(--xb-color-on-primary);
  font-size: 15px;
}

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

.dashboard-kpi-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.dashboard-kpi-card.is-clickable,
.dashboard-chart-point {
  cursor: pointer;
}

.dashboard-kpi-card.is-clickable:hover {
  border-color: color-mix(in srgb, var(--xb-color-primary) 24%, var(--border));
  box-shadow: var(--xb-elevation-3);
  transform: translateY(-2px);
}

.dashboard-kpi-card.is-clickable:focus-visible,
.dashboard-chart-point:focus-visible {
  outline: 2px solid var(--xb-color-primary);
  outline-offset: 3px;
}

.dashboard-kpi-card span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.dashboard-kpi-card > span {
  padding-right: 118px;
}

.dashboard-kpi-card strong {
  color: var(--text-primary);
  font-size: 28px;
  letter-spacing: 0;
}

.dashboard-kpi-card strong.dashboard-amount-income {
  color: var(--xb-chart-revenue);
}

.dashboard-kpi-card strong.dashboard-amount-expense {
  color: var(--xb-chart-expense);
}

.dashboard-hero-value.dashboard-counting,
.dashboard-kpi-card strong.dashboard-counting {
  animation: dashboardCountFade 460ms ease-out both;
}

.dashboard-kpi-card small {
  color: var(--text-muted);
  font-size: 12px;
}

.dashboard-kpi-sparkline {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 104px;
  height: 38px;
  pointer-events: none;
  opacity: 0.92;
}

.dashboard-kpi-sparkline svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dashboard-kpi-sparkline path,
.dashboard-kpi-sparkline polyline {
  vector-effect: non-scaling-stroke;
}

.dashboard-kpi-sparkline .sparkline-fill {
  opacity: 1;
}

.dashboard-kpi-sparkline .sparkline-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-kpi-sparkline .sparkline-dot {
  stroke: var(--surface);
  stroke-width: 1.5;
}

.dashboard-kpi-sparkline.sparkline-animated .sparkline-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: sparkline-draw 760ms cubic-bezier(0.22, 1, 0.36, 1) 90ms forwards;
}

.dashboard-kpi-sparkline.sparkline-animated .sparkline-fill {
  opacity: 0;
  animation: sparkline-fill-in 420ms ease-out 430ms forwards;
}

.dashboard-kpi-sparkline.sparkline-animated .sparkline-dot {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: sparkline-dot-in 260ms ease-out 720ms forwards;
}

@keyframes sparkline-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes sparkline-fill-in {
  to { opacity: 1; }
}

@keyframes sparkline-dot-in {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-kpi-sparkline.sparkline-animated .sparkline-line,
  .dashboard-kpi-sparkline.sparkline-animated .sparkline-fill,
  .dashboard-kpi-sparkline.sparkline-animated .sparkline-dot {
    animation: none;
    stroke-dashoffset: 0;
    opacity: revert;
    transform: none;
  }
}

@media (max-width: 1320px) {
  .dashboard-kpi-card > span {
    padding-right: 98px;
  }

  .dashboard-kpi-card strong {
    font-size: 26px;
    line-height: 1.08;
  }

  .dashboard-kpi-sparkline {
    width: 84px;
    height: 36px;
  }
}

.dashboard-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-trend .dashboard-trend-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke-width: 2.4;
}

.dashboard-trend-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.dashboard-trend-vs {
  margin-left: 3px;
  margin-right: 3px;
  color: var(--text-primary);
  font-weight: 650;
}

.dashboard-trend-period {
  color: var(--text-secondary);
  font-weight: 400;
}

.dashboard-trend.revenue {
  color: var(--xb-chart-revenue);
}

.dashboard-trend.expense {
  color: var(--xb-chart-expense);
}

.dashboard-trend.gst {
  color: var(--xb-alert-warning-content);
}

.dashboard-trend.activity {
  color: var(--xb-color-primary);
}

.dashboard-trend.neutral {
  color: color-mix(in srgb, var(--text-muted) 72%, transparent);
  font-weight: 400;
  opacity: 0.72;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.dashboard-grid > .dashboard-panel:first-child {
  grid-column: span 3;
}

.dashboard-grid > .dashboard-panel:last-child {
  grid-column: span 1;
}

.dashboard-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.dashboard-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.dashboard-panel-header > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-panel-header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.dashboard-panel-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-chart-range-control {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--xb-color-outline-variant, var(--border));
  border-radius: var(--xb-shape-md, 8px);
  background: var(--xb-color-surface-container-low, var(--surface-soft));
}

.dashboard-chart-range-button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--xb-color-outline-variant, var(--border));
  background: transparent;
  color: var(--xb-color-on-surface-variant, var(--text-secondary));
  font-family: var(--font-sans);
  font-size: var(--font-size-button);
  line-height: var(--line-height-button);
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.dashboard-chart-range-button:last-child {
  border-right: 0;
}

.dashboard-chart-range-button:hover {
  background: color-mix(in srgb, var(--xb-color-primary) 8%, transparent);
  color: var(--xb-color-on-surface, var(--text-primary));
}

.dashboard-chart-range-button.is-active {
  background: var(--xb-color-surface, var(--surface));
  color: var(--xb-color-primary, var(--primary));
  box-shadow: inset 0 -2px 0 var(--xb-color-primary, var(--primary));
}

.dashboard-chart,
.dashboard-category-list,
.dashboard-activity-list {
  display: grid;
  gap: 10px;
}

.dashboard-chart,
.dashboard-category-list {
  flex: 1;
}

.dashboard-svg-chart {
  display: grid;
  gap: 12px;
}

.dashboard-svg-chart svg {
  display: block;
  width: 100%;
  height: 260px;
  overflow: visible;
}

.dashboard-chart-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

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

.dashboard-chart-legend i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.dashboard-chart-legend .income {
  background: var(--xb-chart-revenue);
}

.dashboard-chart-legend .expense {
  background: var(--xb-chart-expense);
}

.dashboard-chart-point {
  outline: none;
}

.dashboard-chart-area {
  pointer-events: none;
}

.dashboard-chart-line,
.dashboard-chart-grid,
.dashboard-chart-axis,
.dashboard-chart-labels {
  pointer-events: none;
}

.dashboard-chart-point circle {
  transition: r 160ms ease, opacity 160ms ease;
}

.dashboard-chart-hover-layer {
  outline: none;
}

.dashboard-chart-hover-zone {
  fill: transparent;
  cursor: pointer;
}

.dashboard-chart-hover-layer .dashboard-chart-crosshair,
.dashboard-chart-hover-layer .dashboard-chart-hover-marker,
.dashboard-chart-hover-layer .dashboard-chart-tooltip,
.dashboard-chart-hover-layer .dashboard-chart-axis-date {
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.dashboard-chart-hover-layer .dashboard-chart-tooltip,
.dashboard-chart-hover-layer .dashboard-chart-axis-date {
  transform: translateY(6px);
}

.dashboard-chart-hover-layer:hover .dashboard-chart-crosshair,
.dashboard-chart-hover-layer:hover .dashboard-chart-hover-marker,
.dashboard-chart-hover-layer:hover .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:hover .dashboard-chart-axis-date,
.dashboard-chart-hover-layer:focus .dashboard-chart-crosshair,
.dashboard-chart-hover-layer:focus .dashboard-chart-hover-marker,
.dashboard-chart-hover-layer:focus .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:focus .dashboard-chart-axis-date,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-crosshair,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-hover-marker,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-axis-date {
  opacity: 1;
}

.dashboard-chart-hover-layer:hover .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:hover .dashboard-chart-axis-date,
.dashboard-chart-hover-layer:focus .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:focus .dashboard-chart-axis-date,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-tooltip,
.dashboard-chart-hover-layer:focus-visible .dashboard-chart-axis-date {
  transform: translateY(0);
}

.dashboard-chart-crosshair {
  stroke: color-mix(in srgb, var(--xb-color-on-surface) 38%, transparent);
  stroke-dasharray: 3 3;
  stroke-opacity: 0.72;
}

.dashboard-chart-hover-marker {
  filter: drop-shadow(0 2px 5px rgb(17 24 39 / 16%));
}

.dashboard-chart-tooltip-bg {
  fill: rgb(30 30 30 / 86%);
  stroke: transparent;
  filter: drop-shadow(2px 2px 6px rgb(153 153 153 / 34%));
}

.dashboard-chart-axis-date-box {
  fill: rgb(0 0 0 / 72%);
  stroke: rgb(0 0 0 / 50%);
}

.dashboard-chart-tooltip text {
  fill: var(--xb-color-inverse-on-surface);
  font-family: var(--font-sans);
}

.dashboard-chart-tooltip-title {
  fill: var(--xb-color-inverse-on-surface);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-chart-tooltip-value {
  fill: var(--xb-color-inverse-on-surface);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-chart-tooltip-amount {
  fill: var(--xb-color-inverse-on-surface);
  font-size: 11px;
  font-weight: 750;
}

.dashboard-chart-tooltip-dot.income {
  fill: var(--xb-chart-revenue);
}

.dashboard-chart-tooltip-dot.expense {
  fill: var(--xb-chart-expense);
}

.dashboard-chart-tooltip-note {
  fill: rgb(255 255 255 / 72%);
  font-size: 10px;
  font-weight: 600;
}

.dashboard-chart-axis-date-text {
  fill: var(--xb-color-inverse-on-surface);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 750;
}

.dashboard-chart-row,
.dashboard-category-row,
.dashboard-activity-item {
  min-width: 0;
}

.dashboard-chart-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 118px;
  gap: 12px;
  align-items: center;
}

.dashboard-chart-label,
.dashboard-category-name,
.dashboard-activity-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-chart-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-bar-stack {
  display: grid;
  gap: 4px;
}

.dashboard-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.dashboard-bar {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.dashboard-bar.income {
  background: var(--xb-chart-revenue);
}

.dashboard-bar.expense {
  background: var(--xb-chart-expense);
}

.dashboard-chart-values {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  text-align: right;
}

.dashboard-category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.dashboard-activity-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.dashboard-category-row:last-child,
.dashboard-activity-item:last-child {
  border-bottom: 0;
}

.dashboard-category-name,
.dashboard-activity-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

.dashboard-category-value,
.dashboard-activity-amount {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-category-value {
  color: var(--xb-chart-expense);
}

.dashboard-activity-amount.positive {
  color: var(--xb-chart-revenue);
}

.dashboard-activity-amount.negative {
  color: var(--xb-chart-expense);
}

.dashboard-category-progress {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.dashboard-category-progress i {
  display: block;
  height: 100%;
  width: var(--category-width, 0%);
  border-radius: inherit;
  background: var(--xb-chart-expense);
}

.dashboard-category-row.category-bar-animated .dashboard-category-progress i {
  width: 0;
  animation: dashboard-category-grow 720ms cubic-bezier(0.22, 1, 0.36, 1) var(--category-delay, 0ms) forwards;
}

@keyframes dashboard-category-grow {
  to { width: var(--category-width); }
}

.dashboard-svg-chart.dashboard-chart-animated .dashboard-chart-series-layer {
  clip-path: inset(0 100% 0 0);
  animation: dashboard-chart-reveal 900ms cubic-bezier(0.22, 1, 0.36, 1) 80ms forwards;
}

@keyframes dashboard-chart-reveal {
  to { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-category-row.category-bar-animated .dashboard-category-progress i {
    animation: none;
    width: var(--category-width);
  }

  .dashboard-svg-chart.dashboard-chart-animated .dashboard-chart-series-layer {
    animation: none;
    clip-path: none;
  }
}

.dashboard-activity-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
}

.dashboard-activity-icon.income {
  background: var(--xb-alert-complete-container);
  color: var(--xb-alert-complete-content);
}

.dashboard-activity-icon.expense {
  background: var(--xb-alert-warning-container);
  color: var(--xb-alert-warning-content);
}

.dashboard-activity-icon.transfer {
  background: var(--xb-color-primary-container);
  color: var(--dashboard-blue);
}

.dashboard-activity-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.dashboard-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.dashboard-skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--xb-color-on-surface) 5%, transparent) 0%,
    color-mix(in srgb, var(--xb-color-on-surface) 8%, transparent) 44%,
    color-mix(in srgb, var(--xb-color-on-surface) 4%, transparent) 100%
  );
}

.dashboard-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--xb-color-surface) 58%, transparent) 48%,
    transparent 100%
  );
  animation: dashboardSkeletonSweep 1.35s ease-in-out infinite;
}

.dashboard-chart-skeleton {
  display: grid;
  gap: 14px;
  min-height: 292px;
}

.dashboard-chart-skeleton-legend {
  display: flex;
  gap: 12px;
}

.dashboard-chart-skeleton-legend span {
  width: 72px;
  height: 12px;
  border-radius: 999px;
}

.dashboard-chart-skeleton-plot {
  position: relative;
  min-height: 250px;
  border-bottom: 1px solid var(--xb-color-outline-variant);
  border-left: 1px solid var(--xb-color-outline-variant);
}

.dashboard-chart-skeleton-grid {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: color-mix(in srgb, var(--xb-color-outline-variant) 72%, transparent);
}

.dashboard-chart-skeleton-grid:nth-child(1) {
  top: 18%;
}

.dashboard-chart-skeleton-grid:nth-child(2) {
  top: 38%;
}

.dashboard-chart-skeleton-grid:nth-child(3) {
  top: 58%;
}

.dashboard-chart-skeleton-grid:nth-child(4) {
  top: 78%;
}

.dashboard-chart-skeleton-line {
  position: absolute;
  left: 7%;
  right: 6%;
  height: 68px;
  border-radius: 999px;
  opacity: 0.72;
  clip-path: polygon(0 64%, 16% 40%, 32% 52%, 48% 22%, 64% 55%, 81% 36%, 100% 44%, 100% 72%, 0 72%);
}

.dashboard-chart-skeleton-line.income {
  top: 78px;
}

.dashboard-chart-skeleton-line.expense {
  top: 118px;
  opacity: 0.48;
  clip-path: polygon(0 38%, 18% 58%, 36% 46%, 54% 64%, 72% 42%, 100% 54%, 100% 72%, 0 72%);
}

.dashboard-category-skeleton-list {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.dashboard-category-skeleton-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 12px;
  align-items: center;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border-soft);
}

.dashboard-category-skeleton-row:last-child {
  border-bottom: 0;
}

.dashboard-category-skeleton-name,
.dashboard-category-skeleton-value {
  height: 12px;
  border-radius: 999px;
}

.dashboard-category-skeleton-bar {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
}

@keyframes dashboardSkeletonSweep {
  to {
    transform: translateX(100%);
  }
}

.dashboard-animate-in {
  animation: dashboardSlideUp 520ms ease-out both;
}

@keyframes dashboardSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dashboardCountFade {
  from {
    opacity: 0.72;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-kpi-card,
  .dashboard-counting,
  .dashboard-animate-in {
    animation: none !important;
    transition: none !important;
  }

  .dashboard-kpi-card:hover {
    transform: none;
  }
}

.field-help {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.settings-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-error) 28%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--xb-alert-error-container);
  color: var(--xb-alert-error-content);
  font-size: 13px;
  font-weight: 650;
}

.settings-subsection {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--xb-color-surface-container-low);
}

.settings-subsection h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.fiscal-date-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(100px, 140px);
  gap: 14px;
  align-items: end;
  margin-top: 12px;
}

.fiscal-example {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.fiscal-example span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.workspace-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

.tax-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

.tax-settings-main {
  display: grid;
  gap: 16px;
}

.workspace-settings-guide,
.tax-settings-guide {
  position: sticky;
  top: 18px;
  padding: 18px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--xb-color-surface-container-low);
  box-shadow: var(--xb-elevation-1);
}

.workspace-settings-guide h2,
.tax-settings-guide h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  letter-spacing: 0;
}

.workspace-settings-guide p,
.tax-settings-guide p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.guide-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--xb-color-outline) 28%, transparent);
}

.guide-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.guide-kicker .nav-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.guide-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.guide-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.guide-list .nav-icon {
  width: 15px;
  height: 15px;
  color: var(--success);
}

.guide-example {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-outline) 26%, transparent);
  border-radius: var(--radius-sm);
  background: var(--xb-color-surface-container-lowest);
}

.guide-example-row {
  display: grid;
  gap: 2px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

.guide-example-row + .guide-example-row {
  margin-top: 10px;
}

.guide-example-row span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.tax-guide-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tax-guide-code {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--xb-color-outline) 28%, transparent);
  border-radius: 999px;
  background: var(--xb-color-surface-container-lowest);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 1100px) {
  .dashboard-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-period-filter {
    min-width: 0;
  }

  .dashboard-hero-period-filter {
    position: static;
    min-width: 0;
    order: -1;
  }

  .dashboard-hero h1 {
    padding-right: 0;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

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

  .dashboard-grid > .dashboard-panel:first-child,
  .dashboard-grid > .dashboard-panel:last-child {
    grid-column: auto;
  }

  .dashboard-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-chart-range-control {
    justify-self: start;
  }

  .workspace-settings-layout,
  .tax-settings-layout {
    grid-template-columns: 1fr;
  }

  .workspace-settings-guide,
  .tax-settings-guide {
    position: static;
  }
}

@media (max-width: 720px) {
  .dashboard-kpi-grid,
  .fiscal-date-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-range-control {
    grid-auto-flow: row;
    width: 100%;
  }

  .dashboard-chart-range-button {
    border-right: 0;
    border-bottom: 1px solid var(--xb-color-outline-variant, var(--border));
  }

  .dashboard-chart-range-button:last-child {
    border-bottom: 0;
  }
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 20px;
}

.view {
  display: grid;
  gap: 20px;
}

/* Grid children must be allowed to shrink before a nested data surface can overflow. */
#expensesView > .expense-kpi-grid,
#expensesView > .panel {
  min-width: 0;
  max-width: 100%;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin-bottom: 18px;
}

.page-heading > div:first-child {
  min-width: 0;
}

.page-heading h1 {
  font-size: 26px;
}

.small-primary {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--xb-button-filled-container);
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-button-filled-container);
  color: var(--xb-button-filled-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  transition:
    background-color var(--xb-motion-state),
    border-color var(--xb-motion-state),
    color var(--xb-motion-state);
}

.small-primary:hover,
.primary:hover {
  background: var(--xb-button-filled-hover-container);
}

.small-primary:disabled,
.secondary:disabled,
.primary:disabled {
  border-color: var(--xb-button-disabled-border);
  background: var(--xb-button-disabled-container);
  color: var(--xb-button-disabled-content);
  cursor: not-allowed;
  opacity: 1;
}

.small-primary.settings-save-button.is-clean:disabled {
  cursor: default;
  opacity: 1;
}

.small-primary.settings-save-button.is-saving:disabled {
  cursor: wait;
  opacity: 1;
}

.small-primary.settings-save-button.is-saved {
  border-color: var(--xb-button-tonal-container);
  background: var(--xb-button-tonal-container);
  color: var(--xb-button-tonal-content);
}

.small-primary.settings-save-button.is-saved:hover {
  background: var(--xb-button-tonal-hover-container);
}

.small-primary.settings-save-button.danger.is-clean:disabled,
.small-primary.settings-save-button.danger.is-saved,
.small-primary.settings-save-button.danger.is-saved:hover {
  border-color: var(--xb-button-disabled-border);
  background: var(--xb-button-disabled-container);
  color: var(--xb-button-disabled-content);
}

.secondary {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--xb-button-outlined-border);
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-button-outlined-container);
  color: var(--xb-button-outlined-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  transition:
    background-color var(--xb-motion-state),
    border-color var(--xb-motion-state),
    color var(--xb-motion-state);
}

.secondary:hover {
  border-color: var(--xb-button-outlined-content);
  background: var(--xb-button-outlined-hover-container);
  color: var(--xb-button-outlined-content);
}

.ghost {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--xb-shape-button-compact);
  background: transparent;
  color: var(--xb-button-text-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
}

.danger {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--xb-button-danger-outlined-border);
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-button-outlined-container);
  color: var(--xb-button-danger-outlined-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
}

.primary.danger,
.small-primary.danger {
  border-color: var(--xb-button-danger-container);
  background: var(--xb-button-danger-container);
  color: var(--xb-button-danger-content);
}

.compact {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

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

.page-heading .actions .primary,
.page-heading .actions .secondary,
.page-heading .actions .small-primary,
.page-heading .actions .small-secondary,
.page-heading .actions .danger {
  min-height: 36px;
}

.receipt-capture-launch-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.receipt-capture-launch-button svg {
  width: 16px;
  height: 16px;
}

.action-wrap {
  position: relative;
}

.action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: grid;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.action-menu button {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--secondary-ink);
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.action-menu button:hover {
  background: var(--surface-muted);
}

.transaction-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) minmax(132px, 0.72fr) minmax(132px, 0.72fr) minmax(132px, 0.72fr) minmax(176px, 0.95fr);
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--xb-table-border);
  background: var(--xb-table-header-container);
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.transaction-toolbar > .filter-field > span {
  color: var(--xb-color-on-surface-variant);
  font-size: var(--font-size-label);
  line-height: var(--line-height-label);
  font-weight: var(--font-weight-label);
}

.transaction-toolbar .filter-field input,
.transaction-toolbar .filter-field select {
  min-height: 38px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

#expensesView .transaction-toolbar,
#incomeView .transaction-toolbar {
  grid-template-columns: minmax(152px, 1fr) minmax(96px, 0.56fr) minmax(92px, 0.5fr) minmax(92px, 0.5fr) minmax(145px, 0.85fr) minmax(160px, 0.9fr);
}

.tag-filter-picker {
  position: relative;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.tag-filter-field {
  min-width: 0;
  max-width: 100%;
}

.tag-filter-picker > summary {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: 38px;
  overflow: hidden;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  list-style: none;
  cursor: pointer;
}

.tag-filter-picker > summary::-webkit-details-marker { display: none; }

.tag-filter-summary-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.tag-filter-chevron {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--xb-color-on-surface-variant);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tag-filter-options {
  position: fixed;
  z-index: 1600;
  top: var(--tag-filter-popover-top, 0);
  left: var(--tag-filter-popover-left, 0);
  display: grid;
  gap: 2px;
  width: var(--tag-filter-popover-width, 320px);
  max-height: 320px;
  margin: 0;
  padding: 6px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-card);
  background: var(--xb-color-surface-container-lowest);
  box-shadow: var(--xb-elevation-3);
}

.tag-filter-options label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-height: 28px;
  overflow: hidden;
  padding: 2px 4px;
  color: var(--xb-color-on-surface);
  font-size: var(--font-size-body);
  font-weight: 500;
  line-height: var(--line-height-body);
}

.tag-filter-options label span {
  flex: 1 1 auto;
  width: 0;
  max-width: calc(100% - 26px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.tag-filter-options input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.search-native-field {
  position: relative;
}

.search-native-icon {
  position: absolute;
  left: 12px;
  bottom: 11px;
  width: 16px;
  height: 16px;
  color: var(--xb-color-on-surface-variant, var(--text-secondary));
  pointer-events: none;
  stroke-width: 2;
}

.search-native-field input[type="search"] {
  min-height: 38px;
  padding-left: 38px !important;
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--xb-table-border);
  color: var(--xb-table-footer-content);
  font-size: 13px;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.filter-summary.is-selection {
  background: var(--xb-table-row-selected-container);
  color: var(--xb-table-row-selected-content);
}

.bank-selection-summary {
  box-sizing: border-box;
  height: 52px;
  min-height: 52px;
  overflow: hidden;
}

.bank-selection-summary .bulk-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-left: auto;
}

.bank-selection-summary .bulk-actions .secondary {
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.filter-summary strong {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--xb-table-border);
  background: var(--xb-table-row-selected-container);
  color: var(--xb-table-row-selected-content);
  font-size: 13px;
}

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

.pagination {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--xb-table-border);
  background: var(--xb-table-footer-container);
  color: var(--xb-table-footer-content);
  font-size: 13px;
  position: relative;
  z-index: 1;
}

.panel > .pagination:last-child {
  border-bottom-right-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.page-size-control select {
  width: 82px;
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  padding: 6px 28px 6px 10px;
}

.pagination-summary {
  justify-self: center;
  min-width: 0;
  color: var(--xb-table-footer-content);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
  text-align: center;
  white-space: nowrap;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: color-mix(in srgb, var(--xb-color-scrim) 32%, transparent);
}

.drawer {
  width: min(720px, 100vw);
  height: 100%;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.drawer-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

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

.expense-main-grid,
.expense-detail-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

#transactionForm .expense-main-grid {
  grid-template-columns: repeat(15, minmax(0, 1fr));
}

.expense-field-date {
  grid-column: span 2;
}

.expense-field-category {
  grid-column: span 5;
}

.expense-field-payment {
  grid-column: span 5;
}

.expense-field-third {
  grid-column: span 4;
}

#transactionForm .expense-field-date {
  grid-column: span 3;
}

#transactionForm .expense-field-category,
#transactionForm .expense-field-payment {
  grid-column: span 6;
}

#transactionForm .expense-field-third {
  grid-column: span 5;
}

#detailForm .expense-field-date {
  grid-column: span 3;
}

#detailForm .expense-field-category {
  grid-column: span 4;
}

#detailForm .expense-field-payment {
  grid-column: span 5;
}

.advanced-form-grid {
  grid-template-columns: minmax(120px, 0.8fr) minmax(190px, 1.2fr) minmax(220px, 1.4fr);
}

.tax-pair {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 16px;
}

.tax-tracking-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tax-tracking-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 220px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.tax-tracking-option strong {
  display: block;
  color: var(--text-primary);
}

.tax-tracking-option span {
  color: var(--text-secondary);
  font-size: 13px;
}

.settings-panel {
  border-color: var(--xb-color-outline-variant);
  border-radius: var(--radius-md);
  box-shadow: var(--xb-elevation-1);
}

.settings-panel .panel-header {
  padding: 14px 18px;
}

.settings-panel form {
  padding: 18px;
}

.settings-save-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-save-state {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.settings-save-state.is-dirty {
  color: var(--warning-ink);
}

.settings-save-state.is-saving {
  color: var(--text-secondary);
}

.settings-save-state.is-saved {
  color: var(--success-ink);
}

.workflow-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--xb-color-surface-container-low);
  color: var(--text-secondary);
  line-height: 1.45;
}

.workflow-note .note-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex: 0 0 auto;
  margin-top: 1px;
}

.workflow-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.tax-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 720px;
}

.tax-toggle-copy {
  display: grid;
  gap: 4px;
}

.tax-toggle-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
}

.tax-toggle-helper {
  color: var(--text-secondary);
  font-size: 13px;
}

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

.business-type-option {
  display: flex;
  gap: 12px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.business-type-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--xb-color-primary) 12%, transparent);
}

.business-type-option.is-disabled {
  cursor: default;
  opacity: 0.82;
}

.business-type-radio {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.business-type-option:has(input:checked) .business-type-radio {
  border-color: var(--primary);
}

.business-type-radio::after {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
  opacity: 0;
}

.business-type-option:has(input:checked) .business-type-radio::after {
  opacity: 1;
}

.business-type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.business-type-copy {
  display: grid;
  gap: 4px;
}

.business-type-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.business-type-helper {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.business-profile-list {
  display: grid;
  gap: 12px;
}

.business-profile-bookkeeping {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.business-profile-bookkeeping h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.business-profile-bookkeeping-summary {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.business-profile-coming-soon {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.danger:hover,
.danger:focus-visible {
  background: color-mix(in srgb, var(--xb-color-error) 12%, var(--xb-alert-error-container));
  outline: none;
}

.primary.danger:hover,
.primary.danger:focus-visible,
.small-primary.danger:hover,
.small-primary.danger:focus-visible {
  border-color: var(--xb-button-danger-hover-container);
  background: var(--xb-button-danger-hover-container);
  color: var(--xb-button-danger-hover-content);
}

.business-profile-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.business-profile-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--xb-color-primary) 12%, transparent);
}

.business-profile-option.is-disabled {
  cursor: not-allowed;
  background: var(--surface-soft);
  opacity: 0.78;
}

.business-profile-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.business-profile-option:has(input:checked) .business-profile-check {
  border-color: var(--primary);
  background: var(--primary);
}

.business-profile-check::after {
  width: 10px;
  height: 6px;
  border-bottom: 2px solid var(--xb-color-on-primary);
  border-left: 2px solid var(--xb-color-on-primary);
  content: "";
  opacity: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

.business-profile-option:has(input:checked) .business-profile-check::after {
  opacity: 1;
}

.business-profile-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.business-profile-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.business-profile-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.business-profile-title-row i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--primary);
}

.business-profile-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.business-profile-helper {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.business-profile-output {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.business-profile-output li {
  padding: 4px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.business-profile-account-details {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.business-profile-account-details summary {
  width: fit-content;
  cursor: pointer;
}

.business-profile-account-list {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.business-profile-loading {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.account-setup-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.account-setup-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.account-setup-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--xb-elevation-1);
  overflow: hidden;
}

.account-setup-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-setup-card h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  letter-spacing: 0;
}

.account-setup-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.account-setup-summary-list {
  display: grid;
  gap: 8px;
}

.account-setup-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.account-setup-summary-row:last-child {
  border-bottom: 0;
}

.account-setup-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.account-setup-value {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.account-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-setup-actions a {
  text-decoration: none;
}

.account-setup-activity-list {
  display: grid;
  gap: 8px;
}

.account-setup-activity-list .business-profile-option {
  min-height: 0;
  padding: 10px 12px;
}

/* Business Activities follows the selected Option 5 neutral surface role.
   The foundation token resolves to the appropriate light or dark value. */
.account-setup-activity-list .business-profile-activity-option {
  background: var(--xb-color-surface-container, var(--surface-muted));
  border-color: var(--xb-color-outline-variant, var(--border));
}

.account-setup-control-group {
  display: grid;
  gap: 7px;
}

.account-setup-control-title {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

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

.account-setup-segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  width: min(100%, 340px);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.account-setup-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.account-setup-segment:has(input:checked) {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--xb-elevation-1);
}

.account-setup-segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.account-setup-choice {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.account-setup-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--xb-color-primary) 12%, transparent);
}

.account-setup-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.account-setup-choice strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.account-setup-choice span {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.25;
}

.account-setup-current-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: -4px 0 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.account-setup-current-summary strong {
  flex: 0 0 auto;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

.account-setup-summary-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.account-setup-summary-badges .badge {
  min-height: 20px;
}

.account-setup-fiscal-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 78px;
  gap: 8px;
  width: min(100%, 306px);
}

.account-setup-fiscal-grid select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--radius-md);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 0 10px;
}

.account-setup-fiscal-grid select:disabled {
  background: var(--surface-soft);
  color: var(--text-muted);
  cursor: not-allowed;
}

.account-setup-helper {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.account-setup-error {
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.account-setup-default-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.account-setup-default-note i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--primary);
}

.account-setup-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-setup-preview-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.account-setup-group {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.account-setup-group.is-exiting {
  pointer-events: none;
  border-color: color-mix(in srgb, var(--xb-color-primary) 28%, var(--border));
  background: var(--xb-color-surface-container-low);
  box-shadow: var(--xb-elevation-1);
  transform-origin: center right;
  animation: accountSetupGroupExit 720ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

.account-setup-group.is-entering {
  transform-origin: center right;
  animation: accountSetupGroupEnter 720ms cubic-bezier(0.2, 0, 0, 1) both;
}

.account-setup-group.is-focused {
  border-color: color-mix(in srgb, var(--xb-color-primary) 32%, var(--border));
  background: var(--xb-color-surface-container-low);
  box-shadow: var(--xb-elevation-1);
}

.account-setup-groups {
  display: grid;
  gap: 8px;
}

.account-setup-group + .account-setup-group {
  margin-top: 0;
}

.account-setup-group:first-of-type {
  padding-top: 0;
  border-top: 1px solid var(--border-soft);
}

.account-setup-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.account-setup-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.account-setup-group-title i {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--text-muted);
}

.account-setup-group-source {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.account-setup-group-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.account-setup-account-list {
  display: grid;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
  overflow: hidden;
  animation: accountSetupExpand 180ms ease-out;
}

@keyframes accountSetupExpand {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    max-height: 520px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes accountSetupGroupExit {
  0% {
    max-height: 56px;
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  62% {
    max-height: 56px;
    opacity: 0.92;
    transform: translateX(62%) scale(0.992);
  }
  100% {
    max-height: 0;
    opacity: 0;
    transform: translateX(70%) scale(0.985);
  }
}

@keyframes accountSetupGroupEnter {
  0% {
    opacity: 0;
    transform: translateX(70%) scale(0.985);
  }
  38% {
    opacity: 0.92;
    transform: translateX(62%) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-setup-account-list,
  .account-setup-group.is-entering,
  .account-setup-group.is-exiting {
    animation: none;
  }
}

.account-setup-account-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 29px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-soft);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: transparent;
  font-size: 11.5px;
  line-height: 1.05;
  text-align: left;
  cursor: pointer;
}

.account-setup-account-row:hover,
.account-setup-account-row:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

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

.account-setup-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.account-setup-table td {
  padding: 2px 6px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 11.5px;
  line-height: 1.05;
}

.account-setup-table tr:last-child td {
  border-bottom: 0;
}

.account-setup-number {
  width: 62px;
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.account-setup-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-setup-table td:last-child {
  width: 118px;
}

.account-setup-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.account-setup-table .badge {
  min-height: 14px;
  max-width: 100%;
  padding: 0 5px;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-setup-empty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 720px) {
  .business-type-options {
    grid-template-columns: 1fr;
  }

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

  .account-setup-choice-grid,
  .account-setup-fiscal-grid {
    grid-template-columns: 1fr;
  }

  .account-setup-preview-header,
  .account-setup-card-header,
  .account-setup-group-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-setup-table td {
    display: block;
    border-bottom: 0;
  }

  .account-setup-table tr {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-soft);
  }

  .account-setup-table tr:last-child {
    border-bottom: 0;
  }

  .account-setup-table td {
    padding: 0;
  }

  .account-setup-badges {
    justify-content: flex-start;
  }
}

.tax-switch {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  cursor: pointer;
}

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

.tax-switch span {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--neutral-bg);
  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}

.tax-switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--xb-elevation-1);
  transition: transform 0.16s ease;
}

.tax-switch input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
}

.tax-switch input:checked + span::after {
  transform: translateX(20px);
}

.tax-disabled-note {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-panel .tax-disabled-note {
  max-width: 720px;
  margin-top: 14px;
  border-color: var(--xb-color-outline-variant);
  background: var(--xb-color-surface-container-low);
}

.tax-settings-section {
  margin-top: 16px;
}

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

.span-3 {
  grid-column: span 3;
}

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

form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--xb-color-error) 12%, transparent);
}

.field-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.form-error-summary {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-error) 32%, var(--border));
  border-radius: 12px;
  background: var(--xb-alert-error-container);
  color: var(--danger);
  font-size: 13px;
  font-weight: 650;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--xb-field-border);
  border-radius: 10px;
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  padding: 9px 10px;
}

input[type="date"] {
  padding-right: 12px;
  font-size: 15px;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

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

.advanced-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--secondary-border);
  border-radius: 999px;
  background: var(--secondary-bg);
  color: var(--secondary-ink);
  font-size: 13px;
  font-weight: 650;
}

.advanced-toggle::after {
  content: "+";
  margin-left: 8px;
}

.advanced-toggle[aria-expanded="true"]::after {
  content: "-";
}

.advanced-fields {
  margin-top: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-muted);
}

.advanced-fields.expense-detail-secondary {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#transactionForm,
#detailForm {
  gap: 10px;
  padding: 14px 18px;
}

#transactionForm .form-note,
#detailForm .form-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

#transactionForm .field,
#detailForm .field {
  gap: 4px;
}

#transactionForm input,
#transactionForm select,
#transactionForm textarea,
#transactionForm .category-combobox-input,
#transactionForm .tag-picker-button,
#detailForm input,
#detailForm select,
#detailForm textarea,
#detailForm .category-combobox-input,
#detailForm .tag-picker-button {
  min-height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 13px;
  line-height: 1.3;
}

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

.attachment-name {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.truncate-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-list-table {
  min-width: 900px;
  width: 100%;
}

.expense-mobile-list {
  display: none;
}

.expense-list-table th,
.expense-list-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.expense-list-table th {
  white-space: nowrap;
  text-transform: uppercase;
}

.account-setup-account-row.is-preview {
  cursor: default;
}

.account-setup-account-row.is-preview:hover {
  background: transparent;
}

.expense-list-table .sort-button {
  max-width: 100%;
  white-space: nowrap;
  text-transform: uppercase;
}

.expense-list-table .nowrap-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-list-table .badge,
.banking-table .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-list-table th:nth-child(1),
.expense-list-table td:nth-child(1) {
  width: 36px;
}

.expense-list-table th:nth-child(2),
.expense-list-table td:nth-child(2) {
  width: 108px;
}

.expense-list-table th:nth-child(3),
.expense-list-table td:nth-child(3) {
  width: 120px;
  padding-left: 14px;
}

.expense-list-table th:nth-child(4),
.expense-list-table td:nth-child(4) {
  width: 218px;
}

.expense-list-table th:nth-child(5),
.expense-list-table td:nth-child(5) {
  width: 168px;
}

.expense-list-table th:nth-child(6),
.expense-list-table td:nth-child(6) {
  width: auto;
}

.expense-list-table th:nth-child(7),
.expense-list-table td:nth-child(7) {
  width: 118px;
}

.expense-list-table th:nth-child(8),
.expense-list-table td:nth-child(8) {
  width: 132px;
}

.expense-list-table td:nth-child(4) {
  color: var(--text-primary);
  font-weight: 500;
}

.tax-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  grid-column: 1 / -1;
  margin-top: -4px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
}

.tax-summary strong {
  color: var(--text-primary);
  font-weight: 650;
}

.tax-summary-dot {
  color: var(--text-muted);
}

.tax-manual-note {
  color: var(--warning-text);
  font-weight: 650;
}

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

.tax-input-row input {
  min-width: 0;
  flex: 1;
}

.tax-input-row .secondary {
  min-height: 42px;
  white-space: nowrap;
}

.tax-input-row .secondary[hidden] {
  display: none;
}

.tag-menu-divider {
  height: 1px;
  margin: 4px -8px;
  background: var(--border-soft);
}

.primary {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--xb-button-filled-container);
  border-radius: var(--xb-shape-button);
  background: var(--xb-button-filled-container);
  color: var(--xb-button-filled-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  transition:
    background-color var(--xb-motion-state),
    border-color var(--xb-motion-state),
    color var(--xb-motion-state);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.form-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.source-lock-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.hidden-input {
  display: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 960px;
  background: var(--xb-table-row-container);
}

th,
td {
  height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--xb-table-border);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--xb-table-header-container);
  color: var(--xb-table-header-content);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

th:nth-child(1),
td:nth-child(1) {
  width: 46px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 118px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 118px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 210px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 170px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 190px;
}

.tax-codes-table {
  min-width: 680px;
}

.tax-codes-table th,
.tax-codes-table td {
  padding: 8px 14px;
  height: 46px;
  overflow-wrap: normal;
  line-height: 1.25;
}

.tax-codes-table th {
  white-space: nowrap;
  font-size: 11px;
  background: var(--xb-table-header-container);
}

.tax-codes-table th:nth-child(1),
.tax-codes-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.tax-codes-table th:nth-child(2),
.tax-codes-table td:nth-child(2) {
  width: 230px;
}

.tax-codes-table th:nth-child(3),
.tax-codes-table td:nth-child(3) {
  width: 280px;
}

.tax-codes-table th:nth-child(4),
.tax-codes-table td:nth-child(4) {
  width: 120px;
}

.tax-province-field {
  grid-column: span 2;
  width: min(100%, 360px);
}

.tax-enabled-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: 4px;
  background: var(--surface);
  color: transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tax-enabled-indicator.is-enabled {
  border-color: color-mix(in srgb, var(--xb-color-primary) 58%, var(--xb-color-surface));
  background: color-mix(in srgb, var(--xb-color-primary-container) 72%, var(--xb-color-surface));
  color: var(--primary);
}

.tax-codes-table .badge {
  min-height: 22px;
  padding: 3px 8px;
  font-size: 11px;
}

.tax-codes-table .tax-status-active {
  background: var(--xb-alert-complete-container);
  color: var(--xb-alert-complete-content);
}

.select-cell {
  text-align: center;
  vertical-align: middle;
}

.select-cell input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--xb-checkbox-selected-container);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--xb-table-row-hover-container);
}

:where(
  .expense-list-table,
  .category-table,
  .tax-codes-table,
  .statements-table,
  .rules-table
) tbody tr:not(.is-disabled):not([aria-disabled="true"]) > td:first-child {
  box-shadow: inset 3px 0 0 transparent;
  transition:
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

:where(
  .expense-list-table,
  .category-table,
  .tax-codes-table,
  .statements-table,
  .rules-table
) tbody tr:not(.is-disabled):not([aria-disabled="true"]):hover > td {
  background: var(--xb-table-row-hover-container);
}

:where(
  .expense-list-table,
  .category-table,
  .tax-codes-table,
  .statements-table,
  .rules-table
) tbody tr:not(.is-disabled):not([aria-disabled="true"]):hover > td:first-child {
  box-shadow: inset 3px 0 0 var(--xb-table-row-state-indicator);
}

tbody tr.is-disabled,
tbody tr[aria-disabled="true"] {
  background: var(--xb-table-row-disabled-container);
  color: var(--xb-table-row-disabled-content);
  cursor: not-allowed;
}

tbody tr.is-disabled:hover,
tbody tr[aria-disabled="true"]:hover {
  background: var(--xb-table-row-disabled-container);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
  text-transform: inherit;
}

.sort-arrow {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  line-height: 1;
}

.sort-arrow.is-active {
  color: var(--text-primary);
}

.banking-table .sort-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  gap: 4px;
  padding-right: 0;
  box-sizing: border-box;
  line-height: 1.2;
  overflow: visible;
  white-space: nowrap;
}

.banking-table .sort-button .sort-arrow {
  position: static;
  z-index: 7;
  flex: 0 0 14px;
  transform: none;
  background: transparent;
  pointer-events: none;
}

.sort-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-expense {
  color: var(--xb-amount-spent);
  font-weight: 700;
}

.amount-income {
  color: var(--xb-amount-received);
  font-weight: 700;
}

.banking-table .amount-expense,
.banking-table .amount-income {
  font-weight: inherit;
}

.banking-table .bank-post-main,
.banking-table .bank-post-menu-button,
.banking-table .small-primary.compact {
  min-height: var(--bank-row-control-height);
  height: var(--bank-row-control-height);
  padding-top: 0;
  padding-bottom: 0;
}

.bank-action-split {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 1;
}

.bank-post-split-button {
  display: inline-flex;
  align-items: stretch;
  overflow: visible;
  border-radius: var(--xb-shape-button-compact);
}

.bank-post-main {
  border-radius: var(--xb-shape-button-compact) 0 0 var(--xb-shape-button-compact);
}

.bank-post-menu-button {
  min-width: 26px;
  padding: 0 6px;
  border-left: 1px solid color-mix(in srgb, var(--xb-button-filled-content) 35%, transparent);
  border-radius: 0 var(--xb-shape-button-compact) var(--xb-shape-button-compact) 0;
}

.bank-post-menu-button .chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  line-height: 1;
  font-size: 13px;
}

.bank-post-main,
.bank-review-actions .bank-post-button,
.bank-undo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
}

.bank-post-main.is-posting,
.bank-review-actions .bank-post-button.is-posting,
.bank-undo-button.is-undoing {
  cursor: wait;
}

.bank-post-spinner {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: bank-post-spin 700ms linear infinite;
}

@keyframes bank-post-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bank-post-spinner {
    animation: none;
  }
}

.bank-action-menu {
  position: fixed;
  top: var(--bank-action-menu-top, 0);
  left: var(--bank-action-menu-left, 0);
  z-index: 1000;
  display: grid;
  min-width: 132px;
  padding: var(--xb-space-3);
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-menu);
  background: var(--xb-menu-container);
  box-shadow: var(--xb-elevation-3);
}

.bank-action-menu button {
  justify-content: flex-start;
  min-height: 32px;
  padding: var(--xb-space-3) var(--xb-space-5);
  border-radius: var(--xb-shape-sm);
  background: transparent;
  color: var(--xb-color-on-surface);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  text-align: left;
}

.bank-action-menu button:hover {
  background: var(--xb-menu-item-hover-container);
}

.split-modal-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.split-modal-header,
.split-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.split-modal-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.split-summary-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(280px, 1.8fr) minmax(132px, 0.7fr);
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.split-summary-header div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.split-summary-header span,
.split-memo-field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.split-summary-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-summary-header .split-original-amount {
  text-align: right;
}

.split-summary-header .split-original-amount strong {
  font-size: 28px;
}

.split-lines-wrap {
  overflow: auto;
  padding: 14px 18px 6px;
}

.split-lines-table {
  min-width: 960px;
}

.split-lines-table th,
.split-lines-table td {
  padding: 6px 8px;
  overflow-wrap: normal;
}

.split-lines-table th {
  white-space: nowrap;
}

.split-lines-table input,
.split-lines-table select {
  width: 100%;
  min-height: 38px;
}

.split-line-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
}

.split-lines-table th:nth-child(1),
.split-lines-table td:nth-child(1) {
  width: 138px;
}

.split-lines-table th:nth-child(2),
.split-lines-table td:nth-child(2) {
  width: 238px;
}

.split-lines-table th:nth-child(3),
.split-lines-table td:nth-child(3) {
  width: 276px;
}

.split-lines-table th:nth-child(4),
.split-lines-table td:nth-child(4) {
  width: 132px;
}

.split-lines-table th:nth-child(5),
.split-lines-table td:nth-child(5) {
  width: 142px;
}

.split-delete-cell {
  width: 48px;
  text-align: center;
}

.split-tools-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px 14px;
}

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

.split-totals {
  display: grid;
  gap: 5px;
  min-width: 240px;
}

.split-totals div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.split-totals strong {
  color: var(--text-primary);
}

.split-totals .is-difference {
  color: var(--danger);
}

.split-memo-field {
  display: grid;
  gap: 6px;
  padding: 0 18px 16px;
}

.split-modal-footer {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 0;
  background: var(--surface);
}

.split-detail-panel {
  display: grid;
  gap: 8px;
}

.split-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.split-detail-panel .bank-split-lines-table {
  background: var(--surface);
}

.expense-detail-grid input:disabled,
.expense-detail-grid select:disabled,
.expense-detail-grid textarea:disabled,
.expense-detail-secondary input:disabled,
.expense-detail-secondary select:disabled,
.expense-detail-secondary textarea:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.expense-detail-grid .tax-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  min-height: auto;
  overflow-x: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.split-detail-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  align-items: center;
  min-height: 40px;
  overflow-x: auto;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.expense-detail-grid .tax-summary strong {
  color: var(--text-primary);
  font-weight: 650;
}

.expense-detail-grid .tax-summary strong.amount-expense,
.expense-detail-grid .tax-summary strong.amount-income {
  font-weight: 650;
}

.split-detail-summary strong {
  color: var(--text-primary);
  font-weight: 700;
}

.expense-detail-grid .field,
.expense-detail-secondary .field {
  display: grid;
  gap: 4px;
}

.expense-detail-grid .field label,
.expense-detail-secondary .field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.expense-detail-grid input,
.expense-detail-grid select,
.expense-detail-grid textarea,
.expense-detail-secondary input,
.expense-detail-secondary select,
.expense-detail-secondary textarea {
  min-height: 40px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.expense-detail-grid textarea,
.expense-detail-secondary textarea {
  min-height: 38px;
  height: 38px;
  overflow: hidden;
  resize: none;
  font-weight: 500;
}

.bank-review-field input,
.bank-review-field select,
.bank-review-field textarea,
.expense-detail-grid input,
.expense-detail-grid select,
.expense-detail-grid textarea,
.expense-detail-secondary input,
.expense-detail-secondary select,
.expense-detail-secondary textarea,
.expense-detail-grid .tag-picker-button,
.expense-detail-secondary .tag-picker-button {
  min-height: 38px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.bank-review-field input:disabled,
.bank-review-field select:disabled,
.bank-review-field textarea:disabled,
.expense-detail-grid input:disabled,
.expense-detail-grid select:disabled,
.expense-detail-grid textarea:disabled,
.expense-detail-secondary input:disabled,
.expense-detail-secondary select:disabled,
.expense-detail-secondary textarea:disabled {
  opacity: 1;
  font-weight: 500;
  -webkit-text-fill-color: var(--text-muted);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
  font-size: 12px;
  font-weight: var(--font-weight-badge);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-select {
  display: none;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
}

.tag-picker {
  position: relative;
  display: grid;
  gap: 4px;
}

.tag-picker-button {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--xb-button-outlined-border);
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-button-outlined-container);
  color: var(--xb-button-outlined-content);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  text-align: left;
}

.tag-picker-button:hover,
.tag-picker-button:focus-visible {
  border-color: var(--xb-button-outlined-content);
  background: var(--xb-button-outlined-hover-container);
  outline: none;
}

.tag-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.tag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.tag-option input {
  flex: 0 0 auto;
  width: 16px;
  min-width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.tag-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tag-option:hover {
  background: var(--surface-muted);
}

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

.quick-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 35;
  display: grid;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.quick-option {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 13px;
}

.quick-option:hover {
  background: var(--surface-muted);
}

.quick-option-new {
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0;
  color: var(--secondary-ink);
  font-weight: 650;
}

.quick-modal-card {
  width: min(420px, calc(100vw - 32px));
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.quick-modal-card form {
  padding: 18px;
}

.confirm-modal-card {
  width: min(520px, calc(100vw - 40px));
  border-radius: var(--xb-shape-dialog);
  background: var(--xb-dialog-container);
}

.confirm-modal-card.is-wide {
  width: min(676px, calc(100vw - 40px));
}

.confirm-modal-card .quick-modal-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 20px 20px 0;
}

.confirm-modal-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--xb-shape-md);
  background: var(--xb-color-tertiary-container);
  color: var(--xb-color-on-tertiary-container);
  flex: 0 0 auto;
}

.confirm-modal-icon.is-danger {
  background: var(--xb-alert-error-container);
  color: var(--xb-alert-error-content);
}

.confirm-modal-icon.is-info {
  background: var(--xb-color-tertiary-container);
  color: var(--xb-color-on-tertiary-container);
}

.confirm-modal-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.confirm-modal-heading {
  min-width: 0;
}

.confirm-modal-heading h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.confirm-modal-eyebrow {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
}

.bank-balance-modal-card {
  width: min(460px, calc(100vw - 32px));
}

.confirm-modal-body {
  display: grid;
  gap: 12px;
  padding: 14px 20px 18px 72px;
}

.confirm-modal-body p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.confirm-modal-body ul,
.confirm-modal-body ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.business-setup-review-status {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.business-setup-review-copy p,
.business-setup-review-copy li {
  font-weight: 500;
}

.business-setup-review-section-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
}

.business-setup-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}

.business-setup-review-row strong {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.business-setup-review-note {
  padding-top: 2px;
  color: var(--text-secondary);
}

.confirm-modal-help {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--xb-color-outline-variant, var(--border-subtle));
  border-radius: var(--xb-shape-md, var(--radius-md));
  background: var(--xb-color-surface-container-low, var(--surface-muted));
}

.confirm-modal-help[hidden] {
  display: none;
}

.confirm-modal-help p {
  margin: 0;
}

.confirm-modal-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.confirm-modal-body .business-setup-review-row strong {
  font-weight: 500;
}

.confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--xb-space-2, 8px);
  padding: 14px 20px 20px;
}

.confirm-modal-actions .secondary,
.confirm-modal-actions .primary {
  display: inline-flex;
  align-items: center;
  height: var(--xb-button-height, 40px);
  min-height: var(--xb-button-height, 40px);
  min-width: 132px;
  justify-content: center;
  padding: 0 var(--xb-space-4, 16px);
  border-radius: var(--xb-shape-button, 8px);
  font-size: var(--font-size-button, 12.5px);
  line-height: var(--line-height-button, 17px);
  font-weight: var(--font-weight-button, 700);
  white-space: nowrap;
}

.category-intro {
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.header-two-line {
  display: inline-grid;
  gap: 0;
  line-height: 1.1;
}

.category-sections .table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.category-sections .category-table {
  table-layout: fixed;
  min-width: var(--category-table-min-width, 980px);
}

.category-sections .category-table th,
.category-sections .category-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.category-sections .category-table th {
  white-space: nowrap;
}

.category-sections .category-table th:nth-child(1),
.category-sections .category-table td:nth-child(1) {
  width: 8%;
}

.category-sections .category-table th:nth-child(2),
.category-sections .category-table td:nth-child(2) {
  width: 24%;
}

.category-sections .category-table th:nth-child(3),
.category-sections .category-table td:nth-child(3) {
  width: 15%;
}

.category-sections .category-table th:nth-child(4),
.category-sections .category-table td:nth-child(4) {
  width: 9%;
}

.category-sections .category-table th:nth-child(5),
.category-sections .category-table td:nth-child(5) {
  width: 10%;
}

.category-sections .category-table th:nth-child(6),
.category-sections .category-table td:nth-child(6) {
  width: 11%;
}

.category-sections .category-table th:nth-child(7),
.category-sections .category-table td:nth-child(7) {
  width: 7%;
}

.category-sections .category-table th:nth-child(8),
.category-sections .category-table td:nth-child(8) {
  width: 16%;
}

.category-sections .category-table td:nth-child(2) {
  font-weight: 650;
  line-height: 1.35;
}

.category-sections .category-table th:nth-child(5),
.category-sections .category-table td:nth-child(5) {
  text-align: right;
}

.category-sections .category-table th:nth-child(7),
.category-sections .category-table td:nth-child(7) {
  text-align: left;
}

.category-sections .category-table th:nth-child(8),
.category-sections .category-table td:nth-child(8) {
  text-align: left;
}

.category-table .balance-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

#categoriesView .panel-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 56px;
  overflow-x: auto;
  width: 100%;
}

.category-table-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-width: var(--category-table-min-width, 980px);
  width: 100%;
}

.category-table-controls {
  display: flex;
  align-items: end;
  gap: 6px;
  flex: 0 1 820px;
  width: min(100%, 820px);
  max-width: 820px;
  margin-left: 0;
}

.category-table-controls .filter-field {
  flex: 1 1 0;
  min-width: 0;
}

.category-table-controls .filter-field:first-child {
  flex: 1 1 560px;
}

.category-table-controls .filter-field:last-child {
  flex: 0 0 180px;
}

.category-table-controls label,
.category-table-controls .filter-field span {
  color: var(--text-secondary);
  font-size: var(--font-size-label);
  font-weight: 650;
  line-height: var(--line-height-label);
  text-transform: uppercase;
}

.category-table-controls input,
.category-table-controls select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.category-toolbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 38px;
  align-self: end;
}

.category-toolbar-icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-icon-button-container);
  color: var(--xb-icon-button-content);
  cursor: pointer;
  transition:
    background-color var(--xb-motion-state),
    color var(--xb-motion-state);
}

.category-toolbar-icon-button:hover,
.category-toolbar-icon-button:focus-visible {
  background: var(--xb-icon-button-hover-container);
  color: var(--xb-icon-button-hover-content);
  outline: none;
}

.category-toolbar-icon-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.15;
}

.amount-basis-badge {
  min-width: 104px;
  justify-content: center;
}

.category-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: var(--bank-row-control-height, 34px);
  height: var(--bank-row-control-height, 34px);
  padding: 0 10px;
  border-radius: var(--xb-shape-button-compact);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  white-space: nowrap;
}

.category-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.category-action-button.is-report {
  min-width: 88px;
}

.category-action-button.is-edit {
  min-width: 52px;
}

.category-action-button i,
.category-action-button svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  stroke-width: 2;
}

.category-action-button.is-edit i,
.category-action-button.is-edit svg {
  width: 12px;
  height: 12px;
  flex-basis: 12px;
}

#categoriesView,
#categoriesView .page-heading,
#categoriesView .panel,
#categoriesView .panel-header-row {
  min-width: 0;
}

#categoriesView .page-heading .actions {
  flex: 0 0 auto;
}

#categoriesView .panel {
  overflow: hidden;
}

.wizard-panel {
  max-width: 1220px;
}

.wizard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.wizard-form {
  display: grid;
  gap: 16px;
}

.wizard-result {
  align-self: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-warm);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.wizard-result > strong {
  display: block;
  margin: 8px 0;
  color: var(--deep-green);
  font-size: 30px;
}

.wizard-result p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-label {
  color: var(--muted);
  font-weight: 650;
}

.wizard-result-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.wizard-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.wizard-result-row strong {
  display: inline;
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
}

.wizard-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.wizard-status {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.wizard-status strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}

.vehicle-working-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 1fr);
  gap: 20px;
  align-items: start;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.vehicle-card,
.vehicle-results {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.vehicle-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.vehicle-card-header h2,
.vehicle-results h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.vehicle-card-body {
  padding: 16px;
}

.vehicle-controls {
  display: grid;
  gap: 14px;
}

.vehicle-form-grid {
  display: grid;
  gap: 10px;
}

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

.vehicle-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.vehicle-field > span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.vehicle-field input,
.vehicle-field select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--radius-md);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
}

.vehicle-field input:focus,
.vehicle-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

.vehicle-helper {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.settings-disabled-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--text-primary);
  padding: 12px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.settings-disabled-notice i {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--warning);
  margin-top: 1px;
}

.settings-disabled-notice strong {
  display: block;
  margin-bottom: 2px;
}

.vehicle-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 10px;
}

.vehicle-section-title h3 {
  margin: 0;
  font-size: 16px;
}

.vehicle-section-title span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.vehicle-expense-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.vehicle-expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
}

.vehicle-expense-row:first-child {
  border-top: 0;
}

.vehicle-expense-header {
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.vehicle-expense-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.vehicle-account-number {
  min-width: 42px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.vehicle-expense-name strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-expense-amount {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vehicle-results {
  position: sticky;
  top: 16px;
  padding: 16px;
  display: grid;
  gap: 14px;
  background: var(--xb-color-primary-container-low, #eadcff);
  border-color: var(--xb-color-primary-container-border, #d2bff2);
}

.vehicle-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.vehicle-result-row strong {
  color: var(--text-primary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.vehicle-result-primary {
  display: block;
  margin: 10px 0 8px;
  color: var(--primary);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
}

.vehicle-results .vehicle-note {
  margin: 8px 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.vehicle-results > .vehicle-note {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
}

.vehicle-results-section {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.vehicle-results-section h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.vehicle-journal-meta {
  display: grid;
  gap: 7px;
}

.vehicle-journal-meta-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.vehicle-journal-meta-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-journal-lines {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--xb-color-surface-container-lowest);
}

.vehicle-journal-lines-header,
.vehicle-journal-line,
.vehicle-journal-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--xb-table-border);
}

.vehicle-journal-lines-header {
  background: var(--xb-table-header-container);
  color: var(--xb-table-header-content);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.vehicle-journal-lines-header span:last-child {
  text-align: right;
}

.vehicle-journal-account {
  display: grid;
  min-width: 0;
  gap: 2px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.3;
}

.vehicle-journal-account-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-journal-line-type {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.vehicle-journal-amount {
  color: var(--text-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}

.vehicle-journal-total {
  background: var(--xb-color-surface-container-low);
  border-bottom: 0;
  font-weight: 700;
}

.vehicle-status-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vehicle-status-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.vehicle-status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.vehicle-status-list li.is-complete {
  color: var(--text-primary);
}

.vehicle-status-list li.is-complete .vehicle-status-dot {
  background: var(--xb-alert-complete-container);
}

.vehicle-status-list li.is-withdrawn .vehicle-status-dot {
  background: var(--xb-alert-error-container);
}

.vehicle-last-updated {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.vehicle-action-row {
  display: grid;
  gap: 10px;
}

.vehicle-primary-action,
.vehicle-withdraw-action {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  border-radius: var(--xb-shape-button);
  font: inherit;
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  cursor: pointer;
}

.vehicle-primary-action {
  border: 1px solid var(--xb-button-filled-container);
  background: var(--xb-button-filled-container);
  color: var(--xb-button-filled-content);
}

.vehicle-primary-action:hover {
  border-color: var(--xb-button-filled-hover-container);
  background: var(--xb-button-filled-hover-container);
}

.vehicle-primary-action:disabled {
  border-color: var(--xb-button-disabled-border);
  background: var(--xb-button-disabled-container);
  color: var(--xb-button-disabled-content);
  cursor: not-allowed;
  opacity: 1;
}

.vehicle-withdraw-action {
  border: 1px solid var(--xb-button-danger-outlined-border);
  background: var(--xb-button-outlined-container);
  color: var(--xb-button-danger-outlined-content);
}

.vehicle-withdraw-action:hover {
  border-color: var(--xb-button-danger-outlined-border);
  background: var(--xb-button-danger-hover-container);
  color: var(--xb-button-danger-hover-content);
}

.vehicle-empty-row {
  padding: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 980px) {
  .vehicle-working-layout {
    grid-template-columns: 1fr;
  }

  .vehicle-results {
    position: static;
  }

  .vehicle-form-grid.two {
    grid-template-columns: 1fr;
  }
}

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

.category-sections {
  display: grid;
  gap: 18px;
}

.category-empty-card {
  padding: 18px;
  color: var(--text-secondary);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-ink);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: var(--font-weight-badge);
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-ink);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.badge-review {
  background: var(--review-bg);
  color: var(--review-ink);
}

.badge-pending {
  background: var(--pending-bg);
  color: var(--pending-ink);
}

.badge-source {
  background: var(--source-bg);
  color: var(--source-ink);
}

.badge-accent {
  background: var(--accent-badge-bg);
  color: var(--accent-badge-ink);
}

.badge-ai {
  background: var(--xb-badge-ai-container);
  color: var(--xb-badge-ai-content);
}

.badge-neutral {
  background: var(--neutral-bg);
  color: var(--neutral-ink);
}

.pair-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-ink);
  font-size: 12px;
  font-weight: var(--font-weight-badge);
  vertical-align: middle;
}

.pair-badge-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banking-filters {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(180px, 240px);
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--xb-table-border);
}

#bankTransactionsView .panel {
  border-radius: var(--radius-lg);
}

#bankTransactionsView {
  --xb-bank-search-and-tags-width: clamp(360px, 28.2vw, 540px);
  align-content: start;
  min-height: 100%;
  background: transparent;
  overflow-anchor: none;
}

#bankTransactionsView .page-heading,
#bankTransactionsView .bank-context-banner,
#bankTransactionsView .bank-account-overview {
  margin-bottom: 0;
}

.bank-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--xb-color-primary) 22%, var(--xb-color-outline-variant));
  border-radius: var(--xb-shape-card);
  background: var(--xb-alert-info-container);
  color: var(--xb-alert-info-content);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
  font-weight: var(--font-weight-helper);
}

.bank-context-banner strong {
  color: var(--xb-color-on-surface);
  font-weight: var(--font-weight-button);
}

.bank-context-banner button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--xb-button-outlined-border);
  border-radius: var(--xb-shape-button-compact);
  background: var(--xb-field-container);
  color: var(--xb-button-outlined-content);
  font-family: var(--font-sans);
  font-size: var(--font-size-button);
  line-height: var(--line-height-button);
  font-weight: var(--font-weight-button);
  white-space: nowrap;
  cursor: pointer;
}

.bank-context-banner button:hover,
.bank-context-banner button:focus-visible {
  border-color: var(--xb-button-outlined-content);
  background: color-mix(in srgb, var(--xb-color-primary) 8%, var(--xb-color-surface));
  outline: none;
}

.bank-context-banner[hidden] {
  display: none;
}

#bankTransactionsView .transaction-toolbar {
  grid-template-columns: minmax(0, var(--xb-bank-search-and-tags-width)) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 10px;
  padding: 12px 16px;
}

#bankTransactionsView .filter-field > span {
  color: var(--xb-color-on-surface-variant);
  font-size: 11px;
  font-weight: var(--font-weight-label);
}

#bankTransactionsView .filter-field input,
#bankTransactionsView .filter-field select {
  min-height: 38px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
}

.bank-account-overview {
  display: grid;
  grid-template-columns: 612px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  height: 142px;
  min-height: 142px;
  margin-bottom: 22px;
  overflow: visible;
}

.bank-account-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
  gap: var(--xb-space-6);
  width: 612px;
  height: 142px;
  max-width: 612px;
  align-items: start;
  overflow: visible;
}

.bank-account-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--xb-space-4) var(--xb-space-7);
  min-width: 260px;
  max-width: 300px;
  height: 142px;
  min-height: 142px;
  padding: var(--xb-space-7) var(--xb-space-8);
  border: 1px solid var(--xb-card-border);
  border-radius: var(--xb-shape-card);
  background: var(--xb-card-container);
  color: var(--xb-card-content);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--xb-elevation-1);
  transition:
    background var(--xb-motion-state),
    border-color var(--xb-motion-state),
    box-shadow var(--xb-motion-state),
    transform var(--xb-motion-state);
  z-index: 1;
}

.bank-account-card:hover,
.bank-account-card:focus-within {
  border-color: var(--xb-card-selected-border);
  outline: 0;
  transform: translateY(-1px);
  z-index: 5;
}

.bank-account-card:has(.bank-balance-popover:not([hidden])) {
  z-index: 50;
}

.bank-account-card.active {
  border-color: var(--xb-card-selected-border);
  background: var(--xb-card-selected-container);
  color: var(--xb-card-selected-content);
  box-shadow: var(--xb-elevation-2);
}

.bank-account-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: var(--xb-shape-xs);
  background: var(--xb-card-selected-border);
}

.bank-account-card:active {
  border-color: var(--xb-card-selected-border);
  background: var(--xb-card-selected-container);
}

.bank-account-card-select {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.bank-account-card-select:focus-visible .bank-account-card-title {
  outline: 2px solid var(--xb-focus-ring);
  outline-offset: 3px;
  border-radius: var(--xb-shape-xs);
}

.bank-account-card-title {
  grid-column: 1;
  overflow: hidden;
  color: inherit;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-card-title);
  line-height: var(--line-height-body);
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-account-card-count {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  flex: 0 0 auto;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--xb-shape-chip);
  background: var(--xb-color-primary-container);
  color: var(--xb-color-on-primary-container);
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-badge);
  line-height: 26px;
  text-align: center;
  white-space: nowrap;
}

.bank-account-card.active .bank-account-card-count {
  background: var(--xb-color-primary);
  color: var(--xb-color-on-primary);
}

.bank-account-card-amounts {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--xb-space-3);
}

.bank-account-card-bank {
  display: flex;
  align-items: baseline;
  gap: var(--xb-space-3);
  color: var(--xb-card-supporting);
  font-size: var(--font-size-card-meta);
  font-weight: var(--font-weight-card-meta);
  line-height: var(--line-height-card-meta);
  letter-spacing: 0;
}

.bank-account-card-bank-text {
  min-width: 0;
}

.bank-account-card-bank strong {
  color: var(--xb-card-content);
  font-weight: var(--font-weight-amount);
  font-variant-numeric: tabular-nums;
}

.bank-account-card-bank small {
  display: block;
  margin-top: var(--xb-space-1);
  color: var(--xb-card-supporting);
  font-size: var(--font-size-card-meta);
  font-weight: var(--font-weight-card-meta);
  line-height: var(--line-height-card-meta);
}

.bank-account-card-posted {
  color: var(--xb-card-content);
  font-size: var(--font-size-card-value);
  font-weight: var(--font-weight-card-value);
  line-height: var(--line-height-card-value);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.bank-balance-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 1px solid var(--xb-button-outlined-border);
  border-radius: var(--xb-shape-full);
  background: var(--xb-button-tonal-container);
  color: var(--xb-button-tonal-content);
  font-size: 10px;
  font-weight: var(--font-weight-button);
  line-height: 1;
  cursor: pointer;
}

.bank-account-card :is(button, a, input, select, textarea) {
  cursor: pointer;
}

.bank-balance-help:hover,
.bank-balance-help:focus-visible {
  border-color: var(--xb-field-focus);
  background: var(--xb-button-tonal-container);
  outline: 2px solid var(--xb-focus-ring);
  outline-offset: 2px;
}

.bank-balance-popover {
  position: absolute;
  top: 84px;
  right: 14px;
  width: min(236px, calc(100% - 28px));
  margin-top: 0;
  padding: var(--xb-space-5) var(--xb-space-6);
  border: 1px solid var(--xb-card-border);
  border-radius: var(--xb-shape-menu);
  background: var(--xb-menu-container);
  box-shadow: var(--xb-elevation-2);
  color: var(--xb-card-supporting);
  font-size: 11px;
  font-weight: var(--font-weight-helper);
  line-height: 1.35;
  pointer-events: auto;
  z-index: 100;
}

.bank-balance-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 16px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--xb-card-border);
  border-left: 1px solid var(--xb-card-border);
  background: var(--xb-menu-container);
  transform: rotate(45deg);
}

.bank-balance-popover[hidden] {
  display: none !important;
}

.bank-balance-popover p {
  margin: 0 0 7px;
}

.bank-balance-action {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--xb-button-text-content);
  font-size: 11px;
  font-weight: var(--font-weight-button);
  line-height: 1.25;
  cursor: pointer;
  text-decoration: none;
}

.bank-balance-action:hover,
.bank-balance-action:focus-visible {
  background: transparent;
  outline: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bank-account-empty {
  padding: var(--xb-space-8);
  border: 1px dashed var(--xb-card-border);
  border-radius: var(--xb-shape-card);
  background: var(--xb-card-container);
  color: var(--xb-card-supporting);
}

.bank-account-card.skeleton,
.bank-review-health-card.skeleton {
  pointer-events: none;
}

.bank-account-card.skeleton {
  align-content: space-between;
}

.bank-review-health-card.skeleton {
  align-content: center;
  gap: var(--xb-space-4);
}

.bank-skeleton-line {
  display: block;
  overflow: hidden;
  border-radius: var(--xb-shape-chip);
  background: var(--xb-color-surface-container-highest);
  background-size: 220% 100%;
  animation: bankSkeletonShimmer var(--xb-motion-duration-long-4) ease-in-out infinite;
}

.bank-skeleton-title {
  width: min(78%, 210px);
  height: 14px;
}

.bank-skeleton-pill {
  width: 28px;
  height: 28px;
  border-radius: var(--xb-shape-full);
}

.bank-skeleton-meta {
  width: min(64%, 160px);
  height: 12px;
}

.bank-skeleton-small {
  width: min(42%, 116px);
  height: 11px;
}

.bank-skeleton-amount {
  width: min(70%, 190px);
  height: 20px;
}

.bank-review-health-card.skeleton {
  background: var(--xb-color-primary);
}

.bank-review-health-card.skeleton .bank-skeleton-line {
  background: color-mix(in srgb, var(--xb-color-on-primary) 28%, transparent);
  background-size: 220% 100%;
}

@keyframes bankSkeletonShimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bank-skeleton-line {
    animation: none;
  }
}

.bank-review-health-card {
  position: relative;
  display: grid;
  align-content: center;
  box-sizing: border-box;
  isolation: isolate;
  overflow: hidden;
  height: 142px;
  min-height: 142px;
  min-width: 0;
  padding: var(--xb-space-7) var(--xb-space-10);
  border-radius: var(--xb-shape-card);
  background: var(--xb-button-filled-container);
  color: var(--xb-button-filled-content);
  box-shadow: var(--xb-elevation-2);
}

.bank-review-health-card.is-collapsed {
  align-self: start;
  justify-self: end;
  width: 54px;
  min-height: 142px;
  min-width: 0;
  padding: 0;
  background: var(--xb-button-filled-container);
  box-shadow: var(--xb-elevation-2);
}

.bank-review-health-card::before {
  content: "";
  display: none;
}

.bank-review-health-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--xb-space-6);
  margin-bottom: var(--xb-space-3);
  color: color-mix(in srgb, var(--xb-button-filled-content) 72%, transparent);
  font-size: 11px;
  font-weight: var(--font-weight-helper);
  letter-spacing: 0;
  text-transform: uppercase;
}

.bank-review-health-value {
  display: block;
  color: color-mix(in srgb, var(--xb-button-filled-content) 90%, transparent);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.bank-review-health-subvalue {
  display: block;
  margin: var(--xb-space-3) 0 0;
  color: color-mix(in srgb, var(--xb-button-filled-content) 76%, transparent);
  font-size: 12px;
  font-weight: var(--font-weight-helper);
  line-height: 1.35;
}

.bank-review-health-meta {
  margin: var(--xb-space-4) 0 0;
  color: color-mix(in srgb, var(--xb-button-filled-content) 76%, transparent);
  font-size: 12px;
  font-weight: var(--font-weight-helper);
  line-height: 1.35;
}

.bank-review-health-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--xb-space-5);
  margin-top: var(--xb-space-5);
  min-width: 0;
}

.bank-review-health-stat {
  display: inline-flex;
  align-items: center;
  gap: var(--xb-space-3);
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: color-mix(in srgb, var(--xb-button-filled-content) 74%, transparent);
  font-size: 12px;
  font-weight: var(--font-weight-helper);
}

.bank-review-health-stat strong,
.bank-review-health-stat span {
  display: inline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-review-health-stat strong {
  color: var(--xb-button-filled-content);
  font-size: 12px;
  font-weight: 600;
}

.bank-review-health-stat span {
  color: color-mix(in srgb, var(--xb-button-filled-content) 70%, transparent);
  font-size: 12px;
  font-weight: var(--font-weight-helper);
  overflow: visible;
  text-overflow: clip;
  text-transform: none;
  white-space: normal;
}

.bank-assistant-toggle,
.bank-assistant-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--xb-button-filled-content) 24%, transparent);
  border-radius: var(--xb-shape-full);
  background: color-mix(in srgb, var(--xb-button-filled-content) 12%, transparent);
  color: var(--xb-button-filled-content);
  cursor: pointer;
}

.bank-assistant-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 24px;
  font-size: 16px;
  font-weight: var(--font-weight-button);
  text-align: center;
}

.bank-assistant-chip {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--xb-shape-full);
  background: color-mix(in srgb, var(--xb-button-filled-content) 14%, transparent);
  color: var(--xb-button-filled-content);
  border-color: color-mix(in srgb, var(--xb-button-filled-content) 28%, transparent);
  box-shadow: none;
  font-size: 18px;
  font-weight: var(--font-weight-button);
}

.bank-assistant-chip-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--xb-button-filled-content);
  font-size: 18px;
  font-weight: var(--font-weight-button);
  line-height: 1;
}

.bank-assistant-toggle:hover,
.bank-assistant-toggle:focus-visible,
.bank-assistant-chip:hover,
.bank-assistant-chip:focus-visible {
  outline: 0;
  filter: brightness(1.02);
}

.bank-assistant-learn {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--xb-button-filled-content);
  font-size: 12px;
  font-weight: var(--font-weight-button);
  text-decoration: none;
  white-space: nowrap;
}

.bank-assistant-learn:hover,
.bank-assistant-learn:focus-visible {
  outline: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bank-account-overview.has-many-accounts {
  grid-template-columns: minmax(0, 1fr);
}

.bank-account-overview.has-many-accounts .bank-account-card-grid {
  width: auto;
  max-width: none;
}

.bank-account-overview.has-many-accounts .bank-review-health-card {
  display: none;
}

@media (max-width: 1500px) {
  .bank-account-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .bank-account-card-grid {
    width: auto;
    max-width: none;
  }

  .bank-review-health-card {
    display: none;
  }
}

.bank-queue-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  position: relative;
  min-height: 40px;
  padding: 0 0 0 52px;
  overflow: visible;
  isolation: isolate;
}

.bank-queue-tabs::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--xb-tab-indicator);
  z-index: 20;
}

.bank-queue-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  align-self: center;
  gap: var(--xb-space-4);
  margin: 0 var(--xb-space-8) var(--xb-space-2) auto;
  position: relative;
  transform: translateY(-6px);
  z-index: 30;
}

.bank-queue-actions[hidden] {
  display: none !important;
}

.bank-queue-actions .secondary {
  min-height: 32px;
  padding: var(--xb-space-3) var(--xb-space-6);
  white-space: nowrap;
}

.bank-queue-actions .is-destructive {
  border-color: var(--xb-button-danger-outlined-border);
  color: var(--xb-button-danger-outlined-content);
}

.bank-queue-actions .is-destructive:hover,
.bank-queue-actions .is-destructive:focus-visible {
  background: var(--xb-button-danger-hover-container);
  color: var(--xb-button-danger-hover-content);
}

#expensesView .expense-transaction-actions,
#incomeView .expense-transaction-actions {
  align-self: center;
  margin: 0;
  transform: none;
}

/* Keep the mirrored Expense and Income table anchors fixed when selection
   actions appear. */
@media (min-width: 768px) {
  #expensesView #expenses .panel-header-row,
  #incomeView #income .panel-header-row {
    min-height: 32px;
  }
}

.bank-queue-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 32px;
  margin-right: 15px;
  border: 0;
  border-radius: var(--xb-shape-sm) var(--xb-shape-sm) 0 0;
  background: var(--xb-tab-container);
  color: var(--xb-tab-content);
  font-size: var(--font-size-tab);
  font-weight: var(--font-weight-tab);
  line-height: var(--line-height-tab);
  padding: var(--xb-space-2) var(--xb-space-7);
  cursor: pointer;
  text-transform: none;
  z-index: 1;
  box-shadow: none;
  transition:
    background-color var(--xb-motion-state),
    color var(--xb-motion-state),
    box-shadow var(--xb-motion-state);
}

.bank-queue-tab::before,
.bank-queue-tab::after {
  content: "";
  position: absolute;
  top: 0;
  width: 30px;
  height: 100%;
  background: inherit;
  pointer-events: none;
  z-index: -1;
  transition:
    background-color var(--xb-motion-state),
    box-shadow var(--xb-motion-state);
}

.bank-queue-tab::before {
  right: -16px;
  border-radius: 0 var(--xb-shape-sm) 0 0;
  box-shadow:
    color-mix(in srgb, var(--xb-color-shadow) 9%, transparent) 2px 2px 4px,
    inset color-mix(in srgb, var(--xb-color-surface-bright) 9%, transparent) -1px 0;
  transform: skew(30deg, 0deg);
  transform-origin: left bottom;
}

.bank-queue-tab::after {
  left: -16px;
  border-radius: var(--xb-shape-sm) 0 0 0;
  box-shadow:
    color-mix(in srgb, var(--xb-color-shadow) 9%, transparent) -2px 2px 4px,
    inset color-mix(in srgb, var(--xb-color-surface-bright) 9%, transparent) 1px 0;
  transform: skew(-30deg, 0deg);
  transform-origin: right bottom;
}

.bank-queue-tab[data-bank-queue-tab="pending"] {
  z-index: 3;
}

.bank-queue-tab[data-bank-queue-tab="posted"] {
  z-index: 2;
}

.bank-queue-tab[data-bank-queue-tab="excluded"] {
  z-index: 1;
}

.bank-queue-tab:hover {
  background: var(--xb-tab-hover-container);
  color: var(--xb-tab-hover-content);
  z-index: 4;
}

.bank-queue-tab.active,
.bank-queue-tab[aria-selected="true"] {
  background: var(--xb-tab-selected-container);
  color: var(--xb-tab-selected-content);
  z-index: 8;
  box-shadow: none;
}

.bank-queue-tab.active::before,
.bank-queue-tab.active::after,
.bank-queue-tab[aria-selected="true"]::before,
.bank-queue-tab[aria-selected="true"]::after {
  background: var(--xb-tab-selected-container);
}

.bank-transaction-control-surface {
  position: relative;
  margin: 0;
  padding: var(--xb-space-8) 0 var(--xb-space-7);
  border-bottom: 1px solid var(--xb-table-border);
  border-radius: var(--xb-shape-card) var(--xb-shape-card) 0 0;
  background: var(--xb-color-surface-container);
}

#bankTransactionsView .bank-transaction-control-surface .transaction-toolbar {
  margin-top: -1px;
  padding: 14px 16px 0;
  border-top: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
}

#bankTransactionBulkActionBar {
  display: none !important;
}

.banking-table .select-cell input,
.banking-table .select-cell input:checked,
.banking-table .select-cell input:focus {
  outline: 0;
  box-shadow: none;
}

.banking-table .select-cell input:focus-visible {
  outline: 2px solid var(--xb-checkbox-focus-ring);
  outline-offset: 2px;
  box-shadow: none;
}

.banking-table-wrap {
  width: 100%;
  min-height: calc(48px + (var(--bank-row-height, 52px) * 1));
  min-width: 0;
  overflow-x: auto;
  overflow-anchor: none;
  overscroll-behavior-x: contain;
}

.panel > .table-wrap:last-child,
.panel > .banking-table-wrap:last-child {
  border-bottom-right-radius: inherit;
  border-bottom-left-radius: inherit;
}

.banking-table {
  --bank-row-height: 52px;
  --bank-row-control-height: 34px;
  --bank-col-select: 36px;
  --bank-col-date: 120px;
  --bank-col-spent: 104px;
  --bank-col-received: 132px;
  --bank-col-status: 104px;
  --bank-col-category: clamp(220px, 16vw, 300px);
  --bank-col-tax: clamp(132px, 9vw, 180px);
  --bank-col-action: 88px;
  table-layout: fixed;
  width: 100%;
  min-width: 1120px;
}

.banking-table th:nth-child(1),
.banking-table td:nth-child(1) {
  width: var(--bank-col-select);
}

.banking-table th:nth-child(2),
.banking-table td:nth-child(2) {
  width: var(--bank-col-date);
}

.banking-table th:nth-child(3),
.banking-table td:nth-child(3) {
  width: var(--bank-col-spent);
  text-align: right;
}

.banking-table th:nth-child(4),
.banking-table td:nth-child(4) {
  width: var(--bank-col-received);
  text-align: right;
}

.banking-table th:nth-child(5),
.banking-table td:nth-child(5) {
  width: auto;
}

.banking-table th:nth-child(6),
.banking-table td:nth-child(6) {
  width: var(--bank-col-status);
}

.banking-table th:nth-child(7),
.banking-table td:nth-child(7) {
  width: var(--bank-col-category);
}

.banking-table th:nth-child(8),
.banking-table td:nth-child(8) {
  width: var(--bank-col-tax);
}

.banking-table th:nth-child(9),
.banking-table td:nth-child(9) {
  position: sticky;
  right: 0;
  z-index: 4;
  width: var(--bank-col-action);
  min-width: var(--bank-col-action);
  background: var(--xb-table-row-container);
  text-align: left;
  overflow: visible;
}

.banking-table th:nth-child(9) {
  z-index: 6;
  background: var(--xb-table-header-container);
}

.banking-table tr:has(.bank-action-menu:not([hidden])) td:nth-child(9) {
  z-index: 80;
}

.banking-table th,
.banking-table td {
  padding-inline: 8px;
}

.banking-table tbody tr:last-child td {
  border-bottom: 0;
}

.banking-table th:nth-child(1),
.banking-table td:nth-child(1),
.banking-table th:nth-child(9),
.banking-table td:nth-child(9) {
  padding-inline: 6px;
}

.banking-table th.bank-category-header-cell {
  padding-left: 10px;
}

.statements-table {
  table-layout: fixed;
  min-width: 1250px;
}

.banking-table th,
.banking-table td,
.statements-table th,
.statements-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.banking-table th,
.statements-table th {
  white-space: nowrap;
  vertical-align: middle;
}

.banking-date-cell,
.statement-period-cell {
  white-space: nowrap;
}

.banking-description-cell {
  overflow: hidden;
  line-height: 1.35;
  white-space: nowrap;
}

.banking-description-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-status-cell {
  text-align: left;
}

.banking-table td.bank-status-cell {
  text-align: left;
}

.bank-status-cell .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--font-weight-badge);
}

.bank-status-badge {
  min-width: 84px;
  justify-content: flex-start;
}

.bank-status-badge .status-icon,
.suggestion-source-badge .status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: currentColor;
}

.bank-status-badge .status-icon svg,
.suggestion-source-badge .status-icon svg {
  display: block;
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bank-status-posted .status-icon {
  border-radius: var(--xb-shape-full);
  background: var(--xb-badge-complete-container);
  color: var(--xb-badge-complete-content);
}

.bank-status-posted .status-icon svg {
  width: 9px;
  height: 9px;
  stroke-width: 1.8;
}

.bank-status-pending {
  background: var(--xb-badge-pending-container);
  color: var(--xb-badge-pending-content);
}

.bank-status-rule {
  background: var(--xb-badge-rule-container);
  color: var(--xb-badge-rule-content);
}

.bank-status-pair {
  background: var(--xb-badge-complete-container);
  color: var(--xb-badge-complete-content);
}

.bank-status-posted {
  background: var(--xb-badge-complete-container);
  color: var(--xb-badge-complete-content);
}

.bank-status-excluded {
  background: var(--xb-badge-neutral-container);
  color: var(--xb-badge-neutral-content);
}

.banking-table .amount-expense,
.banking-table .amount-income {
  font-weight: 600;
}

.banking-table td:nth-child(7),
.banking-table td:nth-child(8) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-inline-select {
  appearance: auto;
  -webkit-appearance: auto;
  width: 100%;
  min-height: 34px;
  padding: 6px 28px 6px 8px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-combobox {
  display: grid;
  position: relative;
  min-width: 0;
}

.category-combobox-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 40px;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.category-combobox-input::-webkit-calendar-picker-indicator {
  display: none !important;
  opacity: 0;
}

.category-combobox-input::placeholder {
  color: var(--xb-field-label);
}

.category-combobox-input:focus {
  border-color: var(--xb-field-focus);
  box-shadow: 0 0 0 3px var(--xb-focus-ring);
  outline: 0;
}

.category-combobox-input.has-error {
  border-color: var(--xb-field-error);
}

.category-combobox-input.has-error::placeholder {
  color: var(--xb-field-error);
  opacity: 1;
}

.category-combobox-input:disabled {
  background: var(--xb-color-surface-container);
  color: var(--xb-color-on-surface-variant);
  cursor: not-allowed;
  opacity: 1;
  font-weight: 500;
  -webkit-text-fill-color: var(--xb-color-on-surface-variant);
}

.category-combobox.compact .category-combobox-input {
  min-height: 34px;
  padding: 6px 28px 6px 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-combobox-menu {
  position: fixed;
  top: var(--category-combobox-menu-top, 0);
  left: var(--category-combobox-menu-left, 0);
  z-index: 1200;
  display: none;
  width: var(--category-combobox-menu-width, 420px);
  max-height: var(--category-combobox-menu-max-height, 320px);
  overflow: auto;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-card);
  background: var(--xb-color-surface-container-lowest);
  box-shadow: var(--xb-elevation-3);
  padding: 8px;
}

.category-combobox.is-open .category-combobox-menu {
  display: block;
}

.category-combobox-group + .category-combobox-group {
  margin-top: 8px;
}

.category-combobox-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 2px 6px;
  color: var(--xb-color-on-surface-variant);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 14px;
  text-transform: uppercase;
  white-space: nowrap;
}

.category-combobox-group-label::before,
.category-combobox-group-label::after {
  content: "";
  height: 1px;
  min-width: 12px;
  background: var(--xb-color-outline-variant);
  opacity: 0.72;
}

.category-combobox-group-label::after {
  flex: 1 1 auto;
}

.category-combobox-option {
  display: grid;
  grid-template-columns: minmax(44px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: var(--xb-shape-sm);
  background: transparent;
  color: var(--xb-color-on-surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 17px;
  padding: 7px 8px;
  text-align: left;
}

.category-combobox-option:hover,
.category-combobox-option.is-active {
  background: var(--xb-menu-item-hover-container);
  color: var(--xb-menu-item-hover-content);
}

.category-combobox-option-number {
  color: var(--xb-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.category-combobox-option-name {
  overflow: hidden;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-combobox-empty {
  padding: 12px 10px;
  color: var(--xb-color-on-surface-variant);
  font-size: 12.5px;
  line-height: 18px;
}

.bank-inline-select:focus {
  border-color: var(--xb-field-focus);
  box-shadow: 0 0 0 3px var(--xb-focus-ring);
  outline: 0;
}

.bank-inline-select.has-error {
  border-color: var(--xb-field-error);
}

.bank-review-field select.has-error {
  border-color: var(--xb-field-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--xb-field-error) 12%, transparent);
}

.bank-inline-validation,
.bank-review-validation {
  color: var(--xb-field-error);
  font-size: 12px;
  font-weight: var(--font-weight-helper);
}

.bank-inline-validation {
  display: block;
  margin-top: 4px;
}

.bank-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bank-field-heading .bank-inline-validation {
  margin-top: 0;
  text-align: right;
  white-space: nowrap;
}

.bank-review-validation {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--xb-field-error) 35%, var(--xb-field-border));
  border-radius: var(--xb-shape-sm);
  background: var(--xb-alert-error-container);
}

.bank-pagination {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: var(--xb-space-6);
  padding: var(--xb-space-6) var(--xb-space-8);
  border-top: 1px solid var(--xb-table-border);
  background: var(--xb-table-footer-container);
  color: var(--xb-table-footer-content);
  font-size: var(--font-size-helper);
  position: relative;
  z-index: 1;
  border-bottom-right-radius: inherit;
  border-bottom-left-radius: inherit;
}

.bank-page-size {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  gap: var(--xb-space-4);
  white-space: nowrap;
}

.bank-page-size select {
  min-height: 34px;
  padding: var(--xb-space-2) 28px var(--xb-space-2) var(--xb-space-5);
  border: 1px solid var(--xb-field-border);
  border-radius: var(--xb-shape-input);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
}

.bank-footer-selection-count {
  display: inline-flex;
  grid-column: 2;
  align-items: center;
  justify-self: center;
  min-width: 0;
  color: var(--xb-table-footer-content);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
  font-weight: var(--font-weight-helper);
  white-space: nowrap;
}

.bank-footer-selection-count[hidden] {
  display: none !important;
}

#bankTransactionPaginationSummary {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
  color: var(--xb-table-footer-content);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
  font-weight: var(--font-weight-helper);
  text-align: center;
  white-space: nowrap;
}

.bank-pagination-controls {
  display: inline-flex;
  grid-column: 3;
  align-items: center;
  justify-self: end;
  gap: var(--xb-space-4);
}

.bank-row-main {
  height: var(--bank-row-height);
  cursor: pointer;
}

.bank-row-main td {
  box-sizing: border-box;
  height: var(--bank-row-height);
  min-height: var(--bank-row-height);
  padding-top: 6px;
  padding-bottom: 6px;
  line-height: var(--line-height-table) !important;
  vertical-align: middle;
}

.bank-row-main .bank-inline-select,
.bank-row-main .category-combobox-input,
.bank-row-main .bank-post-main,
.bank-row-main .bank-post-menu-button,
.bank-row-main .small-primary.compact {
  box-sizing: border-box;
  min-height: var(--bank-row-control-height) !important;
  height: var(--bank-row-control-height) !important;
  line-height: var(--line-height-table) !important;
}

.bank-row-main .category-combobox,
.bank-row-main .bank-action-split,
.bank-row-main .bank-post-split-button {
  min-height: var(--bank-row-control-height) !important;
  height: var(--bank-row-control-height) !important;
  align-items: center;
}

.bank-row-main .bank-category-cell {
  padding-left: 6px;
  vertical-align: middle;
}

.bank-row-main .bank-category-cell .category-combobox {
  align-content: center;
  height: 100%;
}

.bank-row-main .category-combobox-input {
  padding-top: 0;
  padding-bottom: 0;
  line-height: var(--line-height-table) !important;
}

.bank-row-main .bank-row-select {
  width: 18px;
  height: 18px;
  margin: 0;
}

.bank-row-main .bank-status-cell .badge {
  box-sizing: border-box;
  height: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}

.bank-row-main td:first-child {
  box-shadow: inset 3px 0 0 transparent;
  transition: box-shadow 0.16s ease;
}

.bank-row-main:hover {
  background: var(--xb-table-row-hover-container);
}

.bank-row-main:hover td,
.bank-row-main:hover td:nth-child(9) {
  background: var(--xb-table-row-hover-container);
}

.bank-row-main:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--xb-table-row-state-indicator);
}

.bank-row-main.is-expanded:not(:hover):not(.is-selected):not(.is-reconcile-context),
.bank-row-main.is-expanded:not(:hover):not(.is-selected):not(.is-reconcile-context) td,
.bank-row-main.is-expanded:not(:hover):not(.is-selected):not(.is-reconcile-context) td:nth-child(9) {
  background: #fef7ff;
}

.bank-row-main.is-reconcile-context,
.bank-row-main.is-reconcile-context td,
.bank-row-main.is-reconcile-context td:nth-child(9) {
  background: var(--xb-table-row-candidate-container);
  color: var(--xb-table-row-candidate-content);
}

.bank-row-main.is-reconcile-context td:first-child {
  box-shadow: inset 3px 0 0 var(--xb-table-border);
}

.bank-row-main.is-selected,
.bank-row-main.is-selected td,
.bank-row-main.is-selected td:nth-child(9) {
  background: var(--xb-table-row-selected-container);
  color: var(--xb-table-row-selected-content);
}

.bank-row-main.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--xb-table-row-state-indicator);
}

.bank-review-row td {
  padding: 0;
  background: var(--xb-table-row-container);
  cursor: default;
}

.bank-review-panel {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 18vw, 320px);
  gap: 20px;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--xb-table-border);
  cursor: default;
}

.bank-review-panel > * {
  min-width: 0;
}

.bank-review-fields {
  position: relative;
  display: grid;
  /* Keep the one-line memo/note layout as compact as the original two-line
     fields without changing the review panel's overall frame. */
  gap: 10px;
}

.bank-review-empty-side {
  min-height: 1px;
}

.row-close-button {
  position: absolute;
  top: -6px;
  right: -4px;
}

.bank-review-grid {
  display: grid;
  grid-template-columns:
    minmax(132px, 190px)
    minmax(300px, 1.5fr)
    minmax(150px, 220px)
    minmax(132px, 190px);
  gap: 10px;
  align-content: start;
}

.bank-review-full-description {
  display: grid;
  gap: 6px;
}

.bank-review-full-description span,
.bank-review-field label,
.bank-ai-card span {
  color: var(--xb-field-label);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
  line-height: var(--line-height-label);
}

.bank-review-full-description strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.bank-review-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  cursor: default;
}

.bank-review-field > span,
.bank-tags-heading,
.bank-attachment-heading {
  color: var(--xb-field-label);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
  line-height: var(--line-height-label);
}

.bank-review-grid > .bank-tags-attachments-layout {
  display: grid;
  position: relative;
  grid-column: 1 / -1;
  /* Keep Tags aligned with the primary Search control, then reserve two
     discrete columns for attachment actions and the opened file list. */
  grid-template-columns: minmax(0, var(--xb-bank-search-and-tags-width)) minmax(220px, 0.52fr) minmax(260px, 0.9fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.bank-tags-attachments-layout .bank-review-field {
  min-width: 0;
}

.bank-attachments-field {
  /* Let the control and its optional file list occupy dedicated grid tracks. */
  display: contents;
}

.bank-attachments-field .bank-attachment-control {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.bank-attachments-field .bank-attachment-panel-slot {
  grid-column: 3;
  grid-row: 1;
  align-self: start;
  min-block-size: 156px;
}

.bank-attachments-field .bank-attachment-panel-slot .bank-attachment-popover { margin-top: 0; }

.bank-review-field > span,
.bank-review-actions .attachment-name,
.bank-ai-card,
.bank-ai-card-title,
.bank-ai-suggestion,
.suggestion-card-header,
.suggestion-source-badge,
.suggestion-reason {
  cursor: default;
}

.bank-tags-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bank-posted-tag-field {
  grid-template-rows: 22px 42px;
  gap: 6px;
}

.bank-posted-tag-field > .bank-tags-heading { align-self: center; }
.bank-posted-tag-field > .bank-posted-tag-picker { align-self: end; }

.bank-tag-icon {
  inline-size: 15px;
  block-size: 15px;
  color: var(--xb-color-primary, var(--primary));
}

.bank-review-field-priority-a {
  min-width: 0;
}

.bank-review-field-priority-b,
.bank-review-field-priority-c {
  min-width: 0;
}

.bank-review-field-rental-property {
  grid-column: 1 / 3;
}

.bank-review-field input,
.bank-review-field select,
.bank-review-field textarea {
  width: 100%;
  height: 40px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.bank-review-field .category-combobox-input {
  height: 40px;
  min-height: 40px;
}

.bank-posted-tag-picker {
  position: relative;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

.bank-posted-tag-picker > summary {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 40px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--xb-field-border);
  /* Keep the tag selector geometry identical in Pending and Posted rows. */
  border-radius: 8px;
  background: var(--xb-field-surface);
  color: var(--xb-color-on-surface);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.bank-posted-tag-picker > summary::-webkit-details-marker {
  display: none;
}

.bank-tag-summary-text {
  display: block;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-select-chevron {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--xb-color-on-surface-variant);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bank-posted-tag-options {
  position: fixed;
  z-index: 1600;
  top: var(--bank-tag-popover-top, 0);
  left: var(--bank-tag-popover-left, 0);
  display: grid;
  gap: 2px;
  width: var(--bank-tag-popover-width, 320px);
  max-height: var(--bank-tag-popover-max-height, 320px);
  margin: 0;
  padding: 6px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-card);
  background: var(--xb-color-surface-container-lowest);
  box-shadow: var(--xb-elevation-3);
}

.bank-posted-tag-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 2px 4px;
  color: var(--xb-color-on-surface);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.bank-posted-tag-options label span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.bank-posted-tag-options input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.bank-review-field input,
.bank-review-field textarea {
  cursor: text;
}

.bank-review-single-line-field input {
  height: 40px;
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-review-field select,
.bank-review-field .category-combobox,
.bank-review-field .category-combobox-input,
.bank-review-field button,
.bank-review-actions button,
.bank-attachment-control button {
  cursor: pointer;
}

.bank-review-field textarea {
  min-height: 60px;
  font-weight: 500;
  resize: vertical;
}

.bank-review-field input:disabled,
.bank-review-field select:disabled,
.bank-review-field textarea:disabled {
  background: var(--xb-color-surface-container);
  color: var(--xb-color-on-surface-variant);
  cursor: not-allowed;
  opacity: 1;
  font-weight: 500;
  -webkit-text-fill-color: var(--xb-color-on-surface-variant);
}

#detailForm .field label,
#detailForm .field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

#detailForm .field input,
#detailForm .field select,
#detailForm .field textarea,
#detailForm .category-combobox-input {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

#detailForm input[type="date"] {
  font-size: 13px;
}

#detailForm .field textarea {
  min-height: 38px;
  height: 38px;
  overflow: hidden;
  resize: none;
}

#detailForm .field input:disabled,
#detailForm .field select:disabled,
#detailForm .field textarea:disabled,
#detailForm .category-combobox-input:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
  font-weight: 500;
  -webkit-text-fill-color: var(--text-muted);
}

#detailForm .tax-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  min-height: auto;
  overflow-x: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

#detailForm .tax-summary strong {
  color: var(--text-primary);
  font-weight: 650;
}

.bank-tax-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  align-items: center;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  overflow-x: auto;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.bank-tax-summary strong {
  color: var(--text);
  font-weight: 700;
}

.bank-split-lines-table {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.bank-split-lines-header,
.bank-split-line-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(140px, 1fr) minmax(90px, 0.45fr) minmax(130px, 0.65fr);
  gap: 12px;
  padding: 10px 12px;
}

.bank-split-lines-header {
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.bank-split-line-row {
  align-items: center;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}

.bank-split-lines-header span:nth-child(3),
.bank-split-line-row .amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bank-memo-readonly,
#detailBankMemo,
.bank-split-line-description {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
}

#detailBankMemo:not(:disabled) {
  color: var(--text-primary);
  background: var(--xb-color-surface-container-lowest);
  font-weight: 500;
}

.bank-attachment-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "heading" "upload";
  grid-template-rows: 22px 42px;
  align-items: start;
  justify-items: start;
  gap: 6px;
  block-size: 70px;
}

.bank-attachment-heading {
  grid-area: heading;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-inline-size: 0;
  color: var(--xb-field-label);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
  line-height: var(--line-height-label);
  block-size: 22px;
}

.bank-attachment-heading .bank-posted-attachment-icon {
  flex: 0 0 auto;
  inline-size: 14px;
  block-size: 14px;
  color: var(--xb-color-primary, var(--primary));
}

.bank-attachment-count-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-inline-size: 28px;
  min-block-size: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.detail-attachment-area {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.attachment-preview-dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: min(760px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--xb-shape-dialog, 20px);
  background: var(--xb-dialog-container, var(--surface));
  color: var(--text-primary);
  box-shadow: var(--shadow-panel);
}

.attachment-preview-dialog::backdrop {
  background: rgb(20 16 24 / 58%);
}

.attachment-preview-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.attachment-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.attachment-preview-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
  overflow-wrap: anywhere;
}

.attachment-preview-header p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.attachment-preview-content {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.attachment-preview-content img,
.attachment-preview-content iframe {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 0;
  border: 0;
  object-fit: contain;
}

.attachment-preview-content p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.attachment-preview-content a {
  color: var(--primary);
  font-weight: 600;
}

.detail-attachment-area .bank-attachment-control {
  min-height: 0;
}

.bank-attachment-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--xb-field-border);
  border-radius: 999px;
  background: var(--xb-field-surface);
  color: var(--primary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.bank-attachment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 28px;
  block-size: 28px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--xb-color-error-container, #e87570);
  color: var(--xb-color-on-error-container, #fff);
  font-size: 13px;
  font-weight: 700;
}

.bank-attachment-count-toggle .bank-attachment-count {
  pointer-events: none;
}

.bank-attachment-count-toggle:hover .bank-attachment-count,
.bank-attachment-count-toggle:focus-visible .bank-attachment-count {
  background: var(--xb-color-error, #c94945);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--xb-color-error, #c94945) 20%, transparent);
}

.bank-attachment-count-toggle:focus-visible {
  outline: none;
}

.bank-attachment-upload {
  grid-area: upload;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-block-size: 40px;
  align-self: end;
}

.bank-attachment-plus {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.bank-attachment-summary:disabled {
  color: var(--text-muted);
  cursor: default;
  text-decoration: none;
}

.bank-attachment-summary { display: none; }

.bank-attachment-empty {
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
}

.bank-attachment-popover {
  display: grid;
  gap: 4px;
  max-height: 156px;
  margin-top: 6px;
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.bank-add-tag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 4px -2px -2px;
  padding: 8px 4px 2px;
  border: 0;
  border-top: 1px solid var(--xb-color-outline-variant);
  background: transparent;
  color: var(--xb-color-primary, var(--primary));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.bank-add-tag-option svg {
  width: 16px;
  height: 16px;
}

.bank-tag-manager-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--xb-shape-dialog, 20px);
  background: var(--xb-dialog-container, var(--surface));
  color: var(--text-primary);
  box-shadow: var(--shadow-panel);
}

.bank-tag-manager-dialog::backdrop { background: rgb(20 16 24 / 58%); }

.bank-tag-manager-card { display: grid; gap: 18px; padding: 22px; }
.bank-tag-manager-card header { display: flex; justify-content: space-between; gap: 16px; }
.bank-tag-manager-card h2 { margin: 0; font-size: 18px; }
.bank-tag-manager-card p { margin: 4px 0 0; color: var(--text-secondary); }
.bank-tag-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.bank-tag-create-row label { display: grid; gap: 6px; }
.bank-tag-create-row label span { color: var(--xb-field-label); font-size: var(--font-size-label); font-weight: var(--font-weight-label); }
.bank-tag-create-row input,
.bank-tag-manager-row input { min-height: 40px; width: 100%; border: 1px solid var(--xb-field-border); border-radius: 8px; background: var(--xb-field-surface); color: var(--text-primary); padding: 8px 10px; }
.bank-tag-manager-list { display: grid; gap: 8px; max-height: 340px; overflow: auto; }
.bank-tag-manager-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }

.bank-tag-delete-confirm {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--xb-color-error-container, var(--border-subtle));
  border-radius: 12px;
  background: var(--xb-color-error-container, var(--surface));
}

.bank-tag-delete-confirm p { margin: 0; }
.bank-tag-delete-confirm > div { display: flex; justify-content: flex-end; gap: 8px; }

.bank-attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
}

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

.bank-attachment-link {
  display: inline-grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.bank-attachment-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bank-attachment-view,
.bank-attachment-delete {
  min-height: 32px;
  padding: 5px 10px;
}

.bank-attachment-link:hover .bank-attachment-view-label {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bank-attachment-file-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-attachment-file-size {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.bank-attachment-view-label {
  color: var(--primary);
  font-weight: 700;
}

.bank-attachment-delete {
  min-height: 32px;
  padding: 5px 9px;
}

.bank-posted-attachment-control {
  display: flex;
  align-items: center;
  min-height: 32px;
}

.bank-posted-attachment-toggle,
.bank-posted-attachment-empty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
}

.bank-posted-attachment-toggle {
  cursor: pointer;
}

.bank-posted-attachment-toggle:hover {
  background: var(--xb-color-surface-container-low);
  color: var(--text-primary);
}

.bank-posted-attachment-empty {
  color: var(--text-muted);
}

.bank-posted-attachment-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-muted);
  transform: rotate(90deg);
}

.bank-posted-attachment-list {
  display: grid;
  gap: 4px;
  max-width: 560px;
  margin-top: 6px;
}

.bank-posted-attachment-file {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.bank-posted-attachment-file:hover {
  background: var(--xb-color-surface-container-low);
}

.bank-posted-attachment-file-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-posted-attachment-meta {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

.file-type-icon {
  --file-accent: #737b88;
  display: block;
  width: 16px;
  height: 19px;
  flex: 0 0 auto;
  overflow: visible;
}

.file-type-icon-page {
  fill: #ffffff;
  stroke: #cfd3d8;
  stroke-width: 3.8;
  stroke-linejoin: round;
}

.file-type-icon-fold {
  fill: #ffffff;
  stroke: #cfd3d8;
  stroke-width: 3.8;
  stroke-linejoin: round;
}

.file-type-icon-label-bg {
  fill: var(--file-accent);
}

.file-type-icon-label {
  fill: #ffffff;
  font-family: "Segoe UI", Aptos, Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0;
}

.file-type-icon.is-pdf {
  --file-accent: #ff2f4f;
}

.file-type-icon.is-xls {
  --file-accent: #22c55e;
}

.file-type-icon.is-pic {
  --file-accent: #3b82f6;
}

.file-type-icon.is-doc {
  --file-accent: #556ee6;
}

.file-type-icon.is-txt {
  --file-accent: #6b7280;
}

.file-type-icon.is-file {
  --file-accent: #8b5cf6;
}

.bank-review-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 40px;
}

.bank-review-actions-under-tags {
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: 12px;
  padding-top: 0;
}

.bank-review-actions-under-tags .attachment-name {
  align-self: flex-end;
  line-height: 1.2;
}

@container (max-width: 1040px) {
  .bank-review-grid {
    grid-template-columns: minmax(150px, 0.35fr) minmax(260px, 0.65fr);
  }

  .bank-review-field-type {
    grid-column: 1;
  }

  .bank-review-field-category {
    grid-column: 2;
  }

  .bank-review-field-tax {
    grid-column: 1;
  }

  .bank-review-field-tax-amount {
    grid-column: 2;
  }

  .bank-review-field-rental-property {
    grid-column: 1 / -1;
  }

  .bank-review-field.span-2,
  .bank-review-field.span-4 {
    grid-column: 1 / -1;
  }

  .bank-tags-attachments-layout {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.52fr);
  }

  .bank-attachments-field {
    display: grid;
    grid-column: 2;
    grid-row: 1;
    align-content: start;
  }

  .bank-attachments-field .bank-attachment-control,
  .bank-attachments-field .bank-attachment-panel-slot {
    grid-column: auto;
    grid-row: auto;
  }

  .bank-attachments-field .bank-attachment-panel-slot {
    margin-top: 6px;
    min-block-size: 0;
  }
}

@container (max-width: 760px) {
  .bank-review-panel {
    grid-template-columns: minmax(0, 1fr) clamp(220px, 34%, 280px);
    overflow-x: auto;
  }

  .bank-review-grid {
    grid-template-columns: minmax(140px, 0.35fr) minmax(240px, 0.65fr);
  }

  .bank-review-field-type,
  .bank-review-field-category,
  .bank-review-field-tax,
  .bank-review-field-tax-amount,
  .bank-review-field.span-2,
  .bank-review-field.span-4 {
    grid-column: 1 / -1;
  }

  .bank-tags-attachments-layout {
    grid-template-columns: 1fr;
  }

  .bank-attachments-field {
    display: grid;
    grid-column: 1;
    grid-row: auto;
    align-content: start;
  }

  .bank-attachments-field .bank-attachment-control,
  .bank-attachments-field .bank-attachment-panel-slot {
    grid-column: auto;
    grid-row: auto;
  }

  .bank-attachments-field .bank-attachment-panel-slot {
    margin-top: 6px;
    min-block-size: 0;
  }
}

.bank-ai-card {
  display: grid;
  gap: 12px;
  align-self: stretch;
  align-content: start;
  min-width: 0;
  min-height: 200px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--xb-card-border);
  border-radius: var(--xb-shape-card);
  background: var(--xb-card-container-emphasis);
}

.bank-ai-card strong {
  font-size: 1rem;
}

.bank-ai-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bank-ai-card-title::after {
  content: "Preview";
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--xb-shape-chip);
  background: var(--xb-badge-neutral-container);
  color: var(--xb-badge-neutral-content);
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-badge);
}

.bank-ai-card:has(.pending-guidance) .bank-ai-card-title::after {
  content: "Pending";
}

/* Rule, Pair, and Pending guidance use one content-led card rhythm. */
.bank-ai-card:has(.bank-ai-suggestion.guidance) {
  align-self: start;
  gap: 8px;
  padding: 14px;
}

.bank-ai-card:has(.bank-ai-suggestion.guidance) .suggestion-section {
  padding-block: 12px;
}

.bank-ai-card:has(.bank-ai-suggestion.guidance) .suggestion-confidence {
  gap: 8px;
}

.bank-ai-card:has(.bank-ai-suggestion.guidance) .suggestion-summary,
.bank-ai-card:has(.bank-ai-suggestion.guidance) .suggestion-posting-line {
  gap: 6px;
}

.bank-ai-card:has(.bank-ai-suggestion.guidance) .suggestion-detail-value {
  margin-top: 3px;
}

.bank-ai-suggestion {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  padding: 10px 12px;
  border-radius: var(--xb-shape-sm);
  background: var(--xb-color-surface-container-lowest);
  overflow-wrap: anywhere;
}

.bank-ai-suggestion.guidance {
  gap: 0;
  padding: 0;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-sm);
}

.bank-ai-suggestion.demo {
  border: 1px dashed var(--xb-color-outline-variant);
  background: var(--xb-color-surface-container-lowest);
}

.bank-ai-suggestion.pending-review {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--xb-color-outline-variant);
  background: var(--xb-color-surface-container-lowest);
  overflow-wrap: normal;
}

.pending-review-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--xb-badge-neutral-container);
  color: var(--xb-color-on-surface-variant);
}

.pending-review-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pending-review-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pending-review-eyebrow {
  color: var(--xb-color-on-surface-variant);
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-badge);
  letter-spacing: 0.04em;
}

.pending-review-copy strong {
  color: var(--xb-color-on-surface);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.pending-review-copy p {
  margin: 0;
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  line-height: 1.45;
}

.pending-review-context {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid var(--xb-color-outline-variant);
  color: var(--xb-color-on-surface-variant);
  font-size: 11px;
  line-height: 1.45;
}

.bank-ai-suggestion.pending-review.is-ready .pending-review-icon {
  background: var(--xb-badge-complete-container);
  color: var(--xb-badge-complete-content);
}

.suggestion-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.suggestion-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--xb-shape-chip);
  background: var(--xb-badge-source-container);
  color: var(--xb-badge-source-content);
  font-size: 11px;
  font-weight: var(--font-weight-badge);
  white-space: nowrap;
}

.suggestion-source-badge.rule {
  background: var(--xb-badge-rule-container);
  color: var(--xb-badge-rule-content);
}

.suggestion-source-badge.pair {
  background: var(--xb-badge-complete-container);
  color: var(--xb-badge-complete-content);
}

.suggestion-confidence {
  display: grid;
  gap: 12px;
}

.suggestion-confidence-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.suggestion-confidence-label,
.suggestion-detail-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.suggestion-confidence-value {
  flex: 0 0 4.5ch;
  width: 4.5ch;
  color: #326f1f;
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.suggestion-confidence-meter {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.suggestion-confidence-track {
  flex: 1 1 auto;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: var(--xb-shape-chip);
  background: var(--xb-color-surface-container-high);
}

.suggestion-confidence-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #326f1f;
  transform: scaleX(var(--suggestion-confidence-ratio, 1));
  transform-origin: left center;
  animation: suggestion-confidence-fill 1040ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.suggestion-confidence-fill.is-static {
  animation: none;
}

.suggestion-confidence-modified {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 15px;
  min-height: 15px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes suggestion-confidence-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(var(--suggestion-confidence-ratio, 1));
  }
}

@media (prefers-reduced-motion: reduce) {
  .suggestion-confidence-fill {
    animation: none;
  }
}

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

.suggestion-section {
  position: relative;
  padding: 16px 14px;
}

.suggestion-section:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 1px;
  background: color-mix(in srgb, var(--xb-color-outline-variant) 58%, transparent);
}

.suggestion-detail-content {
  min-width: 0;
}

.suggestion-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.suggestion-posting-line {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: var(--text-primary);
}

.suggestion-posting-type {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-self: stretch;
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: var(--xb-shape-sm);
  background: var(--xb-badge-rule-container);
  color: var(--xb-badge-rule-content);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.suggestion-posting-account-badge {
  align-items: center;
  justify-self: stretch;
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: var(--xb-shape-sm);
  background: var(--xb-badge-rule-container);
  color: var(--xb-badge-rule-content);
}

.suggestion-posting-account.suggestion-posting-account-badge {
  align-items: center;
}

.suggestion-posting-account-badge .suggestion-posting-name,
.suggestion-detail-value.suggestion-rule-name {
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}

/* Preserve descenders (g, j, p, q, y) inside single-line clipped suggestion text. */
.suggestion-posting-account-badge .suggestion-posting-name.suggestion-single-line,
.suggestion-detail-value.suggestion-rule-name.suggestion-single-line {
  padding-bottom: 2px;
  margin-bottom: -2px;
}

.suggestion-detail-icon .bank-status-badge {
  min-width: 0;
  font-weight: var(--font-weight-badge);
}

.suggestion-posting-account {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}

.suggestion-posting-code {
  flex: 0 0 auto;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.suggestion-posting-name {
  min-width: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.suggestion-detail-value {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.suggestion-detail-value-reason {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 450;
}

.suggestion-detail-muted {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.suggestion-truncate {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.suggestion-single-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-reason {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.45;
}

.suggestion-reason-list {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.suggestion-reason-list li {
  display: inline;
}

.suggestion-reason-list li + li::before {
  content: " / ";
  color: var(--text-tertiary);
  font-weight: 500;
}

.suggestion-detail-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  opacity: 0.88;
}

.suggestion-detail-icon .suggestion-source-badge {
  min-height: 26px;
  padding: 3px 10px;
  border-radius: var(--xb-shape-chip);
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-badge);
}

.suggestion-detail-icon .status-icon {
  width: 14px;
  height: 14px;
}

.suggestion-detail-icon .status-icon svg {
  width: 14px;
  height: 14px;
}

.suggestion-detail-icon-only {
  width: 28px;
  height: 28px;
  border-radius: var(--xb-shape-sm);
  background: color-mix(in srgb, var(--xb-badge-complete-container) 64%, transparent);
  color: color-mix(in srgb, var(--xb-badge-complete-content) 68%, var(--text-secondary));
  opacity: 0.78;
}

.suggestion-detail-icon-only svg {
  width: 16px;
  height: 16px;
}

@container (max-width: 1040px) {
  .suggestion-posting-line {
    display: grid;
    gap: 8px;
  }

  .suggestion-posting-code {
    font-size: 18px;
  }
}

.rules-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.rule-new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1;
}

.rule-new-button i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.rules-table {
  min-width: 1180px;
  table-layout: fixed;
}

.rules-panel,
.tax-codes-panel {
  overflow: hidden;
}

.rules-table th:nth-child(1),
.rules-table td:nth-child(1) {
  width: 72px;
}

.rules-table th:nth-child(2),
.rules-table td:nth-child(2) {
  width: 130px;
}

.rules-table th:nth-child(3),
.rules-table td:nth-child(3) {
  width: 230px;
  white-space: nowrap;
}

.rules-table th:nth-child(4),
.rules-table td:nth-child(4) {
  width: 220px;
}

.rules-table th:nth-child(5),
.rules-table td:nth-child(5) {
  width: 390px;
}

.rules-table th:nth-child(6),
.rules-table td:nth-child(6) {
  width: 90px;
}

.rules-table th:nth-child(7),
.rules-table td:nth-child(7) {
  width: 230px;
}

.rules-panel .table-wrap,
.tax-codes-panel .table-wrap {
  overflow: hidden;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.rules-panel tbody tr:last-child td:first-child,
.tax-codes-panel tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-lg);
}

.rules-panel tbody tr:last-child td:last-child,
.tax-codes-panel tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-lg);
}

.rules-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  white-space: nowrap;
}

.rules-delete-button {
  border-color: var(--xb-button-danger-outlined-border);
  color: var(--xb-button-danger-outlined-content);
}

.rules-delete-button:hover,
.rules-delete-button:focus-visible {
  background: var(--xb-button-danger-hover-container);
  color: var(--xb-button-danger-hover-content);
}

.rules-cell-muted {
  display: block;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-drawer-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.rule-form-section {
  display: grid;
  gap: 12px;
}

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

.rule-condition-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(140px, 1fr) minmax(160px, 1.2fr) auto;
  gap: 8px;
  align-items: end;
}

.rule-preview-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.rule-preview-item {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 13px;
}

.rules-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.rules-overview-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.rules-overview-card strong {
  font-size: 15px;
}

.rules-overview-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.rules-empty-state {
  display: grid;
  gap: 10px;
  padding: 22px;
  border-top: 1px solid var(--border-soft);
}

.rules-empty-state p {
  max-width: 760px;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.rules-design-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-design-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.rules-design-list li:first-child {
  border-top: 0;
}

.rules-design-list span {
  color: var(--text-secondary);
  font-size: 13px;
}

.statements-table {
  min-width: 1120px;
}

.statements-table th:nth-child(1),
.statements-table td:nth-child(1) {
  width: 190px;
}

.statements-table th:nth-child(2),
.statements-table td:nth-child(2) {
  width: 230px;
}

.statements-table th:nth-child(3),
.statements-table td:nth-child(3) {
  width: 120px;
}

.statements-table th:nth-child(4),
.statements-table td:nth-child(4) {
  width: 220px;
}

.statements-table th:nth-child(5),
.statements-table td:nth-child(5),
.statements-table th:nth-child(6),
.statements-table td:nth-child(6),
.statements-table th:nth-child(7),
.statements-table td:nth-child(7) {
  width: 150px;
}

.statements-table th:nth-child(8),
.statements-table td:nth-child(8) {
  width: 230px;
}

.table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.statement-modal-card {
  width: min(560px, calc(100vw - 32px));
}

.statement-import-form {
  grid-template-columns: 1fr;
}

.statement-import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.statement-import-actions .import-action-status {
  flex: 1 1 auto;
  margin: 0;
  min-height: 20px;
  min-width: 0;
  line-height: 1.35;
}

.statement-import-buttons {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
}

.statement-import-buttons .primary,
.statement-import-buttons .secondary {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1;
}

.modal-x-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--xb-button-outlined-border);
  border-radius: var(--xb-shape-button);
  background: var(--xb-button-outlined-container);
  color: var(--xb-icon-button-content);
  font-size: 24px;
  font-weight: var(--font-weight-button);
  line-height: 1;
  cursor: pointer;
}

.modal-x-button:hover,
.modal-x-button:focus-visible {
  color: var(--xb-icon-button-hover-content);
  border-color: var(--xb-button-outlined-content);
  background: var(--xb-icon-button-hover-container);
  outline: 0;
}

.metadata-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0;
}

.metadata-source {
  position: relative;
  display: inline-flex;
}

.metadata-source-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.metadata-source-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 10px;
  min-width: 220px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.metadata-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 13px;
}

.metadata-item strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

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

.entry-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 2px;
}

.entry-action-status {
  min-width: 0;
  flex: 1;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-align: right;
}

.entry-action-status[data-kind="error"] {
  color: var(--danger);
}

.entry-action-status[data-kind="ok"] {
  color: var(--success);
}

.entry-action-status[data-kind="busy"] {
  color: var(--primary);
}

#submitButton {
  width: auto;
  min-width: 128px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.drawer-actions .primary,
.drawer-actions .small-primary,
.drawer-actions .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
}

.empty {
  padding: 20px 18px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.import-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.migration-notice {
  margin: 18px 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 14px;
}

.migration-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 18px;
}

.step {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

.step strong {
  display: block;
  margin-bottom: 6px;
}

.step span {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.import-workspace {
  border-top: 1px solid var(--border);
  padding: 18px;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

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

.import-map-field {
  display: grid;
  gap: 5px;
}

.import-map-field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.import-map-field select {
  min-height: 38px;
  border: 1px solid var(--xb-field-border);
  border-radius: 10px;
  background: var(--xb-field-container);
  color: var(--xb-field-content);
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.import-action-status {
  margin-right: auto;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.import-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#importDataView .bank-post-split-button {
  height: 34px;
}

#importDataView .bank-post-main,
#importDataView .bank-post-menu-button {
  min-height: 34px;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

.import-action-status[data-kind="busy"] {
  color: var(--primary);
}

.import-action-status[data-kind="ok"] {
  color: var(--success-ink);
}

.import-action-status[data-kind="error"] {
  color: var(--danger-ink);
}

.import-preview-wrap {
  max-height: 420px;
  overflow: auto;
}

.import-preview-wrap table {
  min-width: 920px;
}

.import-preview-wrap th,
.import-preview-wrap td {
  overflow-wrap: normal;
  word-break: normal;
}

.import-preview-wrap th {
  white-space: nowrap;
}

.import-preview-wrap th:nth-child(1),
.import-preview-wrap td:nth-child(1) {
  width: 132px;
}

.import-preview-wrap th:nth-child(2),
.import-preview-wrap td:nth-child(2),
.import-preview-wrap th:nth-child(3),
.import-preview-wrap td:nth-child(3) {
  width: 120px;
}

.import-preview-wrap th:nth-child(4),
.import-preview-wrap td:nth-child(4) {
  width: 260px;
}

.import-preview-wrap th:nth-child(5),
.import-preview-wrap td:nth-child(5) {
  width: 240px;
}

.import-preview-wrap .badge {
  white-space: nowrap;
}

.import-empty-row {
  color: var(--text-secondary);
  padding: 20px 16px;
}

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

.placeholder {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.placeholder h2 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: 0;
}

.placeholder p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

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

.category-settings-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.category-settings-profile h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.category-settings-profile-summary {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-settings-meta-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.category-settings-meta-value {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.category-settings-card {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.category-settings-card.is-disabled {
  background: var(--surface-soft);
}

.category-settings-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.category-settings-card-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.category-settings-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.category-settings-card-meta {
  display: grid;
  gap: 10px;
}

.category-settings-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.category-settings-meta-value {
  min-width: 0;
  text-align: right;
}

.category-settings-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-settings-category-list li {
  padding: 4px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.category-settings-accounts {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.category-settings-account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-settings-account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.category-settings-account-toggle:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.category-settings-account-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 6px 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  list-style: none;
}

.category-settings-account-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
}

.category-settings-account-number {
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.category-settings-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.category-settings-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.category-settings-card .small-primary,
.category-settings-card .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
}

@media (max-width: 1440px) {
  .content {
    padding: 24px;
  }

  .summary {
    gap: 12px;
  }

  .panel-header {
    padding: 14px 16px;
  }

  .expense-summary .metric {
    min-height: 80px;
    padding: 14px;
  }
}

@media (max-width: 1280px) {
  .content {
    padding: 22px 20px;
  }

  .page-heading {
    gap: 12px;
  }

  #bankTransactionsView .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #bankTransactionsView .page-heading > div:first-child {
    flex: 1 1 520px;
  }

  #bankTransactionsView .page-heading .actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  #bankTransactionsView .page-heading .actions .small-primary,
  #bankTransactionsView .page-heading .actions .secondary {
    white-space: nowrap;
  }

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

  .transaction-toolbar {
    grid-template-columns: minmax(170px, 1.2fr) minmax(120px, 0.72fr) minmax(120px, 0.72fr) minmax(120px, 0.72fr) minmax(150px, 0.9fr);
    gap: 8px;
    padding: 10px 12px;
  }

  .filter-summary,
  .bulk-action-bar {
    padding-inline: 12px;
  }

  .expense-list-table th,
  .expense-list-table td,
  .banking-table th,
  .banking-table td {
    padding-inline: 8px;
  }

  .banking-table {
    --bank-col-select: 36px;
    --bank-col-date: 114px;
    --bank-col-spent: 92px;
    --bank-col-received: 124px;
    --bank-col-status: 86px;
    --bank-col-category: 220px;
    --bank-col-tax: 136px;
    --bank-col-action: 86px;
    min-width: 1000px;
  }

  .expense-list-table th:nth-child(4),
  .expense-list-table td:nth-child(4) {
    width: 200px;
  }

  .expense-list-table th:nth-child(5),
  .expense-list-table td:nth-child(5) {
    width: 148px;
  }

  .expense-list-table th:nth-child(7),
  .expense-list-table td:nth-child(7) {
    width: 112px;
  }

  .expense-list-table th:nth-child(8),
  .expense-list-table td:nth-child(8) {
    width: 124px;
  }
}

@media (max-width: 1100px) {
  .banking-table {
    min-width: 980px;
  }

  .expense-list-table th:nth-child(8),
  .expense-list-table td:nth-child(8) {
    display: none;
  }

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

  #expensesView .transaction-toolbar,
  #incomeView .transaction-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 960px) {
  body {
    overflow-y: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar {
    display: none;
    height: auto;
    position: static;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .shell.nav-open .sidebar {
    display: block;
  }

  .shell.nav-open .nav {
    display: grid;
    gap: 8px;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 16px;
  }

  .shell.nav-open .sidebar {
    padding: 12px 14px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg);
  }

  .summary,
  .grid,
  .placeholder-grid,
  .category-settings-grid,
  .import-steps,
  .import-mapping-grid,
  .rules-overview-grid {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    display: grid;
  }

  .page-heading {
    display: grid;
  }

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

  .expense-main-grid,
  .expense-detail-grid {
    grid-template-columns: 1fr;
  }

  .expense-field-date,
  .expense-field-category,
  .expense-field-payment,
  .expense-field-third {
    grid-column: 1 / -1;
  }

  .tax-pair {
    grid-template-columns: 1fr;
  }

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

  .bank-review-panel {
    grid-template-columns: minmax(0, 1fr) clamp(220px, 34%, 280px);
    overflow-x: auto;
  }

  .span-3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 18px;
  }

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

  .actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr));
    gap: 10px;
    justify-content: flex-start;
    width: 100%;
  }

  #expensesView .page-heading .actions > button,
  #incomeView .page-heading .actions > button {
    min-width: 0;
    width: 100%;
    min-height: 44px;
  }

  #expensesView .page-heading .actions,
  #incomeView .page-heading .actions {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr));
  }

  .transaction-toolbar,
  .filter-summary,
  .pagination {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bank-review-grid {
    grid-template-columns: minmax(140px, 0.35fr) minmax(240px, 0.65fr);
  }

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

  .drawer {
    width: 100vw;
    border-left: 0;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
    background: transparent;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
  }

  td.mobile-primary {
    display: block;
    padding-top: 2px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 650;
  }

  td.mobile-primary::before {
    content: "";
  }

  .expense-list-table td.amount {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: var(--font-weight-amount);
    font-variant-numeric: tabular-nums;
  }

  .expense-list-table td.select-cell {
    justify-content: flex-start;
  }

  .metadata-line,
  .drawer-actions {
    justify-content: stretch;
  }

  .drawer-actions {
    flex-direction: column;
  }

  .span-2,
  .span-3,
  .span-4 {
    grid-column: 1 / -1;
  }
}
/*
 * Typography profile B: formal accounting compact.
 * Keep this layer near the end of the main stylesheet so legacy page
 * rules inherit the same system before module-specific overrides load.
 */
html,
body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

body {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
}

h1,
.page-heading h1,
.dashboard-hero h1 {
  font-family: var(--font-display);
  font-size: var(--font-size-page-title);
  font-weight: var(--font-weight-page-title);
  line-height: var(--line-height-page-title);
  letter-spacing: 0;
}

h2,
.panel-header h2,
.drawer-header h2,
.card-header h2,
.account-setup-card h2,
.workspace-settings-guide h2,
.tax-settings-guide h2,
.section-title {
  font-family: var(--font-display);
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-section-title);
  line-height: var(--line-height-section-title);
  letter-spacing: 0;
}

.brand strong {
  font-family: var(--font-display);
  font-weight: var(--font-weight-page-title);
}

.brand span,
.workspace-badge,
.nav a,
.nav-toggle,
.nav-heading {
  font-family: var(--font-sans);
}

.nav a,
.nav-toggle {
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-nav);
  line-height: var(--line-height-nav);
  letter-spacing: 0;
}

.nav a[aria-current="page"],
.nav-toggle[aria-expanded="true"] {
  font-weight: var(--font-weight-nav-active);
}

.nav-heading {
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
  line-height: var(--line-height-label);
  letter-spacing: 0.08em;
}

label,
.filter-field label,
.field-label,
.expense-detail-grid label,
.form-field label,
.metadata-label {
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
  line-height: var(--line-height-label);
  letter-spacing: 0;
}

input,
select,
textarea,
.readonly-field,
.readonly-control {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  letter-spacing: 0;
}

button,
.primary-button,
.secondary-button,
.small-primary,
.small-secondary,
.small-danger,
.drawer-actions button,
.table-actions button,
.bank-post-main,
.bank-post-menu-button {
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button);
  letter-spacing: 0;
}

table,
.expense-list-table,
.banking-table,
.statements-table,
.category-table,
.account-setup-table,
.compact-table {
  font-size: var(--font-size-table);
  font-weight: var(--font-weight-table);
  line-height: var(--line-height-table);
}

th,
.expense-list-table th,
.banking-table th,
.statements-table th,
.category-table th,
.account-setup-table th,
.compact-table th {
  font-size: var(--font-size-table);
  font-weight: var(--font-weight-table-header);
  line-height: var(--line-height-table);
  letter-spacing: 0;
}

td,
.expense-list-table td,
.banking-table td,
.statements-table td,
.category-table td,
.account-setup-table td,
.compact-table td {
  font-size: var(--font-size-table);
  font-weight: var(--font-weight-table);
  line-height: var(--line-height-table);
  letter-spacing: 0;
}

.amount,
.balance-cell,
.metric-value,
.summary-value,
.dashboard-kpi-value,
.bank-account-posted,
.bank-account-card-posted,
.bank-account-card-bank strong {
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-amount);
}

.summary-card h3,
.summary-card-title,
.metric-label,
.account-card-title,
.bank-account-title,
.dashboard-panel-header h2,
.card-title {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-card-title);
  line-height: var(--line-height-card-title);
  letter-spacing: 0;
}

.summary-card p,
.summary-card span,
.metric-meta,
.account-card-meta,
.bank-account-meta,
.bank-account-card-bank,
.bank-account-card-bank small,
.helper-text,
.metadata-line,
.filter-summary,
.import-empty-row {
  font-size: var(--font-size-helper);
  font-weight: var(--font-weight-helper);
  line-height: var(--line-height-helper);
  letter-spacing: 0;
}

.summary-card strong,
.metric-value,
    .dashboard-kpi-value,
    .bank-account-posted,
    .bank-account-card-posted,
    .account-card-value {
      font-size: var(--font-size-card-value);
      font-weight: var(--font-weight-card-value);
      line-height: var(--line-height-card-value);
      letter-spacing: 0;
}

.tab,
.tabs button,
.queue-tab,
.bank-queue-tab,
.segmented-control button {
  font-size: var(--font-size-tab);
  font-weight: var(--font-weight-tab);
  line-height: var(--line-height-tab);
  letter-spacing: 0;
}

.badge,
.status-badge,
.source-badge,
.suggestion-source-badge,
.pill {
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-badge);
  line-height: var(--line-height-badge);
  letter-spacing: 0;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--xb-color-surface-container-lowest, #ffffff);
}

.auth-gate[hidden] {
  display: none;
}

.workspace-setup-gate {
  min-height: 100vh;
  background: var(--xb-color-surface-container-low);
  color: var(--xb-color-on-surface);
}

.workspace-setup-gate[hidden] {
  display: none;
}

html.workspace-setup-required,
body.workspace-setup-required {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

.workspace-setup-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--xb-color-outline-variant);
  background: var(--xb-color-surface-container-lowest);
}

.workspace-setup-brand {
  color: var(--xb-color-on-surface);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.workspace-setup-switch {
  padding: 4px 0;
  background: transparent;
  color: var(--xb-color-on-surface-variant);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.workspace-setup-switch:hover,
.workspace-setup-switch:focus-visible {
  color: var(--xb-color-primary);
}

.workspace-setup-main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(32px, 6vh, 56px) 0;
}

.workspace-setup-card {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-card);
  background: var(--xb-color-surface-container-lowest);
  box-shadow: var(--xb-elevation-1);
}

.workspace-setup-heading {
  max-width: 760px;
  margin-top: 28px;
}

.workspace-setup-step {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--xb-color-primary-container);
  color: var(--xb-color-on-primary-container);
  font-size: 12px;
  font-weight: 650;
}

.workspace-setup-name {
  margin: 24px 0 4px;
  color: var(--xb-color-primary);
  font-size: 13px;
  font-weight: 650;
}

.workspace-setup-heading h1 {
  margin: 14px 0 0;
  font-size: clamp(26px, 4vw, 32px);
  line-height: 1.2;
}

.workspace-setup-heading > p:last-child {
  margin: 12px 0 0;
  color: var(--xb-color-on-surface-variant);
  font-size: 14px;
  line-height: 1.55;
}

.workspace-setup-outline {
  display: grid;
  gap: 12px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.workspace-setup-outline li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-surface-container-low);
}

.workspace-setup-outline li.is-current {
  border-color: color-mix(in srgb, var(--xb-color-primary) 48%, var(--xb-color-outline-variant));
  background: color-mix(in srgb, var(--xb-color-primary-container) 42%, var(--xb-color-surface-container-lowest));
}

.workspace-setup-outline li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--xb-color-surface-container-high);
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 700;
}

.workspace-setup-outline li.is-current > span {
  background: var(--xb-color-primary);
  color: var(--xb-color-on-primary);
}

.workspace-setup-outline strong {
  display: block;
  font-size: 14px;
}

.workspace-setup-outline p {
  margin: 4px 0 0;
  color: var(--xb-color-on-surface-variant);
  font-size: 13px;
  line-height: 1.45;
}

.workspace-setup-notice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-secondary-container);
  color: var(--xb-color-on-secondary-container);
}

.workspace-setup-notice svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.workspace-setup-notice p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.workspace-setup-required .shell {
  display: none !important;
}

.workspace-setup-required .xboox-mobile-navigation {
  display: none !important;
}

.workspace-setup-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
}

.workspace-setup-progress-heading strong {
  color: var(--xb-color-primary);
  font-weight: 650;
}

.workspace-setup-progress ol {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.workspace-setup-progress li {
  position: relative;
  display: grid;
  grid-template-rows: 26px auto;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--xb-color-on-surface-variant);
}

.workspace-setup-progress li::after {
  position: absolute;
  z-index: 0;
  top: 12px;
  right: -50%;
  left: 50%;
  height: 1px;
  background: var(--xb-color-outline-variant);
  content: "";
}

.workspace-setup-progress li:last-child::after {
  display: none;
}

.workspace-setup-progress li > span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: 999px;
  background: var(--xb-color-surface-container-lowest);
  font-size: 11px;
  font-weight: 700;
}

.workspace-setup-progress li small {
  position: relative;
  z-index: 1;
  max-width: 152px;
  color: inherit;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.workspace-setup-progress li > span svg {
  width: 14px;
  height: 14px;
}

.workspace-setup-progress li.is-current > span,
.workspace-setup-progress li.is-complete > span {
  border-color: var(--xb-color-primary);
  background: var(--xb-color-primary);
  color: var(--xb-color-on-primary);
}

.workspace-setup-progress li.is-complete::after {
  background: var(--xb-color-primary);
}

.workspace-setup-progress li.is-current small {
  color: var(--xb-color-on-surface);
  font-weight: 650;
}

.workspace-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
}

.workspace-setup-form {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.workspace-setup-help {
  position: sticky;
  top: 24px;
  padding: 20px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-secondary-container);
  color: var(--xb-color-on-secondary-container);
}

.workspace-setup-help > svg {
  width: 22px;
  height: 22px;
  color: var(--xb-color-primary);
}

.workspace-setup-help h2 {
  margin: 14px 0 8px;
  font-size: 15px;
}

.workspace-setup-help p {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
}

.workspace-setup-field {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
}

.workspace-setup-field input,
.workspace-setup-field select,
.workspace-setup-fiscal select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--xb-color-outline);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-surface-container-lowest);
  color: var(--xb-color-on-surface);
  font: inherit;
  font-weight: 500;
}

.workspace-setup-field small,
.workspace-setup-choice small,
.workspace-setup-activities small {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.45;
}

.workspace-setup-choice-group,
.workspace-setup-activities {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.workspace-setup-choice-group legend,
.workspace-setup-activities legend {
  margin-bottom: 2px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.workspace-setup-choice {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 3px 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-surface-container-lowest);
  cursor: pointer;
}

.workspace-setup-choice:has(input:checked),
.workspace-setup-choice.is-selected {
  border-color: color-mix(in srgb, var(--xb-color-primary) 58%, var(--xb-color-outline));
  background: color-mix(in srgb, var(--xb-color-primary-container) 34%, var(--xb-color-surface-container-lowest));
}

.workspace-setup-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.workspace-setup-choice .business-profile-radio {
  grid-row: 1 / span 2;
  margin-top: 1px;
}

.workspace-setup-choice strong {
  font-size: 14px;
}

.workspace-setup-automatic-choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--xb-color-primary) 58%, var(--xb-color-outline));
  border-radius: var(--xb-shape-control);
  background: color-mix(in srgb, var(--xb-color-primary-container) 34%, var(--xb-color-surface-container-lowest));
}

.workspace-setup-automatic-choice > svg {
  width: 20px;
  height: 20px;
  color: var(--xb-color-primary);
}

.workspace-setup-automatic-choice > span {
  display: grid;
  gap: 3px;
}

.workspace-setup-automatic-choice strong {
  font-size: 14px;
}

.workspace-setup-fiscal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
}

.workspace-setup-fiscal[hidden],
.workspace-setup-province[hidden] {
  display: none;
}

.workspace-setup-fiscal label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
}

.workspace-setup-industry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.workspace-setup-activities legend,
.workspace-setup-activities > p {
  grid-column: 1 / -1;
}

.workspace-setup-activities > p {
  margin: 0 0 4px;
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
}

.workspace-setup-activities > label {
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
  cursor: pointer;
}

.workspace-setup-activities > label > svg {
  width: 18px;
  height: 18px;
}

.workspace-setup-activities > label > span {
  display: grid;
  gap: 3px;
}

.workspace-setup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--xb-color-outline-variant);
}

.workspace-setup-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.workspace-setup-actions .secondary {
  border-color: transparent;
  background: transparent;
  color: var(--xb-color-on-surface-variant);
}

.workspace-setup-actions .secondary:hover,
.workspace-setup-actions .secondary:focus-visible {
  border-color: transparent;
  background: var(--xb-color-surface-container);
  color: var(--xb-color-primary);
}

.workspace-setup-actions button svg {
  width: 16px;
  height: 16px;
}

.workspace-setup-error {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--xb-color-error);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-error-container);
  color: var(--xb-color-on-error-container);
  font-size: 13px;
}

.workspace-setup-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
  background: var(--xb-color-outline-variant);
}

.workspace-setup-summary > div {
  padding: 14px 16px;
  background: var(--xb-color-surface-container-lowest);
}

.workspace-setup-summary dt {
  color: var(--xb-color-on-surface-variant);
  font-size: 11px;
}

.workspace-setup-summary dd {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.workspace-setup-impact {
  padding: 18px;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-control);
}

.workspace-setup-impact > div,
.workspace-setup-impact li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace-setup-impact h2 {
  margin: 0;
  font-size: 15px;
}

.workspace-setup-impact > div > span,
.workspace-setup-impact li span {
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
}

.workspace-setup-impact ul {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--xb-color-outline-variant);
  list-style: none;
}

.workspace-setup-impact li {
  font-size: 12.5px;
}

.workspace-setup-impact > p {
  margin: 14px 0 0;
  color: var(--xb-color-on-surface-variant);
  font-size: 12.5px;
  line-height: 1.5;
}

.workspace-chooser-active .workspace-setup-gate,
.app-booting .workspace-setup-gate,
.auth-required .workspace-setup-gate {
  display: none !important;
}

@media (max-width: 640px) {
  .workspace-setup-topbar {
    align-items: flex-start;
    gap: 16px;
  }

  .workspace-setup-switch {
    font-size: 12px;
  }

  .workspace-setup-main {
    width: min(100% - 24px, 880px);
    padding: 24px 0;
  }

  .workspace-setup-card {
    padding: 24px 18px;
  }

  .workspace-setup-progress li {
    grid-template-rows: 26px;
  }

  .workspace-setup-progress li small {
    display: none;
  }

  .workspace-setup-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .workspace-setup-help {
    position: static;
    grid-row: 2;
  }

  .workspace-setup-industry-grid,
  .workspace-setup-summary,
  .workspace-setup-activities {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .workspace-setup-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 641px) and (max-width: 840px) {
  .workspace-setup-industry-grid,
  .workspace-setup-activities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #d9dde4;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(17, 19, 24, 0.12);
  text-align: center;
}

.auth-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border-radius: 12px;
  background: #111318;
  color: #ffffff;
  font-weight: 700;
}

.auth-mark img,
.startup-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-card h1 {
  margin: 0 0 8px;
  color: #111318;
  font-size: 25px;
  line-height: 32px;
  font-weight: 700;
}

.auth-card p {
  margin: 0 0 20px;
  color: #525866;
  font-size: 13px;
  line-height: 19px;
  font-weight: 500;
}

.auth-card .small-primary {
  min-height: 40px;
  min-width: 116px;
  border: 1px solid #111318;
  border-radius: 10px;
  background: #111318;
  color: #ffffff;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 700;
  cursor: pointer;
}

.auth-card .small-primary:hover,
.auth-card .small-primary:focus {
  background: #000000;
}

.auth-message {
  min-height: 20px;
  margin-top: 16px;
  color: #b42318;
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
}

.startup-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--xb-color-surface-container-lowest, #ffffff);
}

.startup-overlay[hidden] {
  display: none;
}

.startup-card {
  width: min(360px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.startup-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--xb-color-on-surface, #111318);
  color: var(--xb-color-surface-container-lowest, #ffffff);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.startup-card h1 {
  margin: 8px 0 0;
  color: var(--xb-color-on-surface, #111318);
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.startup-card p {
  margin: 0;
  color: var(--xb-color-on-surface-variant, #525866);
  font-size: 13px;
  line-height: 19px;
  font-weight: 500;
}

.startup-dots {
  display: inline-flex;
  gap: 5px;
  margin-top: 4px;
}

.startup-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--xb-color-on-surface-variant, #525866);
  opacity: 0.35;
  animation: startup-dot 1.2s ease-in-out infinite;
}

.startup-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.startup-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

.startup-retry {
  min-height: 40px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid var(--xb-color-primary);
  border-radius: var(--xb-shape-control, 10px);
  background: var(--xb-color-primary);
  color: var(--xb-color-on-primary);
  font-size: 12.5px;
  font-weight: 700;
}

.startup-overlay[data-state="error"] .startup-dots {
  display: none;
}

@keyframes startup-pulse {
  0%,
  100% {
    opacity: 0.28;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.7;
    transform: scale(1);
  }
}

@keyframes startup-dot {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 0.85;
    transform: translateY(-3px);
  }
}

.auth-error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #ffffff;
}

.auth-error-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid #d9dde4;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(17, 19, 24, 0.1);
}

.auth-error-card h1 {
  margin: 0 0 10px;
  color: #111318;
  font-size: 25px;
  line-height: 32px;
  font-weight: 700;
}

.auth-error-card p {
  margin: 0;
  color: #525866;
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
}

.auth-error-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 20px;
  padding: 0 16px;
  border: 1px solid #111318;
  border-radius: 10px;
  background: #111318;
  color: #ffffff;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 700;
  text-decoration: none;
}

.auth-booting .app-shell,
.auth-booting .toast-viewport,
.auth-booting .workspace-dialog-backdrop,
.auth-booting .auth-gate {
  display: none !important;
}

.app-booting .shell,
.app-booting .toast-viewport,
.app-booting .auth-gate,
.app-booting .workspace-dialog-backdrop {
  display: none !important;
}

.auth-required .shell,
.auth-required .toast-viewport,
.auth-required .workspace-dialog-backdrop,
.auth-required .workspace-chooser {
  display: none !important;
}

.workspace-chooser-required .shell,
.workspace-chooser-required .toast-viewport {
  display: none !important;
}

.expense-mobile-filter-button,
.expense-mobile-load-more {
  display: none;
}

/* Expense phone list: the desktop table stays intact from 768px upward. */
@media (max-width: 767px) {
  /*
   * The phone Expense route shares data/controllers with desktop, but owns its
   * presentation. Remove desktop panel chrome before styling the mobile list.
   */
  #expensesView {
    background: var(--xb-color-surface);
  }

  #expensesView #expenses.panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #expensesView .expense-kpi-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card {
    box-sizing: border-box;
    min-height: 142px;
    gap: 8px;
    padding: 22px;
    border: 1px solid var(--xb-color-outline-variant);
    border-radius: 24px;
    background: var(--xb-color-surface);
    color: var(--xb-color-on-surface);
    box-shadow: var(--xb-mobile-card-shadow);
    overflow: hidden;
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card:first-child {
    border-color: transparent;
    background: var(--xb-color-primary-container);
    color: var(--xb-color-on-primary-container);
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card > span {
    padding-right: 118px;
    color: var(--xb-color-on-surface);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card:first-child > span,
  #expensesView .expense-kpi-grid .dashboard-kpi-card:first-child small {
    color: var(--xb-color-on-primary-container);
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card > strong {
    color: var(--xb-color-on-surface);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-card > small {
    color: var(--xb-color-on-surface-variant);
    font-size: 13px;
    line-height: 1.4;
  }

  #expensesView .expense-kpi-grid .dashboard-kpi-sparkline {
    top: 22px;
    right: 22px;
    width: 112px;
    height: 46px;
  }

  #expensesView .page-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  #expensesView .page-heading .actions {
    display: flex;
    width: auto;
  }

  #expensesView .page-heading .receipt-capture-launch-button {
    display: none;
  }

  #expensesView #addExpenseButton {
    width: auto;
    min-width: 0;
    min-height: 44px;
    white-space: nowrap;
  }

  #expensesView .panel-header {
    display: none;
  }

  #expensesView .transaction-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: var(--xb-space-2, 8px);
    padding: var(--xb-space-3, 12px) 0 var(--xb-space-4, 16px);
    border: 0;
    background: transparent;
  }

  #expensesView .transaction-toolbar > .filter-field:not(.search-native-field) {
    display: none;
    grid-column: 1 / -1;
  }

  #expensesView .transaction-toolbar.is-mobile-expanded > .filter-field:not(.search-native-field) {
    display: grid;
  }

  #expensesView .transaction-toolbar .search-native-field {
    grid-column: 1;
  }

  #expensesView .transaction-toolbar .search-native-field > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #expensesView .transaction-toolbar .search-native-field input {
    min-height: 48px;
    padding-left: 42px;
  }

  #expensesView .expense-mobile-filter-button {
    display: inline-flex;
    grid-column: 2;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 48px;
    padding-inline: 14px;
    white-space: nowrap;
  }

  #expensesView .expense-kpi-grid,
  #expensesView .dashboard-kpi-card,
  #expensesView .panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #expensesView .table-wrap,
  #expensesView .expense-list-table,
  #expensesView .bulk-action-bar,
  #expensesView .expense-transaction-actions,
  #expensesView .pagination .page-size-control,
  #expensesView #selectAllTransactions {
    display: none;
  }

  #expensesView .expense-mobile-list {
    display: grid;
    gap: 12px;
    min-width: 0;
  }

  #expensesView .expense-mobile-swipe-row {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: 20px;
    background: transparent;
  }

  #expensesView .expense-mobile-delete-action {
    position: absolute;
    inset: 0 0 0 auto;
    display: grid;
    width: 96px;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    gap: 5px;
    border: 0;
    border-radius: 0;
    background: var(--xb-color-error, #ba1a1a);
    color: var(--xb-color-on-error, #fff);
    font-size: 12px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    will-change: opacity;
    text-align: center;
  }

  #expensesView .expense-mobile-delete-action svg,
  #expensesView .expense-mobile-delete-action span {
    display: block;
    margin: 0;
  }

  #expensesView .expense-mobile-swipe-row.is-swiping .expense-mobile-delete-action,
  #expensesView .expense-mobile-swipe-row.is-revealed .expense-mobile-delete-action {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  #expensesView .expense-mobile-swipe-row.is-swiping,
  #expensesView .expense-mobile-swipe-row.is-revealed {
    background: var(--xb-color-error, #ba1a1a);
  }

  #expensesView .expense-mobile-swipe-row[data-can-delete="false"].is-swiping,
  #expensesView .expense-mobile-swipe-row[data-can-delete="false"].is-revealed {
    background: var(--xb-color-surface-container-high);
  }

  #expensesView .expense-mobile-delete-action:disabled {
    background: var(--xb-color-surface-container-high, #e7e1e8);
    color: var(--xb-color-on-surface-variant, #4b454d);
    opacity: 1;
  }

  #expensesView .expense-mobile-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--xb-color-outline-variant);
    border-radius: 20px;
    background: var(--xb-color-surface);
    color: var(--xb-color-on-surface);
    box-shadow: none;
    text-align: left;
    touch-action: pan-y;
    transition: transform 180ms ease;
    will-change: transform;
  }

  #expensesView .expense-mobile-swipe-row.is-revealed .expense-mobile-card {
    transform: translateX(-96px);
  }

  #expensesView .expense-mobile-card:focus-visible {
    outline: 2px solid var(--xb-color-primary);
    outline-offset: 3px;
  }

  #expensesView .expense-mobile-card-heading,
  #expensesView .expense-mobile-card-footer {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--xb-space-2, 8px);
  }

  #expensesView .expense-mobile-card-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: start;
    gap: var(--xb-space-3, 12px);
  }

  #expensesView .expense-mobile-card-title-group {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  #expensesView .expense-mobile-card-label,
  #expensesView .expense-mobile-card-value {
    min-width: 0;
    overflow: hidden;
    color: var(--xb-color-on-surface-variant);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #expensesView .expense-mobile-card-amount {
    flex: 0 0 auto;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    line-height: 1.35;
  }

  #expensesView .expense-mobile-card-category {
    min-width: 0;
    color: var(--xb-color-on-surface);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #expensesView .expense-mobile-card-memo {
    display: block;
    overflow: hidden;
    color: var(--xb-color-on-surface-variant);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #expensesView .expense-mobile-card-detail-row {
    display: grid;
    grid-template-columns: minmax(76px, 0.55fr) minmax(0, 1.45fr);
    min-height: 24px;
    align-items: center;
    gap: var(--xb-space-3, 12px);
  }

  #expensesView .expense-mobile-card-value {
    color: var(--xb-color-on-surface);
    font-weight: 500;
    text-align: right;
  }

  #expensesView .expense-mobile-card-footer {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 2px;
  }

  #expensesView .expense-mobile-card-status,
  #expensesView .expense-mobile-card-source {
    flex: 0 1 auto;
    min-width: 0;
  }

  #expensesView .pagination {
    display: none;
  }

  #expensesView .expense-mobile-load-more {
    width: 100%;
    min-height: 44px;
    margin-top: var(--xb-space-4, 16px);
  }

  .xb-mobile-date-trigger {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
  }

  .xb-mobile-calendar-icon svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  /* Shared Transfer date picker must render above Expense's detail screen. */
  html.xb-mobile-detail-open .xbm-overlay {
    z-index: 1700;
  }

  /* Shared phone form contract. This is reused by all entry/detail drawers. */
  .xb-mobile-form-drawer {
    width: 100%;
    max-width: 100%;
    max-inline-size: 100%;
    min-width: 0;
  }

  .xb-mobile-form {
    gap: var(--xb-space-5, 20px);
    padding: var(--xb-space-5, 20px) var(--xb-space-4, 16px) var(--xb-space-6, 24px);
    inline-size: 100%;
    max-inline-size: 100%;
    min-width: 0;
  }

  .xb-mobile-form .expense-detail-grid,
  .xb-mobile-form .advanced-form-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--xb-space-4, 16px);
    column-gap: 0;
  }

  .xb-mobile-form .field {
    position: relative;
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    max-inline-size: 100%;
    min-width: 0;
  }

  .xb-mobile-form .field:not(.detail-attachment-field) > label {
    position: absolute;
    z-index: 1;
    top: -8px;
    left: 12px;
    padding: 0 4px;
    background: var(--surface);
    color: var(--xb-field-label);
    font-size: 12px;
    font-weight: 650;
    line-height: 16px;
    pointer-events: none;
  }

  .xb-mobile-form .field > input,
  .xb-mobile-form .field > select,
  .xb-mobile-form .field > textarea,
  .xb-mobile-form .field .category-combobox-input,
  .xb-mobile-form .field .tag-picker-button,
  .xb-mobile-form .xb-mobile-field-trigger {
    box-sizing: border-box;
    width: 100%;
    max-inline-size: 100%;
    min-width: 0;
    min-height: 56px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    line-height: 1.35;
  }

  .xb-mobile-form .field > input,
  .xb-mobile-form .field > select,
  .xb-mobile-form .field .category-combobox-input,
  .xb-mobile-form .xb-mobile-field-trigger {
    padding: 12px;
  }

  .xb-mobile-form .field > textarea {
    height: 56px;
    min-height: 56px;
    padding: 12px;
  }

  .xb-mobile-form .field .category-combobox-input {
    padding-right: 12px;
  }

  .xb-mobile-form input[type="date"] {
    min-inline-size: 0;
    max-inline-size: 100%;
    text-align: left;
  }

  .xb-mobile-form .tag-picker {
    min-width: 0;
  }

  .xb-mobile-form .field .tag-picker-button {
    justify-content: flex-start;
    padding: 12px;
  }

  .xb-mobile-form .tax-summary {
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .xb-mobile-form .field > select[data-mobile-select-bound="true"],
  .xb-mobile-form .category-combobox.mobile-selection-ready .category-combobox-input {
    display: none;
  }

  .xb-mobile-field-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--xb-field-border);
    background: var(--xb-field-container);
    color: var(--xb-field-content);
    font-family: inherit;
    font-weight: 500;
    text-align: left;
  }

  .xb-mobile-field-trigger:focus-visible {
    border-color: var(--xb-field-focus);
    box-shadow: 0 0 0 3px var(--xb-focus-ring);
    outline: 0;
  }

  .xb-mobile-field-trigger:disabled {
    background: var(--surface-muted);
    color: var(--text-muted);
  }

  .xb-mobile-field-trigger-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xb-mobile-field-trigger-icon {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
  }

}

/* Bank Transactions detail Tags menu: keep each option compact and prevent
 * the native focus ring from becoming a large purple block around a checkbox. */
.bank-posted-tag-options {
  gap: 0 !important;
  padding: 6px 8px !important;
}

.bank-posted-tag-options label {
  box-sizing: border-box;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 4px !important;
  gap: 8px !important;
  line-height: 18px !important;
  font-weight: 400 !important;
}

.bank-posted-tag-options label span {
  margin: 0 !important;
  font-weight: 400 !important;
}

.bank-posted-tag-options input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.bank-posted-tag-options input[type="checkbox"]:focus,
.bank-posted-tag-options input[type="checkbox"]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/*
 * Mobile Expense detail pilot.
 * This surface is deliberately isolated from the desktop drawer. Its geometry
 * follows the Material outlined-field proportions: 56px controls, 16px input
 * type, 16px horizontal content padding, and a consistent 24px field rhythm.
 */
.xb-mobile-expense-detail {
  display: none;
}

@media (max-width: 767px) {
  #detailEntry.expense-detail-drawer:not([hidden]) {
    visibility: hidden;
  }

  .xb-mobile-expense-detail:not([hidden]) {
    position: fixed;
    z-index: 1400;
    inset: 0;
    display: block;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    block-size: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--xb-color-surface);
    color: var(--xb-color-on-surface);
  }

  .xb-mobile-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-inline-size: 0;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    border-bottom: 1px solid var(--xb-color-outline-variant);
    background: var(--xb-color-surface);
  }

  .xb-mobile-detail-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 28px;
  }

  .xb-mobile-detail-header p {
    margin: 0;
    color: var(--xb-color-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
  }

  .xb-mobile-detail-header button {
    flex: 0 0 auto;
    min-block-size: 44px;
    padding-inline: 16px;
    font-size: 16px;
  }

  .xb-mobile-detail-body {
    min-inline-size: 0;
    overflow: visible;
    padding: 24px 16px 32px;
  }

  .xb-mobile-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-inline-size: 0;
    margin-bottom: 24px;
  }

  .xb-mobile-detail-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    inline-size: 100%;
    min-inline-size: 0;
  }

  .xb-mobile-outlined-field {
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    /* The former mobile field used a 56px minimum. Keep that geometry as the
       baseline while giving the phone form a little more vertical breathing
       room for the native legend and touch target. */
    block-size: 64px;
    min-block-size: 64px;
    max-block-size: 64px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--xb-field-border);
    border-radius: 8px;
    background: var(--xb-field-container);
    color: var(--xb-field-content);
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    text-align: left;
  }

  .xb-mobile-outlined-field:focus-within,
  .xb-mobile-outlined-trigger:focus-visible {
    border-color: var(--xb-color-primary);
    border-width: 2px;
    outline: 0;
  }

  /* Native legend geometry is the notch: the browser removes the legend's
     measured width from the fieldset border. No mask, overlay, or background
     rectangle is used, so it works on any surface and with any label width. */
  .xb-mobile-outlined-field > legend {
    max-inline-size: calc(100% - 24px);
    margin-inline-start: -4px;
    padding-inline: 4px;
    color: var(--xb-field-label);
    font-size: 12px;
    font-weight: 650;
    line-height: 18px;
    overflow-wrap: anywhere;
  }

  .xb-mobile-attachment-icon {
    margin-inline-end: 6px;
    font-size: 18px;
  }

  .xb-mobile-outlined-field > input,
  .xb-mobile-outlined-field > textarea {
    box-sizing: border-box;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    block-size: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    /* Override the desktop --font-size-body token inside this isolated phone surface. */
    font-size: 16px !important;
    line-height: 24px;
    text-align: left;
    outline: 0;
    appearance: none;
    -webkit-appearance: none;
  }

  /* Native fieldset layout reserves the legend's line box above the flex
     content. This shared nudge restores the visual center for every single-
     line value and trigger without field-specific offsets. */
  .xb-mobile-outlined-field:not(.is-textarea) > input,
  .xb-mobile-outlined-field:not(.is-textarea) > .xb-mobile-trigger-value,
  .xb-mobile-outlined-trigger > button {
    position: relative;
    inset-block-start: -4px;
  }

  .xb-mobile-outlined-field > input:focus,
  .xb-mobile-outlined-field > textarea:focus {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  .xb-mobile-outlined-field.is-textarea {
    align-items: stretch;
    block-size: 96px;
    padding-block: 16px 8px;
  }

  .xb-mobile-outlined-field.is-adaptive-memo {
    block-size: auto;
    min-block-size: 64px;
    max-block-size: 96px;
    padding-block: 12px 8px;
  }

  .xb-mobile-clamped-value {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xb-mobile-outlined-field > textarea {
    resize: none;
  }

  .xb-mobile-outlined-trigger {
    /* Triggers use the same 16px content inset as text/date fields. Keeping
       this on the fieldset (rather than duplicating it on the button) also
       keeps the native legend notch aligned across every field type. */
    padding: 0 16px;
  }

  .xb-mobile-outlined-trigger > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    inline-size: 100%;
    block-size: 100%;
    min-block-size: 0;
    max-block-size: 100%;
    box-sizing: border-box;
    min-inline-size: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .xb-mobile-outlined-trigger > button:focus-visible {
    outline: 0;
  }

  .xb-mobile-outlined-field:has(> :disabled),
  .xb-mobile-outlined-field.is-locked,
  .xb-mobile-outlined-trigger:disabled {
    --xb-field-container: var(--xb-color-surface-container-high);
    --xb-field-label: var(--xb-color-on-surface-variant);
    border-color: var(--xb-color-outline-variant);
    background: var(--xb-field-container);
    color: var(--xb-color-on-surface-variant);
    cursor: default;
  }

  .xb-mobile-outlined-field > :disabled {
    color: inherit;
    -webkit-text-fill-color: currentColor;
    opacity: 1;
  }

  .xb-mobile-trigger-value {
    display: block;
    min-inline-size: 0;
    overflow: hidden;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* All single-line field values, including the visually rendered Date
     value, share an explicit 24px line box so the text sits on the same
     vertical center as the trigger control. */
  .xb-mobile-outlined-field:not(.is-textarea) > input,
  .xb-mobile-outlined-field:not(.is-textarea) > .xb-mobile-trigger-value {
    align-self: center;
    line-height: 24px;
  }

  .xb-mobile-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    block-size: 24px;
    font-size: 20px;
    line-height: 24px;
  }

  .xb-mobile-outlined-trigger:disabled .xb-mobile-trigger-icon,
  .xb-mobile-outlined-trigger > button:disabled .xb-mobile-trigger-icon {
    display: none;
  }

  .xb-mobile-date-field {
    overflow: visible;
  }

  .xb-mobile-date-field > .xb-mobile-trigger-value {
    inline-size: 100%;
    padding-inline-end: 28px;
  }

  .xb-mobile-date-field > input[type="date"] {
    position: absolute;
    z-index: 3;
    inset: 0;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    block-size: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .xb-mobile-tax-summary,
  .xb-mobile-supporting-content {
    min-inline-size: 0;
    margin-top: -12px;
    overflow-wrap: anywhere;
    color: var(--xb-color-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
  }

  .xb-mobile-tags-attachments {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(138px, 0.52fr);
    gap: 12px;
    min-inline-size: 0;
    align-items: stretch;
  }

  .xb-mobile-tags-column,
  .xb-mobile-attachment {
    min-inline-size: 0;
    display: grid;
    grid-template-rows: 20px 64px;
    gap: 8px;
  }

  .xb-mobile-tags-column .xb-mobile-outlined-field {
    block-size: 64px;
    min-block-size: 64px;
    max-block-size: 64px;
  }

  /* Tags has an accessible-only legend, so it does not need the visual
     legend compensation used by notched fields such as Tax and Note. */
  .xb-mobile-tags-column .xb-mobile-outlined-trigger > button {
    inset-block-start: 0;
  }

  .xb-mobile-section-heading {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-block-size: 24px;
    color: var(--xb-color-on-surface);
    font-size: 14px;
    font-weight: 650;
    line-height: 20px;
  }

  .xb-mobile-tags-icon {
    color: var(--xb-color-primary, var(--primary));
    display: inline-flex;
    width: 18px;
    height: 18px;
    line-height: 1;
  }

  .xb-mobile-tags-icon .bank-tag-icon {
    width: 18px;
    height: 18px;
  }

  .xb-mobile-detail-actions {
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  }

  .xb-mobile-detail-actions button {
    inline-size: 100%;
    min-block-size: 56px;
    font-size: 16px;
  }

  .xb-mobile-attachment .bank-attachment-control {
    grid-template-columns: 1fr;
    grid-template-areas: "heading" "upload";
    grid-template-rows: 20px 64px;
    align-items: stretch;
    gap: 8px;
    inline-size: 100%;
    min-inline-size: 0;
    block-size: 92px;
    min-block-size: 92px;
    max-block-size: 92px;
  }

  .xb-mobile-attachment .bank-attachment-heading {
    justify-content: flex-start;
    min-block-size: 20px;
    block-size: 20px;
    max-block-size: 20px;
    overflow: hidden;
    white-space: nowrap;
  }

  .xb-mobile-attachment .bank-attachment-control > button {
    box-sizing: border-box;
    block-size: 64px;
    min-block-size: 64px;
    max-block-size: 64px;
    max-inline-size: 100%;
  }

  .xb-mobile-attachment .bank-attachment-upload {
    inline-size: 100%;
  }

  .xb-mobile-attachment .bank-attachment-summary,
  .xb-mobile-attachment .bank-attachment-empty {
    max-inline-size: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xb-mobile-attachment .bank-attachment-popover {
    max-block-size: none;
    inline-size: 100%;
    min-inline-size: 0;
  }

  .xb-mobile-attachment-panel {
    z-index: 1600;
    inset: auto 12px max(12px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    height: min(76dvh, 680px);
    max-height: min(76dvh, 680px);
    margin: 0;
    padding: 0;
    border: 1px solid var(--xb-color-outline-variant);
    border-radius: var(--xb-shape-card);
    background: var(--xb-color-surface-container-lowest);
    color: var(--xb-color-on-surface);
  }

  .xb-mobile-attachment-panel::backdrop {
    background: color-mix(in srgb, var(--xb-color-scrim) 42%, transparent);
  }

  .xb-mobile-attachment-sheet {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
  }

  .xb-mobile-attachment-sheet > header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--xb-color-outline-variant);
  }

  .xb-mobile-attachment-sheet > header h2 {
    margin: 0;
    overflow: hidden;
    font-size: 16px;
    font-weight: 650;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xb-mobile-attachment-sheet-body {
    min-height: 0;
    overflow: auto;
    padding: 12px;
  }

  .xb-mobile-attachment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--xb-color-outline-variant);
  }

  .xb-mobile-attachment-file {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
  }

  .xb-mobile-attachment-file span:last-child,
  .xb-mobile-attachment-file strong,
  .xb-mobile-attachment-file small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xb-mobile-attachment-file small {
    color: var(--xb-color-on-surface-variant);
  }

  .xb-mobile-attachment-thumb {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--xb-shape-sm);
    background: var(--xb-color-surface-container-high);
  }

  .xb-mobile-attachment-thumb svg {
    width: 20px;
    height: 20px;
  }

  .xb-mobile-attachment-preview {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 55dvh;
    border: 0;
    object-fit: contain;
  }

  @media (max-width: 360px) {
    .xb-mobile-tags-attachments {
      grid-template-columns: minmax(0, 1fr) minmax(122px, 0.48fr);
      gap: 8px;
    }
  }

  .xb-mobile-attachment .bank-attachment-item {
    min-inline-size: 0;
  }

  .xb-mobile-attachment .bank-attachment-link {
    min-inline-size: 0;
  }

  .xb-mobile-selection-panel {
    z-index: 1500;
    inset: auto 12px max(12px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    inline-size: calc(100% - 24px);
    max-inline-size: calc(100% - 24px);
    min-inline-size: 0;
    max-block-size: min(76dvh, 680px);
    margin: 0;
  }

  .xb-mobile-selection-search input {
    min-block-size: 56px;
    font-size: 16px !important;
  }
}

.xb-mobile-field-trigger {
  display: none;
}

.xb-mobile-selection-panel {
  width: min(calc(100% - 24px), 560px);
  max-width: 560px;
  max-height: min(76dvh, 680px);
  margin: auto auto 12px;
  padding: 0;
  border: 1px solid var(--xb-color-outline-variant);
  border-radius: var(--xb-shape-card);
  background: var(--xb-color-surface-container-lowest);
  box-shadow: var(--xb-elevation-3);
  color: var(--xb-color-on-surface);
}

@media (max-width: 767px) {
  .xb-mobile-selection-panel {
    position: fixed;
    inset: auto 12px 12px;
    width: auto;
    max-width: none;
    margin: 0;
  }
}

.xb-mobile-selection-panel::backdrop {
  background: color-mix(in srgb, var(--xb-color-scrim) 42%, transparent);
}

.xb-mobile-selection-sheet {
  display: grid;
  max-height: min(76dvh, 680px);
  grid-template-rows: auto auto minmax(0, 1fr);
}

.xb-mobile-selection-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--xb-color-outline-variant);
}

.xb-mobile-selection-sheet-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.xb-mobile-selection-search {
  padding: 12px 16px 4px;
}

.xb-mobile-selection-search input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--xb-field-border);
  border-radius: var(--radius-sm);
  background: var(--xb-field-container);
  color: var(--xb-field-content);
  font: inherit;
  font-size: 16px;
}

.xb-mobile-selection-options {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.xb-mobile-selection-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  border: 0;
  border-radius: var(--xb-shape-sm);
  background: transparent;
  color: var(--xb-color-on-surface);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  text-align: left;
}

.xb-mobile-selection-option.is-selected,
.xb-mobile-selection-option:focus-visible {
  background: var(--xb-menu-item-hover-container);
  outline: 0;
}

.xb-mobile-selection-option-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  margin: 8px 4px 2px;
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.xb-mobile-selection-option-group::before,
.xb-mobile-selection-option-group::after {
  flex: 1 1 auto;
  border-top: 1px solid var(--xb-color-outline-variant);
  content: "";
}

.xb-mobile-selection-options.is-rail {
  display: grid;
  gap: 2px;
  padding: 12px 16px 16px;
}

.xb-mobile-selection-options.is-rail .xb-mobile-selection-option-group {
  position: relative;
  justify-content: flex-start;
  min-height: 28px;
  margin: 14px 0 4px;
  padding-left: 14px;
  color: var(--xb-color-on-surface-variant);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.xb-mobile-selection-options.is-rail .xb-mobile-selection-option-group::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--xb-color-primary);
}

.xb-mobile-selection-options.is-rail .xb-mobile-selection-option-group::after {
  display: none;
}

.xb-mobile-selection-options.is-rail .xb-mobile-selection-option {
  margin-left: 10px;
  border-radius: var(--xb-shape-sm);
}

.xb-mobile-selection-option-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.xb-mobile-selection-option-check {
  color: var(--xb-color-primary);
  font-size: 20px;
  font-weight: 700;
}

.xb-mobile-selection-empty {
  margin: 0;
  padding: 24px 12px;
  color: var(--xb-color-on-surface-variant);
  text-align: center;
}

/*
 * iOS Safari enlarges the visual viewport when a text entry control has a
 * computed font size below 16px. Keep the input text itself at 16px on phone
 * layouts; labels, helper text, and non-editable metadata may remain compact.
 * This is intentionally shared across the approved phone surfaces (Dashboard,
 * Expense, Income, and Transfer), not an Expense-only exception.
 */
@media (max-width: 767px) {
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) select,
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) textarea,
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) .category-combobox-input,
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) .quick-menu input,
  :is(#dashboardView, #expensesView, #incomeView, #transfersView, #detailEntry) .tag-menu input {
    font-size: 16px;
  }
}
