:root {
  --trans: 0.1s;
  --bg: #ffffff;
  --pageBg: #f6f8fa;
  --textColor: #1f2937;
  --mutedTextColor: #4b5563;
  --softTextColor: #6b7280;
  --borderColor: #e7e7e7;
  --strongBorderColor: #d1d5db;
  --panelBorderColor: #e3e5e7;
  --primaryControlBg: #4b66d0;
  --primaryControlActiveBg: #5775eb;
  --primaryControlTextColor: #ffffff;
  --secondaryControlBg: #374151;
  --secondaryControlActiveBg: #111827;
  --secondaryControlTextColor: #ffffff;
  --dangerControlBg: #ffb9b8;
  --dangerControlActiveBg: #ff9f9d;
  --dangerControlTextColor: #8f2f2e;
  --ghostControlTextColor: #2563eb;
  --ghostControlActiveBg: #eef2ff;
  --successControlBgColor: #18c09e;
  --focusRingColor: rgba(75, 102, 208, 0.28);
  --radius: 8px;
  --smallRadius: 5px;
  --contentMaxWidth: 1280px;
}

body {
  margin: 0;
  padding: 0;
  font-family: Inter, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #ffffff;
  color: var(--textColor);
}

/* Hide only the intro until i18n is initialized; keep hero body visible when present in the HTML. */
body:not(.i18n-ready) [data-i18n='intro'] {
  visibility: hidden;
}

.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 0;
  height: 3px;
  background: var(--primaryControlBg);
  box-shadow: 0 0 10px rgba(75, 102, 208, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: width 0.25s ease, opacity 0.2s ease;
}

.top-progress.running {
  width: 72%;
  opacity: 1;
  animation: progress-pulse 1.1s ease-in-out infinite;
}

.top-progress.done {
  width: 100%;
  opacity: 1;
}

.top-progress.failed {
  width: 100%;
  background: #dc2626;
  opacity: 1;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
}

@keyframes progress-pulse {
  0% {
    transform: translateX(-18%);
  }
  50% {
    transform: translateX(12%);
  }
  100% {
    transform: translateX(28%);
  }
}

.container {
  max-width: var(--contentMaxWidth);
  margin: 0 auto;
  padding: 0 48px;
  background: transparent;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  max-width: var(--contentMaxWidth);
  margin: 32px auto 0;
  padding: 22px 48px 36px;
  color: var(--mutedTextColor);
  font-size: 13px;
}

.site-footer a,
.legal-brand {
  color: var(--primaryControlBg);
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover,
.legal-brand:hover {
  text-decoration: underline;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 24px 64px;
}

.legal-header {
  margin-bottom: 18px;
}

.legal-header p {
  margin: 18px 0 8px;
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.legal-header h1 {
  margin: 0 0 8px;
  color: var(--textColor);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
}

.legal-header span {
  color: var(--mutedTextColor);
  font-size: 14px;
  font-weight: 700;
}

.legal-card {
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.legal-card h2 {
  margin: 26px 0 8px;
  color: var(--textColor);
  font-size: 18px;
  line-height: 1.3;
}

.legal-card h2:first-child {
  margin-top: 0;
}

.legal-card p {
  margin: 0 0 12px;
  color: #475569;
  font-size: 15px;
  line-height: 1.65;
}

h1, h2, h3 {
  margin-top: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -48px 0;
  padding: 16px 48px 16px;
  border-bottom: 1px solid var(--borderColor);
  margin-bottom: 0;
}

.page-header p {
  margin-bottom: 0;
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
  font-family: Inter, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.brand-logo {
  color: #005a43;
  font-size: 38px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.02em;
}

.brand-tagline {
  margin: 0;
  padding: 0;
  color: #111827;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.page-header p {
  color: #0f766e;
  font-weight: 700;
  line-height: 1.55;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--mutedTextColor);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--borderColor);
}

.auth-tab {
  flex: 1;
  min-height: 38px;
  background: transparent;
  color: var(--mutedTextColor);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  font-weight: 700;
}

.auth-tab.selected {
  color: var(--primaryControlBg);
  border-bottom-color: var(--primaryControlBg);
}

.auth-tab:hover {
  background: var(--ghostControlActiveBg);
}

.google-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  color: var(--textColor);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
  box-sizing: border-box;
  transition: background var(--trans), border-color var(--trans);
}

.google-auth-btn:hover {
  background: var(--pageBg);
  border-color: var(--primaryControlBg);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--softTextColor);
  font-size: 12px;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--borderColor);
}

