:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --surface-strong: #eef3fa;
  --text: #111827;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.16);
  --primary: #1e40af;
  --primary-2: #2563eb;
  --primary-soft: #eaf1ff;
  --accent: #059669;
  --accent-soft: #e8f7ef;
  --warning: #d97706;
  --warning-soft: #fff4d8;
  --danger: #dc2626;
  --danger-soft: #fff1f2;
  --dark: #0f172a;
  --dark-2: #182234;
  --purple: #6d5dfc;
  --purple-soft: #f0edff;
  --orange: #f97316;
  --orange-soft: #fff0e6;
  --gold: #eab308;
  --gold-soft: #fff8dc;
  --green: #16a34a;
  --green-soft: #eaf8ef;
  /* Banknote-inspired currency palette. Keep chart colors tied to real currency visual language. */
  --currency-cny: #b83a3f;
  --currency-usd: #2f6f4f;
  --currency-hkd: #aa4a78;
  --currency-aed: #c7a23a;
  --currency-eur: #315fa8;
  --currency-gbp: #3a4657;
  --currency-fallback-1: #667a9e;
  --currency-fallback-2: #8a70a8;
  --currency-fallback-3: #6f9f90;
  --currency-fallback-4: #a88668;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 44px rgba(15, 23, 42, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-width: 74px;
  --nav-expanded-width: 244px;
  --content-max: 1440px;
  /* Layout rhythm tokens. New pages should use these tokens/classes instead of ad hoc margins. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 40px;
  --space-10: 48px;
  --page-hero-gap: var(--space-8);
  --section-gap: 34px;
  --section-stack-gap: 42px;
  --panel-padding: 22px;
  --panel-heading-gap: 18px;
  --field-gap: var(--space-2);
  --field-padding: var(--space-4);
  --form-grid-gap: var(--space-4);
  --action-gap: 10px;
  --action-top-gap: 18px;
  --table-top-gap: 14px;
  --table-bottom-gap: 26px;
  --body-line: 1.55;
  --subtitle-line: 1.6;
  --label-line: 1.35;
}

body.nav-expanded {
  --nav-width: var(--nav-expanded-width);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.08), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 48%, #eef3fa 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: var(--body-line);
  letter-spacing: 0;
}

body.file-preview-open {
  overflow: hidden;
}

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

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

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

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
}

img,
svg {
  display: block;
}

/* App shell */
.top-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--nav-width);
  background: rgba(248, 251, 255, 0.94);
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 18px 0 48px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(18px);
  transition: width 220ms ease;
}

.top-nav-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px 22px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--dark);
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.nav-toggle span {
  position: absolute;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle span:nth-child(1) {
  transform: translateY(-5px);
}

.nav-toggle span:nth-child(3) {
  transform: translateY(5px);
}

body.nav-expanded .nav-toggle span:nth-child(1) {
  transform: rotate(45deg);
}

body.nav-expanded .nav-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-expanded .nav-toggle span:nth-child(3) {
  transform: rotate(-45deg);
}

.brand {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.brand::before {
  content: "";
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background:
    repeating-linear-gradient(135deg, #0f172a 0 8px, #0f172a 8px 13px, #ffffff 13px 21px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), var(--shadow-sm);
}

.brand span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 160ms ease, width 160ms ease;
}

body.nav-expanded .brand span {
  width: auto;
  opacity: 1;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.nav-links a {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #667085;
  font-size: 14px;
  font-weight: 800;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

body:not(.nav-expanded) .top-nav-inner {
  align-items: center;
  padding-inline: 10px;
}

body:not(.nav-expanded) .brand {
  width: 46px;
  justify-content: center;
  gap: 0;
  padding-inline: 0;
}

body:not(.nav-expanded) .nav-links {
  align-items: center;
}

body:not(.nav-expanded) .nav-links a {
  width: 46px;
  justify-content: center;
  gap: 0;
  padding: 0;
}

body:not(.nav-expanded) .nav-links a.nav-break::before {
  left: 6px;
  right: 6px;
}

.nav-links a.nav-break {
  margin-top: 12px;
}

.nav-links a.nav-break::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 10px;
  right: 10px;
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: #edf4ff;
  border-color: rgba(37, 99, 235, 0.18);
  color: var(--primary);
}

.nav-links a.is-active {
  background: var(--dark);
  border-color: var(--dark);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
}

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

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 160ms ease, width 160ms ease;
}

body.nav-expanded .nav-label {
  width: auto;
  opacity: 1;
}

.page-shell {
  width: min(calc(100% - var(--nav-width)), var(--content-max));
  max-width: var(--content-max);
  min-height: 100vh;
  margin-left: max(
    var(--nav-width),
    calc(var(--nav-width) + (100vw - var(--nav-width) - var(--content-max)) / 2)
  );
  margin-right: auto;
  padding: 32px clamp(28px, 3.4vw, 52px) 80px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}

.app-topbar-date {
  color: var(--primary-2);
  font-size: 13px;
  font-weight: 900;
}

.app-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.notification-menu {
  position: relative;
  width: 48px;
  height: 48px;
  z-index: 170;
}

.notification-button {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--dark);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 240ms cubic-bezier(.18, .9, .28, 1.12);
}

.notification-button svg {
  width: 18px;
  height: 18px;
  transition: transform 180ms ease;
}

.notification-badge {
  display: none;
}

.notification-menu.has-unread .notification-button {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.24);
  color: var(--primary);
  box-shadow:
    0 12px 26px rgba(37, 99, 235, 0.12),
    0 0 0 0 rgba(37, 99, 235, 0.28);
  animation: notification-pulse 2.8s ease-in-out infinite;
}

.notification-menu.has-unread .notification-button svg {
  animation: notification-ring 2.8s ease-in-out infinite;
}

.notification-menu.has-unread .notification-button::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.notification-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  min-height: 48px;
  max-height: 48px;
  display: block;
  visibility: hidden;
  opacity: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  padding: 0;
  z-index: 2;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  transform-origin: top right;
  pointer-events: none;
  transition:
    width 280ms cubic-bezier(.18, .9, .28, 1.08),
    max-height 280ms cubic-bezier(.18, .9, .28, 1.08),
    border-radius 240ms ease,
    padding 240ms ease,
    background 180ms ease,
    box-shadow 240ms ease,
    visibility 0ms linear 180ms;
}

