:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #edf3f0;
  --ink: #17211f;
  --muted: #65716d;
  --line: #d9dfdc;
  --brand: #163832;
  --brand-2: #27745f;
  --accent: #d4a72c;
  --danger: #b5473b;
  --warning: #a76d13;
  --success: #237755;
  --shadow: 0 10px 30px rgba(22, 56, 50, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img, video, iframe, canvas { max-width: 100%; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 16px 12px;
  background: var(--brand);
  color: #f7f5ef;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 10px;
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 10px;
}
.brand img { width: 34px; height: 34px; }
.sidebar-head { min-width: 0; }
.mobile-nav-toggle { display: none; }
.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.nav-toggle-all {
  border: 1px solid rgba(255,255,255,.14);
  width: 100%;
  min-height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #f7f5ef;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.nav-toggle-all:hover { background: rgba(255,255,255,.12); }
.nav-group {
  display: block;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
  overflow: visible;
}
details.nav-group > summary { list-style: none; cursor: pointer; }
details.nav-group > summary::-webkit-details-marker { display: none; }
.nav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 9px 11px;
  color: rgba(247,245,239,.66);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.nav-title::after {
  content: "›";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 18px;
  color: rgba(247,245,239,.82);
  transition: transform .14s ease;
}
.nav-group[open] .nav-title::after { transform: rotate(90deg); }
.nav-items {
  display: grid;
  gap: 2px;
  padding: 0 6px 7px;
}
.nav a, .logout-button {
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(247,245,239,.88);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.nav a:hover, .logout-button:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active {
  background: #f7f5ef;
  color: var(--brand);
  font-weight: 900;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-footer {
  display: block;
  border-top: 1px solid rgba(255,255,255,.12);
  margin-top: 7px;
  padding-top: 9px;
}
.logout-button {
  justify-content: center;
  background: rgba(255,255,255,.08);
  min-height: 40px;
}
.nav a:focus-visible, .button:focus-visible, .logout-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(247,245,239,.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { margin: 0; font-size: clamp(22px, 3vw, 32px); letter-spacing: 0; }
.user-pill { min-width: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.year-switcher { display: flex; align-items: center; gap: 7px; }
.year-switcher label { color: var(--muted); font-size: 12px; font-weight: 800; }
.year-switcher select { min-height: 36px; width: auto; padding: 6px 30px 6px 10px; }
.content { padding: 26px clamp(18px, 3vw, 36px) 56px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workflows { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { grid-template-columns: 1.2fr .8fr; align-items: start; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > p:last-child { margin-bottom: 0; }
.warning-panel {
  border-color: #f1c884;
  background: #fff8e8;
}
.warning-panel h2 { color: var(--warning); }
.empty-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}
.empty-state strong { color: var(--brand); }
.metric { min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.metric-card { min-height: 104px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 10px; align-content: space-between; box-shadow: var(--shadow); }
.metric-card span { color: var(--muted); font-size: 14px; font-weight: 700; }
.metric-card strong { font-size: 24px; overflow-wrap: anywhere; }
.workflow { min-height: 176px; display: grid; gap: 12px; align-content: start; }
.workflow h3 { margin: 0; font-size: 18px; }
.workflow p { margin: 0; }
.metric-label { color: var(--muted); font-size: 14px; }
.metric-value { font-size: 24px; font-weight: 800; margin-top: 12px; overflow-wrap: anywhere; }
.dashboard-first-title { margin-top: 0; }
.section-title > div { min-width: 0; }
.section-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.finance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.finance-summary a { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); background: rgba(255,255,255,.5); }
.finance-summary a:last-child { border-right: 0; }
.finance-summary span, .finance-summary small { display: block; color: var(--muted); }
.finance-summary span { font-size: 13px; font-weight: 900; }
.finance-summary strong { display: block; margin: 8px 0 4px; color: var(--brand); font-size: 25px; overflow-wrap: anywhere; }
.finance-summary small { line-height: 1.35; }
.finance-summary a.negative strong { color: var(--danger); }
.finance-summary a.positive strong { color: var(--success); }
.dashboard-insights { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 14px; }
.dashboard-chart-panel { min-width: 0; min-height: 330px; display: grid; align-content: start; }
.chart-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.chart-heading h3 { margin: 0 0 5px; font-size: 18px; }
.chart-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.chart-heading > a { color: var(--brand-2); font-weight: 900; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; font-weight: 800; }
.chart-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; }
.chart-legend .revenue::before { background: var(--success); }
.chart-legend .expense::before { background: var(--accent); }
.monthly-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; min-height: 220px; }
.month-bars { min-width: 0; display: grid; grid-template-rows: 190px 22px; gap: 5px; align-items: end; }
.bar-pair { display: flex; align-items: end; justify-content: center; gap: 3px; height: 190px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 46px, #edf1ef 47px); }
.bar-pair i { display: block; width: min(13px, 40%); min-height: 2px; border-radius: 3px 3px 0 0; transition: opacity .15s ease; }
.month-bars:hover i { opacity: .72; }
.revenue-bar { background: var(--success); }
.expense-bar { background: var(--accent); }
.month-bars > strong { color: var(--muted); font-size: 11px; text-align: center; }
.chart-empty { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.expense-ranking { display: grid; gap: 13px; }
.expense-ranking a { display: grid; gap: 7px; }
.expense-ranking a > span { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.expense-ranking strong { min-width: 0; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.expense-ranking em { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 900; }
.expense-ranking i { display: block; height: 8px; border-radius: 999px; background: #e8ecea; overflow: hidden; }
.expense-ranking b { display: block; height: 100%; border-radius: inherit; background: #397ca8; }
.workflow-status-band { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); }
.workflow-status-band > a { min-width: 0; display: grid; gap: 8px; padding: 15px; background: #fff; }
.workflow-status-band a > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.workflow-status-band span, .workflow-status-band small { color: var(--muted); }
.workflow-status-band strong { color: var(--brand); }
.stacked-progress { height: 9px; border-radius: 999px; background: #e8ecea; overflow: hidden; }
.stacked-progress i { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.stacked-progress.bank i { background: #397ca8; }
.next-step-band { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 14px; padding: 16px 18px; border: 1px solid #edc67e; border-left: 4px solid var(--warning); border-radius: 8px; background: #fff9ed; }
.next-step-band > div { min-width: 0; display: grid; gap: 6px; }
.next-step-band strong { color: var(--brand); font-size: 18px; }
.next-step-band p { margin: 0; color: var(--muted); }
.tone-red { border-left: 4px solid var(--danger); }
.tone-amber { border-left: 4px solid var(--warning); }
.tone-blue { border-left: 4px solid #397ca8; }
.tone-green { border-left: 4px solid var(--success); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-title h2 { margin: 0; font-size: 20px; }
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.35; }
th { color: var(--muted); font-size: 13px; font-weight: 700; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--brand); }
.badge.critical { background: #fde8e5; color: var(--danger); }
.badge.warning { background: #fff1d6; color: var(--warning); }
.badge.info { background: #e5f1fd; color: #27658b; }
.badge.success { background: #e8f5ee; color: var(--success); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
.button.secondary { background: #fff; color: var(--brand); }
.button.warning { border-color: var(--warning); background: var(--warning); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.table-wrap .button, td .button { min-height: 36px; padding: 7px 11px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid > h2, .form-grid > h3 { grid-column: 1 / -1; margin: 0; }
.review-form {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: center;
}
.guide-hero h2 {
  margin: 10px 0 8px;
  font-size: clamp(24px, 3vw, 34px);
}
.guide-hero p {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
.guide-progress {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.guide-progress strong {
  font-size: 34px;
  color: var(--brand);
}
.guide-progress span {
  color: var(--muted);
  font-weight: 800;
}
.guide-progress .button {
  width: 100%;
  min-height: 36px;
  font-size: 13px;
}
.review-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}
.review-overview h2 {
  margin: 10px 0 8px;
  font-size: clamp(24px, 3vw, 32px);
  color: var(--brand);
}
.review-overview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.review-score {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}
.review-score strong {
  font-size: 36px;
  color: var(--brand);
}
.review-score span {
  color: var(--muted);
  font-weight: 800;
}
.progress-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe4df;
}
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-2);
}
.review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.mini-stat {
  min-height: 96px;
  display: grid;
  gap: 8px;
  align-content: center;
}
.mini-stat span { color: var(--muted); font-weight: 800; }
.mini-stat strong { font-size: 28px; color: var(--brand); }
.conflict-panel {
  border-color: #f0c278;
  background: #fff9ed;
  margin-bottom: 16px;
}
.inline-title {
  margin: 0 0 12px;
}
.conflict-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.conflict-item {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.conflict-item:hover {
  border-color: var(--warning);
  box-shadow: 0 8px 22px rgba(22,56,50,.08);
}
.conflict-item .badge {
  justify-self: start;
}
.conflict-item strong {
  color: var(--brand);
}
.conflict-item small {
  color: var(--muted);
  line-height: 1.35;
}
.review-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.review-strip > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.review-strip strong {
  color: var(--brand);
}
.review-strip span:not(.badge) {
  color: var(--muted);
  font-weight: 700;
}
.dashboard-conflicts {
  margin-bottom: 18px;
}
.guide-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.guide-task {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.guide-task.done {
  border-color: #b9dec9;
  background: #f6fbf8;
}
.guide-check {
  display: grid;
  place-items: start center;
  padding-top: 2px;
}
.guide-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.guide-check span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.guide-check input:checked + span {
  border-color: var(--success);
  background: var(--success);
}
.guide-check input:checked + span::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
}
.guide-task-body {
  min-width: 0;
  display: grid;
  gap: 9px;
}
.guide-task-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.guide-task-top strong {
  color: var(--muted);
  font-size: 13px;
}
.guide-task h3 {
  margin: 0;
  font-size: 18px;
  color: var(--brand);
}
.guide-task p {
  margin: 0;
  line-height: 1.45;
}
.guide-task.done h3,
.guide-task.done p {
  opacity: .72;
}
.plain-help {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.plain-help summary {
  min-height: 38px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}
.plain-help summary::-webkit-details-marker { display: none; }
.plain-help div {
  padding: 0 11px 11px;
  color: var(--muted);
  line-height: 1.45;
}
.quick-grid,
.explain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.quick-grid a {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.quick-grid a:hover {
  border-color: var(--brand-2);
  box-shadow: 0 8px 22px rgba(22,56,50,.08);
}
.quick-grid strong { color: var(--brand); }
.quick-grid span { color: var(--muted); line-height: 1.35; }
.guide-actions { margin-top: 14px; }
.migration-guide-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 20px;
  align-items: center;
  margin-top: 16px;
}
.migration-guide-head h2 { margin: 10px 0 7px; font-size: 25px; }
.migration-guide-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.migration-guide-progress {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.migration-guide-progress strong { color: var(--brand); font-size: 30px; }
.migration-guide-progress > span { color: var(--muted); font-size: 13px; font-weight: 800; }
.migration-roadmap { display: grid; gap: 10px; margin-top: 12px; }
.migration-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 4px solid #b6c1bc;
  border-radius: 8px;
  background: var(--surface);
}
.migration-step.ready { border-left-color: var(--warning); box-shadow: var(--shadow); }
.migration-step.done { border-left-color: var(--success); background: #f7fbf9; }
.migration-step.locked { background: #f3f5f4; color: var(--muted); }
.migration-step-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.migration-step.done .migration-step-number { background: var(--success); }
.migration-step.locked .migration-step-number { background: #87918d; }
.migration-step-body { min-width: 0; display: grid; gap: 9px; }
.migration-step-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.migration-step-title > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.migration-step-title h3 { margin: 0; font-size: 18px; color: var(--brand); }
.migration-step-title small { color: var(--muted); font-weight: 800; white-space: nowrap; }
.migration-step-body > p { margin: 0; line-height: 1.45; }
.migration-step-details { border-top: 1px solid var(--line); padding-top: 8px; }
.migration-step-details summary { cursor: pointer; color: var(--brand); font-weight: 900; }
.migration-step-details dl { display: grid; gap: 0; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.migration-step-details dl > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.migration-step-details dl > div:last-child { border-bottom: 0; }
.migration-step-details dt { color: var(--muted); font-size: 13px; font-weight: 900; }
.migration-step-details dd { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.text-link, .text-button { color: var(--brand-2); font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
.text-button { border: 0; padding: 7px 0; background: transparent; cursor: pointer; }
.migration-step-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.migration-step-actions form { display: inline-flex; }
.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.guide-steps > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.guide-steps strong { color: var(--brand); }
.guide-steps span { color: var(--muted); line-height: 1.35; }
.start-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.start-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.step-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.step-body {
  min-width: 0;
  display: grid;
  gap: 8px;
}
.step-body h3 { margin: 0; font-size: 17px; }
.step-body p { margin: 0; line-height: 1.4; }
.step-body small { color: var(--muted); line-height: 1.35; }
.step-body .button { justify-self: start; margin-top: 2px; }
.import-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.import-check-item {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.import-check-item:hover { border-color: var(--brand-2); box-shadow: 0 8px 22px rgba(22,56,50,.08); }
.import-check-item strong { color: var(--brand); }
.import-check-item span { color: var(--muted); line-height: 1.35; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); line-height: 1.35; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  min-height: 44px;
}
td input, td select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  min-height: 38px;
}
.check-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
}
.check-row input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin-top: 2px;
}
.full { grid-column: 1 / -1; }
.flash { margin-bottom: 16px; padding: 12px 14px; border-radius: 8px; background: #e8f5ee; color: var(--success); border: 1px solid #bfe3d0; }
.flash.error { background: #fde8e5; color: var(--danger); border-color: #f4b8b1; }
.page-guide {
  margin-bottom: 18px;
  border: 1px solid #c9d9d2;
  border-radius: 8px;
  background: #f2f7f4;
  padding: 0;
}
.page-guide summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 16px;
  color: var(--brand);
  font-weight: 900;
}
.page-guide summary::-webkit-details-marker { display: none; }
.page-guide summary::after { content: "›"; float: right; font-size: 20px; transition: transform .16s ease; }
.page-guide[open] summary::after { transform: rotate(90deg); }
.page-guide div { padding: 0 16px 14px; color: var(--muted); display: grid; gap: 6px; }
.page-guide p { margin: 0; line-height: 1.45; }
.import-page {
  display: grid;
  gap: 20px;
}
.import-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: 22px;
  align-items: center;
  background: #f2f7f4;
}
.import-hero h2 {
  margin: 12px 0 8px;
  font-size: clamp(24px, 3vw, 34px);
}
.import-hero p {
  max-width: 740px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
.import-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.import-flow div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 12px;
  border: 1px solid #c9d9d2;
  border-radius: 8px;
  background: #fff;
}
.import-flow strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
}
.import-flow span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}
.migration-year-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.migration-year-actions .inline-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(110px, 180px) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.migration-year-actions .inline-form input:not([type="hidden"]),
.migration-year-actions .inline-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
.migration-year-actions label {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}
.migration-review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.migration-review-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid #d2a04c;
  border-radius: 8px;
  background: #fff;
}
.migration-review-item.ok { border-left-color: var(--success); }
.migration-review-item.critical { border-left-color: var(--danger); }
.migration-review-item strong { min-width: 0; overflow-wrap: anywhere; }
.migration-review-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.simple-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.simple-details summary { padding: 11px 12px; cursor: pointer; }
.details-fields { display: grid; gap: 10px; padding: 0 12px 12px; }
.archive-list { display: grid; gap: 8px; margin-top: 16px; }
.archive-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  text-decoration: none;
}
.archive-list a:hover { border-color: var(--brand-2); }
.archive-list span { color: var(--muted); font-size: 13px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.section-heading h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.section-heading p {
  margin: 0;
  max-width: 840px;
  line-height: 1.45;
}
.help-strip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border: 1px solid #d7e6dd;
  border-radius: 8px;
  background: #f5fbf7;
  color: var(--ink);
  line-height: 1.45;
}
.help-strip strong {
  flex: 0 0 auto;
  color: var(--success);
}
.help-strip code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}
.import-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.import-upload-card {
  display: grid;
  gap: 13px;
  align-content: start;
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.import-upload-card .button {
  width: 100%;
  margin-top: 2px;
}
.import-card-copy {
  display: grid;
  gap: 6px;
  min-height: 118px;
}
.import-card-copy h3 {
  margin: 0;
  color: var(--brand);
  font-size: 18px;
}
.import-card-copy p {
  margin: 0;
  color: var(--ink);
  line-height: 1.42;
}
.import-card-copy small {
  color: var(--muted);
  font-weight: 800;
}
.import-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.import-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.import-map-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.import-map-card summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.import-map-card summary::-webkit-details-marker { display: none; }
.import-map-card summary::after {
  content: "›";
  justify-self: end;
  color: var(--muted);
  font-size: 22px;
  transition: transform .16s ease;
}
.import-map-card[open] summary::after { transform: rotate(90deg); }
.import-map-card summary span {
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}
.import-map-card summary strong {
  color: var(--brand);
  font-size: 13px;
  text-align: right;
}
.import-map-card div {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  color: var(--muted);
  line-height: 1.42;
}
.import-map-card p {
  margin: 0;
}
.check-row.compact {
  padding: 10px 11px;
  font-size: 13px;
}
details > summary {
  color: var(--brand);
  font-weight: 900;
}
pre {
  max-width: 100%;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f5ef;
  color: var(--ink);
}
.scan-panel { background: var(--brand); color: #fff; }
.scan-panel label, .scan-panel .muted { color: rgba(255,255,255,.78); }
.scan-panel input { background: #fff; color: var(--ink); }
.scan-panel .button { background: #fff; color: var(--brand); border-color: #fff; }
.upload-panels { grid-template-columns: 1fr 1fr; align-items: stretch; margin-bottom: 18px; }
.upload-card h2 { margin-top: 0; }
.muted { color: var(--muted); }
.check-list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.check-list li { display: block; min-width: 0; overflow-wrap: anywhere; }
.check-list li:has(.check-dot) { display: flex; gap: 10px; align-items: flex-start; }
.check-dot { flex: 0 0 10px; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--brand-2); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.list-filter-card { margin: 14px 0 16px; }
.list-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(140px, .8fr));
  gap: 12px;
  align-items: end;
}
.list-filter-grid .actions { align-self: end; }
.paged-list { min-width: 0; }
.list-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.list-size, .list-pages { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-size label, .page-state { color: var(--muted); font-size: 13px; font-weight: 800; }
.list-size select {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
}
.filter-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.status-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.status-tile strong { display: block; font-size: 22px; margin-top: 5px; }
.document-list { display: grid; gap: 12px; }
.document-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.document-card summary { list-style: none; cursor: pointer; }
.document-card summary::-webkit-details-marker { display: none; }
.document-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(110px, .7fr)) 28px;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
}
.document-summary::after { content: "›"; color: var(--muted); font-size: 24px; justify-self: end; transition: transform .16s ease; }
.document-card[open] .document-summary::after { transform: rotate(90deg); }
.document-summary strong { overflow-wrap: anywhere; }
.document-body { border-top: 1px solid var(--line); padding: 16px; background: #fbfcfb; }
.mini-label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.receipt-workbench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 16px; min-width: 0; }
.receipt-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 10px;
  background: #163832;
  color: #fff;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.receipt-hero h2 { margin: 8px 0; font-size: clamp(26px, 3vw, 42px); line-height: 1.06; }
.receipt-hero p { color: rgba(255,255,255,.78); max-width: 760px; }
.receipt-flow {
  display: grid;
  gap: 10px;
}
.receipt-flow a {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  background: rgba(255,255,255,.08);
}
.receipt-flow strong {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--brand);
}
.receipt-flow span { font-weight: 900; }
.receipt-upload-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}
.quick-upload {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  min-width: 0;
}
.quick-upload strong, .quick-upload span { display: block; }
.quick-upload span { color: var(--muted); font-size: 13px; margin-top: 2px; }
.quick-upload input[type="file"] {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.muted-upload { background: #fbfcfb; }
.receipt-guide-card { margin-bottom: 14px; }
.receipt-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.receipt-tab {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.receipt-tab span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #edf3f0;
  color: var(--brand);
  font-weight: 900;
}
.receipt-tab strong { font-size: 18px; }
.receipt-tab small { color: var(--muted); line-height: 1.35; }
.receipt-tab em {
  position: absolute;
  right: 12px;
  top: 12px;
  min-width: 32px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f7f5ef;
  color: var(--brand);
  font-style: normal;
  font-weight: 900;
  text-align: center;
}
.receipt-tab.active {
  border-color: var(--brand);
  background: #edf3f0;
}
.simple-filter { margin-top: 0; }
.simple-filter .list-filter-grid { grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(140px, .7fr)) auto; }
.receipt-list { display: grid; gap: 12px; }
.receipt-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.receipt-card > summary {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1.4fr) minmax(120px, .55fr) minmax(170px, .9fr) 120px 24px;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 14px 16px;
  list-style: none;
  cursor: pointer;
}
.receipt-card > summary::-webkit-details-marker { display: none; }
.receipt-card > summary::after {
  content: "›";
  color: var(--muted);
  font-size: 24px;
  justify-self: end;
  transition: transform .16s ease;
}
.receipt-card[open] > summary::after { transform: rotate(90deg); }
.receipt-state {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f6e9c9;
  color: #7a4c05;
  font-weight: 900;
}
.receipt-state.done { background: #dfeee6; color: var(--success); }
.receipt-title { display: grid; gap: 3px; min-width: 0; }
.receipt-title strong, .receipt-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-title small, .receipt-meta small { color: var(--muted); }
.receipt-meta { display: grid; gap: 2px; min-width: 0; }
.receipt-meta strong { overflow-wrap: anywhere; font-size: 13px; }
.receipt-amount { justify-self: end; font-size: 18px; font-weight: 900; }
.receipt-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr);
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}
.receipt-step-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.step-copy {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.step-copy span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.step-copy h3 { margin: 0 0 4px; }
.step-copy p { margin: 0; color: var(--muted); }
.plain-choice-grid {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(230px, 1.2fr) minmax(150px, .8fr);
  gap: 12px;
}
.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.soft-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}
.soft-details summary { cursor: pointer; font-weight: 900; }
.soft-details .form-grid { margin-top: 12px; }
.receipt-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.receipt-preview-dialog {
  width: min(1080px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(22,56,50,.24);
}
.receipt-preview-dialog::backdrop { background: rgba(23,33,31,.55); }
.receipt-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}
.receipt-preview-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt-preview-dialog iframe {
  display: block;
  width: 100%;
  height: calc(100% - 59px);
  border: 0;
  background: #f7f5ef;
}
.payment-step { background: #f7f5ef; }
.asset-warning {
  border-color: #ead18a;
  background: #fff8e2;
}
.asset-warning strong { color: var(--warning); }
.receipt-next-hint {
  background: #edf3f0;
  border-style: dashed;
}
.match-stack { display: grid; gap: 10px; }
.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.match-card div { min-width: 0; }
.match-card strong, .match-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-card small, .match-card em { color: var(--muted); }
.match-card span { font-weight: 900; }
.match-card em { grid-column: 1 / -1; font-style: normal; }
.match-card .button { justify-self: end; white-space: nowrap; }
.match-stack > .button { justify-self: start; }
.empty-hint { margin: 0; color: var(--muted); }
.prepared-payments { margin-top: 18px; }
.cash-balance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #f7f5ef 0%, #edf3f0 100%);
}
.login-box { width: min(420px, 100%); }
.trap-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-hero { grid-template-columns: 1fr; }
  .import-upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .migration-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-summary a:nth-child(2) { border-right: 0; }
  .finance-summary a:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-insights { grid-template-columns: 1fr; }
  .guide-hero, .guide-board, .review-overview, .conflict-list { grid-template-columns: 1fr; }
  .start-guide, .import-checklist { grid-template-columns: 1fr; }
  .receipt-hero, .receipt-upload-strip, .receipt-body { grid-template-columns: 1fr; }
  .receipt-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-upload { grid-template-columns: 1fr; }
  .plain-choice-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { padding: 14px 10px; }
  .brand { padding: 0 7px; font-size: 18px; }
  .content { padding-left: 20px; padding-right: 20px; }
  .topbar { padding-left: 20px; padding-right: 20px; }
  .year-switcher select, .list-size select { min-height: 44px; }
  .nav a { min-height: 40px; }
  .grid.two { grid-template-columns: 1fr; }
  table { min-width: 680px; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; }
  .sales-entry-table { overflow: visible; border: 0; background: transparent; }
  .sales-entry-table table { display: block; min-width: 0; width: 100%; border-collapse: separate; }
  .sales-entry-table thead { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
  .sales-entry-table tbody { display: grid; gap: 12px; }
  .sales-entry-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .sales-entry-table td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  .sales-entry-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .sales-entry-table td input, .sales-entry-table td select { min-width: 0; width: 100%; }
}

@media (max-width: 1400px) {
  .receipt-hero, .receipt-upload-strip { grid-template-columns: 1fr; }
  .quick-upload { grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.2fr) auto; }
}

@media (max-width: 1080px) {
  .quick-upload { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
  }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .brand { margin-bottom: 0; }
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-weight: 800;
  }
  .nav { display: none; grid-template-columns: 1fr; overflow: visible; padding: 10px 0 0; }
  .nav.mobile-open { display: grid; }
  .nav-title { min-height: 38px; padding: 9px 11px; }
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .content {
    padding: 18px max(14px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  .cards, .metrics { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .review-strip { align-items: stretch; flex-direction: column; }
  .review-strip .button { width: 100%; }
  .workflows, .split, .grid.two { grid-template-columns: 1fr; }
  .quick-grid, .explain-grid { grid-template-columns: 1fr; }
  .quick-upload { grid-template-columns: 1fr; }
  .upload-panels, .status-strip { grid-template-columns: 1fr; }
  .import-flow, .import-upload-grid, .import-map { grid-template-columns: 1fr; }
  .migration-year-actions, .migration-review-grid { grid-template-columns: 1fr; }
  .migration-year-actions .inline-form { grid-template-columns: 1fr; }
  .migration-year-actions label { grid-column: auto; }
  .archive-list a { align-items: flex-start; flex-direction: column; }
  .finance-summary { grid-template-columns: 1fr; }
  .finance-summary a, .finance-summary a:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .finance-summary a:last-child { border-bottom: 0; }
  .monthly-chart { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 14px; }
  .month-bars { grid-template-rows: 120px 20px; }
  .bar-pair { height: 120px; background: repeating-linear-gradient(to top, transparent 0, transparent 29px, #edf1ef 30px); }
  .dashboard-chart-panel { min-height: auto; padding: 15px; }
  .chart-heading { flex-direction: column; }
  .workflow-status-band { grid-template-columns: 1fr; }
  .workflow-status-band a > div:first-child { flex-direction: column; gap: 4px; }
  .next-step-band { align-items: stretch; flex-direction: column; }
  .next-step-band .button { width: 100%; }
  .start-step { grid-template-columns: 1fr; }
  .step-number { width: 36px; height: 36px; }
  .section-heading { flex-direction: column; }
  .help-strip { flex-direction: column; }
  .help-strip span { min-width: 0; overflow-wrap: anywhere; }
  .help-strip code { white-space: normal; overflow-wrap: anywhere; }
  .import-card-copy { min-height: auto; }
  .import-map-card summary {
    grid-template-columns: minmax(0, 1fr) 22px;
  }
  .import-map-card summary strong {
    grid-column: 1 / -1;
    text-align: left;
  }
  .document-summary { grid-template-columns: 1fr; }
  .receipt-tabs, .plain-choice-grid, .amount-grid { grid-template-columns: 1fr; }
  .receipt-hero { padding: 18px; }
  .receipt-flow a { min-height: 50px; }
  .receipt-card > summary {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px 10px;
  }
  .receipt-card > summary::after { grid-column: 3; grid-row: 1; }
  .receipt-title { grid-column: 2; }
  .receipt-meta { grid-column: 2 / -1; }
  .receipt-amount { grid-column: 2 / -1; justify-self: start; }
  .receipt-body { padding: 12px; }
  .receipt-step-card { padding: 12px; }
  .receipt-preview-dialog {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .simple-filter .list-filter-grid { grid-template-columns: 1fr; }
  .match-card { grid-template-columns: 1fr; align-items: stretch; }
  .match-card span, .match-card em, .match-card .button { grid-column: 1; justify-self: stretch; }
  .cash-balance { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .list-filter-grid { grid-template-columns: 1fr; }
  .form-grid > *, .list-filter-grid > *, .grid > *, .split > * { min-width: 0; }
  .full { grid-column: 1; }
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea,
  td input:not([type="checkbox"]):not([type="radio"]),
  td select,
  td textarea,
  .list-size select,
  .year-switcher select {
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }
  td input:not([type="checkbox"]):not([type="radio"]), td select, td textarea { width: 100% !important; }
  .button, .table-wrap .button, td .button, button:not(.nav-title) { min-height: 44px; }
  .section-title > .actions, .section-heading > .actions, .list-filter-grid .actions { width: 100%; }
  .section-title > .actions .button, .section-heading > .actions .button, .list-filter-grid .actions .button { flex: 1 1 160px; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; }
  .card { padding: 16px; }
  .guide-task { grid-template-columns: 36px minmax(0, 1fr); padding: 13px; }
  .guide-check span { width: 30px; height: 30px; }
  .guide-progress { justify-items: stretch; text-align: center; }
  .migration-guide-head { grid-template-columns: 1fr; }
  .migration-step { grid-template-columns: 36px minmax(0, 1fr); padding: 12px; gap: 10px; }
  .migration-step-number { width: 32px; height: 32px; }
  .migration-step-title { flex-direction: column; gap: 6px; }
  .migration-step-title small { white-space: normal; }
  .migration-step-details dl > div { grid-template-columns: 1fr; gap: 4px; }
  .migration-step-actions, .migration-step-actions form, .migration-step-actions .button { width: 100%; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .list-controls { align-items: stretch; flex-direction: column; }
  .list-size, .list-pages { justify-content: space-between; }
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  table {
    display: block;
    min-width: 0;
    width: 100%;
    border-collapse: separate;
  }
  thead {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  tbody {
    display: grid;
    gap: 10px;
  }
  tr {
    display: grid;
    gap: 0;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  td[colspan] {
    display: block;
  }
  td[colspan]::before {
    content: "";
    display: none;
  }
  td .actions {
    min-width: 0;
  }
  td input, td select, td textarea {
    min-width: 0;
  }
  .table-wrap .button, td .button {
    width: 100%;
  }
  .scan-panel {
    position: sticky;
    bottom: 12px;
    z-index: 4;
  }
}

.banking-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, #f2f7f4, #ffffff);
}
.banking-hero h2 { margin: 10px 0 8px; font-size: clamp(24px, 3vw, 34px); }
.banking-hero p { max-width: 820px; color: var(--muted); line-height: 1.5; margin: 0; }
.banking-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.banking-metrics { margin: 18px 0; }
.asset-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, #f2f7f4, #ffffff);
  margin-bottom: 18px;
}
.asset-hero h2 { margin: 10px 0 8px; font-size: clamp(24px, 3vw, 34px); }
.asset-hero p { max-width: 820px; color: var(--muted); line-height: 1.5; margin: 0; }
.info-popover { position: relative; justify-self: end; }
.info-popover summary {
  list-style: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.info-popover summary::-webkit-details-marker { display: none; }
.info-popover div {
  position: absolute;
  right: 0;
  top: 44px;
  z-index: 10;
  width: min(320px, 80vw);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  line-height: 1.45;
  font-weight: 500;
}
.bank-feed { display: grid; gap: 10px; }
.bank-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(22,56,50,.05);
}
.bank-row > summary {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 120px 130px;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.bank-row > summary::-webkit-details-marker { display: none; }
.bank-row > summary::after { content: none; }
.bank-date { color: var(--muted); font-weight: 800; font-size: 13px; }
.bank-main { display: grid; gap: 4px; min-width: 0; }
.bank-main strong, .bank-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-main small { color: var(--muted); }
.bank-status { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.bank-amount { justify-self: end; font-weight: 900; font-size: 18px; }
.money-in .bank-amount { color: var(--success); }
.money-out .bank-amount { color: var(--danger); }
.bank-row-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}
.bank-row-body .form-grid { margin-top: 14px; }
.bank-row-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.danger-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.danger-inline input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}
.danger-zone { border-top: 1px solid #f1c884; padding-top: 14px; }
.bank-row-matches {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.bank-row-matches h3 { margin: 0 0 4px; font-size: 16px; }
.bank-row-matches p { margin: 0; color: var(--muted); }
.bank-match-list { display: grid; gap: 10px; }
.bank-match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.bank-match-card strong,
.bank-match-card small,
.bank-match-card em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-match-card small,
.bank-match-card em { color: var(--muted); }
.bank-match-card em { font-style: normal; margin-top: 3px; }
.bank-match-card > span:not(.badge) { font-weight: 900; }
.match-actions,
.table-action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mini-field {
  display: grid;
  gap: 4px;
  min-width: 140px;
  font-size: 12px;
  color: var(--muted);
}
.mini-field input,
.match-actions input,
.table-action-row input,
.manual-bank-allocation input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}
.manual-bank-allocation {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 860px) {
  .banking-hero { display: grid; }
  .asset-hero { display: grid; }
  .banking-actions { justify-content: stretch; }
  .banking-actions .button, .asset-hero .button { width: 100%; }
  .bank-row > summary {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }
  .bank-date { grid-column: 1; }
  .bank-main { grid-column: 1 / -1; order: 3; }
  .bank-status { justify-self: end; }
  .bank-amount { grid-column: 2; grid-row: 1; }
  .bank-match-card { grid-template-columns: 1fr; align-items: stretch; }
  .match-actions .button,
  .table-action-row .button,
  .manual-bank-allocation .button,
  .manual-bank-allocation input { width: 100%; }
}

@media (max-width: 900px) {
  .info-popover { justify-self: start; }
  .info-popover div {
    left: 0;
    right: auto;
    width: min(320px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    overflow-wrap: anywhere;
  }
}