.auth-error {
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #991b1b;
  background: #fee2e2;
  border-radius: var(--smallRadius);
  font-size: 13px;
}

#authForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

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

.password-field input {
  flex: 1;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 0;
  min-height: unset;
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  color: var(--softTextColor);
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.password-toggle:hover {
  background: transparent;
  color: var(--textColor);
}

.header-controls {
  display: grid;
  gap: 10px;
  min-width: 220px;
  justify-items: end;
}

.header-controls > .language-control {
  display: none;
}

.language-segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(86px, 1fr));
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.language-option {
  min-height: 34px;
  padding: 7px 12px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.language-option:hover {
  color: #0f8a65;
  background: rgba(255, 255, 255, 0.72);
}

.language-option.selected {
  color: #0b6f47;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.language-control {
  display: grid;
  gap: 6px;
  width: min(180px, 100%);
  font-size: 14px;
  font-weight: 700;
}

.language-control span {
  color: #334155;
  font-weight: 800;
}

.language-control select {
  padding: 10px 12px;
  border: 1px solid #9ca3af;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--textColor);
  font-weight: 700;
}

.hero-flow {
  --hero-center-width: 42px;
  --hero-column-gap: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 0;
  padding: 48px 0 24px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
  border: 1px solid #d1fae5;
  border-radius: var(--radius);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #065f46;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.trust-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: #059669;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--ghostControlTextColor);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.mode-picker {
  margin-bottom: 0;
}

.mode-card {
  position: relative;
  display: grid;
  gap: 4px;
  box-sizing: border-box;
  width: 100%;
  min-height: 92px;
  padding: 14px 16px;
  text-align: left;
  color: var(--textColor);
  background: var(--bg);
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
}

.mode-card:hover,
.mode-card:focus-visible {
  color: var(--textColor);
  background: #f8fafc;
  border-color: var(--primaryControlBg);
}

.mode-card.selected {
  border-color: var(--primaryControlBg);
  box-shadow: 0 0 0 2px var(--focusRingColor);
  background: #eef2ff;
}

.mode-card span {
  color: var(--mutedTextColor);
  font-weight: 400;
  line-height: 1.4;
}

.mode-card-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
  stroke: var(--primaryControlBg);
}

form {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
}

#upload-form {
  margin-bottom: 0;
}

#upload-form .file-picker {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
}

input[type='file'] {
  flex: 1 1 220px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-picker {
  display: grid;
  flex: 0 1 300px;
  min-height: 52px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 10px 14px;
  text-align: center;
  color: #075985;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--trans), border-color var(--trans), box-shadow var(--trans);
}

.hero-flow #upload-form .file-picker {
  min-height: 64px;
  color: #064e3b;
  background: #bbf7d0;
  border-color: #86efac;
}

.hero-flow #upload-form .file-picker:hover {
  background: #a7f3d0;
  border-color: #34d399;
}

.hero-flow #upload-form .file-picker span {
  font-size: 18px;
}

