/* Bookey Review — Modern Light design system (see ui_ux/ and BRAND.md) */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --bg-elevated: var(--surface);
  --bg-card: var(--surface);
  --text: #17172b;
  --muted: #777b91;
  --text-muted: var(--muted);
  --line: #e9eaf1;
  --border: var(--line);
  --primary: #6751e8;
  --primary-2: #8d6cff;
  --primary-rgb: 103, 81, 232;
  --accent: var(--primary);
  --accent-dim: rgba(103, 81, 232, 0.12);
  --accent-hover: #5740d4;
  --sidebar: #0d102b;
  --warm: #e48b2e;
  --danger: #c94b52;
  --success: #15966c;
  --warning: #c86f12;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 12px 35px rgba(31, 25, 77, 0.06);
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font-sans);
  --display: var(--font-display);
  --sidebar-width: 245px;
}

html[data-theme="dark"] {
  --bg: #070a18;
  --surface: #0d1225;
  --surface-2: #10162c;
  --bg-elevated: var(--surface);
  --bg-card: var(--surface);
  --text: #f6f7ff;
  --muted: #969ab4;
  --line: #202641;
  --sidebar: #050817;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

html[data-theme="neutral"] {
  --bg: #f4f3ef;
  --surface: #fffefa;
  --surface-2: #faf9f5;
  --bg-elevated: var(--surface);
  --bg-card: var(--surface);
  --text: #262624;
  --muted: #77756f;
  --line: #e7e4dc;
  --primary: #252525;
  --primary-2: #55524b;
  --accent: var(--primary);
  --accent-dim: rgba(37, 37, 37, 0.1);
  --accent-hover: #111;
  --sidebar: #fffefa;
  --shadow: 0 12px 35px rgba(38, 38, 36, 0.06);
}

html[data-theme="luxe"] {
  --bg: #100b20;
  --surface: #17112c;
  --surface-2: #1d1536;
  --bg-elevated: var(--surface);
  --bg-card: var(--surface);
  --text: #fffaff;
  --muted: #afa4c8;
  --line: #332650;
  --primary: #a25cff;
  --primary-2: #e06dff;
  --accent: var(--primary);
  --accent-dim: rgba(162, 92, 255, 0.16);
  --accent-hover: #b57aff;
  --sidebar: #0b0718;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: auto;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: auto;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
}

/* Typography — display for titles, DM Sans for UI */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

h3 {
  font-size: 14px;
  line-height: 1.3;
}

.hint,
.page-lead,
.muted {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Layout — sidebar + main (Modern Light) */
.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar);
  color: #fff;
  padding: 32px 16px 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
}

.sidebar .brand {
  font: 800 21px var(--font-display);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 32px;
  text-decoration: none;
  color: #fff;
}

.sidebar .brand:visited,
.sidebar .brand:hover {
  color: #fff;
}

.brand-mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(23, 94, 89, 0.12);
}

.sidebar .brand-mark {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

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

.brand-wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  min-width: 0;
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: inherit;
}

.sidebar .brand-tagline {
  display: none;
}

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

.nav-item {
  color: #c8cadb;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  transition: 0.2s background, 0.2s color;
  font-size: 13px;
  font-weight: 500;
  border: 0;
  background: transparent;
}

.nav-item span {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(112, 82, 235, 0.42), rgba(112, 82, 235, 0.12));
}

.nav-item.muted,
.nav-item[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  color: #c8cadb;
}

.nav-item.muted:hover {
  color: #c8cadb;
  background: transparent;
}

.nav-item small {
  margin-left: auto;
  border-radius: 6px;
  padding: 2px 6px;
  background: #292d48;
  color: #aeb2c9;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-spacer {
  flex: 1;
}

.connection-card,
.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: #fff;
}

.connection-card:hover,
.profile-card:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.connection-card strong,
.profile-card strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.connection-card span,
.profile-card span {
  display: block;
  color: #9297b2;
  font-size: 10px;
}

.connection-logo {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #2ca54d;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 10px;
  flex-shrink: 0;
}

.connection-card .status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.connection-card .status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connection-card .status.is-connected {
  color: #7fd2a7;
}

.connection-card .status.is-connected i {
  background: #31bd78;
}

.connection-card .status.is-disconnected {
  color: #f0a3a6;
}

.connection-card .status.is-disconnected i {
  background: #c94b52;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}

.status-label {
  color: #9297b2 !important;
}

.chevron {
  margin-left: auto;
  font-size: 18px !important;
  color: #7e829a !important;
}

.main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: 1500px;
  padding: 32px 40px 80px;
  min-width: 0;
}

.main-utility:empty {
  display: none;
}

