@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-elevated: #fafbff;
  --primary: #1a1a2e;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --border: #e5e7eb;
  --border-subtle: #f1f5f9;
  --text-muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--primary);
  line-height: 1.5;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

body.dashboard-page {
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fb 100%);
}

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

a:hover {
  text-decoration: underline;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 1rem;
}

.login-card {
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-card .tagline {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

input,select,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.12s ease, box-shadow 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.25);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
  transform: translateY(-1px);
}

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

@keyframes dropPulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.15); }
  100% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border: none;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
}

/* Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-email {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.layout-body {
  display: flex;
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #f5f8fe 0%, #f1f5fb 100%);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(79, 70, 229, 0.08);
  color: var(--accent);
  text-decoration: none;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2rem 2rem;
  overflow-x: hidden;  
  margin: 0 auto;
  width: 100%;
}

/* Banners */
.banner {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;  
  flex-wrap: wrap;
  gap: 0.75rem;
}

.banner-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.applied-balance-info {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border);
}

.banner-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  flex-direction: column;
  align-items: flex-start;
}

.review-attestation {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.attestation-label {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.875rem;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

.attestation-label input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.btn-danger-outline {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff;
}

.btn-danger-outline:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

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

.banner-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.banner-success .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

.dashboard-settings-glance {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.xero-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.xero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.xero-card-title {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  margin: 0;
}

.xero-watcher-badge {
  text-transform: none;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.xero-folder-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  background: rgba(6, 95, 70, 0.06);
  border: 1px solid rgba(6, 95, 70, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
}

.xero-folder-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #166534;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.xero-folder-path {
  font-size: 0.8rem;
  color: #134e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xero-folder-help {
  margin: 0;
  font-size: 0.82rem;
  color: #065f46;
}

.xero-autopush-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.xero-autopush-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.xero-card-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.xero-connect-card {
  width: 100%;
  background: #f8fffc;
  border: 1px solid #b7ebd2;
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: surfaceIn 0.2s ease;
}

.xero-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.xero-main-drop {
  min-width: 0;
  flex: 1;
}

.xero-main-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #166534;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.xero-main-label::before {
  content: "📥";
  font-size: 0.76rem;
}

.xero-main-path {
  display: block;
  font-size: 0.82rem;
  color: #134e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xero-connect-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.xero-connect-kicker {
  margin: 0 0 0.12rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f766e;
  font-weight: 600;
}

.xero-connect-kicker::before {
  content: "◉";
  font-size: 0.64rem;
  color: #10b981;
}

.xero-connect-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: #065f46;
}

.xero-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.xero-status-active {
  background: #dcfce7;
  color: #166534;
}

.xero-status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.xero-path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}

.xero-path-card {
  background: #ffffff;
  border: 1px solid #d9efe3;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.72rem;
}

.xero-path-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #166534;
  font-weight: 600;
  margin-bottom: 0.22rem;
}

.xero-path-value {
  display: block;
  color: #134e4a;
  font-size: 0.79rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xero-path-help {
  margin: 0;
  font-size: 0.83rem;
  color: #0f766e;
}

.xero-path-help-line {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.xero-path-help-line + .xero-path-help-line {
  margin-top: 0.22rem;
}

.xero-path-help-icon {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #0f766e;
  border: 1px solid #99f6e4;
  background: #ecfeff;
  line-height: 1;
}

.xero-controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.xero-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}

.xero-switch-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.62rem;
  font-size: 0.86rem;
  color: #14532d;
  border: 1px solid #d9efe3;
  background: #ffffff;
  border-radius: 12px;
  padding: 0.54rem 0.66rem;
  width: 100%;
  max-width: 560px;
}

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

.xero-switch-ui {
  width: 2.2rem;
  height: 1.28rem;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  transition: background 0.18s ease;
}

.xero-switch-ui::after {
  content: "";
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  top: 0.19rem;
  left: 0.2rem;
  transition: transform 0.18s ease;
}

.xero-switch-input:checked + .xero-switch-ui {
  background: #10b981;
}

.xero-switch-input:checked + .xero-switch-ui::after {
  transform: translateX(0.9rem);
}

.xero-switch-input:focus-visible + .xero-switch-ui {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.xero-switch-copy {
  display: grid;
  gap: 0.12rem;
  line-height: 1.15;
}

.xero-switch-copy strong {
  font-size: 0.88rem;
  color: #14532d;
}

.xero-switch-copy small {
  font-size: 0.74rem;
  color: #64748b;
}

/* Generic form toggle (used in user create/edit) */
.form-group .form-toggle {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.62rem;
  font-size: 0.86rem;
  color: var(--primary);
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  padding: 0.54rem 0.66rem;
  width: 100%;
  max-width: 520px;
  cursor: pointer;
  margin-bottom: 0;
}

.form-group .form-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
}

.form-group .form-toggle-ui {
  width: 2.2rem;
  height: 1.28rem;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  transition: background 0.18s ease;
}

.form-group .form-toggle-ui::after {
  content: "";
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  top: 0.19rem;
  left: 0.2rem;
  transition: transform 0.18s ease;
}

.form-group .form-toggle-input:checked + .form-toggle-ui {
  background: #10b981;
}

.form-group .form-toggle-input:checked + .form-toggle-ui::after {
  transform: translateX(0.9rem);
}

.form-group .form-toggle-input:focus-visible + .form-toggle-ui {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.form-group .form-toggle-copy {
  display: grid;
  gap: 0.12rem;
  line-height: 1.15;
}

.form-group .form-toggle-copy strong {
  font-size: 0.88rem;
  color: var(--primary);
}

.form-group .form-toggle-copy small {
  font-size: 0.74rem;
  color: #64748b;
}

.xero-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.52rem;
}

.xero-disconnect-btn {
  border-color: #f3caca;
  color: #b91c1c;
  background: #fff;
}

.xero-disconnect-btn:hover {
  background: #fef2f2;
  border-color: #f1a9a9;
}

.xero-advanced-details {
  border: 1px dashed #b7d8c7;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem 0.6rem;
  background: rgba(255, 255, 255, 0.65);
}

.xero-advanced-details > summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: #166534;
  font-weight: 600;
  user-select: none;
  margin-bottom: 0.4rem;
}

.email-ingestion-card {
  margin-bottom: 1.25rem;
}

.email-ingestion-card-header {
  align-items: center;
}

.email-ingestion-card-title {
  font-weight: 600;
}

.email-ingestion-card:not(.dash-source-card) .email-ingestion-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
}

.email-ingestion-lead {
  margin: 0;
  padding: 1rem 1.25rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
}

.email-settings-section {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.email-settings-section--rules {
  background: #fafbfd;
}

.email-settings-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.email-primary-address {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
}

.email-primary-address-text {
  min-width: 0;
  flex: 1;
}

.email-primary-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6366f1;
  margin-bottom: 0.35rem;
}

.email-primary-value {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}

.email-alias-field,
.email-whitelist-field {
  margin-bottom: 0.75rem;
}

.email-alias-field:last-child,
.email-whitelist-field:last-child {
  margin-bottom: 0;
}

.email-field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}

.email-field-optional {
  font-weight: 500;
  color: var(--text-muted);
}

.email-field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 42rem;
}

.email-token-details {
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  overflow: hidden;
}

.email-token-details.hidden {
  display: none;
}

.email-token-summary {
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.email-token-summary::-webkit-details-marker {
  display: none;
}

.email-token-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.email-token-details[open] .email-token-summary::before {
  transform: rotate(90deg);
}

.email-token-details-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.85rem 0.75rem;
  border-top: 1px solid var(--border);
}

.email-token-value {
  flex: 1;
  min-width: 12rem;
  font-size: 0.78rem;
  color: #475569;
  word-break: break-all;
}

.email-ingestion-toggle-row {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.email-whitelist-input {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: var(--primary);
}

.email-whitelist-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.email-ingestion-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.25rem 1.1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

@media (min-width: 720px) {
  .email-ingestion-card:not(.dash-source-card) .email-ingestion-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "lead lead"
      "lock lock"
      "addresses rules"
      "footer footer";
  }

  .email-ingestion-lead {
    grid-area: lead;
  }

  .email-ingestion-lock-note {
    grid-area: lock;
  }

  .email-ingestion-lock-note:not(.hidden) {
    margin: 0 1.25rem;
    border-radius: 8px;
  }

  .email-settings-section:first-of-type {
    grid-area: addresses;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }

  .email-settings-section--rules {
    grid-area: rules;
    border-bottom: none;
  }

  .email-ingestion-footer {
    grid-area: footer;
  }
}

.dashboard-ingestion-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}

.dashboard-ingestion-row .quick-drop-card,
.dashboard-ingestion-row .email-ingestion-card,
.dashboard-ingestion-row .cloud-sync-card {
  margin-bottom: 0;
  min-height: 100%;
}

@media (max-width: 1180px) {
  .dashboard-ingestion-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-ingestion-row .cloud-sync-card {
    grid-column: 1 / -1;
  }
}

.cloud-sync-card {
  animation: surfaceIn 0.24s ease;
}

.cloud-sync-card .card-header {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.cloud-sync-card .card-header::before {
  content: "☁";
  color: var(--accent);
  font-size: 0.9rem;
}

.cloud-sync-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

.cloud-sync-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cloud-sync-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.cloud-sync-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.68rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.cloud-sync-status-active {
  background: #dcfce7;
  color: #166534;
}

.cloud-sync-status-idle {
  background: #f3f4f6;
  color: #4b5563;
}

.cloud-sync-status-warn {
  background: #fef3c7;
  color: #92400e;
}

.cloud-sync-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cloud-sync-meta-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.cloud-providers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.cloud-providers-grid.cloud-providers-grid--single {
  grid-template-columns: 1fr;
  max-width: 28rem;
}

.cloud-provider-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.cloud-provider-panel.is-connected {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f8fdf9 0%, var(--surface-elevated) 2.5rem);
}