.file-picker:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.file-picker:focus-within {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.file-picker span {
  font-weight: 800;
}

.file-picker small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-flow .file-picker small {
  color: #065f46;
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
  text-overflow: unset;
  overflow: visible;
}

button {
  position: relative;
  min-height: 42px;
  background: var(--primaryControlBg);
  color: var(--primaryControlTextColor);
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background-color var(--trans), border-color var(--trans), color var(--trans), box-shadow var(--trans);
}

button:hover {
  background: var(--primaryControlActiveBg);
}

button:focus {
  outline: none;
}

button:focus-visible::before {
  position: absolute;
  inset: -4px;
  border: 2px solid var(--focusRingColor);
  border-radius: calc(var(--radius) + 4px);
  content: '';
  pointer-events: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  box-shadow: none;
}

button[data-emphasis='primary'] {
  background: var(--primaryControlBg);
  color: var(--primaryControlTextColor);
}

button[data-emphasis='primary']:disabled:hover {
  background: var(--primaryControlBg);
}

button[data-emphasis='primary']:hover {
  background: var(--primaryControlActiveBg);
}

button[data-emphasis='secondary'] {
  background: var(--secondaryControlBg);
  color: var(--secondaryControlTextColor);
}

button[data-emphasis='secondary']:disabled:hover {
  background: var(--secondaryControlBg);
}

button[data-emphasis='secondary']:hover {
  background: var(--secondaryControlActiveBg);
}

button[data-emphasis='danger'] {
  background: var(--dangerControlBg);
  color: var(--dangerControlTextColor);
}

button[data-emphasis='danger']:hover {
  background: var(--dangerControlActiveBg);
}

button[data-emphasis='ghost'] {
  background: transparent;
  color: var(--ghostControlTextColor);
}

button[data-emphasis='ghost']:disabled:hover {
  background: transparent;
}

button[data-emphasis='ghost']:hover {
  background: var(--ghostControlActiveBg);
}

button[data-size='compact'] {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: var(--smallRadius);
  font-size: 13px;
}

button[data-size='icon'] {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border-radius: var(--smallRadius);
}

.message {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: var(--radius);
}

.message:empty {
  display: none;
}

.message.info {
  background: #e0f2fe;
  color: #0c4a6e;
}

.message.success {
  background: #dcfce7;
  color: #14532d;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
}

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

.tab-panel-header h3 {
  margin: 0;
}

.report-download-buttons {
  display: flex;
  gap: 8px;
}

.category-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-top: 8px;
}

.export-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 14px;
}

.export-detail-control {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.export-detail-control span {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.export-detail-control select {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--textColor);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--smallRadius);
}

.modal-export-detail {
  margin: 16px 0;
}

.modal-export-detail select {
  min-height: 44px;
}

.report-download-buttons button {
  border: 1px solid var(--ghostControlTextColor);
}

.report.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.report-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.report-heading h2 {
  margin-bottom: 0;
}

.report-date-range {
  margin: 0;
  color: var(--mutedTextColor);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.report-date-range::before {
  content: 'Date range: ';
  color: #0f172a;
}

.summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}

.summary-card {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius);
  background: var(--bg);
}

.summary-card span {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.summary-card strong {
  color: var(--mutedTextColor);
  font-size: 13px;
  text-transform: uppercase;
}

.summary-card.negative span {
  color: #b91c1c;
}

/* Income is shown only for transparency; de-emphasize it. */
.summary-card.muted {
  background: #f8fafc;
  border-style: dashed;
}

.summary-card.muted span,
.summary-card.muted strong {
  color: var(--softTextColor);
}

.summary-note {
  color: var(--softTextColor);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}

.report-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.report-main {
  min-width: 0;
  overflow: visible;
}

.review-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
}

.review-summary h3,
.review-summary h4 {
  margin: 0 0 8px;
}

.review-summary p {
  display: grid;
  gap: 4px;
  margin: 0;
  color: #78350f;
}

.review-summary ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-summary li {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.review-summary li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-summary li em {
  color: #92400e;
  font-style: normal;
  white-space: nowrap;
}

.amount-col {
  text-align: right;
  white-space: nowrap;
}

.cat-group-row td {
  background: var(--pageBg);
  font-weight: 700;
  padding-top: 10px;
  padding-bottom: 10px;
}

.cat-group-row:first-child td {
  padding-top: 6px;
}

.cat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--textColor);
}

.cat-toggle:hover {
  color: var(--ghostControlTextColor);
}

.cat-toggle-icon {
  font-size: 11px;
  width: 10px;
  display: inline-block;
}

