:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #627080;
  --line: #dce2e8;
  --accent: #0f7b6c;
  --accent-dark: #0a5f54;
  --warn: #b26a00;
  --error: #b42318;
  --ok: #178c50;
}

.accrual-controls, .accrual-export-bar { display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin:16px 0; }
.accrual-controls label { display:grid; gap:6px; min-width:150px; font-weight:600; }
.accrual-controls label:last-of-type { min-width:260px; flex:1; }
.accrual-controls select, .accrual-controls input { min-height:40px; }
#payment-comparison-form label:last-of-type { flex: 0 1 280px; min-width: min(220px, 100%); }
.accrual-export-bar { align-items:center; }
.accrual-export-bar strong { margin-right:auto; }
.accrual-table-wrap { max-height:65vh; }
#actual-summary { grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); }
#actual-editor::backdrop { background:rgba(15,30,45,.4); }
#actual-mapping-form .accrual-controls label { min-width:0; flex:1 1 300px; }
#actual-mapping-form select, #actual-mapping-form input { max-width:100%; }
#actual-rows td { white-space:nowrap; }
.accrual-table { width:max-content; min-width:100%; }
.accrual-table td, .accrual-table th { white-space:nowrap; }
.accrual-table th { position:sticky; top:0; z-index:1; background:#edf3f7; }
.accrual-table input[type="checkbox"] { width:18px; height:18px; cursor:pointer; }
.accrual-table .money { text-align:right; }
.accrual-table .pending { color:#986100; }
.accrual-table .excluded { color:#64748b; background:#f4f6f8; }
.accrual-table .manual { color:#0f766e; }
.accrual-status.error { color:var(--error); }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.sidebar {
  background: #16212c;
  color: #fff;
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 3px 0 0;
  color: #aeb9c5;
  font-size: 12px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.tabs > .nav-group + .nav-group {
  margin-top: 10px;
}

.nav-children .nav-parent {
  font-size: 13px;
  font-weight: 600;
}

.nav-group + .tab,
.tab + .nav-group {
  margin-top: 4px;
}

.nav-parent {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #eef5fb;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.nav-toggle:hover {
  background: #223242;
  border-color: #34495e;
}

.nav-arrow {
  transition: transform 0.18s ease;
}

.nav-collapsible.collapsed .nav-arrow {
  transform: rotate(-90deg);
}

.nav-collapsible.collapsed .nav-children {
  display: none;
}

.nav-children {
  display: grid;
  gap: 6px;
  padding-left: 12px;
  border-left: 1px solid #34495e;
  margin-left: 4px;
}

.tab {
  height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #d7dee6;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  font-size: 14px;
}

.child-tab {
  height: 36px;
  font-size: 13px;
}

.tab.active,
.tab:hover {
  background: #223242;
  border-color: #34495e;
  color: #fff;
}

.main {
  padding: 22px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 18px;
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.active-panel {
  display: block;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  align-items: end;
}

.ifs-fetch-grid {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.ifs-fetch-grid .field {
  flex: 0 1 280px;
  min-width: 0;
  max-width: 100%;
}

.ifs-connection-status {
  border-left: 3px solid var(--accent);
  background: #f0f7f5;
  padding: 12px;
  font-size: 13px;
}

.ifs-connection-status.failed {
  border-color: var(--error);
  background: #fff4f2;
  color: var(--error);
}

.ifs-missing-warning {
  padding: 12px 14px;
  border-left: 3px solid #A6670A;
  background: #FFF7E7;
  color: #744409;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ifs-missing-table {
  min-width: 760px;
  margin-top: 12px;
}

.ifs-missing-table td,
.ifs-missing-table th {
  white-space: normal;
  overflow-wrap: anywhere;
}

.shipping-dashboard-filters {
  display: grid;
  grid-template-columns: 180px 180px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  margin: 18px 0;
}
.shipping-dashboard-wrap { max-height: 76vh; }
.shipping-dashboard-table { table-layout: fixed; width: max-content; min-width: 100%; }
.shipping-dashboard-table th:first-child {
  position: sticky;
  left: 0;
  width: 236px;
  min-width: 236px;
  z-index: 1;
  background: #FFFFFF;
  text-align: left;
  white-space: normal;
}
.shipping-dashboard-table td,
.shipping-dashboard-table th:not(:first-child) { width: 150px; min-width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
.shipping-dashboard-table thead th { position: sticky; top: 0; z-index: 2; background: #EDF3F8; }
.shipping-dashboard-table thead th:first-child { z-index: 3; background: #EDF3F8; }
.shipping-dashboard-table input { width: 100%; min-width: 0; padding: 6px; text-align: right; border-radius: 4px; }
.shipping-dashboard-table .shipping-total-row > * { background: #E9F0F7; font-weight: 700; }
.shipping-dashboard-table .shipping-section-row > * { background: #F2F5F7; color: #536471; }
.shipping-dashboard-table .shipping-adjustment-row > * { color: #08796A; font-weight: 700; }
.shipping-dashboard-table .shipping-cell-status { white-space: normal; font-size: 12px; }
@media (max-width: 700px) {
  .shipping-dashboard-filters { grid-template-columns: 1fr 1fr; }
  .shipping-dashboard-filters > p { grid-column: 1 / -1; }
  .shipping-dashboard-table th:first-child { width: 172px; min-width: 172px; }
}

.ifs-report-status {
  font-size: 13px;
  color: var(--muted);
}

.ifs-task-table {
  min-width: 680px;
}

#ifs-fetch button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.compact-grid {
  grid-template-columns: minmax(320px, 1fr) 180px 140px;
}

.manual-summary-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px minmax(280px, 1.4fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.manual-fee-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(138px, 1fr));
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.manual-fee-grid input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.manual-fee-grid .quantity-field input {
  background: #f2f6fa;
}

.manual-fee-grid .total-field input {
  background: #e8f5f1;
  color: var(--accent-dark);
  font-weight: 700;
}

.manual-actions {
  margin-top: 14px;
}

.subsection {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.subsection h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.short {
  max-width: 260px;
}

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

label {
  font-size: 13px;
  font-weight: 600;
}

select,
input,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  line-height: 1.55;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

input[type="file"] {
  padding: 5px 9px;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: end;
}

.primary {
  min-width: 120px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.link-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
  cursor: pointer;
}

.secondary {
  padding: 0 12px;
}

.link-button {
  padding: 0 8px;
}

.link-button:disabled {
  color: var(--muted);
  cursor: default;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 8px;
}

.status-dot.running {
  background: var(--warn);
}

.status-dot.done {
  background: var(--ok);
}

.status-dot.failed {
  background: var(--error);
}

.result-links {
  display: flex;
  gap: 10px;
}

.result-links a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.log {
  min-height: 280px;
  max-height: 430px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: #101820;
  color: #dce7ef;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.preview-wrap {
  margin: 0 0 14px;
}

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

.preview-head strong {
  font-size: 14px;
}

.preview-head span {
  color: var(--muted);
  font-size: 12px;
}

.preview-table {
  min-width: 1080px;
}

.model-table-wrap {
  max-height: 840px;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
}

.public-dashboard-status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #f0f7f5;
  color: #35534e;
  font-size: 13px;
}

.public-dashboard-status.error {
  border-left-color: var(--error);
  background: #fff3f2;
  color: var(--error);
}

.model-month-filter {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.model-month-filter .field {
  flex: 0 1 220px;
  margin: 0;
}

.model-month-filter .muted {
  padding-bottom: 10px;
}

.model-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin: 0 0 16px;
}

.model-filters select[multiple] {
  min-height: 92px;
}

.model-view-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  margin: 0 0 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f5;
}

.public-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.public-scope-tab {
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.public-scope-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.model-view-tab {
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #526273;
  cursor: pointer;
  font-weight: 700;
}

.model-view-tab.active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.model-overview-block[hidden],
.model-subview[hidden] {
  display: none !important;
}

.trend-dashboard-head {
  align-items: center;
  margin-bottom: 16px;
}

.trend-selection-count {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.trend-filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px));
  gap: 12px;
  margin-bottom: 12px;
}

.trend-store-picker {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.trend-store-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.trend-search-field {
  width: min(520px, 100%);
}

.trend-store-actions {
  display: flex;
  gap: 8px;
}

.trend-store-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 6px;
  max-height: 174px;
  overflow-y: auto;
  padding: 2px;
}

.trend-store-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.trend-store-option:has(input:checked) {
  border-color: #7ab5a8;
  background: #edf8f5;
}

.trend-store-option input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.trend-store-option span,
.trend-store-option strong,
.trend-store-option small {
  display: block;
  min-width: 0;
}

.trend-store-option strong {
  overflow: hidden;
  color: #172331;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-store-option small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-table-wrap {
  max-height: 680px;
}

.trend-table {
  min-width: 1080px;
}

.trend-table th,
.trend-table td {
  white-space: nowrap;
}

.trend-table th:nth-child(1),
.trend-table th:nth-child(2) {
  min-width: 84px;
}

.trend-table th:nth-child(3) {
  min-width: 220px;
}

.trend-table th:last-child {
  min-width: 170px;
}

.trend-store-start td {
  border-top: 3px solid #b9ccd6;
}

.trend-total-row td {
  background: #eef6f6;
  font-weight: 700;
}

.trend-detail-row td {
  background: #fff;
}

.trend-store-row:nth-child(even) td {
  background: #f6f9fa;
}

.trend-store-row:hover td {
  background: #edf7f5;
}

.trend-store-name {
  max-width: 260px;
  white-space: normal !important;
}

.trend-metric-name {
  font-weight: 600;
}

.trend-up {
  color: #c2413b;
  font-weight: 700;
}

.trend-down {
  color: #087f6b;
  font-weight: 700;
}

.trend-flat,
.trend-no-data {
  color: var(--muted);
}

.trend-spark-cell {
  padding: 3px 10px !important;
  text-align: center;
}

.trend-sparkline {
  display: block;
  width: 150px;
  height: 42px;
  margin: 0 auto;
}

.trend-sparkline path {
  fill: none;
  stroke: #2f80ed;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trend-sparkline circle {
  fill: #0f8a78;
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

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

.insight-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.insight-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.insight-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.7;
}

.cost-structure-chart {
  display: grid;
  gap: 12px;
}

.ratio-trend-panel {
  margin: 0;
}

.cost-ratio-trend-chart {
  display: grid;
  gap: 10px;
}

.ratio-trend-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.ratio-trend-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ratio-grid-line {
  stroke: #dce5ea;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ratio-axis-line {
  stroke: #94a3b8;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ratio-axis-label {
  fill: #64748b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ratio-series-line {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ratio-point {
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.structure-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

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

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

.structure-latest {
  display: grid;
  gap: 7px;
}

.structure-line {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  align-items: center;
}

.structure-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

.structure-track {
  height: 8px;
  border-radius: 999px;
  background: #edf2f6;
  overflow: hidden;
}

.structure-track span {
  display: block;
  height: 100%;
}

.stack-chart {
  display: grid;
  gap: 8px;
}

.stack-row {
  display: grid;
  grid-template-columns: 58px minmax(160px, 1fr) 106px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.stack-bar {
  display: flex;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  background: #edf2f6;
}

.stack-total {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #334155;
}

.c1 {
  background: #2f80ed;
}

.c2 {
  background: #00a389;
}

.c3 {
  background: #f2994a;
}

.c4 {
  background: #9b51e0;
}

.c5 {
  background: #64748b;
}

.c6 {
  background: #111827;
}

.c7 {
  background: #d97706;
}

.c8 {
  background: #b45309;
}

.c9 {
  background: #92400e;
}

.empty-state {
  color: var(--muted);
  padding: 10px 0;
}

.aggregate-panel {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.aggregate-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.aggregate-table-wrap {
  max-height: none;
}

.aggregate-table tbody td {
  background: #f1f7f8;
  font-weight: 600;
}

.data-table.model-table {
  table-layout: fixed;
  min-width: 100%;
}

.model-table th:nth-child(1),
.model-table td:nth-child(1) {
  width: 62px;
  text-align: center;
}

.model-table th:nth-child(2),
.model-table td:nth-child(2) {
  min-width: 90px;
}

.model-table th:nth-child(3),
.model-table td:nth-child(3) {
  min-width: 90px;
}

.model-table th:nth-child(4),
.model-table td:nth-child(4) {
  min-width: 220px;
}

.model-table .model-project-cell {
  width: 150px;
}

.model-table .model-store-code {
  width: 84px;
  min-width: 0;
  max-width: 84px;
  text-align: center;
  vertical-align: top;
}

.model-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.analysis-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fbfcfd;
}

.analysis-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.analysis-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.75;
}

.placeholder {
  max-width: 900px;
}

.placeholder h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.placeholder p {
  margin: 0 0 16px;
  color: var(--muted);
}

.module-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.module-list button {
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f8fafb;
  color: var(--muted);
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.settings-panel + .settings-panel {
  margin-top: 18px;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.settings-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.settings-head p {
  margin: 0;
  color: var(--muted);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  background: #f8fafb;
  white-space: nowrap;
}

.rule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.rule-actions button {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.rule-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

#rule-2c-status,
#rule-2b-status {
  color: var(--muted);
}

#rule-2c-status.error,
#rule-2b-status.error {
  color: #b42318;
}

.rule-table-wrap {
  max-height: 580px;
}

.rule-table {
  min-width: 1080px;
}

.rule-table-wrap-compact .rule-table {
  min-width: 620px;
}

.rule-input {
  width: 100%;
  min-width: 160px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  font: inherit;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.metric-grid strong {
  display: block;
  font-size: 24px;
}

.metric-grid span {
  color: var(--muted);
  font-size: 13px;
}

.dataset-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.dataset-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.dataset-head p {
  margin: 0;
  color: var(--muted);
}

.dataset-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dataset-summary {
  margin-bottom: 16px;
}

.dataset-summary strong {
  font-size: 18px;
}

.dataset-audit {
  margin-bottom: 16px;
}

.dataset-audit-before-data {
  margin-top: 20px;
}

.dataset-section-head,
.dataset-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dataset-section-head {
  margin-bottom: 10px;
}

.dataset-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dataset-section-head .table-title,
.dataset-table-head .table-title {
  margin: 0;
  font-size: 16px;
}

#dataset-coverage-summary,
#dataset-filter-result,
#shipping-dataset-result {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.dataset-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #f2f6fa;
}

.dataset-category-tab {
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dataset-category-tab:last-child {
  border-right: 0;
}

.dataset-category-tab:hover {
  color: var(--text);
  background: #e7eef5;
}

.dataset-category-tab.active {
  color: #fff;
  background: var(--accent);
}

.coverage-table {
  min-width: 1080px;
}

.coverage-table th:first-child,
.coverage-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}

.coverage-table th:first-child {
  z-index: 3;
  background: #f2f6fa;
}

.coverage-period {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.coverage-total {
  display: inline-block;
  min-width: 82px;
  padding: 5px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
}

.coverage-total.complete {
  color: #12623c;
  background: #e4f5ec;
}

.coverage-total.incomplete {
  color: #9b2c22;
  background: #fde8e6;
}

.coverage-status {
  width: 100%;
  min-width: 132px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.coverage-status strong,
.coverage-status span {
  display: block;
}

.coverage-status span {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.coverage-status.present {
  color: #12623c;
  background: #f0faf5;
  border-color: #addbc2;
}

.coverage-status.missing {
  color: #9b2c22;
  background: #fff3f2;
  border-color: #efb3ae;
}

.coverage-status:hover {
  border-color: var(--accent);
}

.dataset-filters {
  display: grid;
  grid-template-columns: 150px 190px minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dataset-reset {
  height: 36px;
  padding: 0 14px;
}

.dataset-table-head {
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #f2f6fa;
  z-index: 1;
}

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

.data-table .strong {
  font-weight: 700;
}

#ifs-transfer-mapping .data-table {
  min-width: 680px;
  table-layout: fixed;
}

#ifs-transfer-mapping th:first-child { width: 14%; }
#ifs-transfer-mapping th:nth-child(2) { width: 30%; }
#ifs-transfer-mapping th:nth-child(3) { width: 32%; }
#ifs-transfer-mapping th:nth-child(4),
#ifs-transfer-mapping th:last-child { width: 12%; }

#ifs-transfer-mapping td,
#ifs-transfer-mapping th {
  white-space: normal;
  overflow-wrap: anywhere;
}

.model-table tbody tr.store-band-odd td {
  background: #ffffff;
}

.model-table tbody tr.store-band-even td {
  background: #edf4f7;
}

.model-table tbody tr.store-start td {
  border-top: 3px solid #c2d2dc;
}

body.public-dashboard {
  display: block;
  min-width: 0;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

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

.public-brand h1 {
  margin: 0;
  font-size: 20px;
}

.public-brand p,
.public-release-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.public-main {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: 20px 24px 32px;
}

.public-dashboard .panel {
  display: block;
}

.public-dashboard .dataset-head {
  align-items: flex-start;
}

@media (max-width: 700px) {
  body.public-dashboard {
    overflow-x: hidden;
  }

  .public-header {
    position: static;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .public-main {
    padding: 12px;
  }

  .public-dashboard .dataset-head {
    display: grid;
    gap: 12px;
  }

  .public-dashboard .dataset-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-dashboard .dataset-summary > div:last-child {
    grid-column: 1 / -1;
  }

  .model-filters {
    grid-template-columns: 1fr;
  }

  .trend-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .trend-store-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .trend-store-actions button {
    flex: 1;
  }
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

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

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

  .stack-row {
    grid-template-columns: 54px minmax(130px, 1fr);
  }

  .stack-total {
    grid-column: 2;
  }

  .dataset-filters {
    grid-template-columns: 1fr;
  }

  .dataset-section-head,
  .dataset-table-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
.accrual-manual-controls { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:16px 0; padding:14px; border:1px solid #dbe3ec; border-radius:8px; background:#f8fafc; }
.accrual-manual-controls label { display:flex; align-items:center; gap:8px; }
.accrual-manual-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px; width:100%; }
.accrual-manual-controls input[type="number"] { width:190px; }
.accrual-manual-controls input[type="checkbox"] { width:18px; height:18px; }
.accrual-exclusions { margin:12px 0; color:#526477; }
.accrual-exclusions summary { cursor:pointer; font-weight:600; }
.accrual-exclusions p { margin:6px 0; }
#accrual-import-preview .table-wrap { max-height:320px; overflow:auto; margin-top:12px; }
#accrual-import-form input[name="year"] { width:100px; }
#accrual-import-form label, #accrual-import-form strong { white-space:nowrap; flex-shrink:0; }
#accrual-import-form input[type="file"] { width:300px; }
#accrual-import-commit:disabled { opacity:.5; cursor:not-allowed; }
