:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f213c;
  --muted: #5f6f86;
  --line: #dbe3ef;
  --primary: #1f4aa8;
  --primary-hover: #173d8c;
  --surface: #fafcff;
  --surface-soft: #f7f9fc;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 184, 77, 0.14) 0, rgba(255, 184, 77, 0) 28%),
    radial-gradient(circle at 86% 4%, rgba(46, 104, 214, 0.16) 0, rgba(46, 104, 214, 0) 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #eef3f9 100%);
  letter-spacing: 0.1px;
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(20, 35, 59, 0.05);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.brand-wrap {
  display: grid;
  gap: 2px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

.topnav a {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 9px 14px;
  text-decoration: none;
  margin-left: 12px;
  font-weight: 600;
  box-shadow: none;
}

.topnav a:hover {
  background: var(--primary-hover);
}

.main-content {
  padding: 20px 0 40px;
}

.page-title-wrap {
  margin-bottom: 12px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

h2 {
  font-size: 37px;
  margin: 0 0 10px;
  letter-spacing: 0.2px;
}

h3 {
  font-size: 29px;
  margin: 0 0 10px;
  letter-spacing: 0.2px;
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(20, 35, 59, 0.05);
}

.card {
  padding: 20px;
  margin-bottom: 16px;
}

.panel {
  padding: 14px;
}

.panel h4 {
  margin: 14px 0 8px;
  font-size: 15px;
}

.panel h5 {
  margin: 10px 0 6px;
  font-size: 14px;
  color: var(--text);
}

.section-block {
  margin-top: 12px;
}

.panel-inner {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, var(--surface) 100%);
  margin-bottom: 10px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.summary-card h4 {
  margin: 0 0 8px;
}

.summary-main {
  margin: 0 0 6px;
  font-weight: 700;
  line-height: 1.4;
}

.priority-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.priority-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.priority-badge.p0 {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.priority-badge.p1 {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

#overall-conclusion {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

#first-screen-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

#first-screen-summary.quickview-rich {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.quickview-label {
  font-size: 15px;
  color: #243b63;
}

.quickview-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f2f73;
  letter-spacing: 0.2px;
}

.quickview-tail {
  font-size: 13px;
  color: #4f5f79;
}

.summary-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-sub:empty {
  display: none;
}

.amount-once {
  margin: 8px 0 0;
  font-size: 12px;
}

.narrow {
  max-width: 500px;
}

.muted {
  color: var(--muted);
  margin-top: 0;
}

.alert {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%);
}

.alert.warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.strong-hint {
  margin: 8px 0 0;
  color: #92400e;
  font-weight: 600;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

small {
  color: var(--muted);
}

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

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd9e8;
  border-radius: 9px;
  background: #fff;
  transition: all .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7ea5e8;
  box-shadow: 0 0 0 3px rgba(28, 74, 168, 0.12);
}

.btn {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all .18s ease;
  font-weight: 600;
}

.btn:hover {
  background: #edf3ff;
  border-color: #a7bfe7;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.btn.small {
  padding: 4px 8px;
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.actions.compact {
  margin-top: 0;
  margin-bottom: 10px;
}

.kv-grid,
.grid-two {
  display: grid;
  gap: 12px;
}

.kv-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 12px;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

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

th,
td {
  border: 1px solid #e1e8f3;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
  color: #1b3258;
  font-weight: 700;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block,
.inline-pre,
.copy-block {
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.inline-pre {
  font-size: 12px;
}

.copy-block {
  min-height: 90px;
}

.list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

.result-box {
  margin-top: 10px;
  color: var(--muted);
}

.error-text {
  color: var(--danger);
}

.quality-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: #f3f4f6;
}

.inline-grade {
  margin-left: 6px;
  vertical-align: middle;
}

.quality-good {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.quality-warning {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.quality-bad {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.hidden {
  display: none;
}

#failure-state-panel.failure-full {
  border-color: #ef4444;
  background: #fef2f2;
}

#failure-state-panel.failure-partial {
  border-color: #f59e0b;
  background: #fffbeb;
}

#fs-file-status-body .actions.compact {
  margin-top: 6px;
}

.inflow-composition {
  margin-bottom: 12px;
}

.stacked-bar {
  width: 100%;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: #f3f4f6;
  margin: 8px 0;
}

.stacked-segment {
  height: 100%;
  min-width: 0;
  font-size: 11px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
}

.stacked-legend {
  display: grid;
  gap: 6px;
}

.stacked-legend-item {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.stacked-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.stacked-legend-item .name {
  color: var(--text);
}

.stacked-legend-item .value,
.stacked-legend-item .ratio {
  color: var(--muted);
  white-space: nowrap;
}

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

.compare-row {
  display: grid;
  grid-template-columns: 52px 1fr 110px;
  align-items: center;
  gap: 8px;
}

.compare-label {
  font-size: 13px;
  color: var(--text);
}

.compare-track {
  height: 12px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid var(--line);
  overflow: hidden;
}

.compare-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
}

.compare-bar.inflow {
  background: #1d4ed8;
}

.compare-bar.outflow {
  background: #d97706;
}

.compare-bar.net {
  background: #059669;
}

.compare-bar.net.negative {
  background: #b91c1c;
}

.compare-value {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.upload-progress {
  margin-top: 12px;
  border: 1px solid #94a3b8;
  background: #f8fbff;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-progress.hidden {
  display: none !important;
}

.upload-busy-banner {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin-bottom: 12px;
  border: 2px solid #1f4aa8;
  background: linear-gradient(180deg, #eef4ff 0%, #e6efff 100%);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(31, 74, 168, 0.18);
}

.upload-busy-banner.hidden {
  display: none !important;
}

.upload-busy-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: #12316d;
}

.upload-busy-text {
  margin: 0;
  font-size: 13px;
  color: #284378;
}

.upload-progress-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: #0f285a;
}

.upload-progress-text {
  margin: 0;
  font-size: 13px;
  color: #3a4b68;
}

.upload-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  min-height: 260px;
  padding: clamp(24px, 3vw, 34px) clamp(22px, 3.2vw, 36px);
  border-color: #cbdcf5;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 246, 255, 0.98) 58%, rgba(255, 248, 236, 0.96) 100%);
  box-shadow: 0 24px 60px rgba(31, 74, 168, 0.12);
}

.upload-hero::before {
  content: "";
  position: absolute;
  inset: -90px auto auto -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(251, 176, 64, 0.22);
  filter: blur(2px);
}

.upload-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(31, 74, 168, 0.14);
}

.upload-hero-main,
.upload-hero-visual {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.upload-eyebrow {
  margin: 0 0 10px;
  color: #b36a00;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.upload-hero h2 {
  max-width: 560px;
  margin-bottom: 14px;
  font-size: clamp(32px, 3vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.6px;
  word-break: keep-all;
}

.upload-hero-text {
  margin: 0;
  color: #42536f;
  max-width: 620px;
  line-height: 1.7;
  font-size: 16px;
}

.upload-hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.upload-hero-points span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(31, 74, 168, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #173461;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(20, 35, 59, 0.06);
}

.upload-hero-visual {
  display: grid;
  gap: 12px;
  min-height: 0;
  justify-items: stretch;
  align-self: center;
}

.upload-visual-card {
  border: 1px solid rgba(139, 160, 190, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 44px rgba(20, 35, 59, 0.12);
  min-width: 0;
}

.upload-visual-card.main {
  position: relative;
  right: auto;
  top: auto;
  width: 100%;
  padding: 22px;
}

.upload-visual-card.floating {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  padding: 14px 16px;
  background: rgba(16, 42, 84, 0.94);
  color: #fff;
}

.upload-visual-card span,
.upload-visual-label {
  display: block;
  color: #667895;
  font-size: 12px;
  font-weight: 700;
}

.upload-visual-card.floating span {
  color: rgba(255, 255, 255, 0.72);
}

.upload-visual-card strong {
  display: block;
  margin: 8px 0 18px;
  font-size: clamp(16px, 1.5vw, 18px);
  color: #10284f;
  white-space: nowrap;
}

.upload-visual-card.floating strong {
  margin-bottom: 0;
  font-size: clamp(18px, 1.6vw, 20px);
  color: #fff;
}

.upload-visual-line {
  height: 12px;
  margin-top: 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f4aa8 0%, #6ea8ff 55%, #f0b34d 100%);
  opacity: 0.9;
}

.upload-visual-line.wide {
  width: 92%;
}

.upload-visual-line.mid {
  width: 70%;
}

.upload-visual-line.short {
  width: 46%;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.upload-card,
.upload-side-card {
  padding: 24px;
  box-shadow: 0 16px 40px rgba(20, 35, 59, 0.07);
}

.upload-card-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.upload-card-sub {
  margin-bottom: 0;
}

.upload-card-tag {
  display: none;
}

.upload-form-grid {
  gap: 14px;
}

.upload-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upload-file-field {
  padding: 18px;
  border: 1.5px dashed #a8bddc;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(250, 252, 255, 0.96), rgba(240, 246, 255, 0.96));
}

.upload-file-field > span {
  font-weight: 700;
  color: #173461;
}

.upload-form-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.upload-form-actions .btn.primary {
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(31, 74, 168, 0.18);
}

.upload-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-status-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: #fafcff;
}

.upload-status-item strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  color: #173564;
  word-break: break-all;
}

.upload-status-label {
  display: block;
  color: #5f718d;
  font-size: 12px;
}

.upload-side-note {
  min-height: 24px;
}

.upload-placeholder {
  min-height: 72px;
  padding: 10px 2px 0;
}

.global-loading-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 20, 35, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.global-loading-card {
  min-width: 320px;
  max-width: 520px;
  background: #ffffff;
  border: 1px solid #c8d4e6;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 35, 70, 0.25);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.ops-hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 800;
}

.ops-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-actions button,
button.secondary {
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--primary);
}

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

.ops-metric {
  margin-bottom: 12px;
}

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

.ops-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.danger-lite strong {
  color: var(--danger);
}

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

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

.ops-count-list h3 {
  margin: 10px 0 0;
  font-size: 16px;
}

.ops-count-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--surface);
}

.ops-count-list span {
  min-width: 0;
  word-break: break-all;
}

.ops-count-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table.compact {
  font-size: 12px;
}

.global-loading-title {
  margin: 0 0 4px;
  font-weight: 700;
  color: #10284f;
}

.global-loading-detail {
  margin: 0;
  font-size: 13px;
  color: #4c5d78;
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid #d7e3f5;
  border-top-color: #1f4aa8;
  animation: spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.loading-spinner.small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

body.is-busy {
  cursor: progress;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

  .upload-hero h2 {
    max-width: 100%;
  }

  .upload-hero-visual {
    display: none;
  }
}

@media (min-width: 1001px) and (max-width: 1280px) {
  .upload-hero {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  }

  .upload-hero h2 {
    font-size: clamp(30px, 2.7vw, 40px);
  }

  .upload-hero-text {
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  .container {
    width: 94vw;
  }

  .page-title {
    font-size: 30px;
  }

  h2 {
    font-size: 28px;
  }

  h3 {
    font-size: 24px;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .topnav a {
    margin-left: 0;
  }

  .global-loading-card {
    min-width: unset;
    width: 100%;
  }

  #first-screen-summary.quickview-rich {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .upload-hero,
  .upload-layout,
  .upload-form-row,
  .upload-status-grid,
  .ops-hero,
  .ops-two-col {
    grid-template-columns: 1fr;
  }

  .upload-hero {
    padding: 24px;
  }

  .upload-hero-visual {
    display: none;
  }

  .upload-card-head,
  .section-head,
  .ops-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}