.cloud-provider-panel--onedrive.is-connected {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f5f9ff 0%, var(--surface-elevated) 2.5rem);
}

.cloud-provider-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.cloud-provider-panel.is-connected .cloud-provider-panel__head {
  border-bottom-color: #dcfce7;
}

.cloud-provider-panel--onedrive.is-connected .cloud-provider-panel__head {
  border-bottom-color: #dbeafe;
}

.cloud-provider-panel__title-wrap {
  min-width: 0;
  flex: 1;
}

.cloud-provider-panel__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.cloud-provider-panel__account {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.cloud-provider-panel__status {
  color: var(--text-muted);
  font-style: italic;
}

.cloud-provider-panel__head .btn {
  flex-shrink: 0;
}

.cloud-provider-panel__body {
  padding: 0.65rem 0.7rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cloud-provider-panel__body > .btn.btn-primary {
  width: 100%;
  justify-content: center;
}

.cloud-provider-panel__folders-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.cloud-provider-panel__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.cloud-provider-folders {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.cloud-provider-folders .cloud-sync-mini-item {
  padding: 0.45rem 0.5rem;
}

.cloud-provider-folders .cloud-sync-mini-empty {
  padding: 0.55rem 0.6rem;
  font-size: 0.78rem;
}

.cloud-sync-toggle-row {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.cloud-sync-global-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .cloud-providers-grid {
    grid-template-columns: 1fr;
  }

  .cloud-providers-grid.cloud-providers-grid--single {
    max-width: none;
  }
}

/* Legacy aliases (dashboard may still use connection stack naming) */
.cloud-connection-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.cloud-provider-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  background: var(--surface-elevated);
}

.cloud-folder-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cloud-folder-actions .btn {
  width: 100%;
  justify-content: center;
}

.cloud-folder-empty-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.cloud-sync-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.cloud-sync-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.cloud-sync-section-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cloud-sync-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  max-height: 7.5rem;
  overflow-y: auto;
}

.cloud-sync-activity-list {
  max-height: 6.5rem;
}

.cloud-sync-mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.cloud-sync-mini-item:last-child {
  border-bottom: none;
}

.cloud-sync-mini-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-sync-mini-sub {
  grid-column: 1;
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-sync-mini-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.cloud-sync-mini-empty {
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.stat-sub {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.email-ingestion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.email-ingestion-subtitle {
  margin: 0;
  color: var(--text-muted);
  max-width: 780px;
}

.email-ingestion-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.68rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.email-ingestion-enabled {
  background: #dcfce7;
  color: #166534;
}

.email-ingestion-disabled {
  background: #fee2e2;
  color: #991b1b;
}

.email-address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.email-address-box {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: var(--surface-elevated);
}

.email-address-label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.22rem;
}

.email-address-value {
  display: block;
  color: #0f172a;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-token-address-note {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.email-token-address-note code {
  font-size: 0.74rem;
  color: #475569;
  word-break: break-all;
}

.email-alias-group {
  margin-bottom: 0.85rem;
}

.email-alias-row {
  display: flex;
  align-items: stretch;
  max-width: 28rem;
}

.email-alias-input {
  flex: 1;
  min-width: 0;
  border-radius: 8px 0 0 8px !important;
  border-right: none !important;
}

.email-alias-domain {
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.875rem;
  white-space: nowrap;
}

.email-alias-help {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
  max-width: 40rem;
}

.email-ingestion-controls {
  display: grid;
  gap: 0.75rem;
}

.email-whitelist-group {
  margin-bottom: 0;
}

.email-whitelist-group textarea {
  min-height: 86px;
  resize: vertical;
}

.email-whitelist-help {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.email-ingestion-actions {
  display: flex;
  justify-content: flex-start;
}

.cloud-sync-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.75rem;
}

.email-ingestion-lock-note {
  margin: 0 1.25rem 0.85rem;
  padding: 0.58rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.82rem;
}

.email-ingestion-card.email-ingestion-locked .email-settings-section--rules {
  opacity: 0.72;
  pointer-events: none;
}

.quick-drop-card {
  margin-bottom: 1.25rem;
  animation: surfaceIn 0.24s ease;
}

.quick-drop-card .card-header {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.quick-drop-card .card-header::before {
  content: "⬇";
  color: var(--accent);
  font-size: 0.9rem;
}

.quick-drop-head {
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.quick-drop-head-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.quick-drop-batch-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.24rem 0.58rem;
}

.quick-drop-batch-running {
  background: #eff6ff;
  color: #1d4ed8;
  animation: dropPulse 1s ease infinite;
}

.quick-drop-batch-done {
  background: #ecfdf5;
  color: #166534;
}

.quick-drop-active-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.73rem;
  font-weight: 600;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.quick-drop-subtitle {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.quick-drop-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}

.quick-drop-limit-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.52rem;
  font-size: 0.73rem;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.quick-drop-zone {
  margin-bottom: 0.85rem;
  padding: 1.5rem 1rem;
  transition: border-color 0.16s ease, transform 0.12s ease, background 0.16s ease;
}

.quick-drop-zone h3 {
  margin-bottom: 0.22rem;
  font-size: 1rem;
}

.quick-drop-zone p {
  margin-bottom: 0.7rem;
}

.quick-drop-zone.dragover {
  transform: translateY(-1px);
  animation: dropPulse 0.5s ease;
}

.quick-drop-log {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  max-height: 180px;
  overflow: auto;
}

.quick-drop-log-row {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: start;
  gap: 0.5rem;
}

.quick-drop-log-row:last-child {
  border-bottom: none;
}

.quick-drop-log-success {
  color: #166534;
  background: #f0fdf4;
}

.quick-drop-log-error {
  color: #991b1b;
  background: #fef2f2;
}

.quick-drop-log-warning {
  color: #92400e;
  background: #fffbeb;
}

.quick-drop-log-info {
  color: #1e3a8a;
  background: #eff6ff;
}

.quick-drop-log-time {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.quick-drop-log-message {
  word-break: break-word;
}

.quick-drop-log-actions {
  justify-self: end;
}

.quick-drop-log-link {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.quick-drop-log-link::before {
  content: "↗";
  font-size: 0.72rem;
}

.quick-drop-log-link:hover {
  text-decoration: underline;
}

.ingest-channel-badge {
  display: inline-flex;
  margin-top: 0.28rem;
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
  font-size: 0.69rem;
  font-weight: 600;
  color: #334155;
  background: #eef2ff;
  border: 1px solid #e2e8f0;
}

a.sidebar-link:focus-visible,
.btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

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

.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #e3e8f4;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 8px 22px rgba(30, 41, 59, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.14s ease;
}

.stat-card-actionable {
  cursor: pointer;
}

.stat-card-actionable:hover {
  border-color: #c7d2fe;
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.12);
  transform: translateY(-2px);
}

.stat-card-actionable:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.stat-card .label {
  font-size: 0.8125rem;
  color: #64748b;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.vendor-stats-summary {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Spend overview page */
.spend-page-header {
  margin-bottom: 1.25rem;
}

.spend-filters-card {
  margin-bottom: 1.25rem;
}

.spend-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.15rem;
}

.spend-filters-fields {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
  flex: 1;
  min-width: 0;
}

.spend-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.spend-filter-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.spend-filters-bar .filter-input,
.spend-filters-bar .filter-select {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--primary);
}

.spend-filters-bar .filter-input:focus,
.spend-filters-bar .filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.spend-filter-item--user {
  flex: 1 1 11rem;
  max-width: 13rem;
}

.spend-filter-item--status {
  flex: 1 1 9.5rem;
  max-width: 11rem;
}

.spend-filter-item--date {
  flex: 0 1 8.75rem;
  max-width: 10rem;
}

.spend-filters-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-bottom: 1px;
}

@media (max-width: 900px) {
  .spend-filters-bar {
    flex-wrap: wrap;
  }

  .spend-filters-fields {
    flex-wrap: wrap;
    width: 100%;
  }

  .spend-filter-item--user,
  .spend-filter-item--status {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: none;
  }

  .spend-filter-item--date {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: none;
  }

  .spend-filters-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.spend-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 960px) {
  .spend-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .spend-kpi-row {
    grid-template-columns: 1fr;
  }
}

.spend-kpi-card {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.spend-kpi-card--loading {
  opacity: 0.7;
}

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

.spend-kpi-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.spend-kpi-value--accent {
  color: #4f46e5;
}

.spend-kpi-meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spend-charts-card {
  margin-bottom: 1.25rem;
}

.spend-charts-card .card-body {
  padding-top: 0.5rem;
}

.spend-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.spend-section-hint {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.spend-chart-card {
  background: #fff;
  border: 1px solid #e8ecf4;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.spend-chart-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.spend-chart-icon {
  font-size: 1rem;
  line-height: 1;
}

.spend-charts-row {
  margin-bottom: 0;
}

.bar-chart {
  gap: 0.55rem;
  min-height: 5.5rem;
}

.bar-chart-row {
  grid-template-columns: minmax(5rem, 32%) 1fr auto;
  gap: 0.65rem;
  font-size: 0.8125rem;
}

.bar-chart-track {
  height: 0.65rem;
  background: #eef2f8;
}

.bar-chart-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.spend-breakdown-card {
  margin-bottom: 1.25rem;
}

.spend-breakdown-head {
  flex-direction: column;
  align-items: stretch !important;
  gap: 0.75rem;
}

.spend-breakdown-head .spend-section-title {
  margin: 0;
}

.spend-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 3px;
  background: #eef1f8;
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
}

.spend-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.spend-tab-btn:hover {
  color: #334155;
}

.spend-tab-btn--active {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.spend-tab-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  line-height: 1.3;
}

.spend-tab-btn--active .spend-tab-count {
  background: #ede9fe;
  color: #5b4fc7;
}

.spend-tab-count:empty {
  display: none;
}

.spend-tab-panel.hidden {
  display: none;
}

.spend-table-card-body {
  padding-top: 0.25rem;
}

.spend-table-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.spend-table-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.spend-data-table .cell-money,
.spend-data-table .cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.spend-data-table .cell-vendor a.spend-vendor-link {
  color: #4f46e5;
  font-weight: 500;
  text-decoration: none;
}

.spend-data-table .cell-vendor a.spend-vendor-link:hover {
  text-decoration: underline;
}

.spend-data-table .cell-date {
  white-space: nowrap;
  color: #64748b;
  font-size: 0.8125rem;
}

.spend-data-table .cell-category {
  font-weight: 500;
}

.table-empty {
  text-align: center;
  color: #6b7280;
  padding: 1.5rem 1rem !important;
}

.vendor-stats-subhead {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.spend-charts-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.spend-charts-row--compact {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .spend-charts-row {
    grid-template-columns: 1fr;
  }
}

.spend-chart-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.spend-chart-title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 4.5rem;
}

.bar-chart-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 28%) 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}

.bar-chart-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.bar-chart-track {
  height: 0.55rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-chart-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
  min-width: 2px;
}

.bar-chart-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.75rem;
}

