:root {
  --navy: #061a3f;
  --ink: #122546;
  --muted: #66758f;
  --line: #d8e2ef;
  --paper: #f4f7fb;
  --blue: #1f7bf2;
  --teal: #08aa95;
  --green: #059669;
  --orange: #f97316;
  --red: #dc2626;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(20, 44, 84, 0.05) 1px, transparent 1px) 0 0 / 96px 100%,
    linear-gradient(rgba(20, 44, 84, 0.05) 1px, transparent 1px) 0 0 / 100% 32px,
    #f3f6fb;
}

button,
label.upload,
.action-link {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
  color: var(--white);
  background: linear-gradient(135deg, #0aa381, #0d72dc);
  box-shadow: 0 10px 20px rgba(31, 123, 242, 0.18);
  text-decoration: none;
}

button.ghost {
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: none;
}

.action-link.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.full {
  width: 100%;
}

input[type="file"] {
  display: none;
}

.app {
  min-height: 100vh;
  padding: 22px;
}

.site-footer {
  max-width: 1500px;
  margin: 26px auto 0;
  padding: 14px 0 10px;
  border-top: 1px solid rgba(216, 226, 239, 0.86);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  color: #7b879c;
  font-size: 12px;
  line-height: 1.4;
}

.site-footer .filing-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  color: #7b879c !important;
  text-decoration: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  font-weight: 500;
  transition: color 0.18s ease;
}

.site-footer .filing-link:hover {
  color: #3f4f68 !important;
}

.filing-separator {
  color: #b1bccd;
  user-select: none;
}

.filing-police img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 18px;
  max-width: 1500px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #0aa381, #1f7bf2);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 26px;
}

.brand p,
.panel p,
#statusText {
  color: var(--muted);
}

.actions,
.export-actions,
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.workspace {
  max-width: 1500px;
  margin: 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  align-items: start;
  transition: grid-template-columns 0.28s ease, gap 0.28s ease;
}

.workspace.sidebar-collapsed {
  grid-template-columns: 0 1fr;
  gap: 0;
}

.panel,
.canvas-wrap {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(216, 226, 239, 0.92);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
}

.panel {
  padding: 18px;
  height: fit-content;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    padding 0.22s ease,
    border-color 0.22s ease,
    max-height 0.22s ease;
}

.workspace.sidebar-collapsed .sidebar-panel {
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
  overflow: hidden;
  padding-inline: 0;
  padding-block: 0;
  border-color: transparent;
  max-height: 0;
}

.sidebar-edge-toggle {
  position: absolute;
  top: 42px;
  left: 330px;
  transform: translateX(9px);
  width: 24px;
  min-width: 24px;
  height: 120px;
  padding: 0;
  border: 1px solid #cfe0f6;
  border-radius: 999px;
  color: #0d4ea6;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  z-index: 40;
  pointer-events: auto;
}

.workspace.sidebar-collapsed .sidebar-edge-toggle {
  left: 0;
  transform: translateX(-2px);
}

.panel-block + .panel-block {
  margin-top: 22px;
}

.panel h2 {
  font-size: 17px;
  margin-bottom: 8px;
}

.fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fields span {
  padding: 7px 10px;
  border-radius: 8px;
  color: #194165;
  background: #eef5ff;
  font-size: 13px;
  font-weight: 700;
}

textarea {
  width: 100%;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: none;
  line-height: 1.7;
  color: var(--ink);
  background: #fbfdff;
}

.data-preview {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.data-row {
  padding: 10px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #e5edf8;
  font-size: 12px;
}

.data-row.empty {
  color: var(--muted);
}

.diagnostics-panel {
  display: grid;
  gap: 8px;
}

.diagnostic-card {
  padding: 10px 11px;
  border: 1px solid #d9e5f3;
  border-radius: 8px;
  color: #263854;
  background: #f8fbff;
  font-size: 12px;
  line-height: 1.55;
}

.diagnostic-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 13px;
}

.diagnostic-card ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.diagnostic-card li + li {
  margin-top: 2px;
}

.diagnostic-card.ok {
  border-color: #b9eadc;
  background: #f0fdf8;
}

.diagnostic-card.warn {
  border-color: #ffd2d2;
  background: #fff7f7;
}

.diagnostic-card.info {
  border-color: #d6e6fb;
  background: #f7fbff;
}