.cat-sub-name {
  padding-left: 28px;
  color: var(--mutedTextColor);
}

.cat-sub-name .cat-toggle {
  color: var(--mutedTextColor);
  font-weight: 600;
}

.cat-transaction-row td {
  background: #ffffff;
  font-size: 13px;
}

.cat-transaction-row td:first-child {
  padding-left: 56px;
}

.cat-edit-cell {
  width: 320px;
}

.cat-edit-cell .category-select {
  min-width: 220px;
}

.review-section {
  margin-bottom: 24px;
}

.review-section p {
  color: var(--mutedTextColor);
}

.description-cell {
  display: grid;
  gap: 4px;
  max-width: 420px;
}

.description-cell strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.description-cell > span {
  width: fit-content;
  padding: 2px 7px;
  color: #92400e;
  font-size: 12px;
  background: #fef3c7;
  border-radius: 999px;
}

.description-cell details {
  color: var(--softTextColor);
  font-size: 12px;
}

.description-cell summary {
  cursor: pointer;
}

.description-cell p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.category-select {
  width: 100%;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--textColor);
}

.secondary-button {
  white-space: nowrap;
}

.report-tabs {
  position: sticky;
  top: 69px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 0 0;
  background: #ffffff;
  border-bottom: 1px solid var(--strongBorderColor);
  box-shadow: 0 2px 0 #ffffff;
}

.report-tabs::before,
.tab-panel-header::before,
.review-sticky-controls::before {
  position: absolute;
  inset: -16px 0 auto;
  height: 16px;
  background: #ffffff;
  content: '';
}

.tab-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  color: var(--mutedTextColor);
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Override the ghost-emphasis blue so inactive tabs read as muted. */
.report-tabs .tab-button {
  color: var(--mutedTextColor);
}

.tab-button span {
  line-height: 1.2;
  white-space: normal;
}

.tab-button strong {
  min-width: 24px;
  padding: 2px 7px;
  color: var(--textColor);
  font-size: 12px;
  text-align: center;
  background: #eef2ff;
  border-radius: 999px;
}

.tab-button.selected {
  color: var(--ghostControlTextColor);
  background: var(--bg);
  border-color: var(--strongBorderColor);
  border-bottom-color: var(--bg);
}

.tab-panel {
  min-width: 0;
  margin-bottom: 24px;
  padding-top: 0;
}

.tab-panel-header,
.review-sticky-controls {
  position: sticky;
  top: 132px;
  z-index: 19;
  padding: 2px 0 6px;
  background: #ffffff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 2px 0 #ffffff;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius);
  background: var(--bg);
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f4f6;
}

.table-scroll table {
  min-width: 640px;
}

.report-main .table-scroll table {
  min-width: 0;
}

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

thead {
  background: #f3f4f6;
}

th, td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--borderColor);
}

tbody tr:nth-child(even) {
  background: #fbfbfb;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.45);
}

.modal.hidden {
  display: none;
}

.modal-panel {
  position: relative;
  z-index: 1001;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--panelBorderColor);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.field textarea {
  min-height: 96px;
  padding: 10px 12px;
  color: var(--textColor);
  font: inherit;
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
  resize: vertical;
}

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

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

.icon-button {
  color: var(--secondaryControlBg);
  background: #f3f4f6;
}

.icon-button:hover {
  color: var(--secondaryControlActiveBg);
  background: #e5e7eb;
}

.modal-description {
  margin: 0 0 16px;
  color: var(--mutedTextColor);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select {
  padding: 10px 12px;
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--textColor);
}

.link-button {
  padding: 0;
  color: var(--ghostControlTextColor);
  background: transparent;
}

.link-button:hover {
  color: var(--primaryControlActiveBg);
  background: transparent;
}

.new-category-form {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius);
  background: #f9fafb;
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.get-report-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

/* Print options grouped in one box so it's clear "Remember" covers them all. */
.print-settings-group {
  display: grid;
  gap: 12px;
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--strongBorderColor);
  border-radius: var(--radius);
}

