:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --line: #d8e0e5;
  --text: #1d2730;
  --muted: #63717d;
  --accent: #16756f;
  --accent-strong: #0e5f5a;
  --blue: #2c65b8;
  --yellow: #b7791f;
  --orange: #c05621;
  --red: #bf2f2f;
  --black-risk: #24292f;
  --green: #18845d;
  --shadow: 0 12px 30px rgba(19, 32, 44, 0.12);
  --radius: 8px;
  --sidebar: 268px;
  --sidebar-collapsed: 76px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(22, 117, 111, 0.14), rgba(44, 101, 184, 0.08)),
    var(--bg);
}

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

.login-brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.login-brand h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.form-error {
  border: 1px solid #e4b8b8;
  border-radius: 7px;
  padding: 9px 11px;
  color: #a12626;
  background: #fff7f7;
  font-size: 13px;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.app-shell.sidebar-collapsed {
  --sidebar: var(--sidebar-collapsed);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: #17222b;
  color: #f8fbfc;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.brand {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-copy {
  min-width: 0;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #dce7ec;
  background: rgba(255, 255, 255, 0.06);
  font-size: 22px;
  line-height: 1;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #1d8b83;
  color: #fff;
  font-weight: 800;
}

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

.brand p,
.eyebrow {
  margin: 3px 0 0;
  color: #8fa4b2;
  font-size: 12px;
}

.nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.nav button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  color: #dce7ec;
  background: transparent;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav button.parent-active {
  color: #fff;
}

.nav button.sub {
  min-height: 36px;
  margin-left: 28px;
  width: calc(100% - 28px);
  padding-left: 10px;
  grid-template-columns: 22px 1fr auto;
  color: #bdd0da;
}

.nav button.sub .nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.nav .nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 10px;
  gap: 14px;
}

.app-shell.sidebar-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
  padding-inline: 0;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-arrow,
.app-shell.sidebar-collapsed .sidebar-foot {
  display: none;
}

.app-shell.sidebar-collapsed .brand-mark {
  width: 40px;
  height: 40px;
  font-size: 12px;
}

.app-shell.sidebar-collapsed .nav {
  scrollbar-width: none;
}

.app-shell.sidebar-collapsed .nav::-webkit-scrollbar {
  display: none;
}

.app-shell.sidebar-collapsed .nav button,
.app-shell.sidebar-collapsed .nav button.sub {
  width: 100%;
  min-height: 42px;
  margin-left: 0;
  padding: 0;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
}

.app-shell.sidebar-collapsed .nav button.sub .nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 11px;
}

.sidebar-foot {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.sidebar-foot label {
  color: #c8d6dd;
  font-size: 12px;
}

.sidebar-foot select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  padding: 8px 10px;
  color: #fff;
  background: #23313c;
}

