:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #f5f6f2;
  color: #18212f;
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --line: #d9ded6;
  --line-strong: #bac4bb;
  --text: #18212f;
  --muted: #667085;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --teal: #0f8b8d;
  --green: #16834a;
  --green-soft: #e9f7ee;
  --amber: #c77700;
  --amber-soft: #fff4dc;
  --red: #c93636;
  --red-soft: #fdeaea;
  --violet: #7c3aed;
  --violet-soft: #f0ebff;
  --shadow: 0 14px 32px rgba(22, 33, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(245, 246, 242, 0.95) 210px),
    var(--bg);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(520px, 1.14fr);
  background: #fffdfa;
}

.login-brand-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 48px;
  background: #fff4e9;
}

.login-logo-wrap {
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  border-radius: 34px;
  background: #ffe2c9;
  box-shadow: 0 0 0 12px rgba(255, 226, 201, 0.5);
}

.login-logo-wrap img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 50%;
}

.login-brand-panel h1 {
  margin: 16px 0 0;
  color: #111827;
  font-size: 38px;
  letter-spacing: 0;
  text-align: center;
}

.login-brand-panel p,
.login-brand-panel small {
  color: #747887;
  font-size: 18px;
}

.login-brand-panel small {
  font-size: 14px;
}

.login-divider {
  width: 1px;
  height: 90px;
  margin-top: 30px;
  background: #ead8c8;
}

.login-form-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 72px;
  background: #ffffff;
}

.login-tools {
  position: absolute;
  top: 26px;
  right: 32px;
  display: flex;
  gap: 12px;
}

.login-tools span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #eceff3;
  border-radius: 999px;
  background: #ffffff;
  color: #667085;
  padding: 7px 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.login-card {
  width: min(680px, 100%);
  display: grid;
  gap: 20px;
  border: 1px solid #eef0f4;
  border-radius: 18px;
  background: #ffffff;
  padding: 58px 64px;
  box-shadow: 0 28px 74px rgba(15, 23, 42, 0.15);
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.login-card-head img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: contain;
}

.login-card h2 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 28px;
  letter-spacing: 0;
}

.login-card p {
  margin: 0;
  color: #818696;
}

.login-card label {
  display: grid;
  gap: 9px;
  color: #1f2937;
  font-weight: 700;
}

.login-card input {
  min-height: 48px;
  border: 1px solid #e1e5ea;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 14px;
  outline: none;
}

.login-card input:focus {
  border-color: #ffb27c;
  box-shadow: 0 0 0 4px rgba(255, 178, 124, 0.18);
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
}

.icon-button {
  min-height: 48px;
  border: 1px solid #e1e5ea;
  border-radius: 8px;
  background: #ffffff;
  color: #8a8f9d;
}

.login-submit {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: #ffb27c;
  color: #ffffff;
  font-weight: 800;
}

.login-submit:hover {
  background: #f59b5f;
}

.login-error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b42318;
  padding: 10px 12px;
}

.login-hint {
  text-align: center;
  font-size: 13px;
}

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

button {
  cursor: pointer;
}