.print-settings-group .checkbox-control,
.print-settings-group .new-category-form {
  margin: 0;
}

.print-remember-control {
  padding-top: 12px;
  border-top: 1px dashed var(--strongBorderColor);
  font-weight: 700;
}

.pricing-panel {
  width: min(480px, 100%);
}

.pricing-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: #f1f5f9;
  border-radius: 999px;
}

.pricing-period-btn {
  flex: 1;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  color: #475569;
  border: none;
  border-radius: 999px;
}

.pricing-period-btn.selected {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15,23,42,0.1);
}

.pricing-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 6px;
  font-size: 11px;
  color: #065f46;
  background: #d1fae5;
  border-radius: 999px;
}

.pricing-card {
  padding: 20px;
  border: 2px solid var(--borderColor);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.pricing-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 16px;
}

.pricing-price {
  font-size: 36px;
  font-weight: 800;
  color: #0f172a;
}

.pricing-unit {
  color: var(--mutedTextColor);
  font-size: 15px;
}

.pricing-note {
  margin: -10px 0 14px;
  color: #059669;
  font-size: 13px;
  font-weight: 600;
}

.pricing-features {
  margin: 0 0 16px;
  padding: 0 0 0 18px;
  color: var(--mutedTextColor);
  font-size: 14px;
  line-height: 1.8;
}

.pricing-secure {
  text-align: center;
  font-size: 12px;
  color: var(--softTextColor);
  margin: 0;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--borderColor);
  margin: 16px 0 12px;
}

@media (max-width: 640px) {
  .page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px 10px;
  }

  .page-header > div:first-child {
    grid-column: 1 / -1;
  }

  .header-auth {
    min-width: 0;
    flex-wrap: nowrap;
    gap: 8px;
    white-space: nowrap;
  }

  .auth-user-name {
    max-width: min(42vw, 180px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-auth .auth-btn {
    flex-shrink: 0;
    min-height: 38px;
  }

  #loginBtn.auth-btn {
    color: #1f3a5f;
    background: #ffffff;
    border: 1px solid var(--strongBorderColor);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  #loginBtn.auth-btn:hover {
    color: var(--primaryControlBg);
    background: #f8fafc;
  }

  .header-controls,
  .language-control {
    width: auto;
  }

  .header-controls {
    min-width: 0;
    justify-items: end;
  }

  .language-segmented {
    grid-template-columns: repeat(2, 42px);
    gap: 3px;
    padding: 3px;
  }

  .language-option {
    min-height: 36px;
    padding: 0 8px;
    font-size: 0;
  }

  .language-option::after {
    content: attr(data-short-label);
    font-size: 13px;
  }

  @media (max-width: 360px) {
    .page-header {
      grid-template-columns: 1fr;
    }

    .header-auth,
    .header-controls {
      width: 100%;
      justify-content: space-between;
    }

    .header-controls {
      justify-items: start;
    }

    .auth-user-name {
      max-width: 38vw;
    }
  }

  #upload-form {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 12px;
  }

  .mode-picker {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 12px;
  }

  .hero-flow {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .report-workspace {
    grid-template-columns: 1fr;
  }

  .chart-section {
    order: -1;
  }

  .summary-card span {
    font-size: 24px;
  }

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

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

  .review-summary li em {
    grid-column: 1 / -1;
  }

  .modal-actions {
    display: grid;
  }
}

/* Hero controls share the same three-column grid as the demo. */
.hero-flow > .mode-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--hero-center-width) minmax(0, 1fr);
  gap: var(--hero-column-gap);
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.security-note {
  margin: 0;
  padding: 10px 16px;
  text-align: center;
  color: #065f46;
  font-size: 12px;
  font-weight: 700;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}

.mode-picker-label {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  color: var(--mutedTextColor);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-or {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--softTextColor);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-flow > .mode-picker .mode-card:first-child {
  grid-column: 1;
}

.hero-flow > .mode-picker .mode-card:last-child {
  grid-column: 3;
}

.hero-flow > #upload-form {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.hero-flow > #upload-form .file-picker {
  width: 100%;
}