.diagnostic-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.diagnostic-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #17456b;
  background: #edf5ff;
  font-weight: 800;
}

.display-controls {
  display: grid;
  gap: 10px;
}

.display-controls label {
  display: grid;
  grid-template-columns: 1fr 72px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}

.display-controls input {
  width: 72px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfdff;
  font: inherit;
}

.canvas-wrap {
  padding: 18px;
  overflow: visible;
}

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

.toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sidebar-toggle {
  min-width: 112px;
}

.workspace.sidebar-collapsed .sidebar-toggle {
  color: var(--white);
  border-color: transparent;
  background: linear-gradient(135deg, #0aa381, #0d72dc);
  box-shadow: 0 10px 20px rgba(31, 123, 242, 0.18);
}

.canvas-toolbar > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.board-tabs {
  width: min(980px, 100%);
  margin: 0 auto 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.board-tab {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
}

.board-tab.active {
  color: var(--white);
  background: linear-gradient(135deg, #0a9e82, #0d72dc);
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(13, 114, 220, 0.18);
}

.dashboard {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 26px 30px 14px;
  background: var(--white);
  border: 1px solid #cfd9e8;
  box-shadow: 0 16px 42px rgba(23, 43, 77, 0.1);
}

.report-header {
  text-align: center;
  padding: 4px 0 18px;
}

.report-header h2 {
  color: var(--navy);
  font-size: 54px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
}

.report-subtitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  color: var(--navy);
  font-size: 26px;
  font-weight: 900;
}

.report-subtitle span {
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--navy), transparent);
}

.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 4px 0 20px;
}

.period-pill,
.bp-pill {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fbfdff;
  color: #263854;
  font-size: 18px;
}

.bp-pill {
  min-width: 200px;
  padding: 0 14px;
}

.bp-pill input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}

.export-field-value {
  min-width: 100%;
  display: inline-block;
  color: var(--ink);
}