.notification-menu.is-open .notification-panel {
  visibility: visible;
  top: -8px;
  width: min(360px, calc(100vw - 32px));
  max-height: 360px;
  border-radius: 24px;
  padding: 12px 14px 14px;
  pointer-events: auto;
  transition:
    width 300ms cubic-bezier(.18, .9, .28, 1.08),
    max-height 300ms cubic-bezier(.18, .9, .28, 1.08),
    border-radius 220ms ease,
    padding 220ms ease,
    background 180ms ease,
    box-shadow 240ms ease,
    visibility 0ms linear 0ms;
}

.notification-menu.is-open .notification-button {
  opacity: 1;
  transform: scale(0.92);
  pointer-events: none;
}

.notification-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 0 0 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 180ms ease;
}

.notification-menu.is-open .notification-panel-head,
.notification-menu.is-open .notification-list,
.notification-menu.is-open .notification-empty,
.notification-menu.is-open .notification-panel-foot {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 120ms;
}

.notification-panel-head > div {
  display: grid;
  gap: 2px;
}

.notification-panel-head strong {
  font-size: 15px;
}

.notification-panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notification-close {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.notification-close:hover {
  background: transparent;
  color: var(--text);
  transform: none;
}

.notification-list {
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 180ms ease;
}

.notification-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-soft);
}

.notification-item:hover {
  background: var(--primary-soft);
}

.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary-2);
}

.notification-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.notification-item small {
  color: var(--muted);
  font-size: 12px;
}

.notification-item[hidden] {
  display: none;
}

.notification-empty {
  padding: 18px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 180ms ease;
}

.notification-panel-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 180ms ease;
}

.notification-read-all {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
  font-size: 12px;
}

.notification-read-all:hover {
  background: #dbeafe;
  color: var(--primary);
  transform: none;
}

.notification-read-all:disabled {
  opacity: 0.48;
  cursor: default;
}

.app-user-card,
.dashboard-user-card {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-user-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  font-weight: 900;
}

.dashboard-user-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.dashboard-user-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* Typography and page headers */
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: var(--space-3);
  color: var(--text);
  font-size: clamp(42px, 5vw, 64px);
  line-height: 0.98;
  font-weight: 950;
  letter-spacing: 0;
}

h2,
.section-title {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.18;
  font-weight: 950;
}

h3 {
  margin-bottom: var(--space-2);
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.hero,
.dashboard-hero,
.app-page-hero,
.result-hero {
  margin-bottom: var(--page-hero-gap);
}

.app-page-hero,
.result-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
}

.page-subtitle,
.dashboard-hero p,
.app-page-hero p,
.result-hero p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: var(--subtitle-line);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-page-hero-card,
.result-status {
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: var(--space-4) var(--panel-heading-gap);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.app-page-hero-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.app-page-hero-card strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

/* Panels and cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 0.9fr);
  gap: var(--space-5);
  align-items: start;
}

.workflow-panel,
.shortcut-panel {
  grid-column: 1;
}

.finance-panel {
  grid-column: 2;
  grid-row: span 2;
}

.dashboard-panel,
.data-panel,
.workspace-form,
.upload-side-panel,
.ledger-toolbar,
.card,
body > .page-shell > ul {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
}

.dashboard-panel,
.data-panel,
.workspace-form,
.upload-side-panel,
.ledger-toolbar,
.card,
body > .page-shell > ul {
  padding: var(--panel-padding);
}

.card > h2:first-child,
.data-panel > h2:first-child,
.workspace-form > h2:first-child {
  margin-bottom: var(--panel-heading-gap);
}

.card > h2:first-child + .review-form-grid,
.data-panel > h2:first-child + .review-form-grid,
.workspace-form > h2:first-child + .review-form-grid {
  margin-top: 0;
}

.card > .review-form-grid + .review-form-grid,
.data-panel > .review-form-grid + .review-form-grid,
.workspace-form > .review-form-grid + .review-form-grid {
  margin-top: var(--form-grid-gap);
}

.page-shell > h1 {
  margin-bottom: var(--space-5);
}

.page-shell > h1 + .page-subtitle {
  margin-top: calc(var(--space-2) * -1);
  margin-bottom: var(--page-hero-gap);
}

.page-shell > .hero,
.page-shell > .dashboard-hero,
.page-shell > .app-page-hero,
.page-shell > .result-hero,
.page-shell > .system-status-hero {
  margin-bottom: var(--page-hero-gap);
}

.page-shell > .metric-grid,
.page-shell > .result-summary-grid,
.page-shell > .health-grid,
.page-shell > .system-config-grid,
.page-shell > .ai-log-overview,
.page-shell > .page-actions,
.page-shell > .page-workflow-actions,
.page-shell > .ledger-summary-section,
.page-shell > .card,
.page-shell > .data-panel,
.page-shell > table {
  margin-bottom: var(--section-gap);
}

.page-shell > .card + .card,
.page-shell > .data-panel + .data-panel,
.page-shell > table + table,
.page-shell > table + h2,
.page-shell > .data-panel + h2,
.page-shell > .card + h2,
.page-shell > .metric-grid + h2,
.page-shell > .result-summary-grid + h2 {
  margin-top: var(--section-stack-gap);
}

.page-shell > h2 {
  margin: var(--space-9) 0 var(--space-4);
}

.page-shell > h2 + table,
.page-shell > h2 + .data-panel,
.page-shell > h2 + .metric-grid {
  margin-top: 0;
}

.data-panel > table,
.card > table,
.result-detail-card > table {
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* Reusable page composition helpers for new pages. */
.page-stack {
  display: grid;
  gap: var(--section-gap);
}

.content-stack {
  display: grid;
  gap: var(--form-grid-gap);
}

.section-stack {
  display: grid;
  gap: var(--section-stack-gap);
}

.section-heading {
  display: grid;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: var(--subtitle-line);
}

.data-panel .panel-heading h2,
.data-panel .section-title {
  margin: 0;
}

.workspace-form,
.upload-form,
.manual-upload-form {
  display: grid;
  gap: var(--form-grid-gap);
}

.panel-heading,
.form-section-heading,
.log-rate-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--panel-heading-gap);
  margin-bottom: var(--panel-heading-gap);
}