.hero-flow > #upload-form button[type='submit'] {
  display: none;
}

@media (max-width: 640px) {
  .hero-flow > .mode-picker,
  .hero-flow > #upload-form {
    grid-template-columns: 1fr;
    padding-left: 0;
    padding-right: 0;
  }

  .hero-flow > .mode-picker .mode-card:first-child,
  .hero-flow > .mode-picker .mode-card:last-child {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 32px;
  }

  .legal-page {
    padding: 28px 16px 44px;
  }

  .legal-card {
    padding: 20px;
  }

  .page-header {
    margin: 0 -20px 0;
    padding: 16px 20px;
  }

  .hero-flow {
    padding: 32px 0;
  }
}

/* Expense-report workflow refactor */
.workflow-stepper {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 -48px;
  padding: 12px 48px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--borderColor);
  backdrop-filter: blur(10px);
}

.workflow-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #dbe3ea;
}

.workflow-step:hover {
  color: #0f172a;
  background: #eef6f4;
}

.workflow-step span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #475569;
  font-size: 12px;
  background: #e2e8f0;
  border-radius: 50%;
}

.workflow-step.active {
  color: #ffffff;
  background: #0f766e;
  border-color: #0f766e;
}

.workflow-step.active span,
.workflow-step.complete span {
  color: #0f766e;
  background: #ffffff;
}

.workflow-step.complete {
  color: #064e3b;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.workflow-step:disabled {
  cursor: default;
  opacity: 0.58;
}

.workflow-upload-screen {
  gap: 20px;
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 0 34px;
}

.workflow-upload-copy {
  display: grid;
  gap: 10px;
  text-align: center;
}

.workflow-upload-copy h1 {
  max-width: 780px;
  margin: 0 auto;
  color: #0f172a;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: 0;
}

.workflow-upload-copy p {
  max-width: 680px;
  margin: 0 auto;
  color: #475569;
  font-size: 17px;
  line-height: 1.55;
}

.workflow-upload-form {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
}

.workflow-upload-form .file-picker,
.hero-flow #upload-form .file-picker {
  min-height: 190px;
  align-content: start;
  justify-items: center;
  color: #0f766e;
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  text-align: center;
}

.workflow-upload-form .file-picker:hover,
.workflow-upload-form .file-picker.drag-over {
  background: #ecfdf5;
  border-color: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.workflow-upload-form .file-picker span {
  font-size: 22px;
}

.workflow-upload-form .file-picker em {
  color: #64748b;
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
}

.upload-steps-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--textColor);
}

.upload-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 0;
  color: var(--mutedTextColor);
  font-size: 14px;
  line-height: 1.5;
  list-style-position: inside;
  text-align: center;
}

.upload-steps li {
  padding-left: 0;
}

.selected-file-name:not(:empty) {
  margin-top: 4px;
  color: #0f766e;
  font-weight: 800;
}

.hero-flow > #upload-form button[type='submit'] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

.trust-strip {
  background: #f8fafc;
  border-color: #dbe3ea;
}

.trust-item,
.security-note {
  color: #475569;
}

.mode-picker {
  max-width: 860px;
}

.report {
  padding: 24px 0 56px;
}

.report h2 {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 28px;
}

.summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.report-workspace {
  grid-template-columns: 1fr;
}

.chart-section {
  display: none;
}

.panel-intro {
  margin: 0;
  color: #64748b;
  line-height: 1.5;
}

.panel-intro + .next-review-btn {
  margin-top: 12px;
}

.cat-empty-row td {
  padding: 18px 12px;
  color: var(--mutedTextColor);
  text-align: center;
}

.next-review-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  white-space: normal;
}

.next-review-btn + .report-download-buttons {
  margin-top: 10px;
}

.tab-panel-header {
  align-items: flex-start;
}

.review-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 16px;
  margin-bottom: 8px;
}

.review-header h3 {
  margin-bottom: 6px;
}