.chart-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
}

.pipeline-card {
  padding: 0.9rem 1rem 1rem;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.pipeline-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pipeline-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.pipeline-live-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.46rem;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pipeline-link {
  font-size: 0.82rem;
  font-weight: 600;
}

.pipeline-track {
  display: grid;
  grid-template-columns: repeat(11, auto);
  align-items: center;
  gap: 0.28rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.pipeline-stage {
  border: 1px solid #dbe4f4;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  min-width: 128px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.pipeline-stage:hover {
  border-color: #b8c7e8;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

.pipeline-stage:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.pipeline-stage-label {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.16rem;
}

.pipeline-stage-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}

.pipeline-stage-danger {
  background: #fff7f7;
  border-color: #fecaca;
}

.pipeline-stage-danger .pipeline-stage-value {
  color: #b91c1c;
}

.pipeline-stage-success {
  background: #f3fff7;
  border-color: #bbf7d0;
}

.pipeline-stage-success .pipeline-stage-value {
  color: #15803d;
}

.pipeline-sep {
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Cards & Tables */
.card {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  border: 1px solid #e3e8f4;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  margin-bottom: 1.25rem;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e8edf7;
  font-weight: 650;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  background: #f9fbff;
}

.card-body {
  padding: 1.1rem 1.25rem 1.2rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 14px 14px;
}

.table-wrap table {
  border-radius: 0;
}

.cell-filename {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Light grid on all data tables (receipts, spend, vendors, users, dashboard) */
table {
  width: 100%;
  border-collapse: collapse;
  --table-grid-border: #e8ecf4;
  border: 1px solid var(--table-grid-border);
}

table th,
table td {
  border-right: 1px solid var(--table-grid-border);
  border-bottom: 1px solid var(--table-grid-border);
}

table th:last-child,
table td:last-child {
  border-right: none;
}

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

table thead th {
  border-bottom: 1px solid #dce3ef;
}

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

table tbody tr:hover td {
  background: #f2f6ff;
}

.receipts-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.receipts-table th:first-child,
.receipts-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.receipts-table tbody td:first-child {
  background: var(--bg);
  box-shadow: 1px 0 0 var(--table-grid-border);
}

.receipts-table tbody tr:nth-child(even) td:first-child {
  background: #fbfdff;
}

.receipts-table tbody tr:hover td:first-child {
  background: #f2f6ff;
}

.receipts-table thead th:first-child {
  background: var(--surface);
  z-index: 3;
  box-shadow: 1px 0 0 var(--table-grid-border);
}

th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  vertical-align: middle;
}

th {
  background: #f6f8fd;
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.receipts-table .cell-status {
  text-align: left;
}

.receipts-table .cell-actions {
  text-align: right;
}

.receipts-table .cell-actions .receipts-actions-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

/* All receipts — view switcher & financial columns */
.receipts-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #edf1f7;
  background: #fafbfd;
}

.receipts-view-switcher {
  display: inline-flex;
  padding: 3px;
  background: #eef1f8;
  border-radius: 10px;
  gap: 2px;
}

.receipts-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.receipts-view-btn:hover {
  color: #334155;
}

.receipts-view-btn--active {
  background: #fff;
  color: #5b4fc7;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.receipts-view-btn-icon {
  font-size: 0.9rem;
}

.receipts-view-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.receipts-table-wrap--financial {
  max-width: 100%;
}

.receipts-table-wrap--financial .receipts-table {
  min-width: 88rem;
}

.receipts-table-wrap--financial .cell-vat-bucket {
  min-width: 4.75rem;
}

.receipts-table .receipt-row--vat-warn td {
  background: #fffbeb;
}

.receipts-table .cell-money {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.receipts-table .th-sub {
  display: block;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.65rem;
  color: #94a3b8;
}

.receipts-vat-group-head {
  text-align: center !important;
  border-bottom: 1px solid #dce3ef !important;
}

.receipts-head-row-sub th {
  font-size: 0.7rem;
  padding-top: 0.35rem;
  padding-bottom: 0.55rem;
  background: #f0f3fa;
  border-top: none;
}

.cell-vat-bucket {
  vertical-align: middle;
  min-width: 5.5rem;
}

.cell-vat-bucket .vat-bucket-items {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.3;
}

.cell-vat-bucket .vat-bucket-vat {
  display: block;
  font-size: 0.875rem;
  color: #1e293b;
  font-weight: 500;
}

.cell-dash {
  color: #94a3b8;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.badge-pending { background: #f3f4f6; color: #4b5563; }
.badge-extracted { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.badge-draft { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.badge-confirmed { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.badge-synced { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.badge-error { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* Upload */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(79, 70, 229, 0.04);
}

.upload-zone p {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

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

/* Loading panel */
.loading-panel {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 420px;
  margin: 2rem auto;
}

.loading-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.loading-sub {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.loading-steps {
  list-style: none;
  text-align: left;
  display: inline-block;
}

.loading-steps li {
  padding: 0.5rem 0 0.5rem 1.75rem;
  position: relative;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.loading-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
}

.loading-steps li.active {
  color: var(--accent);
  font-weight: 500;
}

.loading-steps li.active::before {
  border-color: var(--accent);
  background: var(--accent);
}

.loading-steps li.done {
  color: var(--success);
}

.loading-steps li.done::before {
  border-color: var(--success);
  background: var(--success);
}

/* Review step */
#step-review {
  position: relative;  
}

.review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.review-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success);
  margin-bottom: 0.35rem;
}

.review-eyebrow--duplicate {
  color: #0d9488;
}

.review-eyebrow--synced {
  color: #7c3aed;
}

.review-title {
  margin-bottom: 0.35rem;
  font-size: 1.625rem;
  letter-spacing: -0.02em;
}

.review-filename {
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.review-file-meta {
  margin-top: 0.18rem;
  color: #6b7280;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
}

.review-header .badge {
  padding: 0.35rem 0.875rem;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.review-alert {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
}

/* Compact review notices (extraction warnings, etc.) */
.notice-panel {
  margin-bottom: 0.875rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.notice-panel--warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.notice-list--scroll {
  max-height: 9.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.notice-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  margin: 0;
}

.notice-list li::before {
  content: '';
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.9;
}

.notice-list li strong {
  font-weight: 600;
  color: #78350f;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.summary-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

.summary-card-highlight {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(79, 70, 229, 0.02));
  border-color: rgba(79, 70, 229, 0.25);
}

.summary-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.summary-value {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-word;
}

.summary-total {
  font-size: 1.375rem;
  color: var(--accent);
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(260px, 30%) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.receipt-preview-card {
  position: sticky;
  top: 1rem;
}

.receipt-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.receipt-preview-body {
  padding: 0.5rem;
  background: #f8fafc;
  min-height: 320px;
}

.receipt-preview-loading,
.receipt-preview-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.receipt-preview-frame,
.receipt-preview-image {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.receipt-preview-frame {
  height: min(70vh, 640px);
  min-height: 320px;
}

.receipt-preview-image {
  display: block;
  max-height: min(70vh, 640px);
  width: 100%;
  object-fit: contain;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .review-layout {
    grid-template-columns: 1fr;
  }
  .receipt-preview-card {
    position: static;
  }
  .receipt-preview-frame {
    height: min(70vh, 720px);
    min-height: 360px;
  }
  .receipt-preview-image {
    max-height: min(70vh, 720px);
  }
}

.review-form .card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.readonly-banner {
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #5b21b6;
  background: linear-gradient(90deg, #f5f3ff 0%, #ede9fe 100%);
  border-bottom: 1px solid #ddd6fe;
}

.review-readonly .review-form input:disabled,
.review-readonly .review-form select:disabled,
.review-readonly .review-form textarea:disabled,
.review-readonly .line-item-row input:disabled,
.review-readonly .line-item-row select:disabled {
  background: var(--surface);
  color: var(--primary);
  opacity: 1;
  cursor: default;
  -webkit-text-fill-color: var(--primary);
}

.review-readonly .review-form input:disabled,
.review-readonly .line-item-row input:disabled {
  border-color: var(--border-subtle);
}

.review-readonly .input-with-prefix .input-prefix {
  background: #eef2f7;
  color: var(--text-muted);
}

.review-readonly .line-items-actions,
.review-readonly .line-item-row .remove-li {
  display: none !important;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-row-ref-account:has(#account-code-group.hidden) {
  grid-template-columns: 1fr;
}

.form-row-amounts {
  grid-template-columns: 1fr 1fr minmax(7rem, 9rem);
}

.form-row-vendor-meta {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(8.5rem, 0.85fr);
}

.form-row-meta {
  grid-template-columns: 1fr minmax(5.5rem, 7rem);
}

@media (min-width: 1100px) {
  .form-row-meta {
    grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 7rem) minmax(0, 1.1fr) minmax(0, 1.2fr);
  }
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.input-with-prefix {
  display: flex;
  align-items: stretch;
}

.input-with-prefix .input-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-weight: 500;
  color: var(--text-muted);
}

.input-with-prefix input {
  border-radius: 0 8px 8px 0;
  flex: 1;
}

.line-items-header {
  margin-bottom: 0.75rem;
}

.line-items-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.line-items-title-row h3 {
  font-size: 1rem;
  margin: 0;
}

.line-items-header .field-hint {
  margin-top: 0;
}

.line-items-totals {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.lines-vs-total.mismatch {
  color: #b45309;
  font-weight: 500;
}

.lines-vs-total.match {
  color: var(--success);
}

.line-items-table {
  --line-grid: minmax(120px, 2fr) 3.75rem 5.25rem 5rem 4.75rem minmax(9rem, 1.35fr) 2rem;
  overflow-x: auto;
}

.line-items-table-head,
.line-item-row {
  display: grid;
  grid-template-columns: var(--line-grid);
  column-gap: 0.625rem;
  align-items: center;
}

@media (min-width: 900px) {
  .line-items-table-head,
  .line-item-row {
    min-width: 640px;
  }
}

.line-items-table-head {
  padding: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.line-items-table-head .li-col-num,
.line-items-table-head .li-col-act {
  text-align: center;
}

.line-items-table-head .li-col-account {
  text-align: left;
  font-size: 0.625rem;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.line-item-row {
  margin-bottom: 0.5rem;
}

.line-item-row input,
.line-item-row select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.875rem;
}

.line-item-row .li-desc {
  min-width: 0;
}

.line-item-row .li-qty,
.line-item-row .li-amount {
  text-align: right;
}

.line-item-row .li-qty {
  min-width: 3.5rem;
  padding-right: 0.35rem;
}

.line-item-row .li-price-type {
  font-size: 0.75rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.line-item-row--vat-inferred .li-vat {
  outline: 2px solid var(--warning, #d97706);
  outline-offset: 1px;
}

.line-item-row .li-vat {
  min-width: 4.5rem;
  padding-left: 0.35rem;
  padding-right: 1.35rem;
  text-align: left;
  text-align-last: left;
}

.line-item-row .li-vat option {
  text-align: left;
}

.line-item-row .li-account {
  font-size: 0.8125rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  min-width: 0;
}

.line-item-row .remove-li {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  line-height: 1;
  justify-self: center;
}

.line-items-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--border);
}

.ocr-details {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ocr-details summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--surface);
  user-select: none;
}

.ocr-details summary:hover {
  background: var(--border);
}

.ocr-details pre {
  padding: 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  color: var(--text-muted);
  margin: 0;
}

.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  z-index: 10;
}

.review-actions-right {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.review-actions .btn-primary {
  width: auto;
  min-width: 200px;
}

.btn-success-state {
  background: var(--success) !important;
}

.push-error-alert {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Receipt history timeline */
.activity-card {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--bg) 100%);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.activity-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s ease;
}

.activity-card-toggle:hover {
  background: rgba(79, 70, 229, 0.04);
}

.activity-card-toggle-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.activity-card-badge {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-card-headings {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.activity-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
}

.activity-card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-card-chevron {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  margin-right: 0.25rem;
  transition: transform 0.2s ease;
}

.activity-card-toggle[aria-expanded="false"] .activity-card-chevron {
  transform: rotate(-135deg);
  margin-top: 0.25rem;
}

.activity-card-body {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--border);
  max-height: 280px;
  overflow-y: auto;
}

.activity-card-body.is-collapsed {
  display: none;
}

.activity-timeline {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0 0.25rem;
}

.activity-step {
  display: grid;
  grid-template-columns: 2.125rem 1fr;
  gap: 0 0.875rem;
  position: relative;
  padding-bottom: 1.125rem;
}

.activity-step:last-child {
  padding-bottom: 0;
}

.activity-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 1.0625rem;
  top: 2.125rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.activity-step-marker {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.activity-step-marker svg {
  width: 1rem;
  height: 1rem;
}

.activity-step--success .activity-step-marker {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #059669;
}

.activity-step--warning .activity-step-marker {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #d97706;
}

.activity-step--danger .activity-step-marker {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.activity-step--neutral .activity-step-marker {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

.activity-step-content {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  row-gap: 0.2rem;
  align-items: start;
  padding-top: 0.2rem;
  min-width: 0;
}

.activity-step-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  grid-column: 1;
  line-height: 1.35;
}

.activity-step-detail {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  grid-column: 1;
  line-height: 1.4;
  word-break: break-word;
}

.activity-step-time {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: start;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.1rem;
}

@media (max-width: 520px) {
  .activity-step-content {
    grid-template-columns: 1fr;
  }
  .activity-step-time {
    grid-column: 1;
    grid-row: auto;
    padding-top: 0;
  }
}

/* Line items */
.line-items-section {
  margin: 1.5rem 0;
}

.line-items-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.form-actions .btn-primary {
  width: auto;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Spinner */
.spinner-wrap {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.hidden { display: none !important; }

/* Cloud folder picker modal */
.cloud-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cloud-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.cloud-picker-dialog {
  position: relative;
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-md), 0 20px 48px rgba(15, 23, 42, 0.18);
  display: grid;
  grid-template-rows: auto auto auto auto minmax(180px, 1fr) auto;
  gap: 0;
  padding: 0.95rem 1rem 1rem;
}

.cloud-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.cloud-picker-title {
  margin: 0;
  font-size: 1rem;
}

.cloud-picker-provider,
.cloud-picker-path {
  margin: 0.12rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cloud-picker-controls {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.cloud-picker-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  min-height: 200px;
  background: var(--surface);
}

.cloud-picker-empty {
  margin: 0;
  padding: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.cloud-picker-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
}

.cloud-picker-item:last-child {
  border-bottom: none;
}

.cloud-picker-item.is-selected {
  background: #eef2ff;
}

.cloud-picker-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.45rem;
  align-items: center;
}

.cloud-picker-choice input {
  width: 0.95rem;
  height: 0.95rem;
}

.cloud-picker-name {
  font-size: 0.86rem;
  font-weight: 600;
}

.cloud-picker-id {
  grid-column: 2;
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}

.cloud-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

/* Confirm modal */
body.modal-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.confirm-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem 1.5rem 1.25rem;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md), 0 20px 48px rgba(15, 23, 42, 0.18);
  text-align: center;
  animation: modalIn 0.2s ease;
}

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

.confirm-modal-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.confirm-modal-dialog--danger .confirm-modal-icon {
  background: #fef2f2;
  color: var(--danger);
}

.confirm-modal-dialog--warning .confirm-modal-icon {
  background: #fffbeb;
  color: #d97706;
}

.confirm-modal-dialog--info .confirm-modal-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.confirm-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--primary);
}

.confirm-modal-message {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  white-space: pre-line;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

.confirm-modal-actions .btn {
  min-width: 7.5rem;
}

.confirm-modal-actions .btn-danger {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  background: var(--danger);
  color: #fff;
}

.confirm-modal-actions .btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

/* Review busy overlay (push / discard) */
.review-busy-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  border-radius: var(--radius-md);
}

.review-busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.review-busy-card .spinner {
  width: 32px;
  height: 32px;
}

.review-busy-card p {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.error-msg {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.page-subtitle {
  color: #6b7280;
  font-size: 0.95rem;
  margin: -1rem 0 1.5rem;
  max-width: 52rem;
  line-height: 1.5;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

/* All receipts: filters & pagination */
.card-all-receipts {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.receipts-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.receipts-filters-fields {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
  flex: 1;
  min-width: 0;
}

.receipts-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.receipts-filter-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.receipts-filters-bar .filter-input,
.receipts-filters-bar .filter-select {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--primary);
}

.receipts-filters-bar .filter-input::placeholder {
  color: #9ca3af;
}

.receipts-filters-bar .filter-input:focus,
.receipts-filters-bar .filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.receipts-filter-item--status {
  flex: 0 1 9.5rem;
  max-width: 11rem;
}

.receipts-filter-item--search {
  flex: 1 1 12rem;
  min-width: 8rem;
}

.receipts-filter-item--date {
  flex: 0 1 8.75rem;
  max-width: 10rem;
}

.receipts-filters-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-bottom: 1px;
}

@media (max-width: 900px) {
  .receipts-filters-bar {
    flex-wrap: wrap;
  }

  .receipts-filters-fields {
    flex-wrap: wrap;
    width: 100%;
  }

  .receipts-filter-item--status,
  .receipts-filter-item--search {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: none;
  }

  .receipts-filter-item--date {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: none;
  }

  .receipts-filters-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.receipt-filters-panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.receipt-filters-head {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.receipt-filters-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--primary);
}

.receipt-filters-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 42rem;
}

.receipt-filters-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr);
  gap: 1rem 1.25rem;
  padding: 1.25rem 1.5rem 1rem;
  align-items: end;
}

.receipt-filters-panel .filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.filter-field-span-2 {
  grid-column: span 1;
}

@media (min-width: 900px) {
  .filter-field-span-2 {
    grid-column: span 2;
  }
}

.receipt-filters-panel .filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.receipt-filters-panel .filter-input,
.receipt-filters-panel .filter-select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.receipt-filters-panel .filter-input::placeholder {
  color: #9ca3af;
}

.receipt-filters-panel .filter-input:hover,
.receipt-filters-panel .filter-select:hover {
  border-color: #d1d5db;
}

.receipt-filters-panel .filter-input:focus,
.receipt-filters-panel .filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.receipt-filters-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem 1.5rem 1.25rem;
  background: var(--bg);
}

.receipt-filters-actions .btn {
  flex: 0 0 auto;
  min-width: auto;
}

.pagination-bar {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.pagination-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.pagination-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pagination-summary {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--primary);
}

.pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pagination-btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: none;
  background: var(--bg);
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pagination-btn:first-child {
  border-right: 1px solid var(--border);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--accent);
}

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

/* Extraction details + duplicate callout */
.extraction-details-card {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--bg) 100%);
}

.extraction-details-header {
  padding: 0.875rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
}

.extraction-details-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.extraction-details-body {
  padding: 1.125rem 1.25rem 1.25rem;
}

.extraction-details-card .extraction-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg);
}

.extraction-details-card .meta-stat {
  padding: 0.875rem 1rem;
  border-right: 1px solid var(--border-subtle);
  min-width: 0;
}

.extraction-details-card .meta-stat:last-child {
  border-right: none;
}

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

.meta-stat-value {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
  word-break: break-word;
}

.meta-stat-mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}

.extraction-save-mapping {
  margin-top: 0.875rem;
}

.duplicate-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-top: 1rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1px solid #99f6e4;
}

.duplicate-callout-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  display: flex;
  align-items: center;
  justify-content: center;
}

.duplicate-callout-content {
  flex: 1;
  min-width: 0;
}

.duplicate-callout-title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #115e59;
}

.duplicate-callout-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #134e4a;
}

.duplicate-callout-btn {
  flex-shrink: 0;
  align-self: center;
  background: var(--bg);
  border-color: #5eead4;
  color: #0f766e;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.duplicate-callout-btn:hover:not(:disabled) {
  background: #f0fdfa;
  border-color: #2dd4bf;
}

@media (max-width: 768px) {
  .extraction-details-card .extraction-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .extraction-details-card .meta-stat {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .extraction-details-card .meta-stat:nth-child(odd) {
    border-right: 1px solid var(--border-subtle);
  }

  .extraction-details-card .meta-stat:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .duplicate-callout {
    flex-wrap: wrap;
  }

  .duplicate-callout-btn {
    width: 100%;
    margin-top: 0.25rem;
  }
}

.field-confidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.fc-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.fc-chip.fc-ok { border-color: #86efac; color: #047857; }
.fc-chip.fc-warn { border-color: #fcd34d; color: #b45309; }
.fc-chip.fc-low { border-color: #fca5a5; color: #b91c1c; }

.summary-value.text-ok { color: #047857; }
.summary-value.text-warn { color: #b45309; }
.summary-value.text-danger { color: #b91c1c; }

@media (max-width: 899px) {
  .receipt-filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filter-field-span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .receipt-filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-field-span-2 {
    grid-column: 1;
  }

  .pagination-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-nav {
    width: 100%;
    display: flex;
  }

  .pagination-nav .pagination-btn {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 0.75rem; }
  .pipeline-card {
    padding: 0.7rem 0.75rem 0.8rem;
  }
  .pipeline-stage {
    min-width: 114px;
    padding: 0.45rem 0.55rem;
  }
  .pipeline-stage-value {
    font-size: 1.35rem;
  }
  .dashboard-ingestion-row {
    grid-template-columns: 1fr;
    margin-bottom: 1rem;
  }
  .cloud-sync-mini-list {
    max-height: none;
  }
  .cloud-picker-dialog {
    width: min(560px, 96vw);
    grid-template-rows: auto auto auto auto minmax(170px, 1fr) auto;
  }
  .cloud-picker-item {
    grid-template-columns: 1fr;
  }
  .cloud-picker-open-btn {
    justify-self: start;
  }
  .card {
    border-radius: 12px;
    margin-bottom: 1rem;
  }
  .line-items-table {
    --line-grid: 1fr;
  }
  .line-items-table-head {
    display: none;
  }
  .line-item-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .line-item-row input,
  .line-item-row select {
    margin-bottom: 0.25rem;
  }
  .line-item-row .remove-li {
    justify-self: start;
    margin-top: 0.25rem;
  }
  .review-summary {
    grid-template-columns: 1fr 1fr;
  }
  .form-row,
  .form-row-amounts,
  .form-row-vendor-meta,
  .form-row-meta {
    grid-template-columns: 1fr;
  }
  .review-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .review-actions-right {
    flex-direction: column;
  }
  .review-actions .btn-primary {
    width: 100%;
  }
  .xero-folder-row {
    grid-template-columns: 1fr;
  }
  .xero-path-grid {
    grid-template-columns: 1fr;
  }
  .xero-controls-grid {
    grid-template-columns: 1fr;
  }
  .xero-connect-card {
    padding: 0.75rem 0.8rem;
    gap: 0.65rem;
  }
  .quick-drop-card .card-body {
    padding: 0.75rem;
  }
  th, td {
    padding: 0.6rem 0.75rem;
  }
  .quick-drop-log-row {
    grid-template-columns: 52px 1fr;
  }
  .quick-drop-log-actions {
    grid-column: 2;
    justify-self: start;
  }
}

/* —— Dashboard v2 (dashboard.html only) —— */
body.dash-v2 {
  --dash-sidebar-bg: #1a263e;
  --dash-sidebar-text: #c5d0e6;
  --dash-sidebar-active: #ffffff;
  --dash-main-bg: #f4f7f9;
  --dash-card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  /* Figma reference artboard 1440×1024; layout fills viewport width */
  --dash-sidebar-w: 248px;
  --dash-health-w: clamp(340px, 28%, 420px);
  --dash-page-pad-x: 20px;
  --dash-page-pad-y: 16px;
  --dash-section-gap: 14px;
}

body.dash-v2 {
  background: var(--dash-main-bg);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
}

body.dash-v2.dashboard-page {
  overflow: hidden;
}

/* Stroke icons aligned with SVG Repo / Figma exports (24×24, 2px stroke) */
body.dash-v2 .dash-icon,
body.dash-v2 .dash-nav-icon svg,
body.dash-v2 .dash-search-icon svg,
body.dash-v2 .dash-source-banner-icon--info svg,
body.dash-v2 .dash-source-card-icon svg,
body.dash-v2 .dash-pipeline-svg {
  display: block;
}

body.dash-v2 .app-layout.dash-shell {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
}

body.dash-v2 .dash-shell {
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  max-width: none;
  height: 100vh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

body.dash-v2 .dash-sidebar {
  width: var(--dash-sidebar-w);
  flex-shrink: 0;
  background: var(--dash-sidebar-bg);
  border-right: none;
  padding: 1.25rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}

body.dash-v2 .dash-sidebar-brand {
  display: block;
  padding: 0 1.25rem 1.1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

body.dash-v2 .dash-sidebar-brand:hover {
  text-decoration: none;
  color: #fff;
}

body.dash-v2 .dash-nav-group {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.65rem;
}

body.dash-v2 .dash-nav-label {
  display: block;
  padding: 0.55rem 0.6rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8cad;
}

body.dash-v2 .dash-sidebar .sidebar-link {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--dash-sidebar-text);
  font-size: 0.875rem;
  gap: 0.65rem;
}

body.dash-v2 .dash-sidebar .sidebar-link:hover,
body.dash-v2 .dash-sidebar .sidebar-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--dash-sidebar-active);
}

body.dash-v2 .dash-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.92;
}

body.dash-v2 .dash-nav-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

body.dash-v2 .dash-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #7b8cad;
}

body.dash-v2 .dash-footer-link {
  color: #9fb0d0;
  text-decoration: none;
}

body.dash-v2 .dash-footer-link:hover {
  color: #fff;
  text-decoration: underline;
}

body.dash-v2 .dash-version {
  margin-top: 0.35rem;
  color: #6b7c9a;
}

body.dash-v2 .dash-main-column {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.dash-v2 .dash-topbar {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

body.dash-v2 .dash-org-select {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dash-v2 .dash-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
}

body.dash-v2 .dash-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  min-width: 0;
  padding: 0.15rem 0;
}

body.dash-v2 .dash-search-input:focus {
  outline: none;
  box-shadow: none;
}

body.dash-v2 .dash-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex-shrink: 0;
}

body.dash-v2 .dash-search-icon svg {
  width: 1rem;
  height: 1rem;
}

body.dash-v2 .dash-search-kbd {
  font-size: 0.68rem;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.12rem 0.35rem;
  font-family: inherit;
}

body.dash-v2 .dash-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

body.dash-v2 .dash-user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

body.dash-v2 .dash-user-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

body.dash-v2 .dash-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

body.dash-v2 .dash-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dash-v2 .dash-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

body.dash-v2 .dash-logout-btn {
  flex-shrink: 0;
}

body.dash-v2 .dash-main-content {
  flex: 1 0 auto;
  padding: var(--dash-page-pad-y) var(--dash-page-pad-x) 18px;
  background: var(--dash-main-bg);
}

body.dash-v2 .dash-xero-banner {
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  margin-bottom: var(--dash-section-gap);
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

body.dash-v2 .dash-xero-banner-text {
  font-size: 0.9rem;
  color: #065f46;
}

body.dash-v2 .dash-xero-banner-text strong {
  color: #064e3b;
  font-weight: 650;
}

body.dash-v2 .dash-xero-banner-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

body.dash-v2 .dash-metrics-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
  gap: var(--dash-section-gap);
  margin-bottom: var(--dash-section-gap);
}

body.dash-v2 .dash-metric-card {
  padding: 0.85rem 1rem 0.75rem;
  min-height: 100px;
}

body.dash-v2 .dash-metric-card .label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 0;
}

body.dash-v2 .dash-metric-standard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body.dash-v2 .dash-metric-standard .label {
  margin-bottom: 0.35rem;
}

body.dash-v2 .dash-metric-standard .dash-metric-value {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0.15rem 0;
}

body.dash-v2 .dash-metric-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 0.35rem;
  min-height: 1.25rem;
}

body.dash-v2 .dash-metric-card .value,
body.dash-v2 .dash-metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.05;
  color: #111827;
}

body.dash-v2 .dash-metric-synced .dash-metric-split-col--synced .dash-metric-value {
  color: #2563eb;
}

body.dash-v2 .dash-metric-failed .dash-metric-value {
  color: #dc2626;
}

body.dash-v2 .dash-metric-synced {
  padding: 0.85rem 1rem 0.75rem;
}

body.dash-v2 .dash-metric-synced .dash-metric-split {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: stretch;
  gap: 0.75rem 1rem;
  min-height: 76px;
  height: 100%;
}

body.dash-v2 .dash-metric-split-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
}

body.dash-v2 .dash-metric-split-col--synced {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  gap: 0.4rem;
}

body.dash-v2 .dash-metric-split-col--synced .label {
  margin-bottom: 0;
}

body.dash-v2 .dash-metric-split-col--synced .dash-metric-value {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  color: #2563eb;
  margin-top: 0.15rem;
}

body.dash-v2 .dash-metric-split-col--total {
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  gap: 0.35rem;
}

body.dash-v2 .dash-metric-split-col--total .dash-metric-value--total {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  color: #0f172a;
}

body.dash-v2 .dash-metric-total-label {
  margin-bottom: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  text-align: right;
}

body.dash-v2 .dash-metric-split-divider {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  min-height: 4.5rem;
}

body.dash-v2 .dash-trend-pct {
  font-weight: 600;
  color: #059669;
}

body.dash-v2 .dash-trend-pct--neutral {
  color: #64748b;
}

body.dash-v2 .dash-trend-vs {
  color: #94a3b8;
  font-weight: 400;
}

body.dash-v2 .dash-metric-trend--down .dash-trend-pct {
  color: #dc2626;
}

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

body.dash-v2 .dash-pipeline-card {
  box-shadow: var(--dash-card-shadow);
  padding: 1rem 1.25rem 1.15rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e8edf5;
  border-radius: 14px;
  background: #fff;
  overflow: visible;
}

body.dash-v2 .dash-pipeline-card .pipeline-head {
  margin-bottom: 0.85rem;
  padding-bottom: 0;
  border-bottom: none;
}

body.dash-v2 .dash-pipeline-card .pipeline-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
}