.main-utility:not(:empty) {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.mobile-nav {
  display: none;
}

/* Auth pages — centered card, no sidebar */
.auth-shell .app-shell,
.auth-app-shell {
  display: block;
  min-height: 100vh;
}

.auth-main {
  max-width: 440px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.brand-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  text-decoration: none;
  color: var(--text);
}

.brand-auth .brand-tagline {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.brand-auth .brand-name {
  color: var(--text);
  font-size: 22px;
}

/* Legacy top-nav classes (detail “Next review” etc.) */
.nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}

.nav-link:hover {
  background: var(--accent-dim);
  color: var(--primary);
}

.nav-link-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  border-color: transparent;
}

.page-lead {
  margin: -0.5rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-panel {
  margin-bottom: 2rem;
}

.filter-form {
  margin: 0;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem 1.5rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 12rem;
  flex: 1 1 14rem;
}

.filter-field label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
  cursor: pointer;
}

.filter-field select:focus {
  outline: none;
  border-color: rgba(103, 81, 232, 0.5);
}

.filter-actions {
  flex: 0 0 auto;
  padding-bottom: 0.05rem;
}

.sync-priority-need_receipt {
  background: rgba(232, 93, 117, 0.2);
  color: var(--danger, #e85d75);
}

.sync-priority-match_qbo,
.sync-priority-banking {
  background: rgba(245, 166, 35, 0.2);
  color: var(--warm);
}

.sync-priority-review,
.sync-priority-post,
.sync-priority-sync {
  background: rgba(103, 81, 232, 0.15);
  color: var(--accent);
}

.nav-link:hover {
  color: var(--text);
  border-color: rgba(103, 81, 232, 0.3);
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-card.highlight .value {
  color: var(--accent);
}

/* Upload zone */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.upload-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--warm));
}

.upload-section h2 {
  margin: 0 0 0.35rem;
}

.upload-section .hint {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inbox-scan-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.inbox-dir-row {
  width: 100%;
  max-width: 36rem;
}

.inbox-dir-row label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.inbox-dir-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.inbox-dir-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.file-drop {
  flex: 1;
  min-width: 220px;
  position: relative;
  border: 2px dashed rgba(103, 81, 232, 0.35);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  background: var(--accent-dim);
  transition: border-color 0.2s, background 0.2s;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--accent);
  background: rgba(103, 81, 232, 0.08);
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.file-drop-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.file-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.file-name {
  color: var(--accent);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.btn.is-loading {
  pointer-events: none;
}

.btn-spinner,
.bookey-busy-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bookey-spin 0.65s linear infinite;
  vertical-align: -0.15em;
}

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

.bookey-busy-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(15, 20, 25, 0.1);
  pointer-events: auto;
}

.bookey-busy-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  min-width: min(22rem, 70vw);
  max-width: 36rem;
}

.bookey-busy-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.bookey-busy-hint[hidden] {
  display: none;
}

.bookey-busy-dismiss {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.bookey-busy-dismiss:hover {
  color: var(--text);
  border-color: var(--accent);
}

.bookey-busy-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(15, 20, 25, 0.08);
  overflow: hidden;
}

.bookey-busy-track[hidden] {
  display: none;
}

.bookey-busy-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

body.bookey-page-busy .bookey-busy-banner {
  display: flex;
}

.bookey-progress-chip {
  display: none;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(23, 23, 43, 0.12));
  background: var(--surface, #fff);
  color: var(--text, #17172b);
  box-shadow: var(--shadow, 0 8px 28px rgba(15, 20, 25, 0.14));
  font: 600 0.85rem var(--font-ui, "DM Sans", sans-serif);
  cursor: pointer;
}

.bookey-progress-chip:hover {
  border-color: var(--primary, #6751e8);
}

body.bookey-progress-minimized .bookey-progress-chip {
  display: inline-flex;
}

@media (max-width: 720px) {
  body.bookey-progress-minimized .bookey-progress-chip {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }
}

.bookey-notifications {
  position: relative;
}

.bookey-notifications > summary {
  list-style: none;
  cursor: pointer;
}

.bookey-notifications > summary::-webkit-details-marker {
  display: none;
}

.bookey-notifications-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: min(360px, calc(100vw - 2rem));
  padding: 12px;
  display: grid;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  color: var(--text);
}

.bookey-notifications-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.bookey-notifications-head strong {
  font: 700 0.95rem var(--font-display, "Plus Jakarta Sans", sans-serif);
}

.bookey-notif-sub {
  display: block;
  margin-top: 2px;
  font: 500 0.72rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
}

.bookey-notif-time {
  display: block;
  margin-top: 4px;
  font: 500 0.72rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
  font-style: normal;
}

.bookey-notifications-head .text-link {
  border: 0;
  background: none;
  padding: 0;
  font: 600 0.8rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--primary);
  cursor: pointer;
}