.review-header p {
  margin: 0;
  line-height: 1.45;
}

.review-status-pill {
  align-self: start;
  padding: 9px 12px;
  color: #92400e;
  font-size: 13px;
  font-weight: 800;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}

.bulk-review-bar {
  display: grid;
  grid-template-columns: minmax(180px, max-content) minmax(260px, 360px) minmax(360px, 1fr);
  grid-template-areas:
    "selected category-label rule"
    "hint select apply";
  column-gap: 30px;
  row-gap: 8px;
  align-items: start;
  margin-bottom: 10px;
  padding: 22px 24px;
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: var(--radius);
}

.review-sticky-controls .bulk-review-bar {
  margin-bottom: 0;
}

.bulk-review-bar .field {
  display: contents;
  margin-bottom: 0;
}

.bulk-review-bar .checkbox-control {
  grid-area: rule;
  align-self: end;
  margin: 0;
  line-height: 1.3;
}

.bulk-selection-status {
  display: contents;
}

.bulk-selection-status strong {
  grid-area: selected;
  align-self: end;
  color: #0f172a;
  font-size: 15px;
}

.bulk-selection-status span {
  grid-area: hint;
  align-self: start;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.bulk-review-bar .field > span {
  grid-area: category-label;
  align-self: end;
  color: #0f172a;
  font-weight: 800;
}

.review-category-select,
.bulk-review-bar .category-select {
  min-height: 44px;
  font-size: 15px;
}

.bulk-review-bar .category-select {
  grid-area: select;
  width: auto;
  min-width: 260px;
  max-width: 360px;
}

#applyBulkCategory {
  min-height: 44px;
}

#applyBulkCategory {
  grid-area: apply;
  align-self: start;
  justify-self: start;
  white-space: nowrap;
}

.review-select-cell {
  width: 96px;
}

.review-row-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.review-row-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: #0f766e;
}

.needs-review-row {
  background: #fffdf5;
}

.empty-review-state {
  display: grid;
  gap: 4px;
  padding: 18px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
}

.empty-review-state span {
  color: #475569;
}

.export-panel .report-download-buttons button {
  border: 1px solid var(--strongBorderColor);
}

.export-table-scroll table {
  min-width: 0;
}

@media (max-width: 768px) {
  .workflow-stepper {
    margin: 0 -20px;
    padding: 8px 12px;
    gap: 4px;
  }

  .workflow-step {
    min-height: 42px;
    padding: 8px 6px;
    gap: 4px;
  }

  .workflow-step strong {
    font-size: 12px;
  }

  .workflow-step span {
    width: 20px;
    height: 20px;
  }

  .workflow-upload-screen {
    padding: 32px 0 24px;
  }

  .workflow-upload-copy {
    text-align: left;
  }

  .workflow-upload-copy h1 {
    font-size: 31px;
  }

  .workflow-upload-copy p,
  .workflow-upload-copy h1 {
    margin-left: 0;
  }

  .trust-strip {
    display: grid;
    gap: 10px;
    justify-content: stretch;
  }

  .trust-item {
    white-space: normal;
  }

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

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

  .report-date-range {
    white-space: normal;
  }

  .report-tabs {
    top: 58px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding-top: 6px;
    border-bottom: 0;
  }

  .tab-button {
    justify-content: center;
    min-height: 44px;
    margin-bottom: 0;
    padding: 8px 6px;
    border: 1px solid var(--borderColor);
    border-radius: var(--radius);
  }

  .tab-button span {
    font-size: 12px;
  }

  .tab-panel-header,
  .review-sticky-controls {
    top: 130px;
    padding: 4px 0 6px;
  }

  .tab-panel-header,
  .review-header,
  .bulk-review-bar,
  .report-download-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .export-action-group {
    width: 100%;
    margin-left: 0;
  }

  .bulk-review-bar {
    grid-template-areas:
      "selected"
      "hint"
      "category-label"
      "select"
      "rule"
      "apply";
  }

  .bulk-review-bar .category-select {
    max-width: none;
    width: 100%;
  }

  .report-download-buttons button,
  .export-action-group button,
  .bulk-review-bar button,
  .workflow-upload-form button {
    width: 100%;
    min-height: 48px;
  }

  .review-status-pill {
    width: fit-content;
  }

  .report-main .table-scroll,
  .table-scroll {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  .report-main .table-scroll table,
  .table-scroll table {
    min-width: 0;
  }

  #reviewTable,
  #reviewTable tbody,
  #reviewTable tr,
  #reviewTable td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #reviewTable thead {
    display: none;
  }

  #reviewTable tr {
    margin-bottom: 12px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  #reviewTable td {
    padding: 6px 0;
    border-bottom: 0;
  }

  #reviewTable td.review-select-cell {
    padding-bottom: 10px;
  }

  #reviewTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #reviewTable .category-select {
    width: 100%;
    min-height: 48px;
  }

  .review-row-checkbox {
    width: 100%;
    min-height: 44px;
  }

  .description-cell {
    max-width: none;
  }

  .description-cell strong {
    white-space: normal;
  }

  #categoriesTable,
  #transactionsTable {
    font-size: 14px;
  }

  #categoriesTable th,
  #categoriesTable td,
  #transactionsTable th,
  #transactionsTable td {
    padding: 10px 6px;
  }
}