.period-pill strong {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(135deg, #079d82, #13b8a1);
}

.period-pill span {
  padding: 0 24px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 146px;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid #d9e3f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.kpi-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #0aa381, #21c7ad);
}

.kpi-margin .kpi-icon {
  background: linear-gradient(135deg, #1d6eea, #5fa6ff);
}

.kpi.warn .kpi-icon {
  background: linear-gradient(135deg, #f97316, #ffb020);
}

.kpi.good .kpi-icon {
  background: linear-gradient(135deg, #4f46e5, #7567ff);
}

.kpi-copy span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.kpi-copy strong {
  display: block;
  margin-bottom: 12px;
  color: var(--navy);
  font-size: 25px;
  line-height: 1.1;
}

.kpi-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #e8eef7;
  color: #40506c;
  font-size: 14px;
}

.kpi-row + .kpi-row {
  margin-top: 2px;
}

.kpi-row em {
  color: #0d72dc;
  font-style: normal;
  font-weight: 900;
}

.up {
  color: var(--green);
  font-weight: 900;
}

.down {
  color: var(--red);
  font-weight: 900;
}

.chart-card,
.mini-card,
.insight-strip {
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.chart-card {
  padding: 16px 12px 12px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 6px;
}

.section-title h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 22px;
}

.title-mark {
  color: #0d72dc;
  font-size: 21px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  color: #263854;
  font-size: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 20px;
  height: 8px;
  display: inline-block;
  border-radius: 2px;
}

.legend-blue {
  background: var(--blue);
}

.legend-teal {
  background: var(--teal);
}

.legend-orange {
  background: var(--orange);
}

#trendChart {
  width: 100%;
  height: 300px;
  display: block;
}

.trend-table-wrap {
  overflow: auto;
  border: 1px solid #d9e3f0;
  border-radius: 4px;
}

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

.trend-table th,
.trend-table td,
.issue-table th,
.issue-table td {
  border: 1px solid #d9e3f0;
  padding: 9px 8px;
  text-align: center;
  font-size: 14px;
}

.trend-table th {
  color: var(--navy);
  background: #f3f7fc;
}

.trend-table tbody th {
  text-align: left;
  white-space: nowrap;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.mini-card {
  padding: 14px 10px 10px;
}

.risk-card .section-title h3,
.risk-card .title-mark {
  color: var(--red);
}

.action-card .section-title h3,
.action-card .title-mark {
  color: #0d4ea6;
}

.issue-table th {
  color: var(--navy);
  background: #eef5ff;
  font-weight: 900;
}

.risk-card .issue-table th {
  color: #b91c1c;
  background: #fff1f1;
}

.issue-table td {
  color: #183153;
}

.issue-table td:first-child {
  text-align: left;
  font-weight: 800;
}

.risk-dot,
.step-no {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-right: 6px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.risk-dot {
  background: var(--red);
}

.step-no {
  background: var(--blue);
}

.level,
.status {
  display: inline-block;
  min-width: 40px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
  font-weight: 900;
}

.level-high {
  background: var(--red);
}

.level-mid {
  background: var(--orange);
}

.status {
  color: #1d4c90;
  background: #eaf3ff;
  border: 1px solid #cfe0f6;
}

.table-summary {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid #ffd7d7;
  border-radius: 4px;
  text-align: center;
  color: #dc2626;
  background: #fff7f7;
  font-weight: 900;
}

.action-summary {
  color: #0d4ea6;
  background: #f3f8ff;
  border-color: #d9e8ff;
}

.insight-strip {
  min-height: 76px;
  display: grid;
  grid-template-columns: 60px 1fr 180px;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
  padding: 12px 18px;
  background: linear-gradient(90deg, #eef6ff, #ffffff);
}

.bulb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #0d72dc;
  border: 2px solid #8ec3ff;
  font-size: 28px;
  font-weight: 900;
}

.insight-strip strong {
  display: block;
  margin-bottom: 5px;
  color: var(--navy);
  font-size: 19px;
}

.insight-strip span {
  color: #263854;
}

.insight-visual {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.insight-visual span {
  width: 82px;
  height: 46px;
  border: 3px solid #4591e8;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 20%, #61a5f7 21% 24%, transparent 25% 43%, #61a5f7 44% 47%, transparent 48%),
    #eaf4ff;
}

.insight-visual i {
  width: 56px;
  height: 56px;
  display: block;
  border: 8px solid #0c315e;
  border-radius: 50%;
  position: relative;
}

.insight-visual i::after {
  content: "";
  width: 38px;
  height: 9px;
  position: absolute;
  right: -28px;
  bottom: -14px;
  border-radius: 999px;
  background: #0c315e;
  transform: rotate(45deg);
}

.special-board[hidden] {
  display: none !important;
}

.dashboard.special-mode > .kpis,
.dashboard.special-mode > .chart-card,
.dashboard.special-mode > .grid-two,
.dashboard.special-mode > .insight-strip {
  display: none;
}

.special-board {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.special-card {
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.special-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #d9e3f0;
  color: var(--white);
  background: linear-gradient(135deg, #0b2c61, #0a1f47);
  font-size: 18px;
  font-weight: 900;
}

.collection-topline,
.expense-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.collection-alert {
  min-width: 240px;
  padding: 18px 20px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  background: linear-gradient(180deg, #fff7f7, #ffffff);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.collection-filters,
.expense-period-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filter-pill,
.expense-period-pill {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #fbfdff;
}

.filter-pill strong,
.expense-period-pill strong {
  color: #40506c;
  font-size: 14px;
}

.filter-pill span,
.expense-period-pill span {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.collection-main,
.expense-main {
  display: grid;
  gap: 14px;
}

.collection-main {
  grid-template-columns: 1.2fr 1fr;
  align-items: stretch;
}

.expense-main {
  grid-template-columns: 3fr 1fr;
}

.budget-main {
  grid-template-columns: 2.2fr 1fr;
  align-items: stretch;
}

.budget-layout {
  display: grid;
  grid-template-columns: 2.35fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.revenue-budget-layout {
  display: grid;
  grid-template-columns: 2.4fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.collection-kpis {
  margin-bottom: 0;
}

.collection-kpis .kpi {
  min-height: 132px;
  align-items: start;
}

.collection-kpis .kpi-copy span {
  min-height: 38px;
  display: flex;
  align-items: flex-start;
  margin-bottom: 4px;
  line-height: 1.2;
}

.collection-kpis .kpi-copy strong {
  min-height: 32px;
  margin-bottom: 10px;
}

.collection-kpis .kpi-row {
  min-height: 29px;
  align-items: center;
}

.matrix-frame {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px 14px 10px;
  min-height: 358px;
}

.matrix-axis-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: #517086;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0 12px;
}

.matrix-axis-left .axis-top,
.matrix-axis-left .axis-bottom {
  line-height: 1;
}

.matrix-axis-left .axis-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 1px;
  color: #30516c;
}

.matrix-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.matrix-axis-bottom {
  width: min(380px, 82%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 36px minmax(140px, 1fr) 36px;
  align-items: center;
  column-gap: 8px;
  color: #517086;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 0 4px;
  min-height: 26px;
}

.matrix-axis-bottom::before,
.matrix-axis-bottom::after {
  content: none;
}

.matrix-axis-bottom strong {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.matrix-axis-bottom strong::before,
.matrix-axis-bottom strong::after {
  content: "";
  flex: 1;
  min-width: 44px;
  height: 1px;
  background: linear-gradient(90deg, #9fb8d2, #3b6f95);
}

.matrix-axis-bottom span:first-child {
  text-align: right;
}

.matrix-axis-bottom span:last-child {
  text-align: left;
}

.matrix-card {
  display: flex;
  flex-direction: column;
}

.matrix-item {
  min-height: 124px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 8px;
  border: 1px solid #d9e3f0;
  background: #ffffff;
}

.matrix-item.teal {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #f3fffb, #ffffff);
}

.matrix-item.orange {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff8f1, #ffffff);
}

.matrix-item.blue {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f4f9ff, #ffffff);
}

.matrix-item.gold {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffdf3, #ffffff);
}

.matrix-icon {
  font-size: 28px;
  font-weight: 900;
}

.matrix-item strong {
  color: var(--navy);
  font-size: 16px;
}

.matrix-item b {
  color: var(--ink);
  font-size: 18px;
}

.matrix-item em {
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
}

.matrix-item .amount {
  font-size: 22px;
  font-weight: 900;
}

.matrix-item.teal .amount { color: #059669; }
.matrix-item.orange .amount { color: #f97316; }
.matrix-item.blue .amount { color: #1f7bf2; }
.matrix-item.gold .amount { color: #b7791f; }

.chart-shell {
  padding: 14px 16px 18px;
}

.chart-shell svg {
  width: 100%;
  height: 300px;
  display: block;
}

.expense-compare-card .chart-shell {
  min-height: 430px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px 18px 20px;
}

.expense-compare-card .chart-shell svg {
  height: 360px;
}

.budget-compare-card .chart-shell {
  min-height: 400px;
}

.budget-compare-card .chart-shell svg {
  height: 330px;
}

.budget-profit-card .chart-shell {
  min-height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 24px;
}

.budget-profit-card .chart-shell svg {
  height: 350px;
}

.revenue-budget-card .chart-shell {
  min-height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 24px;
}

.revenue-budget-card .chart-shell svg {
  height: 350px;
}

.aging-card .chart-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 358px;
  padding: 14px 14px 10px;
}

.aging-card .chart-shell svg {
  height: 430px;
}

.aging-card .chart-summary {
  margin-top: 0;
}

.chart-summary {
  margin: 0 16px 16px;
  padding: 14px 16px;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  color: #dc2626;
  background: #fff8f8;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.chart-summary strong {
  margin: 0 6px;
}

.empty-special-board {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 32px 24px;
  border: 1px dashed #cddbec;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}

.empty-special-copy {
  text-align: center;
  color: #4f6786;
}

.empty-special-copy strong {
  display: block;
  color: var(--navy);
  font-size: 22px;
  margin-bottom: 10px;
}

.empty-special-copy p {
  margin: 0;
  font-size: 15px;
}

.followup-card table,
.expense-table-card table {
  width: 100%;
  border-collapse: collapse;
}

.followup-card th,
.followup-card td,
.expense-table-card th,
.expense-table-card td {
  border: 1px solid #d9e3f0;
  padding: 10px 10px;
  text-align: center;
  font-size: 15px;
}

.followup-card th,
.expense-table-card th {
  color: var(--white);
  background: linear-gradient(135deg, #0b2c61, #0a1f47);
  font-weight: 900;
}

.followup-card td:first-child,
.followup-card td:last-child,
.expense-table-card td:first-child {
  text-align: left;
}

.danger-cell {
  color: #dc2626;
  font-weight: 900;
}

.safe-cell {
  color: #059669;
  font-weight: 900;
}

.collection-footnote,
.expense-tip-inner {
  padding: 14px 18px 18px;
  color: var(--muted);
  font-size: 14px;
}

.expense-focus-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.expense-focus-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #f5d3cd;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff9f7, #ffffff);
}

.expense-focus-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ef4444;
  background: radial-gradient(circle at 30% 30%, #fff1eb, #ffe2d8);
  font-size: 34px;
  font-weight: 900;
}

.expense-focus-copy strong {
  display: block;
  color: var(--navy);
  font-size: 18px;
}

.expense-focus-copy b {
  display: block;
  margin: 6px 0;
  color: #ef4444;
  font-size: 22px;
}

.expense-focus-copy span {
  color: #5d6b84;
  font-size: 15px;
}

.budget-focus-list {
  padding-top: 4px;
}

.budget-focus-item.over .expense-focus-copy b {
  color: #ef4444;
}

.budget-focus-item.under .expense-focus-copy b {
  color: #0f9f6e;
}

.expense-bottom {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.budget-bottom {
  grid-template-columns: 1fr 1fr;
}

.checklist {
  padding: 14px 18px 18px;
  display: grid;
  gap: 14px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.check-box {
  width: 28px;
  height: 28px;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
}

.expense-tip-inner {
  min-height: 100%;
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 18px;
  background: linear-gradient(90deg, #f0fdf9, #ffffff);
}

.expense-tip-icon {
  display: grid;
  place-items: center;
  color: #0f9d7a;
  font-size: 72px;
  font-weight: 900;
}

.expense-tip-copy {
  color: var(--navy);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.8;
}

.budget-action-card .special-card-header {
  border-bottom: 1px solid #dbe8f3;
}

.budget-action-body {
  min-height: 100%;
  padding: 0 4px;
}

.budget-action-card .expense-tip-inner {
  min-height: 160px;
}

.budget-tree-card {
  overflow: hidden;
}

.budget-impact-note {
  padding: 12px 16px 0;
  color: #5d6b84;
  font-size: 14px;
  font-weight: 700;
}

.budget-tree {
  display: grid;
  gap: 10px;
  padding: 14px 16px 18px;
}

.budget-category-grid {
  display: grid;
  gap: 14px;
  padding: 14px 16px 4px;
}

.budget-detail-tree {
  padding-top: 8px;
}

.revenue-dimension-grid {
  display: grid;
  gap: 12px;
  padding: 14px 16px 18px;
}

.budget-tree-group,
.budget-subtree,
.budget-category-section,
.revenue-dimension-section {
  overflow: hidden;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #fff;
}

.budget-tree-group > summary,
.budget-subtree > summary,
.budget-category-section > summary,
.revenue-dimension-section > summary {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 260px 92px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  color: var(--navy);
  background: #f3f7fc;
  font-weight: 900;
}

.budget-tree-group > summary::-webkit-details-marker,
.budget-subtree > summary::-webkit-details-marker,
.budget-category-section > summary::-webkit-details-marker,
.revenue-dimension-section > summary::-webkit-details-marker {
  display: none;
}

.budget-tree-group > summary span::before,
.budget-subtree > summary span::before,
.budget-category-section > summary span::before,
.revenue-dimension-section > summary span::before {
  content: "\25BE";
  display: inline-block;
  width: 14px;
  margin-right: 8px;
  color: #0d72dc;
  text-align: center;
}

.budget-tree-group:not([open]) > summary span::before,
.budget-subtree:not([open]) > summary span::before,
.budget-category-section:not([open]) > summary span::before,
.revenue-dimension-section:not([open]) > summary span::before {
  content: "\25B8";
}

.budget-tree-group > summary em,
.budget-subtree > summary em,
.budget-category-section > summary em,
.revenue-dimension-section > summary em {
  font-style: normal;
  color: #52627c;
  font-size: 13px;
}

.budget-category-section > summary {
  background: #eef4fb;
}

.budget-category-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.budget-category-body .chart-shell {
  padding: 4px;
}

.budget-category-body .chart-shell svg {
  height: 280px;
}

.budget-category-body table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.budget-category-body th,
.budget-category-body td {
  border: 1px solid #d9e3f0;
  height: 42px;
  padding: 8px 10px;
  text-align: right;
  vertical-align: middle;
}

.budget-category-body th {
  color: var(--navy);
  background: #eef4fb;
  font-weight: 900;
}

.budget-category-body th:first-child,
.budget-category-body td:first-child {
  text-align: left;
}

.revenue-dimension-section > summary {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.revenue-dimension-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.9fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.revenue-dimension-body .chart-shell {
  padding: 4px;
}

.revenue-dimension-body .chart-shell svg {
  height: 280px;
}

.revenue-dimension-body table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.revenue-dimension-body th,
.revenue-dimension-body td {
  border: 1px solid #d9e3f0;
  height: 42px;
  padding: 8px 10px;
  text-align: right;
}

.revenue-dimension-body th {
  color: var(--navy);
  background: #eef4fb;
  font-weight: 900;
}

.revenue-dimension-body th:first-child,
.revenue-dimension-body td:first-child {
  text-align: left;
}

.budget-subtree {
  margin: 10px;
}

.budget-subtree > summary {
  background: #fbfdff;
}

.budget-subtree table {
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.budget-subtree th,
.budget-subtree td {
  border: 1px solid #d9e3f0;
  height: 44px;
  padding: 9px 14px;
  text-align: right;
  vertical-align: middle;
  line-height: 1.45;
}

.budget-subtree th {
  color: var(--navy);
  background: #eef4fb;
  font-weight: 900;
}

.budget-subtree th:first-child,
.budget-subtree td:first-child {
  width: 25%;
  text-align: left;
  word-break: keep-all;
}

.budget-subtree th:nth-child(2),
.budget-subtree td:nth-child(2),
.budget-subtree th:nth-child(3),
.budget-subtree td:nth-child(3) {
  width: 16%;
}

.budget-subtree th:nth-child(4),
.budget-subtree td:nth-child(4) {
  width: 22%;
}

.budget-subtree th:nth-child(5),
.budget-subtree td:nth-child(5) {
  width: 21%;
}

.usage-note {
  width: min(980px, 100%);
  margin: 16px auto 0;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #dfe8f6;
  background: rgba(255, 255, 255, 0.88);
}

.usage-note h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

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

.note-grid div {
  padding: 14px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #e5edf8;
}

.note-grid strong {
  display: block;
  margin-bottom: 8px;
}

.note-grid p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .workspace.sidebar-collapsed {
    grid-template-columns: 1fr;
    gap: 18px;
  }

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

  .workspace.sidebar-collapsed .sidebar-panel {
    display: none;
  }

  .sidebar-edge-toggle {
    top: 18px;
    left: auto;
    right: 18px;
    width: auto;
    min-width: 92px;
    height: 40px;
    padding: 0 12px;
    transform: none;
    border-radius: 8px;
  }

  .workspace.sidebar-collapsed .sidebar-edge-toggle {
    left: auto;
    transform: none;
  }

  .panel-block + .panel-block {
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .topbar,
  .actions,
  .canvas-toolbar,
  .export-actions,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .panel,
  .kpis,
  .grid-two,
  .revenue-budget-layout,
  .revenue-dimension-body,
  .budget-category-body,
  .note-grid,
  .insight-strip {
    grid-template-columns: 1fr;
  }

  .report-header h2 {
    font-size: 36px;
  }

  .report-subtitle {
    font-size: 18px;
  }

  .report-subtitle span,
  .insight-visual {
    display: none;
  }
}

@page {
  size: 1100px 1600px;
  margin: 24px;
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .panel,
  .board-tabs,
  .canvas-toolbar,
  .sidebar-toggle,
  .sidebar-edge-toggle,
  .usage-note,
  .site-footer {
    display: none !important;
  }

  .app,
  .canvas-wrap,
  .workspace {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 0;
    box-shadow: none;
  }

  .dashboard {
    width: 980px;
    max-width: none;
    margin: 0 auto;
    break-inside: avoid;
  }

  .report-meta {
    display: flex;
    justify-content: space-between;
  }

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

  .kpi {
    display: grid;
    grid-template-columns: 54px 1fr;
  }

  .grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .insight-strip {
    display: grid;
    grid-template-columns: 60px 1fr 180px;
  }

  .insight-visual {
    display: flex;
  }
}