.bookey-notif-active {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.bookey-notif-progress {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.bookey-notif-progress strong {
  display: block;
  font: 600 0.9rem var(--font-ui, "DM Sans", sans-serif);
}

.bookey-notif-progress span {
  display: block;
  margin-top: 2px;
  font: 500 0.8rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
}

.bookey-notif-hint {
  display: block;
  margin-top: 4px;
  font: 500 0.75rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
  font-style: normal;
}

.bookey-notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.bookey-notif-item {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg, #f6f7fb);
}

.bookey-notif-item.is-unread {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
}

.bookey-notif-item a,
.bookey-notif-item {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}

.bookey-notif-item strong {
  display: block;
  font: 600 0.88rem var(--font-ui, "DM Sans", sans-serif);
}

.bookey-notif-item span {
  display: block;
  margin-top: 2px;
  font: 500 0.8rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
}

.bookey-notif-item.is-success strong {
  color: var(--success, #1f8a5b);
}

.bookey-notif-item.is-error strong {
  color: var(--danger, #c0392b);
}

.bookey-notif-empty {
  margin: 0;
  padding: 8px 4px;
  font: 500 0.85rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--muted, #5c6078);
}

.bookey-notif-footer {
  display: block;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font: 600 0.82rem var(--font-ui, "DM Sans", sans-serif);
  color: var(--primary);
  text-decoration: none;
}

.bookey-notif-footer:hover {
  text-decoration: underline;
}

.dashboard .top-actions .bookey-notifications {
  flex-shrink: 0;
}

/* Status banner only — keep the app usable while long work runs. */
body.bookey-page-busy {
  padding-top: 3.5rem;
}

body.bookey-page-busy .sidebar {
  top: 3.5rem;
}

tr[data-receipt-id].bookey-row-updating {
  opacity: 0.55;
  pointer-events: none;
}

.receipt-live-panel {
  margin-top: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff;
  box-shadow: 0 8px 18px rgba(103, 81, 232, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 10px 22px rgba(103, 81, 232, 0.28);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--accent-dim);
}

.btn-danger {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.35);
}

/* Section headers */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
}

.section-head .count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tables */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
  max-width: 100%;
}

table.data-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table th:last-child,
table.data-table td:last-child {
  padding-right: 1.25rem;
}

table.data-table thead {
  background: var(--bg-elevated);
}

table.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tbody tr {
  transition: background 0.12s;
}

table.data-table tbody tr:hover {
  background: var(--surface-2);
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* State badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
  border-radius: 999px;
  letter-spacing: 0.02em;
  background: rgba(139, 156, 179, 0.2);
  color: var(--text-muted);
}

.badge-duplicate_suspect {
  background: rgba(233, 196, 106, 0.2);
  color: var(--warning);
  border: 1px solid rgba(233, 196, 106, 0.35);
}

.badge-pending_review {
  background: rgba(233, 196, 106, 0.2);
  color: var(--warning);
}

.badge-approved {
  background: rgba(125, 216, 125, 0.15);
  color: var(--success);
}

.badge-qbo_posted {
  background: rgba(103, 81, 232, 0.2);
  color: var(--accent);
}

.badge-rejected,
.badge-failed {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.badge-pending,
.badge-processing {
  background: rgba(139, 156, 179, 0.2);
  color: var(--text-muted);
}

.badge-match_suggested {
  background: rgba(233, 196, 106, 0.2);
  color: var(--warning);
}

.badge-expense_linked {
  background: rgba(120, 180, 255, 0.15);
  color: var(--accent, #7ab8ff);
}

.qbo-banner-linked {
  background: rgba(120, 180, 255, 0.08);
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.badge-matched {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.badge-matching_not_found {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

/* QBO post + bank match (orthogonal to workflow state) */
.sync-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.sync-none {
  background: rgba(139, 156, 179, 0.15);
  color: var(--text-muted);
}

.sync-pending {
  background: rgba(233, 196, 106, 0.18);
  color: var(--warning);
}

.sync-ok {
  background: rgba(103, 81, 232, 0.2);
  color: var(--accent);
}

.sync-warn {
  background: rgba(233, 196, 106, 0.22);
  color: var(--warning);
}

.sync-error {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.sync-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.sync-status-card {
  flex: 1;
  min-width: 12rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sync-status-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.sync-status-detail,
.sync-status-time {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.qbo-banner-ok {
  border-color: rgba(103, 81, 232, 0.35);
  background: rgba(103, 81, 232, 0.08);
}

.qbo-banner-match {
  border-color: rgba(125, 180, 255, 0.35);
  background: rgba(125, 180, 255, 0.08);
}

.qbo-banner-pending {
  border-color: rgba(233, 196, 106, 0.3);
  background: rgba(233, 196, 106, 0.06);
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.flash-ok {
  background: rgba(103, 81, 232, 0.12);
  border: 1px solid rgba(103, 81, 232, 0.35);
  color: var(--accent);
}

.flash-error {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--danger);
  line-height: 1.45;
}

.flash-detail {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.95;
}

.qbo-reauth-banner {
  display: block;
}

.qbo-reauth-title {
  margin: 0 0 0.55rem;
  font-weight: 700;
  font-size: 1rem;
}

.qbo-reauth-steps {
  margin: 0;
  padding-left: 1.25rem;
}

.qbo-reauth-steps li {
  margin: 0.35rem 0;
}

.qbo-reauth-steps code {
  font-size: 0.86em;
}

.flash-warn {
  background: rgba(233, 196, 106, 0.12);
  border: 1px solid rgba(233, 196, 106, 0.35);
  color: var(--warning);
}

.workflow-hero {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.workflow-hero h2 {
  margin: 0 0 0.5rem;
}

.workflow-hero .hint {
  margin: 0 0 1rem;
}

.btn-lg {
  font-size: 1.05rem;
  padding: 0.65rem 1.25rem;
}

.workflow-hero {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.workflow-hero h2 {
  margin: 0 0 0.5rem;
}

.workflow-hero .hint {
  margin: 0 0 1rem;
}

.btn-lg {
  font-size: 1.05rem;
  padding: 0.65rem 1.25rem;
}

.bulk-qbo-form {
  margin-bottom: 0.5rem;
}

.bulk-check-cell {
  width: 2.25rem;
  padding-left: 0.5rem !important;
  padding-right: 0.25rem !important;
  vertical-align: middle;
}

.bulk-check-cell input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--accent, #6ee7b7);
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0.75rem 0 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
}

.bulk-toolbar[hidden] {
  display: none !important;
}

.bulk-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 5rem;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

.btn-danger-outline {
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.45);
  background: transparent;
}

.btn-danger-outline:hover {
  background: rgba(240, 113, 120, 0.12);
}

.receipt-id {
  font-size: 0.75rem;
  word-break: break-all;
}

.link-action {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.btn-text {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  transition: background 0.12s, color 0.12s;
}

.btn-text-danger {
  color: var(--danger);
}

.btn-text-danger:hover {
  background: rgba(201, 75, 82, 0.1);
  color: var(--danger);
}

.actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}

.actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.empty-state p {
  margin: 0;
  font-size: 0.95rem;
}

/* Detail page */
.detail-header {
  margin-bottom: 1.5rem;
}

.detail-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.detail-header h1 {
  margin: 0;
}

.detail-review-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.detail-review-count {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.nav-link-next {
  font-weight: 600;
  color: var(--accent);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.actions-review {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.review-advance-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0.25rem 0;
}

.meta code {
  font-size: 0.8rem;
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--accent);
}

.layout-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.2fr);
  gap: 2rem;
  align-items: start;
}

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

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.receipt-pdf-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.receipt-pdf-toolbar {
  justify-content: flex-start;
}

.receipt-pdf {
  width: 100%;
  min-height: 480px;
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.receipt-zoom {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.receipt-zoom-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.receipt-zoom-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

.receipt-zoom-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

.receipt-zoom-expand {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 500;
  min-width: auto;
  padding: 0 0.65rem;
}

.receipt-zoom-level {
  min-width: 3rem;
  text-align: center;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.receipt-zoom-viewport {
  position: relative;
  overflow: hidden;
  max-height: 70vh;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted, #f4f4f5);
  touch-action: none;
  cursor: zoom-in;
}

.receipt-zoom.is-zoomed .receipt-zoom-viewport {
  cursor: grab;
}

.receipt-zoom-viewport.is-panning {
  cursor: grabbing;
}

.receipt-image {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.receipt-zoom-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.receipt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.receipt-lightbox[hidden] {
  display: none !important;
}

body.receipt-lightbox-open {
  overflow: hidden;
}

.receipt-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
}

.receipt-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(96vw, 1200px);
  margin: 2vh auto;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.receipt-lightbox-close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.receipt-lightbox-close:hover {
  background: var(--surface-elevated);
  color: var(--text);
}

.receipt-zoom-lightbox {
  flex: 1;
  min-height: 0;
}

.receipt-zoom-lightbox .receipt-zoom-viewport {
  max-height: calc(96vh - 5rem);
  min-height: 50vh;
  flex: 1;
}

.receipt-zoom-lightbox .receipt-image {
  max-height: calc(96vh - 5rem);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.fields {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.65rem 1rem;
  align-items: center;
}

.fields label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.fields input,
.fields select,
.fields textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.fields input:focus,
.fields select:focus,
.fields textarea:focus {
  outline: none;
  border-color: rgba(103, 81, 232, 0.5);
}

.fields textarea {
  min-height: 160px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.8rem;
}

.field-hint {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -0.35rem;
}

.actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.actions input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

h3.subhead {
  margin: 1.5rem 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.qbo-banner {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--accent-dim);
  border: 1px solid rgba(103, 81, 232, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

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

/* Unified receipt queue */
.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;
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.queue-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.queue-lead {
  margin: 0;
  font-size: 0.9rem;
}

.queue-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ingest-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 20, 25, 0.28);
  cursor: default;
}

.ingest-backdrop[hidden] {
  display: none !important;
}

.ingest-details > summary {
  list-style: none;
  cursor: pointer;
}

.ingest-details > summary::-webkit-details-marker {
  display: none;
}

.ingest-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  margin-top: 0.5rem;
  padding: 1rem;
  min-width: min(420px, 92vw);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ingest-details {
  position: relative;
  z-index: 20;
}

.ingest-block + .ingest-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ingest-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.ingest-block .inbox-dir-input {
  width: 100%;
  margin-bottom: 0.5rem;
}

.queue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.queue-filter-btn {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.queue-filter-btn:hover {
  color: var(--text);
  border-color: var(--primary);
}

.queue-filter-active {
  background: var(--accent-dim);
  border-color: rgba(103, 81, 232, 0.45);
  color: var(--primary);
}

.queue-filter-count {
  opacity: 0.85;
  margin-left: 0.15rem;
}

.queue-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
}

.queue-search {
  min-width: 220px;
  padding: 0.45rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
}

.queue-sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.queue-sort {
  padding: 0.4rem 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
}

.queue-result-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
}

.queue-status {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.queue-status-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

button.queue-status-trigger {
  font: inherit;
  border: none;
  cursor: help;
  text-align: left;
}

button.queue-status-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.queue-status-bubble {
  position: absolute;
  z-index: 40;
  left: 0;
  top: calc(100% + 0.35rem);
  min-width: 14rem;
  max-width: min(22rem, 70vw);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(15, 20, 25, 0.97);
  border: 1px solid rgba(240, 113, 120, 0.45);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}

.queue-status-wrap:hover .queue-status-bubble,
.queue-status-wrap:focus-within .queue-status-bubble,
.queue-status-wrap.is-open .queue-status-bubble {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.queue-status-pending {
  background: rgba(233, 196, 106, 0.15);
  color: var(--warning);
}

.queue-status-error {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.queue-status-warn {
  background: rgba(244, 162, 97, 0.15);
  color: var(--warm);
}

.queue-status-ok {
  background: rgba(125, 216, 125, 0.12);
  color: var(--success);
}

.queue-complete-mark {
  margin-right: 0.2rem;
  font-weight: 700;
}

.queue-row-complete {
  background: rgba(125, 216, 125, 0.06);
}

.queue-row-complete td:first-child + td {
  box-shadow: inset 3px 0 0 var(--success);
}

.queue-row-awaiting-bank {
  background: rgba(233, 196, 106, 0.04);
}

.queue-row-duplicate {
  background: rgba(244, 162, 97, 0.1);
}

.queue-row-duplicate td:first-child + td {
  box-shadow: inset 3px 0 0 var(--warm);
}

.row-subhint-duplicate {
  color: var(--warm);
  font-weight: 500;
}

.currency-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.queue-legend {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
}

.queue-status-none {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.row-subhint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.15rem;
}

.data-table-queue .col-vendor strong {
  font-weight: 600;
}

table.data-table-queue {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

table.data-table-queue .col-date {
  width: 6.5rem;
}

table.data-table-queue .col-category {
  width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.data-table-queue .col-total {
  width: 5.5rem;
}

table.data-table-queue .col-status {
  width: 9.5rem;
  white-space: nowrap;
}

table.data-table-queue .col-sync {
  width: 8.5rem;
  white-space: nowrap;
  vertical-align: middle;
}

table.data-table-queue .col-actions,
table.data-table-queue .actions-cell {
  width: 14rem;
  min-width: 14rem;
}

table.data-table-queue td {
  vertical-align: middle;
}

tr[hidden] {
  display: none;
}

/* Auth / setup */
.auth-panel {
  max-width: none;
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-panel {
  max-width: 520px;
}

.auth-panel h1 {
  margin-bottom: 0.35rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-form input {
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
}

.auth-form input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.flash-ok,
.flash-success {
  color: var(--success);
  background: rgba(125, 216, 125, 0.12);
  border: 1px solid rgba(125, 216, 125, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.site-header .auth-user {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* —— Bookey dashboard (Modern Light) —— */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.eyebrow,
.dash-eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.topbar h1 {
  margin: 0;
  font: 700 25px var(--font-display);
  letter-spacing: -0.7px;
}

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

.date-button {
  font: 600 12px var(--font-sans);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 13px;
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.date-button::-webkit-details-marker {
  display: none;
}

.date-picker {
  position: relative;
}

.date-picker-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font: 600 14px var(--font-sans);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  text-decoration: none;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--primary);
}

.icon-button b {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 8px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 8px 18px rgba(103, 81, 232, 0.2);
}

.primary-button:hover {
  color: #fff;
}

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

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}

a.kpi-card:hover {
  color: inherit;
  border-color: var(--primary);
}

.kpi-card > div:last-child {
  min-width: 0;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.kpi-card strong {
  display: block;
  font: 700 18px var(--font-display);
  letter-spacing: -0.4px;
  white-space: nowrap;
}

.kpi-card em {
  display: block;
  font-style: normal;
  font-size: 10px;
  margin-top: 6px;
  color: var(--muted);
}

.kpi-card .positive {
  color: var(--success);
}

.kpi-card .negative {
  color: var(--warm);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 14px;
}

.kpi-icon.purple { background: #eeeaff; color: #6d54e9; }
.kpi-icon.green { background: #e7f8f0; color: #15966c; }
.kpi-icon.blue { background: #e8f2ff; color: #2877d7; }
.kpi-icon.orange { background: #fff3e3; color: #e48b2e; }
.kpi-icon.violet { background: #f0e9ff; color: #8d5de6; }

.dashboard .exec-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}
.dash-period {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.dash-period label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.dash-period input[type="date"] {
  font: 600 12px var(--font-sans);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.dashboard .kpi-strip {
  display: none;
}
.dashboard .section,
.dash-chart-panel.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.25rem;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.section-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.section-head .muted,
.timeline-note,
.subhead + .muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.subhead {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.timeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  min-height: 150px;
  overflow-x: auto;
  padding: 0.25rem 0 0.15rem;
}
.timeline-chart.dense { min-height: 110px; }
.timeline-day {
  flex: 1 0 30px;
  max-width: 44px;
  height: 140px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.65rem;
}
.timeline-chart.dense .timeline-day {
  height: 100px;
  flex-basis: 18px;
  max-width: 28px;
}
.timeline-chart.is-medium-range {
  gap: 0.18rem;
}
.timeline-chart.is-medium-range .timeline-day {
  flex: 1 0 16px;
  max-width: 28px;
  min-width: 12px;
  font-size: 0.6rem;
}
.timeline-chart.is-long-range {
  gap: 0.12rem;
}
.timeline-chart.is-long-range .timeline-day {
  flex: 1 0 10px;
  max-width: 18px;
  min-width: 8px;
  font-size: 0.58rem;
}
.timeline-chart.is-medium-range .day-tick,
.timeline-chart.is-long-range .day-tick {
  max-width: 2.6rem;
  overflow: visible;
  white-space: nowrap;
  transform: translateX(-35%);
  text-align: left;
}
.timeline-chart.is-long-range .day-tick-spacer,
.timeline-chart.is-medium-range .day-tick-spacer {
  display: block;
  height: 1em;
  width: 1px;
  overflow: hidden;
  visibility: hidden;
}
.timeline-day.show-tick .day-tick {
  font-weight: 600;
  color: var(--text-muted);
}
.timeline-day .bar.revenue {
  display: block;
  width: 100%;
  height: var(--h, 0%);
  min-height: 2px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
}
.timeline-day.is-empty .bar.revenue {
  background: var(--border);
  opacity: 0.55;
}
.timeline-day.is-selected .bar.revenue,
.timeline-day:not(:disabled):hover .bar.revenue {
  filter: brightness(1.06);
  box-shadow: 0 0 0 1px rgba(103, 81, 232, 0.4);
}

.dash-modal::backdrop {
  background: rgba(15, 20, 25, 0.35);
}
.day-tick { font-variant-numeric: tabular-nums; }
.dash-modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(960px, 96vw);
  max-height: 88vh;
}
.dash-modal-card {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
.dash-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.day-drill-lead { display: grid; gap: 0.55rem; }
.day-drill-lead h2 { margin: 0; font-size: 1.2rem; }
.day-drill-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}
.day-total { display: grid; gap: 0.1rem; min-width: 4.5rem; }
.day-total-label {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.day-total-value {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.dash-modal-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow: auto;
}
.dash-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1rem 0 0.4rem;
}
.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.hour-ticket-scroll {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.hour-ticket-table { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
.hour-ticket-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.hour-ticket-table .num,
.hour-lines-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.hour-ticket-table .hour-expand {
  width: 1.25rem;
  color: var(--text-muted);
  text-align: center;
  user-select: none;
}
.hour-ticket-row.is-expandable { cursor: pointer; }
.hour-ticket-row.is-expandable:hover,
.hour-ticket-row.is-expandable:focus {
  background: rgba(103, 81, 232, 0.08);
  outline: none;
}
.hour-ticket-row.is-open { background: rgba(103, 81, 232, 0.12); }
.hour-lines td {
  padding: 0.45rem 0.75rem 0.85rem;
  background: var(--surface-2);
}
.receipt-expand { display: grid; gap: 0.65rem; }
.receipt-expand-meta { font-size: 0.88rem; }
.receipt-totals.sku-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}
.sku-kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  background: var(--bg-card);
}
.sku-kpi-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.sku-kpi strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.hour-lines-table {
  width: 100%;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.hour-lines-table td {
  background: var(--surface);
}
.hour-lines-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.dash-qbo-ok { color: var(--success); font-weight: 600; }
.dash-qbo-pending { color: var(--text-muted); }
@media (max-width: 720px) {
  .receipt-totals.sku-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard .kpi-strip { flex-wrap: wrap; }
  .dashboard .kpi { border-right: 0; border-bottom: 1px solid var(--border); min-width: 45%; }
}

/* —— Account menu + account hub —— */
.account-menu {
  position: relative;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

.account-menu > summary {
  list-style: none;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 14rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.account-menu-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.account-menu-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-caret {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.account-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 40;
  min-width: 11.5rem;
  padding: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.15rem;
}

.account-menu-panel a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.account-menu-panel a:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.account-page-head {
  margin-bottom: 1.5rem;
}

.account-page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}

.account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04);
}

.account-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.settings-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.settings-dl dt {
  color: var(--text-muted);
  font-weight: 600;
}

.settings-dl dd {
  margin: 0;
}

/* —— Home exceptions + Add receipts + settings —— */
.home-actions {
  margin-bottom: 16px;
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.home-action-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.12s, background 0.12s;
}

.home-action-card:hover {
  border-color: var(--primary);
  background: var(--accent-dim);
  color: var(--text);
}

.home-action-card strong {
  font: 700 18px var(--font-display);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.home-action-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.home-action-card.is-warn strong {
  color: var(--danger);
}

.home-action-feature strong {
  color: var(--primary);
}

.feature-page-head,
.account-page-head {
  margin-bottom: 24px;
}

.feature-page-head h1,
.account-page-head h1 {
  margin: 0 0 4px;
  font: 700 25px var(--font-display);
  letter-spacing: -0.7px;
}

.add-receipts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.add-receipts-card {
  min-height: 220px;
}

.add-receipts-card .inbox-dir-input,
.add-receipts-card input[type="file"] {
  display: block;
  width: 100%;
  margin: 12px 0 16px;
}

.upload-hero {
  margin-top: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #17133c, #312073);
  color: #fff;
  padding: 32px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: center;
}

.upload-hero h2 {
  font: 800 25px var(--font-display);
  margin: 0 0 10px;
  max-width: 560px;
  letter-spacing: -0.8px;
  color: #fff;
}

.upload-hero p:not(.eyebrow) {
  color: #c4c1dd;
  line-height: 1.7;
  max-width: 610px;
}

.upload-hero .eyebrow {
  color: #aaa2d7;
}

.upload-zone {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-zone.is-dragover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
}

.upload-zone strong {
  font: 700 15px var(--font-display);
}

.upload-zone > span:not(.upload-icon):not(.upload-filename) {
  font-size: 10px;
  color: #aaa6c5;
}

.upload-zone input[type="file"],
.upload-zone .upload-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none;
}

.upload-filename {
  font-size: 12px;
  color: #efeaff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.upload-zone .btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  margin-top: 0;
}

.upload-zone .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
}

.upload-zone .upload-submit {
  margin-top: 0;
}

.upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 20px;
}

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

.setting-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}

.setting-card:hover {
  border-color: var(--primary);
  color: inherit;
}

.setting-card > span {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.setting-card strong {
  font-size: 13px;
  display: block;
}

.setting-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.feature-page-foot {
  margin-top: 8px;
}

.empty-state {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 14px;
}

.queue-title {
  font: 700 25px var(--font-display);
  letter-spacing: -0.7px;
}

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

.panel-head h2 {
  font: 700 14px var(--font-display);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.text-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.dashboard .panel {
  padding: 20px;
}

.dashboard .panel h2 {
  margin: 0 0 4px;
  font: 700 14px var(--font-display);
  letter-spacing: -0.2px;
}

.dashboard .select {
  padding: 7px 9px;
  font: 600 10px var(--font-sans);
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
}

.chart-grid,
.lower-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.chart {
  height: 255px;
  position: relative;
  padding: 5px 0 0 38px;
}

.chart svg {
  width: 100%;
  height: 220px;
  overflow: visible;
}

.grid-lines line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.area-fill {
  fill: url(#expense-area);
}

.chart .point {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 3;
  cursor: pointer;
}

.y-labels {
  position: absolute;
  left: 0;
  top: 10px;
  height: 215px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.x-labels {
  position: relative;
  height: 16px;
  color: var(--muted);
  font-size: 9px;
  margin: 0 7px;
}

.x-tick {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.chart-tooltip {
  position: absolute;
  top: 36px;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  border-radius: 9px;
  pointer-events: none;
  z-index: 2;
}

.chart-tooltip small {
  display: block;
  color: var(--muted);
  font-size: 8px;
}

.chart-tooltip strong {
  font-size: 11px;
}

.category-body {
  display: flex;
  align-items: center;
  gap: 25px;
  min-height: 255px;
}

.donut {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
}

.donut:after {
  content: "";
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--surface);
  position: absolute;
}

.donut > div {
  z-index: 1;
  text-align: center;
}

.donut strong {
  display: block;
  font: 700 17px var(--font-display);
}

.donut span {
  color: var(--muted);
  font-size: 10px;
}

.legend {
  display: grid;
  gap: 14px;
  flex: 1;
}

.legend > div {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 7px;
  font-size: 9px;
}

.legend .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: block;
}

.legend b {
  color: var(--muted);
  font-weight: 500;
}

.legend strong {
  font-size: 9px;
}

.receipt-list {
  display: grid;
}

.receipt-row {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

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

.receipt-row:hover {
  color: inherit;
}

.merchant {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: #f2f3f7;
  color: #111;
}

.merchant.tone-a { background: #fff; color: #111; border: 1px solid var(--line); }
.merchant.tone-b { background: #eaf8ef; color: #16834e; }
.merchant.tone-c { background: #fff1f1; color: #e23e4d; }
.merchant.tone-d { background: #edf2ff; color: #1758be; }
.merchant.tone-e { background: #f0f0f0; color: #555; }

.receipt-row strong,
.vendor-list strong {
  font-size: 10px;
  display: block;
}

.receipt-row div span {
  font-size: 9px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.receipt-row .amount {
  font-size: 10px;
  font-weight: 700;
}

.receipt-row .badge {
  font-size: 8px;
  padding: 4px 7px;
  border-radius: 6px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.receipt-row .badge.matched {
  color: #12855f;
  background: #e7f8f0;
}

.receipt-row .badge.unmatched {
  color: #c86f12;
  background: #fff2df;
}

.vendor-list {
  display: grid;
  gap: 15px;
}

.vendor-list > div {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
}

.vendor-info strong {
  margin-bottom: 6px;
}

.spend-bar {
  height: 3px;
  background: var(--line);
  border-radius: 4px;
}

.spend-bar i {
  height: 100%;
  display: block;
  border-radius: 4px;
  background: var(--primary);
}

.vendor-list > div > b {
  font-size: 9px;
}

@media (max-width: 1150px) {
  .sidebar {
    width: 210px;
  }

  .main {
    margin-left: 210px;
    width: calc(100% - 210px);
    padding: 24px;
  }

  .kpi-grid,
  .home-action-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .category-body {
    justify-content: center;
  }

  .kpi-card:nth-child(4),
  .kpi-card:nth-child(5) {
    grid-column: span 1;
  }

  .upload-hero,
  .settings-grid,
  .add-receipts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 80px;
  }

  .sidebar {
    display: none;
  }

  .main {
    margin: 0;
    width: 100%;
    padding: 20px 16px 32px;
  }

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

  .topbar h1,
  .queue-title,
  .feature-page-head h1,
  .account-page-head h1 {
    font-size: 20px;
  }

  .top-actions {
    width: 100%;
  }

  .kpi-grid,
  .home-action-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .kpi-card:nth-child(5) {
    grid-column: span 2;
  }

  .chart-grid,
  .lower-grid {
    gap: 10px;
  }

  .dashboard .panel {
    padding: 15px;
  }

  .category-body {
    flex-direction: column;
  }

  .donut {
    width: 145px;
    height: 145px;
  }

  .donut:after {
    width: 91px;
    height: 91px;
  }

  .legend {
    width: 100%;
  }

  .receipt-row {
    grid-template-columns: 30px 1fr auto;
  }

  .receipt-row .amount,
  .receipt-row .badge {
    grid-column: 3;
  }

  .mobile-nav {
    position: fixed;
    display: flex;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    z-index: 30;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
  }

  .mobile-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 16px;
    text-align: center;
  }

  .mobile-nav small {
    display: block;
    font-size: 8px;
    margin-top: 2px;
  }

  .mobile-nav a.active {
    color: var(--primary);
  }

  .mobile-upload {
    width: 44px !important;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff !important;
    display: grid !important;
    place-items: center;
    box-shadow: 0 8px 20px rgba(103, 81, 232, 0.3);
  }

  .mobile-upload small {
    display: none;
  }
}