.workspace-form > .form-section-heading,
.workspace-form > .form-meta,
.workspace-form > .upload-form-grid,
.workspace-form > .review-form-grid,
.workspace-form > .upload-picker-card,
.workspace-form > .manual-fields,
.workspace-form > .form-actions {
  margin: 0;
}

.panel-heading span,
.form-section-heading span,
.log-rate-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.optional-fields-panel {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.optional-fields-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.optional-fields-panel > summary::-webkit-details-marker {
  display: none;
}

.optional-summary-copy {
  display: grid;
  gap: 4px;
}

.optional-summary-copy strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 950;
}

.optional-summary-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

.optional-summary-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-strong);
  font-size: 13px;
  font-weight: 950;
}

.optional-summary-indicator::after {
  content: "展开";
}

.optional-fields-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.optional-fields-panel[open] .optional-summary-indicator {
  color: var(--text);
  background: #f8fafc;
}

.optional-fields-panel[open] .optional-summary-indicator::after {
  content: "收起";
}

.optional-fields-grid {
  padding: 18px;
}

.metric-grid,
.dashboard-status-grid,
.finance-grid,
.result-summary-grid,
.ledger-summary-strip {
  display: grid;
  gap: 16px;
}

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

.metric-grid,
.result-summary-grid,
.ledger-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric-grid.finance-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.metric-card,
.metric,
.compact-metric,
.finance-overview-card {
  position: relative;
  min-height: 128px;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.metric-label,
.metric-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
}

.metric-value {
  margin-top: 14px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.small-value {
  font-size: 20px;
  line-height: 1.2;
}

.status-metric {
  padding-top: 54px;
}

.status-metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  background: var(--tone, var(--primary-2));
}

.status-metric .metric-label {
  position: absolute;
  top: 9px;
  left: 18px;
  right: 18px;
  color: #fff;
}

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