.current-user-info {
  margin: 0;
  color: #c8d6dd;
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar h2 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.top-actions,
.toolbar,
.inline-actions,
.segmented,
.filter-row,
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.schedule-mode-check {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.schedule-mode-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.schedule-mode-check:has(input:checked) {
  border-color: #8fc9c2;
  background: #eaf7f5;
  color: #126a62;
}

.session-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.pagination {
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.content {
  padding: 20px 24px 32px;
}

.alerts {
  padding: 0 24px;
}

.alert-bar {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #f0d49f;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  color: #5b3c0b;
  background: #fff8e7;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.panel,
.metric-card,
.table-card,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card {
  padding: 16px;
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

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

.metric-card .value {
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.metric-card .hint {
  color: var(--muted);
  font-size: 12px;
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

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

.panel-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 14px;
}

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

.schedule-health-grid {
  margin-bottom: 12px;
}

.schedule-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.schedule-insights article {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.schedule-insights strong {
  color: #263640;
  font-size: 13px;
}

.schedule-insights span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.schedule-workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.schedule-workflow article {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.schedule-workflow strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.schedule-workflow span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  line-height: 1.45;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #394855;
  background: #f6f9fa;
  font-weight: 700;
}

.table-sort-button {
  border: 0;
  padding: 0;
  min-height: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.table-sort-button:hover,
.table-sort-button.active {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

tbody tr:hover {
  background: #f8fbfc;
}

.compact-table table {
  min-width: 560px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.status,
.risk,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status {
  color: #24435c;
  background: #eaf2f7;
  border-color: #d4e4ee;
}

.status.done,
.risk.normal {
  color: #0f5f43;
  background: #e8f6ef;
  border-color: #bde6d1;
}

.status.active,
.risk.minor {
  color: #765111;
  background: #fff5db;
  border-color: #eed28d;
}

.status.exception,
.risk.high,
.risk.delay {
  color: #8b2b16;
  background: #fff0e8;
  border-color: #f3c4ae;
}

.risk.overdue {
  color: #fff;
  background: #30363d;
  border-color: #30363d;
}

.tag {
  color: #204b52;
  background: #e7f4f4;
  border-color: #c7e4e1;
}

.tag.gray {
  color: #4d5963;
  background: #eef1f3;
  border-color: #d9e0e5;
}

.tag.red {
  color: #9b2525;
  background: #fff0f0;
  border-color: #f1c5c5;
}

.tag.danger {
  color: #9b2525;
  background: #fff0f0;
  border-color: #f1c5c5;
}

.tag.yellow {
  color: #795200;
  background: #fff6db;
  border-color: #edd089;
}

.settings-entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.settings-entry strong {
  font-size: 28px;
  line-height: 1;
}

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

.primary-button,
.ghost-button,
.text-button,
.danger-button,
.small-button {
  border-radius: 7px;
  border: 1px solid transparent;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

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

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

.ghost-button,
.small-button {
  color: #24333f;
  background: #fff;
  border-color: var(--line);
}

.ghost-button:hover,
.small-button:hover {
  background: #f6f9fa;
}

.ghost-button.active,
.small-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.compact-filter {
  margin: 10px 0 12px;
}

.ghost-button.danger,
.danger-button {
  color: #a12626;
  border-color: #e4b8b8;
  background: #fff7f7;
}

.text-button {
  min-height: 30px;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
}

.text-button:hover {
  background: #eef5ff;
}

.small-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #354653;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

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

textarea {
  min-height: 78px;
  resize: vertical;
}

label {
  display: grid;
  gap: 5px;
  color: #465763;
  font-size: 13px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.calendar-slot-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfc;
}

.slot-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.slot-editor-head strong,
.slot-editor-head span {
  display: block;
}

.slot-editor-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-slot-rows {
  display: grid;
  gap: 8px;
}

.calendar-slot-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(110px, 1fr) auto minmax(110px, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.calendar-slot-row > span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

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

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 11px;
  color: #51616d;
  background: transparent;
}

.segmented button.active {
  color: #fff;
  background: var(--accent);
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.capacity-trend-chart-root {
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.capacity-trend-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  color: #33434f;
  font-size: 12px;
}

.capacity-trend-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -1px;
}

.capacity-trend-legend-dot.capacity-trend-available {
  background: #b8c9d8;
}

.capacity-trend-legend-dot.capacity-trend-planned {
  background: #16756f;
}

.capacity-trend-canvas {
  position: relative;
  height: 228px;
  min-width: 0;
  overflow: hidden;
}

.capacity-trend-y-axis {
  position: absolute;
  top: 0;
  bottom: 24px;
  left: 0;
  width: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #63717d;
  font-size: 11px;
  padding-right: 6px;
  box-sizing: border-box;
}

.capacity-trend-y-axis span {
  line-height: 1;
  transform: translateY(50%);
  text-align: right;
}

.capacity-trend-grid {
  position: absolute;
  left: 44px;
  right: 4px;
  top: 0;
  bottom: 24px;
  pointer-events: none;
}

.capacity-trend-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #dce4ea;
}

.capacity-trend-bars-row {
  position: absolute;
  left: 44px;
  right: 4px;
  top: 0;
  bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.capacity-trend-item {
  flex: 0 0 clamp(42px, 6vw, 58px);
  min-width: 54px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.capacity-trend-item.capacity-station-item {
  flex-basis: 64px;
  min-width: 58px;
}

.capacity-trend-bars {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.capacity-trend-bar-container {
  position: relative;
  height: 100%;
  width: 13px;
}

.capacity-trend-bar-wrap {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  background: transparent;
}

.capacity-trend-bar-wrap:focus {
  outline: none;
}

.capacity-trend-bar-wrap:focus-visible {
  outline: 2px solid #2f7fbf;
}

.capacity-trend-bar {
  width: 10px;
  border-radius: 6px 6px 0 0;
  display: block;
}

.capacity-trend-bar.capacity-trend-available {
  background: linear-gradient(180deg, #c9d7e3, #a2b9cf);
}

.capacity-trend-bar.capacity-trend-planned {
  background: linear-gradient(180deg, #3aa398, #16756f);
}

.capacity-trend-bar.capacity-trend-over {
  background: linear-gradient(180deg, #f06b6b, #bf2f2f);
}

.capacity-trend-tooltip {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 3;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #eff8f6;
  background: #20313c;
  box-shadow: 0 12px 24px rgba(17, 30, 38, 0.2);
  display: none;
  gap: 2px;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  white-space: nowrap;
}

.capacity-trend-tooltip strong,
.capacity-trend-tooltip span {
  display: block;
}

.capacity-trend-bar-wrap:hover .capacity-trend-tooltip,
.capacity-trend-bar-wrap:focus-visible .capacity-trend-tooltip {
  display: block;
}

.capacity-trend-date {
  margin-top: 8px;
  color: #63717d;
  font-size: 11px;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-hours-chart {
  height: 360px;
}

.station-workload-toolbar {
  margin: 10px 0 12px;
  align-items: center;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-field input {
  min-height: 34px;
}

.station-hours-control {
  margin-bottom: 14px;
  padding: 10px 4px 2px;
  max-height: 640px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.station-hours-axis {
  margin-left: 136px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  color: #7a8791;
  font-size: 12px;
}

.station-hours-axis span:nth-child(2) {
  text-align: center;
}

.station-hours-axis span:nth-child(3) {
  text-align: right;
}

.station-hours-row {
  position: relative;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 34px;
  padding: 3px 0;
  cursor: pointer;
  outline: none;
}

.station-hours-row:focus .station-hours-track,
.station-hours-row:focus-visible .station-hours-track,
.station-hours-row:hover .station-hours-track,
.station-hours-track:hover {
  background: #eef7f5;
}

.station-hours-name {
  overflow: hidden;
  color: #33434f;
  font-size: 13px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-hours-track {
  position: relative;
  height: 24px;
  border-radius: 6px;
  background: #f5f8fa;
  transition: background 0.15s ease;
}

.station-hours-grid {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(to right, transparent 0, transparent calc(50% - 1px), #dce5ea calc(50% - 1px), #dce5ea 50%, transparent 50%),
    linear-gradient(to right, transparent 0, transparent calc(100% - 1px), #dce5ea calc(100% - 1px));
  pointer-events: none;
}

.station-hours-bar {
  position: absolute;
  inset: 3px auto 3px 0;
  min-width: 8px;
  border-radius: 5px;
  background: linear-gradient(90deg, #16756f, #4aa69a);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.station-hours-row:focus .station-hours-bar,
.station-hours-row:focus-visible .station-hours-bar,
.station-hours-row:hover .station-hours-bar,
.station-hours-track:hover .station-hours-bar {
  background: linear-gradient(90deg, #0f5f5b, #2f8f86);
}

.station-hours-value {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 1;
  color: #33434f;
  font-size: 12px;
  font-weight: 650;
  transform: translateY(-50%);
}

.station-hours-tooltip {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 8px);
  z-index: 8;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid rgba(30, 48, 59, 0.12);
  border-radius: 8px;
  color: #eff8f6;
  background: #20313c;
  box-shadow: 0 12px 28px rgba(20, 32, 40, 0.22);
  display: none;
  gap: 3px;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

.station-hours-tooltip strong,
.station-hours-tooltip span {
  display: block;
}

.station-hours-row:focus .station-hours-tooltip,
.station-hours-row:focus-visible .station-hours-tooltip,
.station-hours-row:hover .station-hours-tooltip,
.station-hours-track:hover .station-hours-tooltip {
  display: block;
}

.station-hours-floating-tooltip {
  position: fixed;
  z-index: 90;
  width: max-content;
  min-width: 206px;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(30, 48, 59, 0.12);
  border-radius: 8px;
  color: #eff8f6;
  background: #20313c;
  box-shadow: 0 12px 28px rgba(20, 32, 40, 0.22);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

.station-hours-floating-tooltip.below {
  transform: translate(-50%, 0);
}

.station-hours-floating-tooltip strong,
.station-hours-floating-tooltip span {
  display: block;
}

.station-hours-tooltip-tip {
  margin-top: 5px;
  color: #a8d9d0;
}

.station-workload-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.station-workload-summary > div,
.station-workload-summary > article,
.station-process-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.station-process-card {
  position: relative;
}

.station-process-card summary {
  cursor: pointer;
  list-style: none;
}

.station-process-card summary::-webkit-details-marker {
  display: none;
}

.station-workload-summary > div > strong,
.station-workload-summary > article > strong,
.station-process-card summary > strong {
  display: block;
  color: #1e2d38;
  font-size: 22px;
  line-height: 1.15;
}

.station-workload-summary > div > span,
.station-workload-summary > article > span,
.station-process-card summary > span {
  display: block;
  margin-top: 5px;
  color: #6d7d89;
  font-size: 12px;
}

.modal-section-title {
  margin: 14px 0 8px;
  color: #1e2d38;
  font-size: 15px;
  line-height: 1.3;
}

.station-process-card summary::after {
  content: "查看";
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.station-process-card[open] summary::after {
  content: "收起";
}

.station-process-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  overflow: auto;
}

.station-process-item {
  padding: 9px 10px;
  border: 1px solid #dbe5eb;
  border-radius: 7px;
  background: #fff;
}

.station-process-item strong {
  display: block;
  color: #1e2d38;
  font-size: 13px;
  line-height: 1.35;
}

.station-process-item span {
  display: block;
  margin-top: 4px;
  color: #6d7d89;
  font-size: 12px;
}

.line-balance-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(260px, 0.85fr);
  gap: 14px;
  align-items: stretch;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #f8fbfc;
}

.line-balance-card.good {
  border-left-color: #16756f;
}

.line-balance-card.warn {
  border-left-color: #d89a16;
}

.line-balance-card.bad {
  border-left-color: #d45b47;
}

.line-balance-score {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  min-height: 116px;
}

.line-balance-score .score {
  color: #1e2d38;
  font-size: 46px;
  line-height: 0.95;
  font-weight: 850;
}

.line-balance-score .label {
  color: #6d7d89;
  font-size: 13px;
}

.line-balance-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.line-balance-details div {
  padding: 11px 12px;
  border: 1px solid #dbe5eb;
  border-radius: 7px;
  background: #fff;
}

.line-balance-details strong {
  display: block;
  color: #1e2d38;
  font-size: 18px;
  line-height: 1.2;
}

.line-balance-details span {
  display: block;
  margin-top: 5px;
  color: #6d7d89;
  font-size: 12px;
}

.line-balance-side {
  display: grid;
  align-content: start;
  gap: 9px;
}

.line-balance-lines,
.line-balance-bottlenecks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.line-balance-lines span,
.line-balance-bottlenecks span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid #d7e2e7;
  border-radius: 999px;
  color: #33434f;
  background: #fff;
  font-size: 12px;
}

.line-balance-side p {
  margin: 0;
  color: #5f6f7b;
  font-size: 12px;
  line-height: 1.55;
}

.daily-order-suggestion {
  display: grid;
  gap: 3px;
  padding: 6px 0;
  border-bottom: 1px solid #eef2f4;
}

.daily-order-suggestion:last-child {
  border-bottom: 0;
}

.daily-order-suggestion strong {
  color: #1e2d38;
  font-size: 13px;
}

.daily-order-suggestion span {
  color: #6d7d89;
  font-size: 12px;
  line-height: 1.4;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.schedule-gantt-panel.is-collapsed {
  padding-bottom: 14px;
}

.gantt-collapsed-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  color: #60717f;
  font-size: 13px;
}

.gantt-collapsed-summary strong {
  color: #1e2d38;
  font-size: 18px;
  line-height: 1;
}

.gantt {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
}

.gantt-grid {
  display: grid;
  min-width: 1060px;
}

.gantt-head,
.gantt-row {
  display: grid;
  grid-template-columns: 160px repeat(10, minmax(96px, 1fr));
}

.gantt-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f6f9fa;
  border-bottom: 1px solid var(--line);
}

.gantt-head div,
.gantt-label,
.gantt-cell {
  min-height: 44px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  font-size: 12px;
}

.gantt-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  font-weight: 700;
  color: #324350;
}

.gantt-cell {
  min-height: 86px;
  background: #fff;
}

.task-bar {
  display: grid;
  gap: 3px;
  margin: 3px 0;
  padding: 6px 7px;
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #edf5ff;
  color: #24415f;
  line-height: 1.25;
}

.task-bar strong {
  overflow-wrap: anywhere;
}

.task-bar.done {
  border-left-color: var(--green);
  background: #e9f7f0;
}

.task-bar.active {
  border-left-color: var(--yellow);
  background: #fff6df;
}

.task-bar.exception {
  border-left-color: var(--red);
  background: #fff0f0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 27, 36, 0.38);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 21;
  width: min(920px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal.order-process-modal {
  width: min(1380px, calc(100vw - 28px));
  max-height: min(92vh, 920px);
}

.modal.mes-scan-time-modal {
  width: min(1540px, calc(100vw - 28px));
  max-height: min(94vh, 960px);
}

.mes-scan-time-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.mes-scan-result-head {
  padding: 0;
}

.mes-scan-summary-grid {
  gap: 10px;
}

.mes-scan-metric {
  min-height: 92px;
  padding: 12px 14px;
}

.mes-scan-metric .value {
  font-size: 25px;
}

.mes-scan-rule-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 12px;
}

.mes-scan-rule-note strong {
  color: var(--text);
}

.mes-scan-fallback-note {
  margin-top: 4px;
  color: #9a5a08;
}

.mes-scan-order-selector {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(0, 1fr);
  align-items: end;
  gap: 10px 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
}

.mes-scan-order-selector label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mes-scan-order-selector select {
  width: 100%;
  min-width: 0;
}

.mes-scan-source-note {
  grid-column: 1 / -1;
}

@media (max-width: 780px) {
  .mes-scan-order-selector {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mes-scan-time-link {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.mes-scan-time-link:hover,
.mes-scan-time-link:focus-visible {
  color: #0b625d;
}

.mes-scan-result-table {
  max-height: 54vh;
}

.mes-scan-result-table table {
  min-width: 1160px;
}

.mes-scan-result-table th,
.mes-scan-result-table td {
  padding: 8px 9px;
}

.mes-scan-result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f8;
}

.mes-scan-result-table td {
  white-space: normal;
}

.mes-scan-unmatched-row {
  background: #fff8f7;
}

.mes-scan-detail-table {
  max-height: 60vh;
}

.mes-scan-detail-table table {
  min-width: 1460px;
}

.mes-scan-detail-table th,
.mes-scan-detail-table td {
  padding: 8px 9px;
  white-space: normal;
  vertical-align: top;
}

.mes-scan-detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f8;
}

.mes-scan-detail-rejected {
  background: #fff8f7;
}

.order-process-modal-content {
  display: grid;
  gap: 14px;
  min-width: min(1220px, calc(100vw - 80px));
}

.order-route-history-content {
  display: grid;
  gap: 14px;
  min-width: min(1120px, calc(100vw - 80px));
}

.order-route-history-head {
  padding: 0;
}

.order-route-history-content td {
  vertical-align: top;
}

.order-route-history-content td > div + div {
  margin-top: 4px;
}

.inline-cell-input {
  width: 86px;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #22313b;
  font: inherit;
}

.inline-cell-input.wide {
  width: 150px;
}

.inline-cell-input.compact {
  width: 70px;
}

.inline-cell-input.process-name-input {
  width: 210px;
}

.order-route-add-form {
  display: grid;
  grid-template-columns: 90px minmax(220px, 1fr) 130px 100px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.order-route-add-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.order-route-add-form input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #22313b;
  font: inherit;
}

.text-button.danger-text {
  color: #a12626;
}

.text-button.danger-text:hover {
  background: #fff0f0;
}

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

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

.modal-body {
  padding: 16px;
  overflow: auto;
}

@media (max-width: 980px) {
  .order-route-add-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
}

.toast {
  padding: 11px 12px;
  border: 1px solid #b8d8d3;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f3fbfa;
  box-shadow: var(--shadow);
  color: #173f3b;
  font-size: 13px;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed #c7d2d9;
  border-radius: 8px;
  background: #fbfcfd;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #edf1f3;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.mini-progress {
  height: 5px;
  margin-top: 5px;
}

.simulation-meter {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.simulation-order-picker {
  display: grid;
  gap: 8px;
}

.simulation-controls {
  align-items: start;
}

.simulation-controls select,
.simulation-controls input[type="range"] {
  min-height: 36px;
}

.simulation-controls input[type="range"] {
  padding: 0;
}

.simulation-field {
  display: grid;
  gap: 5px;
  color: #465763;
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 28px;
}

.check-row input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.check-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.simulation-order-options {
  max-height: 156px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.simulation-check-all {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid rgba(22, 117, 111, 0.25);
  border-radius: 8px;
  background: #eef8f6;
  font-weight: 800;
}

.hanger-simulation {
  display: grid;
  gap: 18px;
  overflow: auto;
  padding-bottom: 4px;
}

.hanger-loop {
  display: grid;
  grid-template-columns: 40px minmax(720px, 1fr);
  gap: 8px;
  align-items: stretch;
}

.simulation-line-title {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
  color: #324350;
  font-weight: 800;
}

.hanger-loop-track {
  position: relative;
  display: grid;
  grid-template-rows: 40px 16px 40px;
  align-content: center;
  gap: 6px;
  min-height: 126px;
  padding: 10px 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  overflow: visible;
}

.hanger-loop-track::before,
.hanger-loop-track::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 92px;
  transform: translateY(-50%);
  width: 12px;
  border: 2px solid rgba(22, 117, 111, 0.25);
}

.hanger-loop-track::before {
  left: 10px;
  border-right: 0;
  border-radius: 16px 0 0 16px;
}

.hanger-loop-track::after {
  right: 10px;
  border-left: 0;
  border-radius: 0 16px 16px 0;
}

.hanger-loop-row {
  display: grid;
  gap: 5px;
  position: relative;
  z-index: 1;
  align-items: stretch;
  min-height: 40px;
}

.hanger-loop-row.top-row {
  grid-row: 1;
}

.hanger-loop-row.bottom-row {
  grid-row: 3;
}

.b-loop .hanger-loop-row {
  grid-template-columns: repeat(18, minmax(36px, 1fr));
}

.a-loop .hanger-loop-row {
  grid-template-columns: repeat(15, minmax(36px, 1fr));
}

.hanger-loop-side {
  min-height: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.hanger-loop-side.left {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
}

.hanger-loop-side.right {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
}

.hanger-loop-direction {
  position: absolute;
  left: 50%;
  bottom: 3px;
  z-index: 1;
  color: #6d7d89;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
}

.simulation-station {
  position: relative;
  min-height: 38px;
  padding: 4px 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
  display: grid;
  gap: 3px;
  align-content: center;
}

.simulation-station strong {
  font-size: 10px;
}

.simulation-station span {
  min-height: 11px;
  color: var(--muted);
  font-size: 10px;
}

.simulation-station.has-piece {
  border-color: rgba(22, 117, 111, 0.45);
  background: #eef8f6;
}

.simulation-station em,
.simulation-station i,
.simulation-station small {
  position: absolute;
  top: -6px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}

.simulation-station em {
  right: -4px;
  background: var(--accent);
}

.simulation-station i {
  left: -4px;
  background: var(--blue);
}

.simulation-station small {
  right: 12px;
  background: var(--green);
}

.simulation-bridge {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 58px;
}

.simulation-bridge span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #324350;
  background: #f7fafb;
  font-size: 12px;
  font-weight: 700;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 5px;
}

.timeline-item strong {
  font-size: 13px;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.row-note {
  color: var(--muted);
  font-size: 12px;
}

.json-preview {
  max-width: 560px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink);
}

.field-name-key {
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.field-name-key strong {
  font-size: 13px;
  font-weight: 700;
}

.field-name-key span {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .line-balance-card {
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .line-balance-side {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .nav {
    flex: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    scrollbar-gutter: auto;
  }

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

  .content,
  .alerts {
    padding-left: 14px;
    padding-right: 14px;
  }

  .dashboard-grid,
  .three-col,
  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-3 {
    grid-column: auto;
  }

  .slot-editor-head,
  .calendar-slot-row {
    grid-template-columns: 1fr;
  }

  .slot-editor-head {
    display: grid;
  }

  .calendar-slot-row > span {
    text-align: left;
  }

  .station-hours-axis {
    margin-left: 0;
  }

  .station-hours-row {
    grid-template-columns: 1fr;
    gap: 5px;
    min-height: 52px;
  }

  .station-hours-name {
    text-align: left;
  }

  .station-hours-tooltip {
    right: auto;
    left: 0;
  }

  .station-workload-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-balance-card {
    grid-template-columns: 1fr;
  }

  .line-balance-score {
    min-height: auto;
  }

  .line-balance-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.dataset-field-input {
  width: min(760px, 62vw);
  min-height: 86px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

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

.selected-order-picker,
.selected-order-workload-result {
  min-width: 0;
}

.basic-line-balance-panel {
  min-width: 0;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.basic-line-balance-head {
  padding: 0 0 12px;
}

.basic-balance-note {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-left: 3px solid #18857d;
  background: #f3f8f8;
  color: #405660;
}

.basic-line-balance-chart .selected-station-bar {
  background: linear-gradient(180deg, #3f9b91, #176f69);
}

.mes-station-sync-dialog {
  display: grid;
  gap: 12px;
  min-width: min(1080px, 88vw);
}

.workload-mes-sync-dialog {
  grid-template-columns: 1fr;
  gap: 16px;
  width: min(900px, 84vw);
}

.workload-mes-sync-dialog > label {
  max-width: 520px;
}

.mes-station-sync-progress-meta {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.mes-station-sync-progress-meta span:last-child {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mes-station-sync-summary {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.mes-station-sync-warnings {
  padding: 10px 12px;
  border: 1px solid #e5d6ab;
  border-radius: 6px;
  background: #fffaf0;
}

.mes-station-sync-warnings summary {
  cursor: pointer;
  color: #76571a;
  font-weight: 600;
}

.mes-station-sync-warnings .row-note {
  padding-top: 7px;
}

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

.selected-order-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.selected-order-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.selected-order-option span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.selected-order-option strong,
.selected-order-option span span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-order-option span span {
  color: var(--muted);
  font-size: 12px;
}

.compact-summary {
  margin-bottom: 12px;
}

.selected-order-station-chart {
  --chart-height: 220px;
  display: grid;
  grid-template-columns: repeat(var(--station-count), minmax(34px, 1fr));
  align-items: end;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px 10px 8px;
  min-height: 310px;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(to top, #e7edf1 1px, transparent 1px) 0 12px / 100% calc(var(--chart-height) / 4),
    linear-gradient(var(--panel), var(--panel));
}

.selected-station-bar-item {
  display: grid;
  grid-template-rows: 28px var(--chart-height) 26px 18px;
  align-items: end;
  min-width: 0;
  cursor: pointer;
  outline: none;
}

.selected-station-bar-value {
  align-self: center;
  overflow: hidden;
  color: #33434f;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-station-bar-track {
  position: relative;
  align-self: stretch;
  min-width: 8px;
  border-radius: 6px;
  background: #f2f6f8;
  overflow: hidden;
}

.selected-station-bar {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  min-height: 4px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, #4aa69a, #16756f);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, transform 0.15s ease;
}

.selected-station-bar-item:hover .selected-station-bar,
.selected-station-bar-item:focus .selected-station-bar,
.selected-station-bar-item:focus-visible .selected-station-bar {
  background: linear-gradient(180deg, #63b9ad, #0f5f5b);
  transform: scaleX(1.08);
}

.selected-station-bar-name,
.selected-station-bar-meta {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-station-bar-name {
  align-self: center;
  color: #263540;
  font-size: 12px;
  font-weight: 700;
}

.selected-station-bar-meta {
  align-self: start;
  color: var(--muted);
  font-size: 11px;
}

.selected-balance-note {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #c7e3df;
  border-radius: 8px;
  background: #f2fbf9;
  color: #315f5a;
}

.selected-process-distribution {
  margin: 12px 0;
}

.station-employee-workload {
  margin: 16px 0 12px;
}

.station-employee-workload .modal-section-title {
  margin-bottom: 10px;
}

.station-employee-input {
  width: min(220px, 100%);
  min-width: 120px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.station-employee-input:focus {
  border-color: #258a81;
  outline: 2px solid rgba(37, 138, 129, 0.14);
  outline-offset: 1px;
}

.station-split-pill {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 3px 7px;
  border: 1px solid #d5e1e6;
  border-radius: 999px;
  background: #f8fbfc;
  color: #344854;
  font-size: 12px;
  white-space: nowrap;
}

.station-split-pill small {
  margin-left: 6px;
  color: #4f6f6b;
  font-size: 11px;
}

.station-split-pill.unavailable {
  border-color: #efc9c9;
  background: #fff7f7;
  color: #9b3232;
}

.station-split-pill.unavailable small {
  color: #a85050;
}

.compact-empty {
  margin: 10px 0;
  padding: 12px;
}

.station-hours-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.workload-order-picker {
  display: grid;
  gap: 12px;
}

.workload-mingdao-sync-form {
  min-width: min(760px, 84vw);
}

.workload-mingdao-sync-note {
  align-self: end;
  display: grid;
  gap: 3px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f6faf9;
}

.workload-mingdao-sync-note span,
.workload-mingdao-progress-meta {
  color: var(--muted);
  font-size: 12px;
}

.workload-mingdao-sync-progress {
  display: grid;
  gap: 12px;
  min-width: min(980px, 88vw);
}

.workload-mingdao-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.workload-mingdao-result-table {
  max-height: 440px;
}

.workload-mingdao-result-message {
  max-width: 340px;
  white-space: normal;
}

.workload-order-list {
  max-height: 220px;
}

.workload-summary-grid {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.workload-validation-warning {
  margin: 10px 0 12px;
  padding: 9px 11px;
  border: 1px solid #efc3c3;
  border-left: 4px solid var(--red);
  border-radius: 7px;
  color: #8f2929;
  background: #fff7f7;
  font-size: 13px;
  line-height: 1.5;
}

.workload-edit-table .table-scroll {
  max-height: 760px;
  overflow-x: hidden;
}

.workload-edit-table table {
  min-width: 0;
  table-layout: fixed;
}

.workload-edit-table th,
.workload-edit-table td {
  padding: 6px 5px;
  font-size: var(--workload-table-font-size, 13px);
  line-height: 1.25;
}

.workload-edit-table th:nth-child(1) { width: 11%; }
.workload-edit-table th:nth-child(2) { width: 26%; }
.workload-edit-table th:nth-child(3) { width: 13%; }
.workload-edit-table th:nth-child(4) { width: 8%; }
.workload-edit-table th:nth-child(5) { width: 10%; }
.workload-edit-table th:nth-child(6) { width: 10%; }
.workload-edit-table th:nth-child(7) { width: 11%; }
.workload-edit-table th:nth-child(8) { width: 11%; }

.workload-edit-table .row-note {
  margin-top: 2px;
  font-size: max(10px, calc(var(--workload-table-font-size, 13px) - 2px));
  line-height: 1.25;
}

.workload-cell-input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.workload-cell-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(22, 117, 111, 0.14);
  outline-offset: 1px;
}

.workload-cell-input.compact,
.workload-cell-input.numeric {
  width: 100%;
  min-width: 0;
}

.workload-cell-input.process {
  min-width: 0;
}

.workload-cell-input.employee {
  min-width: 0;
}

.workload-employee-cell {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.workload-employee-actual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 3px;
  color: #16756f;
  font-size: max(10px, calc(var(--workload-table-font-size, 13px) - 2px));
  line-height: 1.2;
}

.workload-employee-actual span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-employee-actual .text-button {
  flex: 0 0 auto;
  padding: 0;
  font-size: inherit;
}

.workload-employee-actual-empty {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-cell-input.station {
  width: 100%;
  min-width: 0;
}

.workload-process-cell {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 4px;
}

.workload-quantity-cell,
.workload-time-cell {
  display: grid;
  gap: 3px;
}

.workload-quantity-cell .tag {
  min-height: 18px;
  justify-content: center;
  padding: 1px 4px;
  font-size: 10px;
}

.workload-time-cell span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-time-cell strong {
  color: var(--text);
}

.workload-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 5px;
}

.workload-row-actions .text-button {
  font-size: max(10px, calc(var(--workload-table-font-size, 13px) - 2px));
  line-height: 1.2;
}

.workload-table-toolbar {
  align-items: center;
}

.workload-font-control {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 5px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.workload-font-control .icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  font-size: 18px;
}

.workload-font-control output {
  min-width: 34px;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

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

.workload-chart-panel {
  display: grid;
  gap: 24px;
}

.workload-balance-panel {
  display: grid;
  gap: 14px;
}

.workload-balance-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.workload-balance-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #f7fafb;
  font-size: 12px;
}

.workload-balance-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.72fr) minmax(620px, 1.55fr);
  align-items: start;
  gap: 20px;
}

.workload-balance-grid section {
  min-width: 0;
}

.workload-balance-grid h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.workload-balance-grid .table-scroll {
  max-height: 600px;
}

.workload-balance-grid table {
  min-width: 0;
}

.workload-balance-grid section:last-child th:nth-child(1) { width: 8%; }
.workload-balance-grid section:last-child th:nth-child(2) { width: 20%; }
.workload-balance-grid section:last-child th:nth-child(3),
.workload-balance-grid section:last-child th:nth-child(4) { width: 31%; }
.workload-balance-grid section:last-child th:nth-child(5) { width: 10%; }

.balance-load-up {
  color: #a45e06;
  font-weight: 700;
}

.balance-load-down {
  color: var(--accent);
  font-weight: 700;
}

.workload-balance-method {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

@media (max-width: 1400px) {
  .workload-summary-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .workload-balance-grid {
    grid-template-columns: 1fr;
  }
}

.workload-chart-section + .workload-chart-section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.compact-head {
  margin-bottom: 8px;
}

.workload-live-chart {
  --workload-chart-height: 230px;
  display: grid;
  grid-template-columns: repeat(var(--workload-bar-count), minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-height: 315px;
  padding: 12px 10px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(to top, #e4eaee 1px, transparent 1px) 0 12px / 100% calc(var(--workload-chart-height) / 4),
    #fff;
}

.workload-live-bar-item {
  position: relative;
  display: grid;
  grid-template-rows: 28px var(--workload-chart-height) 24px 34px;
  align-items: end;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.workload-live-chart.dense {
  gap: 3px;
  min-height: 290px;
  padding-inline: 6px;
}

.workload-live-chart.dense .workload-live-bar-item {
  grid-template-rows: var(--workload-chart-height) 32px;
}

.workload-live-chart.dense .workload-live-value {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  width: max-content;
  max-width: 90px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(32, 49, 59, 0.12);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.12s ease;
}

.workload-live-chart.dense .workload-live-bar-item:hover .workload-live-value,
.workload-live-chart.dense .workload-live-bar-item:focus-visible .workload-live-value {
  opacity: 1;
}

.workload-live-chart.dense .workload-live-track {
  min-width: 0;
  border-radius: 3px;
}

.workload-live-chart.dense .workload-live-fill {
  right: 2px;
  left: 2px;
  border-radius: 3px 3px 1px 1px;
}

.workload-live-chart.dense .workload-live-bar-item small {
  display: none;
}

.workload-live-chart.dense.station .workload-live-bar-item strong {
  font-size: 10px;
}

.workload-live-chart.dense.employee .workload-live-bar-item {
  grid-template-rows: var(--workload-chart-height) 48px;
}

.workload-live-chart.dense.employee .workload-live-bar-item strong {
  align-self: start;
  justify-self: center;
  max-height: 46px;
  overflow: hidden;
  writing-mode: vertical-rl;
  font-size: 10px;
  line-height: 1;
  text-overflow: clip;
  white-space: normal;
}

.workload-detail-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workload-live-value,
.workload-live-bar-item strong,
.workload-live-bar-item small {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-live-value {
  align-self: center;
  color: #344854;
  font-size: 11px;
  font-weight: 700;
}

.workload-live-track {
  position: relative;
  align-self: stretch;
  min-width: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: #f0f4f6;
}

.workload-live-fill {
  position: absolute;
  right: 4px;
  bottom: 2px;
  left: 4px;
  min-height: 4px;
  border-radius: 5px 5px 2px 2px;
  background: #16756f;
  transition: transform 0.15s ease, background 0.15s ease;
}

.workload-live-fill.employee {
  background: #2c65b8;
}

.workload-live-bar-item:hover .workload-live-fill,
.workload-live-bar-item:focus-visible .workload-live-fill {
  transform: scaleX(1.1);
  background: #0e5f5a;
}

.workload-live-bar-item:hover .workload-live-fill.employee,
.workload-live-bar-item:focus-visible .workload-live-fill.employee {
  background: #204f92;
}

.workload-live-bar-item strong {
  align-self: center;
  font-size: 12px;
}

.workload-live-bar-item small {
  align-self: start;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.workload-add-process-dialog {
  display: grid;
  gap: 16px;
  width: min(760px, 76vw);
}

.workload-add-process-dialog label,
.workload-add-order-summary {
  display: grid;
  gap: 7px;
}

.workload-add-process-dialog select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.workload-add-order-summary span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .mes-station-sync-dialog {
    min-width: 0;
  }

  .mes-station-sync-summary,
  .mes-station-sync-progress-meta {
    grid-template-columns: 1fr;
  }

  .mes-station-sync-progress-meta span:last-child {
    text-align: left;
  }

  .selected-order-list {
    grid-template-columns: 1fr;
  }

  .selected-order-station-chart {
    grid-template-columns: repeat(var(--station-count), minmax(30px, 1fr));
    gap: 4px;
    padding-inline: 6px;
    min-height: 270px;
    --chart-height: 178px;
  }

  .selected-station-bar-item {
    grid-template-rows: 24px var(--chart-height) 24px 16px;
  }

  .selected-station-bar-value,
  .selected-station-bar-meta {
    font-size: 10px;
  }

  .selected-station-bar-name {
    font-size: 11px;
  }

  .workload-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workload-balance-summary-grid,
  .workload-balance-grid {
    grid-template-columns: 1fr;
  }

  .workload-live-chart {
    grid-template-columns: repeat(var(--workload-bar-count), minmax(62px, 1fr));
    --workload-chart-height: 180px;
    min-height: 270px;
  }

  .workload-live-bar-item {
    grid-template-rows: 24px var(--workload-chart-height) 22px 32px;
  }

  .workload-add-process-dialog {
    width: min(100%, 92vw);
  }
}

@media print {
  .sidebar,
  .topbar,
  .alerts,
  .toolbar,
  .modal,
  .modal-backdrop,
  .toast-region {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .panel {
    border: 0;
    padding: 0;
  }
}
