:root {
  --navy: #102033;
  --navy-soft: #1c3047;
  --teal: #087f8c;
  --teal-soft: #dff1f1;
  --green: #3a8f67;
  --gold: #b78235;
  --red: #bd5b50;
  --blue: #3c6f9f;
  --ink: #182633;
  --muted: #6b7884;
  --line: #dbe2e7;
  --surface: #ffffff;
  --canvas: #f3f6f7;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
body.modal-open { overflow: hidden; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #eef6f7;
  background: var(--navy);
  display: flex;
  flex-direction: column;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 24px; border-bottom: 1px solid #2a3c50; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #eef6f7; color: var(--navy); font-weight: 800; border-radius: 6px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand div span { margin-top: 3px; color: #98acbd; font-size: 12px; }

.side-nav { display: grid; gap: 5px; margin-top: 22px; }
.nav-item { width: 100%; min-height: 42px; padding: 0 11px; border: 0; border-radius: 5px; color: #afbecb; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; }
.nav-item:hover, .nav-item.active { color: #fff; background: var(--navy-soft); }
.nav-item.active { box-shadow: inset 3px 0 0 #2fb0b4; }
.nav-item.nav-primary { margin-bottom: 9px; color: #eafafa; background: #126879; }
.nav-item.nav-primary:hover { background: #168093; }
.nav-icon { width: 20px; font-size: 17px; text-align: center; }

.sidebar-meta { margin-top: auto; padding: 15px 8px 0; border-top: 1px solid #2a3c50; }
.sidebar-home { width: 100%; min-height: 38px; margin-bottom: 14px; padding: 0 9px; border: 1px solid #35506b; border-radius: 5px; color: #dce7ed; background: #172a3f; display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 11px; font-weight: 650; }
.sidebar-home:hover { border-color: #4b7186; color: #fff; background: #20384f; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; color: #90a3b3; font-size: 11px; }
.meta-row strong { color: #d7e1e8; font-weight: 600; }
.local-badge { margin-top: 15px; padding: 9px 10px; border: 1px solid #35506b; border-radius: 5px; color: #b7c7d3; font-size: 12px; }
.local-badge span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #57be8b; }

.main-area { min-width: 0; padding: 0 30px 26px; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-label { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
h1, h2 { margin: 0; }
h1 { font-size: 23px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
.current-ship-context { margin: 5px 0 0; color: var(--teal); font-size: 11px; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.month-select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); display: flex; align-items: center; gap: 9px; }
.month-select span { color: var(--muted); font-size: 12px; }
.month-select select { border: 0; outline: 0; color: var(--ink); background: transparent; font-weight: 650; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--surface); font-size: 20px; }
.icon-button:hover { border-color: var(--teal); color: var(--teal); }
.primary-button, .secondary-button, .text-button { min-height: 38px; padding: 0 14px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.primary-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.primary-button:hover { border-color: #086c77; background: #086c77; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.text-button { min-height: 30px; padding: 0 8px; border: 0; color: var(--teal); background: transparent; }

.batch-notice { min-height: 52px; margin: 16px 0 -2px; padding: 9px 12px; border: 1px solid #bddcde; border-left: 3px solid var(--teal); background: #f0f8f8; align-items: center; justify-content: space-between; gap: 16px; }
.batch-notice:not([hidden]) { display: flex; }
.batch-notice > div { min-width: 0; display: flex; align-items: center; gap: 10px; }
.batch-notice strong, .batch-notice span { display: block; }
.batch-notice strong { font-size: 12px; }
.batch-notice div div span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.notice-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.batch-notice.success { border-color: #b9ddc8; border-left-color: var(--green); background: #f1f8f4; }
.batch-notice.success .notice-dot { background: var(--green); }
.batch-notice.failed { border-color: #e7c5c1; border-left-color: var(--red); background: #fbf3f2; }
.batch-notice.failed .notice-dot { background: var(--red); }

.control-band { min-height: 64px; margin: 18px 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--teal); background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.mode-copy { min-width: 0; display: flex; align-items: center; gap: 10px; }
.mode-copy strong, .mode-copy span { display: block; }
.mode-copy strong { font-size: 14px; }
.mode-copy div span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--teal); }
.mode-badge { flex: 0 0 auto; min-height: 30px; padding: 0 11px; border: 1px solid #bddcde; border-radius: 4px; color: #076c77; background: #f0f8f8; display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; }

.page-section { scroll-margin-top: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi-card { min-height: 105px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); position: relative; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.kpi-card .kpi-label { color: var(--muted); font-size: 12px; }
.kpi-card strong { display: block; margin-top: 9px; font-size: 25px; font-variant-numeric: tabular-nums; }
.kpi-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 14px; margin-top: 14px; }
.overview-grid-single { grid-template-columns: minmax(0, 1fr); }
.panel { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 5px 16px rgb(16 32 51 / 3%); }
.panel-heading { padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf0f2; }
.unit-label { color: var(--muted); font-size: 11px; }
.bar-chart { min-height: 220px; padding: 18px; display: grid; align-content: center; gap: 15px; }
.bar-row { width: 100%; padding: 7px 8px; border: 1px solid transparent; border-radius: 4px; color: inherit; background: transparent; display: grid; grid-template-columns: minmax(150px, 210px) minmax(120px, 1fr) 75px; gap: 12px; align-items: center; text-align: left; }
.bar-row:hover { background: #f7fafb; }
.bar-row.selected { border-color: #bddcde; background: #f0f8f8; }
.bar-name strong, .bar-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-name strong { font-size: 12px; }
.bar-name span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.bar-track { height: 12px; background: #e7edef; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; min-width: 2px; background: var(--bar-color); border-radius: 3px; }
.bar-value { text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.quality-summary { min-height: 220px; padding: 18px; display: grid; align-content: center; gap: 15px; }
.quality-meter { display: grid; grid-template-columns: 78px 1fr; gap: 18px; align-items: center; }
.meter-ring { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) var(--meter), #e5eaed 0); position: relative; }
.meter-ring::after { content: ""; width: 58px; height: 58px; border-radius: 50%; background: #fff; position: absolute; }
.meter-ring strong { position: relative; z-index: 1; font-size: 16px; }
.quality-copy strong { display: block; font-size: 13px; }
.quality-copy span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.quality-list { display: grid; gap: 9px; }
.quality-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.quality-row strong { color: var(--ink); }

.ship-table-panel { margin-top: 14px; }
.table-toolbar { min-height: 72px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #edf0f2; }
.table-actions { display: flex; align-items: center; gap: 8px; }
.search-box { height: 34px; width: 220px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; display: flex; align-items: center; gap: 7px; }
.search-box span { color: var(--muted); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.command-button { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fff; font-size: 12px; }
.command-button:hover { border-color: var(--teal); color: var(--teal); }
.table-wrap { overflow-x: auto; }
.ship-table-panel table { min-width: 960px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 15px; color: var(--muted); background: #f7f9fa; text-align: left; font-weight: 650; white-space: nowrap; }
td { padding: 13px 15px; border-top: 1px solid #edf0f2; vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.selected { background: #f0f8f8; }
.ship-cell strong, .ship-cell span { display: block; }
.ship-cell span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.number-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.route-code { color: var(--blue); font-weight: 700; }
.progress-cell { min-width: 110px; }
.progress-track { width: 90px; height: 5px; background: #e6ebee; border-radius: 2px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--teal); }
.progress-cell small { display: block; margin-top: 5px; color: var(--muted); }
.state-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 4px; color: #27704e; background: #e4f2e9; font-size: 11px; }
.state-pill.waiting { color: #885f21; background: #f6ecd9; }

.detail-section { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 7px 20px rgb(16 32 51 / 4%); }
.detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.route-badge { min-width: 150px; padding: 10px 12px; border: 1px solid #cfdce3; border-top-color: var(--blue); border-radius: 5px; background: #fbfcfd; text-align: right; }
.route-badge strong, .route-badge span { display: block; }
.route-badge strong { color: var(--blue); font-size: 14px; }
.route-badge span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.detail-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin-top: 18px; background: var(--line); border: 1px solid var(--line); }
.detail-stat { min-height: 74px; padding: 13px; background: #fff; }
.detail-stat span, .detail-stat strong { display: block; }
.detail-stat span { color: var(--muted); font-size: 10px; }
.detail-stat strong { margin-top: 7px; font-size: 16px; font-variant-numeric: tabular-nums; }
.operation-breakdown { margin-top: 20px; padding: 18px 0 2px; border-top: 1px solid var(--line); }
.breakdown-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.breakdown-heading h3, .port-water-copy h3 { margin-top: 4px; font-size: 14px; }
.breakdown-heading > span { color: var(--muted); font-size: 10px; }
.state-bar { width: 100%; height: 15px; margin-top: 14px; border: 1px solid #d4dde1; border-radius: 3px; background: #e7edef; display: flex; overflow: hidden; box-shadow: inset 0 1px 2px rgb(16 32 51 / 7%); }
.state-bar span { min-width: 1px; height: 100%; background: var(--state-color); }
.state-legend { margin-top: 12px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.state-item { min-width: 0; display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 3px 7px; align-items: center; }
.state-swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--state-color); }
.state-item > span:not(.state-swatch) { color: var(--muted); font-size: 10px; }
.state-item strong { grid-column: 2; font-size: 13px; font-variant-numeric: tabular-nums; }
.state-item small { grid-column: 2; color: var(--muted); font-size: 9px; }
.port-water-band { margin-top: 18px; padding: 16px 18px; border: 1px solid #d5e6e7; border-left: 3px solid var(--teal); background: #f4f9f9; display: grid; grid-template-columns: minmax(260px, .85fr) minmax(440px, 1.15fr); gap: 28px; align-items: center; }
.port-water-copy h3 { color: #086f79; }
.port-water-copy p { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.port-emission-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.port-emission-stat { min-height: 68px; padding: 11px; border-top: 2px solid var(--teal); background: #fff; }
.port-emission-stat:nth-child(2) { border-top-color: var(--gold); }
.port-emission-stat:nth-child(3) { border-top-color: var(--blue); }
.port-emission-stat:nth-child(4) { border-top-color: #8a5d91; }
.port-emission-stat span, .port-emission-stat strong, .port-emission-stat small { display: block; }
.port-emission-stat span, .port-emission-stat small { color: var(--muted); font-size: 9px; }
.port-emission-stat strong { margin: 6px 0 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.breakdown-note { grid-column: 1 / -1; margin: 0; padding: 14px; color: var(--muted); background: #f8fafb; font-size: 11px; }
.detail-tabs { display: flex; gap: 2px; margin-top: 20px; border-bottom: 1px solid var(--line); }
.detail-tabs button { min-width: 90px; height: 38px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; }
.detail-tabs button.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 700; }
.detail-content { min-height: 190px; padding-top: 16px; }
.timeline { display: grid; gap: 10px; }
.timeline-row { margin: 0 -8px; padding: 8px; border-radius: 4px; display: grid; grid-template-columns: 138px 18px minmax(0, 1fr) 100px; gap: 10px; align-items: center; transition: background-color 140ms ease; }
.timeline-row:hover { background: #f5f9f9; }
.timeline-time { color: var(--muted); font-size: 10px; text-align: right; }
.timeline-marker { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px #b9d7da; position: relative; }
.timeline-marker::after { content: ""; position: absolute; width: 2px; height: 30px; left: 4px; top: 10px; background: #d7e2e4; }
.timeline-row:last-child .timeline-marker::after { display: none; }
.timeline-main { min-width: 0; }
.timeline-main strong { font-size: 12px; }
.timeline-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.timeline-main .timeline-states { margin-top: 6px; color: #48616e; line-height: 1.55; white-space: normal; }
.timeline-value { text-align: right; font-size: 11px; }
.timeline-value strong, .timeline-value small { display: block; }
.timeline-value strong { font-size: 12px; }
.timeline-value small { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 400; }
.empty-state { min-height: 150px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.candidate-list, .audit-list { display: grid; gap: 8px; }
.candidate-row, .audit-row { min-height: 52px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; display: grid; grid-template-columns: minmax(120px, 1fr) 90px 100px; align-items: center; gap: 12px; }
.candidate-row.selected { border-color: #6bb5b5; background: #f0f8f8; }
.candidate-row strong, .candidate-row span { font-size: 11px; }
.confidence-bar { height: 5px; background: #e7edef; border-radius: 2px; overflow: hidden; }
.confidence-bar span { display: block; height: 100%; background: var(--gold); }
.audit-row { grid-template-columns: 80px 170px minmax(0, 1fr); }
.audit-severity { color: var(--gold); font-weight: 700; }
.port-table { width: 100%; }
.page-footer { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; }
.page-footer strong { color: var(--green); }

.modal-shell { position: fixed; inset: 0; z-index: 100; }
.modal-shell[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgb(16 32 51 / 58%); }
.batch-dialog { position: absolute; top: 0; right: 0; width: min(620px, 100%); height: 100%; overflow-y: auto; color: var(--ink); background: var(--surface); box-shadow: -16px 0 40px rgb(16 32 51 / 18%); }
.dialog-header { min-height: 102px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-header h2 { font-size: 20px; }
.dialog-header div > span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.batch-form { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(260px, 1.2fr); gap: 18px; }
.field-group { min-width: 0; display: block; }
.field-group > span, .field-group legend { display: block; margin-bottom: 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
.field-group input[type="month"], .field-group textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fff; outline: 0; }
.field-group input[type="month"] { height: 39px; padding: 0 10px; }
.field-group textarea { min-height: 92px; padding: 10px; resize: vertical; line-height: 1.55; }
.field-group input:focus, .field-group textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgb(8 127 140 / 10%); }
.field-group small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.mode-fieldset { margin: 0; padding: 0; border: 0; }
.form-segmented { min-height: 58px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #eef2f4; display: grid; grid-template-columns: repeat(3, 1fr); }
.form-segmented label { min-width: 0; cursor: pointer; }
.form-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.form-segmented span { min-height: 50px; padding: 6px 7px; border-radius: 4px; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; white-space: nowrap; }
.form-segmented span strong { font-size: 11px; }
.form-segmented span small { margin: 0; color: inherit; font-size: 9px; font-weight: 400; }
.form-segmented input:checked + span { color: #fff; background: var(--navy-soft); }
.upload-zone { min-height: 142px; margin-top: 20px; padding: 18px; border: 1px dashed #9bb7c1; border-radius: 6px; background: #f7fafb; display: grid; place-items: center; align-content: center; text-align: center; cursor: pointer; }
.upload-zone:hover, .upload-zone.has-files { border-color: var(--teal); background: #f0f8f8; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { width: 34px; height: 34px; margin-bottom: 7px; border-radius: 50%; color: #fff; background: var(--teal); display: grid; place-items: center; font-size: 18px; }
.upload-zone strong { font-size: 13px; }
.upload-zone > span:not(.upload-icon) { margin-top: 4px; color: var(--muted); font-size: 11px; }
.upload-zone em { margin-top: 8px; color: var(--blue); font-size: 10px; font-style: normal; }
.import-guide { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.import-guide a { flex: 0 0 auto; color: var(--blue); font-weight: 700; text-decoration: none; }
.import-guide a:hover { text-decoration: underline; }
.assignment-field { margin-top: 18px; }
.assignment-field[hidden] { display: none; }
.library-strip { margin-top: 18px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafb; }
.library-strip > div { min-height: 38px; padding: 0 11px; border-top: 1px solid #e8edef; display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 7px; font-size: 11px; }
.library-strip > div:first-child { border-top: 0; }
.library-strip strong { color: var(--green); font-size: 10px; }
.ready-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.local-lock { color: var(--blue); font-size: 13px; }
.form-message { margin-top: 16px; padding: 10px 12px; border: 1px solid #e7c5c1; border-radius: 5px; color: #8f4038; background: #fbf3f2; font-size: 11px; line-height: 1.5; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.recent-batches { padding: 20px 24px 28px; }
.recent-heading { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-heading strong { font-size: 12px; }
.batch-list { display: grid; gap: 7px; margin-top: 8px; }
.batch-row { min-height: 54px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: #fff; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.batch-row-main strong, .batch-row-main span { display: block; }
.batch-row-main strong { font-size: 11px; }
.batch-row-main span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.batch-status { min-width: 58px; height: 24px; padding: 0 7px; border-radius: 4px; color: #885f21; background: #f6ecd9; display: grid; place-items: center; font-size: 10px; }
.batch-status.succeeded { color: #27704e; background: #e4f2e9; }
.batch-status.failed { color: #8f4038; background: #f8e4e2; }
.batch-view { border: 0; color: var(--teal); background: transparent; font-size: 10px; font-weight: 700; }
.muted-text { color: var(--muted); font-size: 11px; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; }
  .brand { justify-content: center; padding: 0 0 18px; }
  .brand div, .nav-item:not(.active) .nav-label, .sidebar-meta .meta-row { display: none; }
  .nav-item { justify-content: center; padding: 0; font-size: 0; }
  .nav-icon { font-size: 17px; }
  .sidebar-home { justify-content: center; padding: 0; }
  .sidebar-home-label { display: none; }
  .local-badge { padding: 8px 4px; text-align: center; font-size: 9px; }
  .local-badge span { display: block; margin: 0 auto 5px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .port-water-band { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
  .brand { padding: 0; border: 0; }
  .brand div { display: block; }
  .side-nav { margin: 0; display: flex; justify-content: flex-end; }
  .nav-item { width: 38px; min-height: 36px; }
  .sidebar-meta { margin: 0; padding: 0; border: 0; }
  .sidebar-home { width: 38px; min-height: 36px; margin: 0; }
  .local-badge { display: none; }
  .main-area { padding: 0 14px 20px; }
  .topbar { min-height: 70px; }
  .topbar-actions .primary-button { width: 38px; padding: 0; font-size: 0; }
  .topbar-actions .primary-button span { font-size: 17px; }
  .control-band { align-items: stretch; flex-direction: column; }
  .mode-badge { align-self: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid > .panel { min-width: 0; }
  .bar-row { grid-template-columns: minmax(80px, 110px) minmax(60px, 1fr) 60px; gap: 8px; }
  .kpi-card { min-height: 94px; padding: 13px; }
  .kpi-card strong { font-size: 20px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-actions { width: 100%; }
  .search-box { width: 100%; }
  .detail-heading { flex-direction: column; }
  .route-badge { width: 100%; text-align: left; }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .state-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .port-emission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-tabs { overflow-x: auto; }
  .timeline-row { grid-template-columns: 90px 14px minmax(120px, 1fr); }
  .timeline-value { grid-column: 3; text-align: left; }
  .candidate-row, .audit-row { grid-template-columns: 1fr; }
  .page-footer { align-items: flex-start; flex-direction: column; justify-content: center; }
  .dialog-header, .batch-form, .recent-batches { padding-left: 16px; padding-right: 16px; }
  .import-guide { align-items: flex-start; flex-direction: column; gap: 5px; }
  .form-grid { grid-template-columns: 1fr; }
}