body.dash-v2 .dash-pipeline-card .pipeline-link:hover {
  text-decoration: underline;
}

body.dash-v2 .dash-pipeline-card .pipeline-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

body.dash-v2 .dash-pipeline-card .pipeline-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.18rem 0.5rem;
  font-size: 0.62rem;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

body.dash-v2 .pipeline-live-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 999px;
  background: #ef4444;
  flex-shrink: 0;
}

body.dash-v2 .dash-pipeline-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.25rem 0 0.15rem;
}

body.dash-v2 .dash-pipeline-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.55rem;
  min-width: 2.55rem;
  margin: 0 0.6rem;
  color: #94a3b8;
  padding: 0;
  user-select: none;
  pointer-events: none;
}

body.dash-v2 .dash-pipeline-arrow {
  width: 2.25rem;
  height: 2.25rem;
  display: block;
  flex-shrink: 0;
}

body.dash-v2 .dash-pipeline-stage {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: max-content;
  width: auto;
  max-width: none;
  padding: 0.2rem 0.1rem;
  overflow: visible;
  border: none !important;
  background: transparent !important;
  border-radius: 8px;
  text-align: left;
  flex: none;
  justify-content: flex-start;
  justify-self: stretch;
  box-shadow: none !important;
  transform: none !important;
  font-family: inherit;
}