.metric-trend {
  min-width: 92px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.metric-trend.trend-up,
.metric-trend.up,
.metric-trend.positive {
  background: var(--accent-soft);
  color: #047857;
}

.metric-trend.trend-down,
.metric-trend.down,
.metric-trend.negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.trend-arrow {
  font-size: 14px;
  line-height: 1;
  font-weight: 950;
}

.metric-change {
  width: 92px;
  margin: 6px 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.tone-blue,
.status-metric.tone-blue,
.finance-tone-invoice {
  --tone: linear-gradient(90deg, #5f8dff, #245bff);
  --tone-solid: #245bff;
  --tone-alt: #7c3aed;
}

.tone-orange,
.status-metric.tone-orange,
.finance-tone-payment {
  --tone: linear-gradient(90deg, #ffad7a, #ff7a45);
  --tone-solid: #ff7a45;
  --tone-alt: #e85d75;
}

.tone-yellow,
.tone-gold,
.status-metric.tone-yellow,
.status-metric.tone-gold {
  --tone: linear-gradient(90deg, #ffe18a, #f2c84d);
}

.tone-purple,
.status-metric.tone-purple {
  --tone: linear-gradient(90deg, #a78bfa, #694cff);
}

.tone-green,
.status-metric.tone-green,
.finance-tone-receipt {
  --tone: linear-gradient(90deg, #87e8ad, #31bf6b);
  --tone-solid: #31bf6b;
  --tone-alt: #14b8a6;
}

.tone-dark,
.status-metric.tone-dark,
.finance-tone-net {
  --tone: linear-gradient(90deg, #40516f 0%, #182234 52%, #050b16 100%);
  --tone-solid: #111827;
  --tone-alt: #4b5563;
}

.finance-overview-card {
  min-height: 150px;
  isolation: isolate;
  background: #fff;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.finance-overview-card::before,
.finance-overview-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 260ms ease,
    transform 420ms cubic-bezier(.18, .9, .28, 1.12);
}

.finance-overview-card::before {
  background:
    radial-gradient(circle at 18% 16%,
      color-mix(in srgb, var(--tone-solid, #2563eb) 34%, transparent) 0 16%,
      transparent 44%),
    radial-gradient(circle at 76% 84%,
      color-mix(in srgb, var(--tone-alt, var(--tone-solid, #2563eb)) 30%, transparent) 0 18%,
      transparent 48%),
    conic-gradient(from 145deg at 52% 46%,
      color-mix(in srgb, var(--tone-solid, #2563eb) 18%, transparent),
      rgba(255, 255, 255, 0.66),
      color-mix(in srgb, var(--tone-alt, var(--tone-solid, #2563eb)) 22%, transparent),
      rgba(255, 255, 255, 0.62),
      color-mix(in srgb, var(--tone-solid, #2563eb) 16%, transparent));
  filter: saturate(.94);
  transform: translate3d(-6%, 5%, 0) scale(1.18) rotate(-4deg);
}

.finance-overview-card::after {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(15, 23, 42, .11) 0 1px, transparent 1.2px),
    radial-gradient(circle at 72% 64%, rgba(15, 23, 42, .08) 0 1px, transparent 1.25px);
  background-size: 12px 12px, 17px 17px;
  mix-blend-mode: multiply;
  transform: translate3d(0, 0, 0);
}

.finance-overview-card:hover {
  transform: translateY(-2px) scale(1.012);
  border-color: color-mix(in srgb, var(--tone-solid, #2563eb) 22%, rgba(15, 23, 42, 0.08));
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.10);
}

.finance-overview-card:hover::before {
  opacity: .95;
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  transition-duration: 420ms;
  transition-timing-function: cubic-bezier(.18, .9, .28, 1.12);
}

.finance-overview-card:hover::after {
  opacity: .2;
  transition-duration: 420ms;
  transition-timing-function: cubic-bezier(.18, .9, .28, 1.12);
}

.finance-overview-card > * {
  position: relative;
  z-index: 1;
}

@keyframes notification-pulse {
  0%,
  68%,
  100% {
    box-shadow:
      0 12px 26px rgba(37, 99, 235, 0.12),
      0 0 0 0 rgba(37, 99, 235, 0.24);
  }

  12% {
    box-shadow:
      0 12px 26px rgba(37, 99, 235, 0.16),
      0 0 0 8px rgba(37, 99, 235, 0.08);
  }
}

@keyframes notification-ring {
  0%,
  68%,
  100% {
    transform: rotate(0deg);
  }

  5% {
    transform: rotate(-12deg);
  }

  10% {
    transform: rotate(10deg);
  }

  15% {
    transform: rotate(-8deg);
  }

  20% {
    transform: rotate(6deg);
  }

  25% {
    transform: rotate(0deg);
  }
}

.finance-overview-card .metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.finance-overview-card .metric-value {
  max-width: 100%;
  font-size: clamp(27px, 2vw, 34px);
  white-space: nowrap;
  overflow-wrap: normal;
}

.finance-overview-card .metric-label::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tone-solid, var(--primary-2));
}

.metric-currency-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.currency-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.currency-breakdown-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--currency-color);
  font-weight: 850;
  line-height: 1.2;
}

.currency-breakdown-token i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--currency-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--currency-color) 10%, transparent);
}

.currency-breakdown-token[data-currency="AED"],
.currency-share-item[data-currency="AED"] {
  color: var(--currency-aed);
}

.currency-breakdown-token[data-currency="AED"] i,
.currency-share-item[data-currency="AED"] i {
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--currency-aed) 14%, transparent),
    0 0 14px color-mix(in srgb, #f8df89 34%, transparent);
}

.currency-donut-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 24px;
  margin-top: 30px;
}

.currency-donut-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.currency-donut {
  position: relative;
  --donut-angle: 0deg;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.04),
    0 10px 24px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  animation: currency-donut-pop 620ms cubic-bezier(.18, .9, .28, 1.12) both;
}

.currency-donut-card:nth-child(2) .currency-donut {
  animation-delay: 90ms;
}

.currency-donut-card:nth-child(3) .currency-donut {
  animation-delay: 160ms;
}

.currency-donut-card:nth-child(4) .currency-donut {
  animation-delay: 230ms;
}

.currency-donut::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from var(--donut-angle), var(--donut));
  -webkit-mask: radial-gradient(farthest-side, transparent 55%, #000 57% 100%);
  mask: radial-gradient(farthest-side, transparent 55%, #000 57% 100%);
  z-index: 1;
  animation: currency-donut-color-spin 1180ms cubic-bezier(.2, .8, .2, 1) both;
}

.currency-donut::after {
  content: "";
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface);
  pointer-events: none;
  z-index: 2;
}

.currency-donut-card:nth-child(2) .currency-donut::before {
  animation-delay: 90ms;
}

.currency-donut-card:nth-child(3) .currency-donut::before {
  animation-delay: 160ms;
}

.currency-donut-card:nth-child(4) .currency-donut::before {
  animation-delay: 230ms;
}

.currency-donut-center {
  position: absolute;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 3;
}

.currency-donut-center strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
  font-weight: 950;
}

.currency-share-legend,
.chart-legend {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.currency-share-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--currency-color, var(--muted));
}

.currency-share-item i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--currency-color, currentColor);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--currency-color, currentColor) 10%, transparent);
}

@keyframes currency-donut-pop {
  from {
    opacity: 0;
    transform: scale(0.86) rotate(-18deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes currency-donut-color-spin {
  0% {
    --donut-angle: -280deg;
    opacity: .15;
  }

  18%,
  70% {
    opacity: 1;
  }

  100% {
    --donut-angle: 0deg;
    opacity: 1;
  }
}

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

@supports not (background: conic-gradient(from 10deg, red, blue)) {
  .currency-donut::before {
    background: conic-gradient(var(--donut));
    animation: none;
  }
}

.currency-share-empty {
  color: var(--muted-2);
}

/* Links, actions, and quick entries */
.quick-grid,
.page-workflow-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quick-card,
.compact-quick-card,
.page-workflow-actions a {
  position: relative;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.quick-card::after,
.page-workflow-actions a::after {
  content: ">";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease;
}

.quick-card:hover,
.page-workflow-actions a:hover {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(37, 99, 235, 0.22);
}

.quick-card:hover::after,
.page-workflow-actions a:hover::after {
  opacity: 1;
  transform: translateX(0);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

button,
.btn,
input[type="submit"],
.quick-submit-button,
.floating-upload {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

button:hover,
.btn:hover,
input[type="submit"]:hover,
.quick-submit-button:hover,
.floating-upload:hover {
  background: var(--dark-2);
  color: #fff;
  transform: translateY(-1px);
}

.secondary-btn,
.action-link,
.export-link,
td a,
p > a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 900;
}

.secondary-btn:hover,
.action-link:hover,
.export-link:hover,
td a:hover,
p > a:hover {
  background: #dbe8ff;
  color: var(--primary);
}

.subtle-action {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

.subtle-action:hover {
  background: #ffe1e5 !important;
}

.floating-upload {
  position: fixed;
  right: 34px;
  bottom: 34px;
  z-index: 90;
  min-width: 118px;
}

.floating-home {
  display: none;
}

.result-continue-upload {
  z-index: 95;
}

/* Forms */
.upload-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(300px, 0.42fr);
  gap: var(--panel-padding);
  align-items: start;
}

.upload-layout-primary {
  grid-template-columns: minmax(0, 820px);
}

form {
  margin: 0;
}

.upload-form-grid,
.review-form-grid,
.ledger-filter-form,
.filter-bar,
.filter-controls {
  display: grid;
  gap: var(--form-grid-gap);
}

.upload-form-grid,
.review-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-field {
  grid-column: 1 / -1;
}

label,
.filter-bar label,
.filter-search,
.filter-controls label,
.review-field,
.upload-picker-card,
.side-info-card,
.side-flow-card {
  display: grid;
  gap: var(--field-gap);
}

.review-field,
.upload-picker-card,
.side-info-card,
.side-flow-card,
.form-meta {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  padding: var(--field-padding);
}

label,
.filter-bar label,
.filter-search,
.filter-controls label,
.review-field span,
.upload-picker-title {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
  line-height: var(--label-line);
}

.filter-bar {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  column-gap: var(--space-4);
  row-gap: var(--space-4);
  margin: 0 0 var(--space-5);
}

.filter-bar > label {
  min-width: 0;
  margin: 0;
}

.filter-bar > button,
.filter-bar > .btn,
.filter-bar > .secondary-btn,
.filter-bar > .action-link {
  justify-self: start;
  align-self: end;
  width: auto;
  min-width: 126px;
  min-height: 44px;
  height: 44px;
  border-radius: 999px;
  padding: 0 20px;
  font-size: 14px;
  line-height: 1;
}

.filter-bar + .page-subtitle,
.filter-bar + .muted-text {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.required-label::after {
  content: "*";
  display: inline-block;
  margin-left: 4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  vertical-align: text-top;
}

.spend-approval-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.spend-approval-hint.muted {
  background: #f1f5f9;
  color: #64748b;
}

.spend-approval-hint.ok {
  background: var(--accent-soft);
  color: #047857;
}

.spend-approval-hint.warn {
  background: var(--warning-soft);
  color: #9a5b00;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type="file"] {
  min-height: auto;
  padding: 12px;
  cursor: pointer;
}

input[type="date"] {
  color-scheme: light;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.68;
}

input[type="date"]:focus::-webkit-calendar-picker-indicator,
input[type="date"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

input[type="radio"],
input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  accent-color: var(--primary-2);
  box-shadow: none;
  cursor: pointer;
}

input[type="checkbox"] {
  border-radius: 5px;
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.review-field > label:has(input[type="radio"]),
.review-field > label:has(input[type="checkbox"]) {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  cursor: pointer;
}

.review-field > label:has(input[type="radio"]:checked),
.review-field > label:has(input[type="checkbox"]:checked) {
  border-color: rgba(37, 99, 235, 0.28);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.form-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.form-meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.form-meta-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.form-meta-note,
.upload-picker-desc,
.selected-file-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-actions,
.workflow-actions,
.review-form-actions,
.result-actions,
.result-actions-flat,
.filter-actions,
.ledger-export-actions,
.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--action-gap);
}

.form-actions,
.workflow-actions,
.review-form-actions,
.result-actions,
.result-actions-flat {
  margin-top: var(--action-top-gap);
}

.result-actions,
.result-actions-flat {
  margin-bottom: var(--section-gap);
}

.result-actions > form,
.result-actions-flat > form {
  margin: 0;
  display: inline-flex;
}

.spend-request-actions {
  margin-top: 0;
  margin-bottom: var(--space-7);
}

.spend-request-actions + .card {
  margin-top: 0;
}

.filter-actions,
.ledger-export-actions {
  gap: var(--space-3);
}

.ledger-export-actions {
  margin-top: var(--space-2);
}

td .action-link,
td button.action-link,
.action-group .action-link,
.action-group button,
.ledger-actions .action-link,
.ledger-actions button,
.file-actions a {
  min-width: 72px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.ledger-file-cell .file-actions a,
.cell-sub-actions .file-actions a {
  min-width: 72px;
}

.workflow-actions {
  gap: var(--space-3);
  margin-top: 0;
}

.manual-fields {
  display: grid;
  gap: var(--form-grid-gap);
}

.manual-upload-form .review-field:hover,
.manual-upload-form .upload-picker-card:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
  transform: none;
}

.manual-upload-form select:hover {
  border-color: var(--line-strong);
  box-shadow: none;
}

.form-actions > .quick-submit-button,
.form-actions > .secondary-btn,
.form-actions > .quick-card,
.form-actions > .compact-quick-card,
.workflow-actions > .quick-submit-button,
.workflow-actions > .secondary-btn,
.workflow-actions > .quick-card,
.workflow-actions > .compact-quick-card,
.review-form-actions > button,
.review-form-actions > .btn,
.review-form-actions > .secondary-btn,
.review-form-actions > .quick-card,
.result-actions > .btn,
.result-actions > button,
.result-actions > form > button,
.result-actions > .secondary-btn,
.result-actions > .quick-card,
.result-actions-flat > .btn,
.result-actions-flat > button,
.result-actions-flat > form > button,
.result-actions-flat > .secondary-btn,
.result-actions-flat > .quick-card,
.filter-actions > button,
.filter-actions > .btn,
.filter-actions > .secondary-btn,
.filter-actions > .action-link {
  width: auto;
  min-width: 126px;
  min-height: 44px;
  height: 44px;
  border-radius: 999px;
  padding: 0 20px;
  font-size: 14px;
  line-height: 1;
}

.form-actions > .quick-card,
.form-actions > .compact-quick-card,
.workflow-actions > .quick-card,
.workflow-actions > .compact-quick-card,
.review-form-actions > .quick-card,
.result-actions > .quick-card {
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transform: none;
}

.form-actions > .quick-card::after,
.form-actions > .compact-quick-card::after,
.workflow-actions > .quick-card::after,
.workflow-actions > .compact-quick-card::after,
.review-form-actions > .quick-card::after,
.result-actions > .quick-card::after {
  display: none;
}

.form-actions > .quick-card:hover,
.form-actions > .compact-quick-card:hover,
.workflow-actions > .quick-card:hover,
.workflow-actions > .compact-quick-card:hover,
.review-form-actions > .quick-card:hover,
.result-actions > .quick-card:hover {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.upload-side-panel {
  display: grid;
  gap: var(--form-grid-gap);
  align-content: start;
}

.upload-side-panel .side-info-card,
.upload-side-panel .side-flow-card {
  margin: 0;
}

.side-info-card strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

.side-info-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.side-flow-card ol,
.risk-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-soft);
  line-height: 1.75;
}

.manual-fields[hidden] {
  display: none !important;
}

.review-exception-actions {
  margin-top: 18px;
  padding: 0;
  overflow: hidden;
  border-color: rgba(220, 38, 38, 0.12);
  box-shadow: var(--shadow-xs);
}

.review-exception-actions summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  padding: 14px 18px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.88), rgba(255, 255, 255, 0.96));
}

.review-exception-actions summary::-webkit-details-marker {
  display: none;
}

.review-exception-actions summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  box-shadow: var(--shadow-xs);
  transition: transform 180ms ease;
}

.review-exception-actions[open] summary::after {
  content: "-";
  transform: rotate(180deg);
}

.review-exception-actions summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.exception-action-body {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-top: 1px solid rgba(220, 38, 38, 0.1);
}

.exception-action-body form {
  display: grid;
  gap: 12px;
}

.exception-action-body .subtle-action {
  justify-self: start;
}

/* Tables and data views */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: var(--table-top-gap) 0 var(--table-bottom-gap);
}

th,
td {
  border: 0 !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f6fb;
  color: #5f6f86;
  font-size: 12px;
  font-weight: 950;
}

td {
  color: var(--text);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0 !important;
}

tbody tr:hover td {
  background: #fbfdff;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
  font-size: 12px;
}

.operation-log-table {
  table-layout: fixed;
}

.operation-log-table th:nth-child(1),
.operation-log-table td:nth-child(1) {
  width: 52px;
}

.operation-log-table th:nth-child(2),
.operation-log-table td:nth-child(2) {
  width: 150px;
}

.operation-log-table th:nth-child(3),
.operation-log-table td:nth-child(3) {
  width: 130px;
}

.operation-log-table th:nth-child(4),
.operation-log-table td:nth-child(4) {
  width: 128px;
}

.operation-log-table th:nth-child(5),
.operation-log-table td:nth-child(5) {
  width: 132px;
}

.operation-log-table th:nth-child(7),
.operation-log-table td:nth-child(7) {
  width: 96px;
}

.operation-log-table .note-cell {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.55;
  word-break: normal;
  overflow-wrap: anywhere;
}

.operation-log-table .selected-row td {
  background: #f8fbff;
  box-shadow: inset 0 1px 0 #dbeafe, inset 0 -1px 0 #dbeafe;
}

.log-empty-detail {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.operation-log-detail-panel {
  display: grid;
  gap: 16px;
}

.operation-log-detail-panel .detail-table {
  max-width: none;
}

.log-detail-panel-body {
  display: grid;
  gap: 10px;
}

.log-detail-panel-body h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.log-detail-panel-pre {
  width: 100%;
  max-height: 420px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0f172a;
  color: #e5edf7;
  padding: 14px 16px;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.6;
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
  border-color: #9ec5ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  background: #f8fafc;
  color: var(--muted);
}

.custom-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transition: transform 160ms ease;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 4px;
}

.custom-select-option {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: color 120ms ease, background 120ms ease;
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
  outline: none;
  box-shadow: none;
  transform: none;
}

.custom-select-option.selected {
  color: var(--accent);
  background: transparent;
}

.custom-select-option.selected:hover,
.custom-select-option.selected:focus {
  background: rgba(37, 99, 235, 0.12);
  color: var(--text);
}

.custom-select-option:active {
  transform: none !important;
  box-shadow: none !important;
}

.custom-select-option:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.spend-trace-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.trace-dot {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 0 0 4px #f1f5f9;
}

.trace-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trace-body strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.trace-body span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.trace-body .trace-detail {
  color: var(--text-soft);
  font-weight: 800;
}

.trace-step.trace-done .trace-dot {
  background: #10b981;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.trace-step.trace-current {
  border-color: #93c5fd;
  background: #f8fbff;
}

.trace-step.trace-current .trace-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px #dbeafe;
}

.trace-step.trace-warn {
  border-color: #f4c86b;
  background: #fffaf0;
}

.trace-step.trace-warn .trace-dot {
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}

.spend-variance-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #f8fafc;
}

.spend-variance-card strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.spend-variance-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.spend-variance-card.variance-ok {
  border-color: #b7e7d3;
  background: var(--accent-soft);
}

.spend-variance-card.variance-warn {
  border-color: #f4c86b;
  background: var(--warning-soft);
}

.spend-variance-card.variance-muted {
  background: #f1f5f9;
}

.compact-actions {
  margin-top: 12px;
}

.detail-table {
  max-width: 920px;
}

.detail-table th:first-child,
.detail-table td:first-child {
  width: 150px;
  color: var(--muted);
  font-weight: 900;
}

.ledger-filter-form {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "search search"
    "controls actions";
  align-items: end;
  column-gap: 18px;
  row-gap: 18px;
}

.ledger-filter-form .filter-search {
  grid-area: search;
}

.ledger-filter-form .filter-controls {
  grid-area: controls;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  min-width: 0;
}

.ledger-filter-form .filter-controls label {
  min-width: 0;
}

.ledger-filter-form .filter-actions {
  grid-area: actions;
  justify-content: flex-end;
  min-width: 260px;
}

.ledger-export-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ledger-summary-section {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.ledger-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ledger-summary-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ledger-summary-link {
  flex: 0 0 auto;
  min-width: 150px;
  box-shadow: var(--shadow-sm);
}

.ledger-summary-section .ledger-summary-strip {
  margin: 0;
}

.ledger-toolbar {
  display: grid;
  gap: 18px;
  margin-bottom: 38px;
}

.ledger-export-actions {
  padding-top: 2px;
  margin-bottom: 0;
}

.ledger-toolbar + h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

.ledger-table {
  table-layout: fixed;
}

.ledger-table th:nth-child(1),
.ledger-table td:nth-child(1) {
  width: 112px;
}

.ledger-table th:nth-child(2),
.ledger-table td:nth-child(2) {
  width: 210px;
}

.ledger-table th:nth-child(3),
.ledger-table td:nth-child(3) {
  width: 168px;
}

.ledger-table th:nth-child(4),
.ledger-table td:nth-child(4) {
  width: 150px;
}

.ledger-table th:nth-child(5),
.ledger-table td:nth-child(5) {
  width: 250px;
}

.ledger-table th:nth-child(6),
.ledger-table td:nth-child(6) {
  width: 160px;
}

.ledger-table th:nth-child(7),
.ledger-table td:nth-child(7) {
  width: 96px;
}

.ledger-money-cell .cell-title {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-stack {
  display: grid;
  gap: 3px;
  line-height: 1.28;
}

.cell-title,
.primary-text {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.cell-meta,
.muted-text,
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.truncate-cell,
.note-cell,
.narrow-cell {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.file-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-action-form,
table form {
  display: inline-flex;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hidden-action-form {
  display: none !important;
}

.ledger-actions {
  display: grid;
  grid-template-columns: 72px;
  gap: 8px;
}

/* AI logs overview */
.ai-log-overview {
  display: grid;
  gap: 22px;
}

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

.chart-card {
  min-height: 142px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
}

.log-rate-card {
  min-height: 120px;
}

.log-rate-heading,
.distribution-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.log-rate-heading span,
.distribution-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.log-rate-heading strong,
.distribution-meta strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.bullet-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bullet-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-2), #4f46e5);
}

.secondary-fill {
  background: linear-gradient(90deg, #60a5fa, #22c55e);
}

.log-rate-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.distribution-row {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

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

.distribution-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.mini-bar-chart {
  min-height: 150px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  padding-top: 6px;
}

.mini-bar-item {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.mini-bar-track {
  width: 100%;
  height: 92px;
  display: flex;
  align-items: end;
  border-radius: 12px;
  background: var(--surface-strong);
  overflow: hidden;
}

.mini-bar-track span {
  width: 100%;
  min-height: 8px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #60a5fa, var(--primary-2));
}

.mini-bar-item strong,
.mini-bar-item em {
  font-size: 11px;
  font-style: normal;
  line-height: 1.1;
}

.log-line-card {
  grid-column: 1 / -1;
}

.log-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.log-line-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.log-line-chart {
  position: relative;
  min-height: 190px;
  padding: 4px 0 18px;
}

.log-line-chart svg {
  width: 100%;
  height: 178px;
  overflow: visible;
}

.log-line-chart .grid-line {
  stroke: rgba(15, 23, 42, 0.08);
  stroke-width: 1;
}

.log-line-chart .trend-area {
  fill: rgba(37, 99, 235, 0.10);
}

.log-line-chart .trend-line {
  fill: none;
  stroke: var(--primary-2);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 10px 16px rgba(37, 99, 235, 0.18));
}

.trend-markers circle {
  fill: #fff;
  stroke: var(--primary-2);
  stroke-width: 3;
}

.trend-markers text {
  fill: var(--text);
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
}

.log-line-labels {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
}

.log-line-labels span {
  position: absolute;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.trace-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.ledger-trace-combo {
  display: grid;
  gap: 10px;
}

/* Status and badges */
.status-badge,
.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pending,
.status-progress {
  background: var(--warning-soft);
  color: #9a5b00;
}

.status-done {
  background: var(--accent-soft);
  color: #047857;
}

.status-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-muted {
  background: #eef2f7;
  color: #475569;
}

.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.status-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
}

/* System status health view */
.system-status-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.overall-health-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.overall-health-card strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
}

.overall-health-card p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.health-card {
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.health-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.health-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--health-color, var(--muted-2));
  box-shadow: 0 0 0 5px var(--health-soft, rgba(148, 163, 184, 0.16));
}

.health-priority {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.health-card h3 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.health-card strong {
  color: var(--health-text, var(--text));
  font-size: 18px;
  line-height: 1.2;
  font-weight: 950;
}

.health-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.health-ok {
  --health-color: #16a34a;
  --health-soft: #dcfce7;
  --health-text: #047857;
}

.health-warn {
  --health-color: #d97706;
  --health-soft: #fef3c7;
  --health-text: #a15c00;
}

.health-bad {
  --health-color: #dc2626;
  --health-soft: #fee2e2;
  --health-text: #b91c1c;
}

.system-config-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.system-config-grid .metric-card {
  min-height: 104px;
}

.status-chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 950;
}

.status-chip.status-ok {
  background: var(--accent-soft);
  color: #047857;
}

.status-chip.status-warn {
  background: var(--warning-soft);
  color: #9a5b00;
}

/* Ledger summary rhythm */
.summary-section {
  margin-top: 34px;
}

.summary-section + .summary-section {
  margin-top: 42px;
  padding-top: 4px;
}

.summary-section .section-title {
  margin-bottom: 18px;
}

.summary-section .metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.summary-section .compact-metric {
  min-height: 122px;
  padding: 18px 20px;
}

.summary-section .compact-metric .metric-label {
  margin-bottom: 18px;
  line-height: 1.35;
}

.summary-section .compact-metric .metric-value {
  margin-top: 0;
}

.summary-section .detail-grid {
  gap: 24px;
  margin-top: 18px;
}

.summary-section .detail-grid h3 {
  margin-bottom: 14px;
}

.summary-section .compact-table {
  margin-top: 0;
}

/* Ledger edit pages */
.ledger-edit-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}

.ledger-edit-form {
  gap: 22px;
}

.ledger-edit-subheading {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ledger-edit-actions {
  padding-top: 2px;
}

/* Review/detail pages */
.review-top-grid,
.review-compare-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.two-column-info {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.info-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.info-list dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.party-match-card {
  display: grid;
  gap: 18px;
  margin-bottom: 34px;
}

.party-match-copy {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.party-match-copy p {
  margin: 0;
}

.inline-party-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 0.8fr);
  gap: 16px;
  align-items: end;
}

.inline-party-form button {
  justify-self: start;
  grid-column: 1 / -1;
  margin-top: 2px;
}

pre {
  max-width: 100%;
  overflow: auto;
  border: 0 !important;
  border-radius: 18px;
  background: #111827 !important;
  color: #f8fafc;
  padding: 16px !important;
  font-size: 13px;
  line-height: 1.6;
}

/* Raw document delete confirmation */
.delete-confirm-hero {
  align-items: center;
}

.delete-confirm-status {
  min-width: 210px;
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.delete-confirm-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.delete-summary-panel {
  display: grid;
  gap: 20px;
  margin-bottom: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}

.delete-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.delete-summary-head h2 {
  margin-bottom: 4px;
}

.delete-summary-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.delete-danger-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

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

.delete-info-item {
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.delete-info-item.wide {
  grid-column: span 2;
}

.delete-info-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.delete-info-item strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.38;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.delete-info-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.delete-info-item.strong {
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.92), #fff);
  border-color: rgba(37, 99, 235, 0.14);
}

.delete-info-item.file-name strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.delete-info-item.file-status.ok {
  border-color: rgba(22, 163, 74, 0.18);
  background: linear-gradient(135deg, rgba(232, 247, 239, 0.86), #fff);
}

.delete-info-item.file-status.warn {
  border-color: rgba(217, 119, 6, 0.18);
  background: linear-gradient(135deg, rgba(255, 244, 216, 0.86), #fff);
}

.delete-info-item.file-status.danger {
  border-color: rgba(220, 38, 38, 0.2);
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.92), #fff);
}

.delete-review-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.delete-review-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.delete-review-chip.muted {
  background: var(--surface-strong);
  color: var(--muted);
}

.delete-impact-panel {
  margin-bottom: 20px;
}

.delete-impact-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 2px 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.delete-impact-list li {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: transparent;
}

.delete-impact-list li:last-child {
  border-bottom: 0;
}

.delete-impact-list strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.delete-impact-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.delete-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.danger-button {
  min-width: 126px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 14px 28px rgba(220, 38, 38, 0.18);
}

.danger-button:hover {
  background: #b91c1c;
  color: #fff;
}

/* File preview */
.file-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.58);
}

.file-preview-overlay.is-open {
  display: flex;
}

.file-preview-dialog {
  width: min(1100px, 96vw);
  height: min(780px, 92vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.file-preview-close {
  justify-self: end;
  width: 42px;
  height: 42px;
  margin: 12px 12px 0 0;
  padding: 0;
}

.file-preview-title {
  padding: 0 18px 12px;
  color: var(--text);
  font-weight: 900;
}

.file-preview-body {
  min-height: 0;
  background: #0b1020;
}

.file-preview-image,
.file-preview-frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
}

.pdf-preview-wrap {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.pdf-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.pdf-page-btn {
  min-height: 32px;
  padding: 6px 12px;
}

.pdf-page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.pdf-page-status {
  min-width: 96px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.pdf-open-link {
  margin-left: auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.pdf-preview-frame {
  min-height: 360px;
}

/* Generic fallbacks */
body > .page-shell > ul {
  list-style-position: inside;
}

body > .page-shell > ul li {
  margin: 4px 0;
}

.page-shell p {
  color: var(--text-soft);
}

.page-shell p > a {
  margin: 2px 4px 2px 0;
}

/* Responsive */
@media (max-width: 1180px) {
  .dashboard-grid,
  .upload-layout {
    grid-template-columns: 1fr;
  }

  .health-grid,
  .system-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .delete-info-grid,
  .delete-impact-list,
  .log-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-panel,
  .shortcut-panel,
  .finance-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .ledger-filter-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "search"
      "controls"
      "actions";
  }

  .ledger-filter-form .filter-controls {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .ledger-filter-form .filter-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  :root {
    --nav-width: 74px;
  }

  body.nav-expanded {
    --nav-width: 74px;
  }

  .top-nav-inner {
    align-items: center;
    padding: 16px 10px;
  }

  .brand {
    width: 46px;
    justify-content: center;
    padding: 0 0 12px;
  }

  .brand span,
  .nav-label {
    opacity: 0;
    width: 0;
  }

  .nav-links a {
    width: 46px;
    justify-content: center;
    padding: 0;
  }

  .nav-links a.nav-break::before {
    left: 6px;
    right: 6px;
  }

  .page-shell {
    padding: 28px 18px 72px;
  }

  .app-page-hero,
  .result-hero,
  .system-status-hero,
  .app-topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-topbar-actions {
    justify-content: start;
  }

  h1 {
    font-size: 40px;
  }
}

@media (max-width: 720px) {
  :root {
    --nav-width: 0px;
  }

  body.nav-expanded {
    --nav-width: 0px;
  }

  .top-nav {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .top-nav-inner {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 12px;
  }

  .brand {
    width: auto;
    border-bottom: 0;
    padding: 0;
    justify-content: start;
  }

  .brand span {
    display: inline;
  }

  .nav-links {
    grid-column: 1 / -1;
    display: none;
    padding-top: 10px;
  }

  body.nav-expanded .nav-links {
    display: grid;
  }

  .nav-label {
    display: inline;
  }

  .nav-links a {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .page-shell {
    width: 100%;
    margin-left: 0;
    padding: 24px 14px 76px;
  }

  .dashboard-status-grid,
  .finance-grid,
  .quick-grid,
  .page-workflow-actions,
  .currency-donut-panel,
  .health-grid,
  .system-config-grid,
  .upload-form-grid,
  .review-form-grid,
  .review-top-grid,
  .review-compare-grid,
  .detail-grid,
  .two-column-info,
  .delete-info-grid,
  .delete-impact-list,
  .log-chart-grid,
  .filter-bar,
  .filter-controls {
    grid-template-columns: 1fr;
  }

  .filter-bar > button,
  .filter-bar > .btn,
  .filter-bar > .secondary-btn,
  .filter-bar > .action-link {
    justify-self: start;
  }

  .delete-info-item.wide {
    grid-column: auto;
  }

  .inline-party-form {
    grid-template-columns: 1fr;
  }

  .notification-panel {
    right: auto;
    left: 0;
  }

  .floating-upload {
    right: 14px;
    bottom: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