@media (max-width: 420px) {
  .workflow-step strong {
    display: none;
  }

  .workflow-step {
    min-height: 40px;
  }

  .workflow-upload-copy h1 {
    font-size: 28px;
  }

  .workflow-upload-form .file-picker,
  .hero-flow #upload-form .file-picker {
    min-height: 160px;
  }

  .workflow-upload-form .file-picker span {
    font-size: 18px;
  }
}

.report-heading h2 {
  margin-bottom: 0;
}

.print-report-header {
  display: none;
}

.print-report-header:not(.hidden) {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  margin: 0 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--borderColor);
  border-bottom: 1px solid var(--borderColor);
}

.print-report-header span {
  display: block;
  color: var(--mutedTextColor);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.print-report-header strong {
  display: block;
  color: var(--textColor);
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.print-header-notes {
  grid-column: 1 / -1;
}

@media print {
  .page-header,
  .hero-flow,
  #message,
  #categoryModal,
  #printHeaderModal,
  .workflow-stepper,
  .report-tabs,
  .tab-panel-header,
  .review-sticky-controls,
  .summary,
  #reviewSummary,
  .report-download-buttons,
  .category-actions,
  .chart-section,
  .top-progress,
  .tab-panel,
  [data-tab-panel='review'],
  #reviewSection,
  #reviewTable,
  .cat-sub-row,
  .cat-transaction-row,
  .description-cell details,
  details,
  .cat-toggle-icon,
  #categoriesTable th:nth-child(3),
  #categoriesTable td:nth-child(3) {
    display: none !important;
  }

  #report {
    display: block;
  }

  [data-tab-panel='categories'] {
    display: block !important;
  }

  #categoriesTable,
  #categoriesTable thead,
  #categoriesTable tbody,
  #categoriesTable tr {
    display: table !important;
    width: 100%;
  }

  #categoriesTable thead {
    display: table-header-group !important;
  }

  #categoriesTable tbody {
    display: table-row-group !important;
  }

  #categoriesTable tr {
    display: table-row !important;
  }

  #categoriesTable th,
  #categoriesTable td {
    display: table-cell !important;
  }

  .report-workspace {
    grid-template-columns: 1fr;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
  }

  body {
    background: white;
    color: black;
  }

  .summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .report-heading h2 {
    font-size: 22px;
  }

  .cat-toggle {
    color: black;
  }

  .print-report-header:not(.hidden) {
    display: grid;
  }

  #categoriesTable .cat-sub-row,
  #categoriesTable .cat-transaction-row,
  #categoriesTable .cat-toggle-icon {
    display: none !important;
  }

  #categoriesTable .cat-group-row {
    display: table-row !important;
  }
}