body.dash-v2 .dash-pipeline-stage:hover,
body.dash-v2 .dash-pipeline-stage:focus-visible {
  background: #f8fafc !important;
  box-shadow: none !important;
  transform: none !important;
  border: none !important;
}

body.dash-v2 .dash-pipeline-icon-wrap {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dash-v2 .dash-pipeline-svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

body.dash-v2 .dash-pipeline-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
}

body.dash-v2 .dash-pipeline-stage .pipeline-stage-label {
  margin-bottom: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

body.dash-v2 .dash-pipeline-stage .pipeline-stage-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.02em;
}

body.dash-v2 .dash-pipeline-stage--imported .dash-pipeline-icon-wrap {
  background: #dbeafe;
  color: #2563eb;
}
body.dash-v2 .dash-pipeline-stage--imported .pipeline-stage-label {
  color: #2563eb;
}

body.dash-v2 .dash-pipeline-stage--ocr .dash-pipeline-icon-wrap {
  background: #ffedd5;
  color: #ea580c;
}
body.dash-v2 .dash-pipeline-stage--ocr .pipeline-stage-label {
  color: #ea580c;
}

body.dash-v2 .dash-pipeline-stage--exception .dash-pipeline-icon-wrap {
  background: #fee2e2;
  color: #dc2626;
}
body.dash-v2 .dash-pipeline-stage--exception .pipeline-stage-label {
  color: #dc2626;
}