.welcome {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.upload-page {
  min-height: calc(100vh - 82px);
}

.welcome-card {
  width: min(760px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 12px;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
}

.welcome h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.24;
  letter-spacing: 0;
}

.welcome p {
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.upload-row,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-row {
  margin: 24px 0 14px;
}

.hint {
  font-size: 13px;
}

.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  border-color: #8fa0b3;
  background: #fbfcff;
}

.button.primary {
  border-color: #1d4ed8;
  background: var(--blue);
  color: #ffffff;
}

.button.success {
  border-color: #15803d;
  background: var(--green);
  color: #ffffff;
}

.button.ghost {
  background: #f8fafc;
}

.select,
.toggle {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.select {
  padding: 6px 34px 6px 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.app-topbar {
  min-height: 72px;
}

.app-brand-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
}

.app-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.file-name {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message,
.notice {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #eef6ff;
  color: #17406e;
  padding: 9px 18px;
  font-size: 14px;
}

.notice {
  margin-top: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
}

.message.loading {
  background: var(--amber-soft);
  color: #744900;
}

.view-nav {
  position: sticky;
  top: 72px;
  z-index: 19;
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 250, 247, 0.96);
  backdrop-filter: blur(12px);
  overflow-x: auto;
}

.view-tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #475467;
  padding: 7px 16px;
  font-weight: 700;
  white-space: nowrap;
}

.view-tab:hover,
.view-tab.active {
  border-color: #b7c8e8;
  background: var(--blue-soft);
  color: #174ea6;
}

.page-shell {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.overview-grid,
.export-page {
  display: grid;
  gap: 16px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 22px rgba(22, 33, 48, 0.04);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card b {
  font-size: 30px;
  line-height: 1;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.split-page {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.analysis-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.audit-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.audit-left {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 132px;
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.filter-stack {
  display: grid;
  gap: 10px;
}

.filter-stack label:not(.toggle) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.export-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.export-hero p {
  color: var(--muted);
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr) 346px;
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.sidebar,
.detail-pane,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(22, 33, 48, 0.04);
}

.sidebar,
.detail-pane {
  position: sticky;
  top: 132px;
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.sidebar {
  padding: 12px;
}

.workspace {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.detail-pane {
  padding: 12px;
}

.view-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.panel-title {
  min-height: 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title span {
  font-weight: 800;
}

.panel-title small {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.warning-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #744900;
}

.warning-strip span {
  font-size: 13px;
}

.sidebar-title,
.summary-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.batch-list {
  display: grid;
  gap: 8px;
}

.batch-card {
  width: 100%;
  min-height: 78px;
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.batch-card strong {
  font-size: 16px;
}

.batch-card span,
.batch-card small {
  color: var(--muted);
}

.batch-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.batch-card.large {
  min-height: 112px;
  padding: 16px;
}

.overview-actions,
.flow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.overview-actions span,
.flow-actions span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.summary-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.flow-panel {
  overflow: hidden;
}

.flow-line {
  display: flex;
  align-items: stretch;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.flow-segment {
  min-width: 108px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 0;
  border-right: 1px solid rgba(24, 33, 47, 0.12);
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
}

.flow-segment:last-child {
  border-right: 0;
}

.flow-segment b {
  font-size: 15px;
}

.flow-segment span,
.flow-segment small {
  color: #334155;
}

.flow-segment.nursery {
  background: #edf8f6;
}

.flow-segment.juvenile {
  background: #edf2ff;
}

.flow-segment.adult {
  background: #f3edff;
}

.metric-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 90px;
  overflow: auto;
  margin-bottom: 10px;
}

.metric-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 5px 9px;
  font-size: 13px;
}

.chart-scale-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
  margin: 0 0 12px;
}

.chart-scale-controls label {
  display: grid;
  grid-template-columns: 42px minmax(120px, 1fr) 64px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.chart-scale-controls input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.chart-scale-controls output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.trend-chart-list {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.trend-card {
  width: var(--chart-width, 100%);
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.trend-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.trend-card-head strong {
  font-size: 15px;
}

.trend-card-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.trend-svg {
  width: 100%;
  height: var(--chart-height, auto);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.axis {
  stroke: #8b97a8;
  stroke-width: 1;
}

.axis.right {
  stroke-dasharray: 5 4;
}

.axis-label,
.phase-label,
.tick-label,
.legend {
  font-size: 11px;
}

.axis-label,
.tick-label {
  fill: var(--muted);
}

.tick-label-date {
  font-size: 10px;
  fill: #75839a;
}

.grid-line {
  stroke: #dbe3ee;
  stroke-width: 1;
  opacity: 0.68;
}

.tick-line {
  stroke: #8b97a8;
  stroke-width: 1;
}

.phase-marker {
  stroke: #a16207;
  stroke-dasharray: 4 5;
}

.phase-label {
  fill: #744900;
}

.chart-hit-target {
  fill: transparent;
  cursor: crosshair;
}

.chart-dot {
  cursor: pointer;
}

.chart-dot.ok {
  fill: var(--blue);
  stroke: #ffffff;
  stroke-width: 1.5;
}

.chart-dot.warning,
.chart-dot.error {
  fill: var(--red);
  stroke: #ffffff;
  stroke-width: 2;
}

.chart-dot.missing {
  fill: var(--amber);
}

.chart-dot.modified {
  fill: var(--violet);
}

.modified-original {
  stroke-dasharray: 4 4;
  opacity: 0.72;
}

.crosshair-line,
.crosshair-label-bg,
.crosshair-label {
  opacity: 0;
  pointer-events: none;
}

.crosshair-line {
  stroke: #0f172a;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.crosshair-label-bg {
  fill: rgba(15, 23, 42, 0.86);
}

.crosshair-label {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.crosshair-label-sub {
  font-weight: 500;
}

.trend-svg.crosshair-active .crosshair-line,
.trend-svg.crosshair-active .crosshair-label-bg,
.trend-svg.crosshair-active .crosshair-label {
  opacity: 1;
}

.empty-chart,
.empty-detail {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.heatmap {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
}

.heat-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.heat-label {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heat-cells {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 9px;
  gap: 3px;
  overflow-x: auto;
  min-height: 22px;
  align-items: center;
}

.heat-cell {
  width: 9px;
  height: 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend-cell {
  width: 16px;
  height: 10px;
  display: inline-block;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
}

.ok,
.legend-cell.ok,
.heat-cell.ok {
  background: var(--green-soft);
}

.missing,
.legend-cell.missing,
.heat-cell.missing {
  background: var(--amber-soft);
}

.warning,
.error,
.legend-cell.warning,
.heat-cell.warning,
.heat-cell.error {
  background: var(--red-soft);
}

.modified,
.legend-cell.modified,
.heat-cell.modified {
  background: var(--violet-soft);
}

b.ok {
  color: var(--green);
  background: transparent;
}

b.missing {
  color: var(--amber);
  background: transparent;
}

b.warning,
b.error {
  color: var(--red);
  background: transparent;
}

b.modified {
  color: var(--violet);
  background: transparent;
}

.day-table {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-head,
.day-row {
  display: grid;
  grid-template-columns: 74px 104px 82px minmax(82px, 1fr) 74px 58px;
  gap: 8px;
  align-items: center;
  min-width: 560px;
}

.day-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f0;
  color: #475467;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.day-row {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 10px;
  text-align: left;
}

.day-row:hover,
.day-row.active {
  background: var(--blue-soft);
}

.day-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.point-diagram {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 32px minmax(150px, 1fr) 32px minmax(150px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.point-node {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
}

.point-node span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.point-node.valid {
  background: var(--green-soft);
  border-color: #9fd3b2;
}

.point-node.blocked {
  background: var(--red-soft);
  border-color: #efb6b6;
}

.point-node.neutral {
  background: #eef2f0;
}

.arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 20px;
}

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

.matrix {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 13px;
}

.matrix th,
.matrix td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.matrix th {
  position: sticky;
  top: 0;
  background: #eef2f0;
  color: #475467;
  z-index: 1;
}

.matrix tr {
  cursor: pointer;
}

.matrix tr.selected,
.matrix tr:hover {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.detail-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 10px;
}

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

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

.record-list {
  display: grid;
  gap: 8px;
  max-height: 262px;
  overflow: auto;
  padding-right: 3px;
}

.record-card {
  width: 100%;
  min-height: 68px;
  display: grid;
  gap: 3px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  padding: 9px 10px;
}

.record-card.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

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

.record-card b {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.record-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.selected-record {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.selected-record dl {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 0 0 12px;
  font-size: 13px;
}

.selected-record dt {
  color: var(--muted);
}

.selected-record dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.mod-note {
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  background: var(--violet-soft);
  color: #4c1d95;
  padding: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

.edit-box {
  display: grid;
  gap: 9px;
}

.edit-box label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.edit-box input,
.edit-box select,
.edit-box textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 9px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  padding: 22px;
}

.edit-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 78px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
  letter-spacing: 0;
}

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

.icon-button.compact {
  min-width: 34px;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.modal-facts {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  font-size: 13px;
}

.modal-facts dt {
  color: var(--muted);
}

.modal-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-edit-box {
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

@media (max-width: 1240px) {
  .summary-cards,
  .batch-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .audit-page {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .detail-pane {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 960px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 360px;
  }

  .login-form-panel {
    padding: 32px 18px 56px;
  }

  .login-tools {
    position: static;
    justify-content: center;
    margin-bottom: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-name {
    max-width: 92vw;
  }

  .app-shell,
  .view-grid,
  .split-page,
  .analysis-page,
  .audit-page {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .audit-left {
    position: static;
    max-height: none;
  }

  .point-diagram {
    grid-template-columns: 1fr;
  }

  .arrow {
    transform: rotate(90deg);
  }

  .chart-scale-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login-card {
    padding: 30px 22px;
  }

  .login-brand-panel h1 {
    font-size: 30px;
  }

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

  .welcome {
    padding: 16px;
  }

  .welcome-card {
    padding: 22px;
  }

  .welcome h1 {
    font-size: 24px;
  }

  .top-actions,
  .upload-row {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .button,
  .select,
  .toggle {
    width: 100%;
  }

  .app-shell {
    padding: 10px;
  }

  .flow-line {
    flex-direction: column;
  }

  .flow-segment {
    width: 100% !important;
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 33, 47, 0.12);
  }

  .heat-row {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}