body.dash-v2 .dash-pipeline-stage--draft .dash-pipeline-icon-wrap {
  background: #ede9fe;
  color: #7c3aed;
}
body.dash-v2 .dash-pipeline-stage--draft .pipeline-stage-label {
  color: #7c3aed;
}

body.dash-v2 .dash-pipeline-stage--syncing .dash-pipeline-icon-wrap {
  background: #f3e8ff;
  color: #9333ea;
}
body.dash-v2 .dash-pipeline-stage--syncing .pipeline-stage-label {
  color: #9333ea;
}

body.dash-v2 .dash-pipeline-stage--syncing .dash-pipeline-icon-wrap {
  flex-shrink: 0;
}

body.dash-v2 .dash-pipeline-stage--syncing .dash-pipeline-svg {
  width: 1.05rem;
  height: 1.05rem;
}

body.dash-v2 .dash-pipeline-stage--synced .dash-pipeline-icon-wrap {
  background: #dcfce7;
  color: #16a34a;
}
body.dash-v2 .dash-pipeline-stage--synced .pipeline-stage-label {
  color: #16a34a;
}

@media (max-width: 1100px) {
  body.dash-v2 .dash-pipeline-track {
    justify-content: flex-start;
    gap: 0;
  }
  body.dash-v2 .dash-pipeline-stage {
    flex: 0 0 auto;
  }
}

body.dash-v2 .dash-ingestion-row,
body.dash-v2 .dashboard-ingestion-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--dash-section-gap);
  margin-top: 0.15rem;
  margin-bottom: var(--dash-section-gap);
  align-items: stretch;
}

body.dash-v2 .dash-source-card {
  box-shadow: var(--dash-card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.dash-v2 .dash-source-card--folder {
  border-top: 3px solid #2563eb;
}

body.dash-v2 .dash-source-card--email {
  border-top: 3px solid #7c3aed;
}

body.dash-v2 .dash-source-card--cloud {
  border-top: 3px solid #f59e0b;
}

body.dash-v2 .dash-source-card .card-body,
body.dash-v2 .dash-source-body {
  display: grid;
  grid-template-rows: 4.5rem minmax(2.75rem, auto) 4.85rem minmax(0, 1fr) auto;
  gap: 0;
  flex: 1;
  padding: 0 1.15rem 1.15rem;
  min-height: 0;
}

body.dash-v2 .dash-source-card--email .dash-source-body {
  padding: 0 1.15rem 1.15rem;
}

body.dash-v2 .dash-source-card--email .dash-source-top,
body.dash-v2 .dash-email-top {
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
}

body.dash-v2 .dash-source-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

body.dash-v2 .dash-source-slot--connect {
  height: 100%;
  padding: 0.5rem 0;
  box-sizing: border-box;
  justify-content: center;
  overflow: hidden;
}

body.dash-v2 .dash-source-slot--sync {
  height: auto;
  min-height: 2.75rem;
  padding: 0.1rem 0 0.35rem;
  box-sizing: border-box;
  justify-content: flex-start;
  flex-shrink: 0;
  overflow: visible;
}

body.dash-v2 .dash-source-slot--stats {
  height: 100%;
  padding: 0.35rem 0 0.5rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-slot--extra {
  min-height: 0;
  padding: 0.25rem 0;
  justify-content: flex-start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.dash-v2 .dash-email-recent,
body.dash-v2 .dash-source-card .cloud-sync-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

body.dash-v2 .dash-source-slot--extra .quick-drop-head {
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}

body.dash-v2 .dash-source-activity-scroll {
  flex: 1 1 auto;
  min-height: 6.75rem;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

body.dash-v2 .dash-source-slot--extra .quick-drop-log.dash-source-activity-scroll {
  max-height: none;
  margin-top: 0;
}

body.dash-v2 .dash-email-recent-list.dash-source-activity-scroll {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

body.dash-v2 .dash-source-card .cloud-sync-activity-list.dash-source-activity-scroll {
  max-height: none;
}

body.dash-v2 .dash-source-slot--bottom {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.5rem;
  margin-top: auto;
}

body.dash-v2 .dash-source-slot--sync {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

body.dash-v2 .dash-source-slot--sync .dash-source-toggle-row {
  width: 100%;
  padding: 0;
  margin: 0;
  min-height: 2.75rem;
  align-items: center;
}

body.dash-v2 .dash-source-toggle-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #64748b;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-card--email .dash-source-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: #ede9fe;
  color: #7c3aed;
}

body.dash-v2 .dash-email-top-actions {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

body.dash-v2 .dash-email-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
}

body.dash-v2 .dash-email-menu-btn:hover {
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
}

body.dash-v2 .dash-source-slot--connect .dash-email-address-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  height: 3.35rem;
  min-height: 3.35rem;
  max-height: 3.35rem;
  padding: 0 0.65rem;
  margin: 0;
  flex-wrap: nowrap;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  background: #fafbfc;
  box-sizing: border-box;
}

body.dash-v2 .dash-email-at {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
}

body.dash-v2 .dash-email-address-link {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dash-v2 .dash-email-address-link:hover {
  color: #5b21b6;
}

body.dash-v2 .dash-email-go-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: 0.35rem;
  padding: 0.42rem 0.75rem;
  font-size: 0.74rem;
  border-radius: 8px;
}

body.dash-v2 .dash-email-ext-icon {
  width: 0.8rem;
  height: 0.8rem;
}

body.dash-v2 .dash-source-sync-block {
  display: contents;
}

body.dash-v2 .dash-email-auto-sync {
  padding: 0;
  margin: 0;
  border: none;
}

body.dash-v2 .dash-metric-vdiv {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  flex-shrink: 0;
  min-height: 2.5rem;
}

body.dash-v2 .dash-email-recent {
  margin-top: 0;
}

body.dash-v2 .dash-email-recent-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-card .cloud-sync-section-head {
  flex-shrink: 0;
}

body.dash-v2 .dash-email-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

body.dash-v2 .dash-email-recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

body.dash-v2 .dash-email-recent-status {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: end;
}

body.dash-v2 .dash-email-recent-main {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

body.dash-v2 .dash-email-recent-sender {
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dash-v2 .dash-email-recent-file {
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dash-v2 .dash-email-recent-badge-icon {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dash-v2 .dash-email-recent-badge-icon svg {
  width: 0.62rem;
  height: 0.62rem;
}

body.dash-v2 .dash-email-recent-badge-icon--extracting {
  background: #dbeafe;
  color: #2563eb;
}

body.dash-v2 .dash-email-recent-badge-icon--syncing {
  background: #ffedd5;
  color: #ea580c;
}

body.dash-v2 .dash-email-recent-badge-icon--synced {
  background: #dcfce7;
  color: #16a34a;
}

body.dash-v2 .dash-email-recent-badge-icon--failed {
  background: #fee2e2;
  color: #dc2626;
}

body.dash-v2 .dash-email-spinner {
  width: 0.55rem;
  height: 0.55rem;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 999px;
  display: block;
  animation: dash-email-spin 0.8s linear infinite;
}

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

body.dash-v2 .dash-email-recent-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

body.dash-v2 .dash-email-recent-badge--extracting {
  background: #dbeafe;
  color: #1d4ed8;
}

body.dash-v2 .dash-email-recent-badge--syncing {
  background: #ffedd5;
  color: #c2410c;
}

body.dash-v2 .dash-email-recent-badge--synced {
  background: #dcfce7;
  color: #15803d;
}

body.dash-v2 .dash-email-recent-badge--failed {
  background: #fee2e2;
  color: #b91c1c;
}

body.dash-v2 .dash-email-recent-time {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
}

body.dash-v2 .dash-email-recent-empty {
  font-size: 0.78rem;
  color: #94a3b8;
  padding: 0.35rem 0;
}

body.dash-v2 .dash-email-footer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0;
}

body.dash-v2 .dash-email-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-weight: 600;
  font-size: 0.74rem;
  border-radius: 8px;
  text-decoration: none;
  padding: 0.45rem 0.35rem;
}

body.dash-v2 .dash-email-action-btn svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

body.dash-v2 .dash-email-action-btn--disable {
  border-color: #fecaca;
  color: #dc2626;
  background: #fff;
}

body.dash-v2 .dash-email-action-btn--enable {
  border-color: #bbf7d0;
  color: #16a34a;
}

body.dash-v2 .dash-source-card--email .dash-source-slot--bottom .dash-source-banner {
  padding: 0.85rem 1rem;
}

body.dash-v2 .dash-source-card--email .dash-source-banner-text {
  font-size: 0.76rem;
  line-height: 1.45;
}

body.dash-v2 .dash-source-card--email .email-ingestion-status-pill {
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}

body.dash-v2 .dash-source-card--email .email-ingestion-enabled {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

body.dash-v2 .dash-source-card--email .email-ingestion-disabled {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

body.dash-v2 .dash-source-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  height: 4.5rem;
  min-height: 4.5rem;
  max-height: 4.5rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-top-main {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

body.dash-v2 .dash-source-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-card-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

body.dash-v2 .dash-source-card-icon--folder {
  background: #dbeafe;
  color: #2563eb;
}

body.dash-v2 .dash-source-card-icon--email {
  background: #ede9fe;
  color: #7c3aed;
}

body.dash-v2 .dash-source-card-icon--cloud {
  background: #fef3c7;
  color: #d97706;
}

body.dash-v2 .dash-source-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

body.dash-v2 .dash-source-kicker {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

body.dash-v2 .dash-source-top-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-active-pill {
  font-size: 0.68rem;
}

body.dash-v2 .dash-source-cta {
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.38rem 0.7rem;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

body.dash-v2 .dash-source-cta:hover {
  text-decoration: none;
  filter: brightness(0.95);
}

body.dash-v2 .dash-source-cta--folder {
  background: #2563eb;
}

body.dash-v2 .dash-source-cta--email {
  background: #7c3aed;
}

body.dash-v2 .dash-source-cta--cloud {
  background: #d97706;
}

body.dash-v2 .dash-source-detail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

body.dash-v2 .dash-source-slot--connect .dash-source-detail:not(.dash-source-detail--cloud) {
  height: 3.35rem;
  min-height: 3.35rem;
  max-height: 3.35rem;
  justify-content: center;
  padding: 0 0.65rem;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  background: #fafbfc;
  box-sizing: border-box;
}

body.dash-v2 .dash-source-detail--cloud {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  height: 3.35rem;
  min-height: 3.35rem;
  max-height: 3.35rem;
}

body.dash-v2 .dash-source-detail-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

body.dash-v2 .dash-source-detail-action {
  flex-shrink: 0;
}

body.dash-v2 .dash-source-detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

body.dash-v2 .dash-source-detail-value {
  font-size: 0.8rem;
  color: #334155;
  word-break: break-all;
}

body.dash-v2 .dash-email-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

body.dash-v2 .dash-source-detail--email .email-address-value {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

body.dash-v2 .dash-token-address {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

body.dash-v2 .dash-email-forward-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
}

body.dash-v2 .dash-xero-brand {
  font-weight: 700;
  color: #13b5ea;
}

body.dash-v2 .dash-source-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0;
  cursor: pointer;
  user-select: none;
}

body.dash-v2 .dash-source-toggle-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

body.dash-v2 .dash-source-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.dash-v2 .dash-source-toggle-ui {
  width: 2.2rem;
  height: 1.28rem;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  transition: background 0.18s ease;
  flex-shrink: 0;
}

body.dash-v2 .dash-source-toggle-ui::after {
  content: "";
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #fff;
  top: 0.19rem;
  left: 0.2rem;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

body.dash-v2 .dash-source-toggle-input:checked + .dash-source-toggle-ui {
  background: #22c55e;
}

body.dash-v2 .dash-source-toggle-input:checked + .dash-source-toggle-ui::after {
  transform: translateX(0.9rem);
}

body.dash-v2 .dash-source-slot--stats .dash-source-metrics--panel {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.55rem 0.15rem;
  background: #f8fafc;
  border: 1px solid #e8edf5;
  border-radius: 10px;
  box-sizing: border-box;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.2rem 0.25rem;
  text-align: center;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric-value--compact {
  font-size: 0.72rem;
  font-weight: 600;
  color: #0f172a;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric--danger .dash-source-metric-value {
  color: #dc2626;
}

body.dash-v2 .dash-source-metrics--panel .dash-source-metric--success .dash-source-metric-value {
  color: #16a34a;
}

body.dash-v2 .dash-source-slot--bottom .dash-source-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0;
}

body.dash-v2 .dash-source-slot--bottom .dash-source-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0;
  padding: 0.75rem 0.85rem;
  border: 1px dashed;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}

body.dash-v2 .dash-source-slot--bottom .dash-source-banner--folder,
body.dash-v2 .dash-source-banner--folder {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  background: #eff6ff;
  border-color: #93c5fd;
  cursor: pointer;
}

body.dash-v2 .dash-source-banner--folder .dash-source-banner-text {
  width: 100%;
  max-width: 18rem;
}

body.dash-v2 .dash-source-banner--email {
  background: #f5f3ff;
  border-color: #c4b5fd;
}

body.dash-v2 .dash-source-banner--email .dash-source-banner-icon--info {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #7c3aed;
}

body.dash-v2 .dash-source-banner--email .dash-source-banner-link {
  color: #7c3aed;
}

body.dash-v2 .dash-source-banner--cloud {
  background: #fffbeb;
  border-color: #fcd34d;
}

body.dash-v2 .dash-source-banner-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #64748b;
}

body.dash-v2 .dash-source-banner--folder .dash-source-banner-icon {
  width: auto;
  height: auto;
  color: #2563eb;
}

body.dash-v2 .dash-source-banner--folder .dash-source-banner-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

body.dash-v2 .dash-source-banner-icon--info {
  background: rgba(255, 255, 255, 0.65);
  border: none;
  color: #7c3aed;
}

body.dash-v2 .dash-source-banner-icon--info svg {
  width: 1.1rem;
  height: 1.1rem;
}

body.dash-v2 .dash-source-banner--cloud .dash-source-banner-icon--info {
  color: #d97706;
}

body.dash-v2 .dash-source-banner-text {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

body.dash-v2 .dash-source-banner-link {
  color: #334155;
  font-weight: 600;
}

body.dash-v2 .dash-banner-arrow {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  vertical-align: -0.15em;
  margin-left: 0.1rem;
}

body.dash-v2 .dash-source-banner-btn {
  margin-top: 0.15rem;
}

body.dash-v2 .dash-source-banner--folder .dash-source-banner-btn {
  margin-top: 0;
}

body.dash-v2 .dash-source-card--folder .quick-drop-limits {
  margin: 0;
}

body.dash-v2 .cloud-sync-card .card-header::before {
  display: none;
}

body.dash-v2 .dash-source-card .cloud-sync-section {
  margin-top: 0;
}

body.dash-v2 .dash-source-card .cloud-sync-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}


body.dash-v2 .dash-spend-card {
  margin-bottom: var(--dash-section-gap);
  box-shadow: var(--dash-card-shadow);
}

body.dash-v2 .dash-bottom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--dash-health-w);
  gap: var(--dash-section-gap);
  margin-bottom: var(--dash-section-gap);
  align-items: stretch;
}

body.dash-v2 .dash-recent-card,
body.dash-v2 .dash-health-card,
body.dash-v2 .dash-email-log-card {
  box-shadow: var(--dash-card-shadow);
}

body.dash-v2 .dash-recent-card,
body.dash-v2 .dash-health-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

body.dash-v2 .dash-recent-card .table-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

body.dash-v2 .dash-recent-card .dash-recent-table {
  flex: 1;
}

body.dash-v2 .dash-health-card .dash-source-health-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.dash-v2 .dash-doc-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

body.dash-v2 .dash-doc-type {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.dash-v2 .dash-doc-type svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

body.dash-v2 .dash-doc-type--pdf {
  background: #fee2e2;
  color: #b91c1c;
}

body.dash-v2 .dash-doc-type--sheet {
  background: #dcfce7;
  color: #15803d;
}

body.dash-v2 .dash-doc-type--doc {
  background: #dbeafe;
  color: #1d4ed8;
}

body.dash-v2 .dash-doc-type--image,
body.dash-v2 .dash-doc-type--file {
  background: #f1f5f9;
  color: #475569;
}

body.dash-v2 .dash-doc-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dash-v2 .dash-confidence {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

body.dash-v2 .dash-confidence--high {
  color: #16a34a;
}

body.dash-v2 .dash-confidence--medium {
  color: #ea580c;
}

body.dash-v2 .dash-confidence--low {
  color: #dc2626;
}

body.dash-v2 .dash-confidence--muted {
  color: #94a3b8;
  font-weight: 500;
}

body.dash-v2 .dash-doc-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

body.dash-v2 .dash-doc-status--synced {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

body.dash-v2 .dash-doc-status--draft {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.dash-v2 .dash-doc-status--review {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

body.dash-v2 .dash-doc-status--extracted {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.dash-v2 .dash-doc-status--failed {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

body.dash-v2 .dash-doc-status--muted {
  background: #f1f5f9;
  color: #64748b;
}

body.dash-v2 .dash-source-cell {
  text-align: center;
}

body.dash-v2 .dash-source-channel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
}

body.dash-v2 .dash-source-channel svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

body.dash-v2 .dash-source-channel--email {
  background: #ede9fe;
  color: #7c3aed;
}

body.dash-v2 .dash-source-channel--folder {
  background: #dbeafe;
  color: #2563eb;
}

body.dash-v2 .dash-source-channel--cloud {
  background: #ffedd5;
  color: #ea580c;
}

body.dash-v2 .dash-source-channel--drop {
  background: #ecfdf5;
  color: #16a34a;
}

body.dash-v2 .dash-health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

body.dash-v2 .dash-health-view-all {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
}

body.dash-v2 .dash-health-view-all:hover {
  color: #7c3aed;
  text-decoration: none;
}

body.dash-v2 .dash-source-health-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.dash-v2 .dash-health-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(5.5rem, auto) auto;
  gap: 0.5rem 0.85rem;
  align-items: center;
  flex: 1;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 0;
}

body.dash-v2 .dash-health-row--loading {
  flex: 1;
  align-items: center;
}

body.dash-v2 .dash-health-row:last-child {
  border-bottom: none;
}

body.dash-v2 .dash-health-row-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0;
}

body.dash-v2 .dash-health-row-icon svg {
  width: 1rem;
  height: 1rem;
}

body.dash-v2 .dash-health-row-icon--folder {
  background: #fef3c7;
  color: #d97706;
}

body.dash-v2 .dash-health-row-icon--email {
  background: #dbeafe;
  color: #2563eb;
}

body.dash-v2 .dash-health-row-icon--onedrive {
  background: #dbeafe;
  color: #2563eb;
}

body.dash-v2 .dash-health-row-icon--google_drive {
  background: #dcfce7;
  color: #16a34a;
}

body.dash-v2 .dash-health-row-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

body.dash-v2 .dash-health-xero {
  font-weight: 600;
  color: #64748b;
  margin-left: 0.1rem;
}

body.dash-v2 .dash-health-row-sub {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dash-v2 .dash-health-row-activity {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  text-align: right;
  white-space: nowrap;
  padding-right: 0.15rem;
}

body.dash-v2 .dash-health-row-end {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

body.dash-v2 .dash-health-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}

body.dash-v2 .dash-health-dot--healthy {
  background: #22c55e;
}

body.dash-v2 .dash-health-dot--warn {
  background: #f59e0b;
}

body.dash-v2 .dash-health-dot--disabled {
  background: #94a3b8;
}

body.dash-v2 .dash-health-end-label {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

body.dash-v2 .dash-health-end-label--healthy {
  color: #16a34a;
}

body.dash-v2 .dash-health-end-label--warn {
  color: #d97706;
}

body.dash-v2 .dash-health-end-label--disabled {
  color: #94a3b8;
}

body.dash-v2 .dash-recent-table {
  font-size: 0.82rem;
}

body.dash-v2 .dash-recent-table thead th {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: #fff;
  border-bottom: 1px solid #e8edf5;
}

body.dash-v2 .dash-recent-table tbody td {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  vertical-align: middle;
}

body.dash-v2 .dash-view-btn {
  min-width: 3.25rem;
}

body.dash-v2 .dash-actions-col {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  body.dash-v2 .dash-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.dash-v2 .dash-bottom-row {
    grid-template-columns: 1fr;
  }
  body.dash-v2 .dashboard-ingestion-row,
  body.dash-v2 .dash-ingestion-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.dash-v2 .dashboard-ingestion-row .cloud-sync-card,
  body.dash-v2 .dash-ingestion-row .dash-source-card--cloud {
    grid-column: 1 / -1;
  }
}

/* 1440×1024 artboard: tighter vertical rhythm so primary dashboard fits one screen */
@media (min-width: 1280px) and (max-height: 1060px) {
  body.dash-v2 {
    --dash-page-pad-y: 12px;
    --dash-section-gap: 12px;
    --dash-health-w: 392px;
  }

  body.dash-v2 .dash-topbar {
    padding: 0.65rem 1.25rem;
  }

  body.dash-v2 .dash-metric-card {
    min-height: 92px;
    padding: 0.7rem 0.85rem 0.65rem;
  }

  body.dash-v2 .dash-metric-card .value,
  body.dash-v2 .dash-metric-value {
    font-size: 1.65rem;
  }

  body.dash-v2 .dash-pipeline-card {
    margin-bottom: 1rem;
  }

  body.dash-v2 .dash-pipeline-card .card-body,
  body.dash-v2 .dash-pipeline-card .pipeline-head {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  body.dash-v2 .dash-pipeline-stage .pipeline-stage-value {
    font-size: 1.35rem;
  }

  body.dash-v2 .dash-recent-table {
    font-size: 0.78rem;
  }

  body.dash-v2 .dash-recent-table tbody td {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  body.dash-v2 .dash-recent-table .cell-filename {
    max-width: 9rem;
  }

  body.dash-v2 .dash-spend-card,
  body.dash-v2 .dash-email-log-card {
    display: none;
  }
}

@media (max-width: 768px) {
  body.dash-v2 .sidebar {
    display: flex;
  }
  body.dash-v2 .dash-pipeline-stage {
    min-width: 0;
    padding: 0.3rem 0.4rem;
  }
  body.dash-v2 .dash-pipeline-stage .pipeline-stage-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 900px) {
  body.dash-v2 {
    height: auto;
    overflow: visible;
  }

  body.dash-v2 .dash-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  body.dash-v2 .dash-sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    position: static;
    overflow: visible;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.75rem;
  }

  body.dash-v2 .dash-main-column {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  body.dash-v2 .dash-sidebar-brand,
  body.dash-v2 .dash-sidebar-footer,
  body.dash-v2 .dash-nav-label {
    display: none;
  }
  body.dash-v2 .dash-nav-group {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
  }
  body.dash-v2 .dash-topbar {
    grid-template-columns: 1fr;
  }
  body.dash-v2 .dash-search-kbd {
    display: none;
  }
  body.dash-v2 .dashboard-ingestion-row {
    grid-template-columns: 1fr;
  }
}
