* {
  box-sizing: border-box;
}

:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --surface: #ffffff;
  --surface-soft: #f5f5f7;
  --blue: #007aff;
  --blue-soft: #eaf4ff;
  --mint: #34c759;
  --mint-soft: #ecfdf3;
  --cyan: #32ade6;
  --cyan-soft: #edf9ff;
  --rose: #ff3b30;
  --rose-soft: #fff1f0;
  --violet: #5856d6;
  --violet-soft: #f1f0ff;
  --amber: #ff9f0a;
  --amber-soft: #fff6e6;
  --teal: #00c7be;
  --teal-soft: #e8fbfa;
  --shadow: 0 18px 48px rgba(0, 35, 78, 0.08);
  --shadow-strong: 0 24px 70px rgba(0, 35, 78, 0.13);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -10%, rgba(0, 122, 255, 0.08), transparent 32%),
    radial-gradient(circle at 90% 4%, rgba(88, 86, 214, 0.06), transparent 26%),
    linear-gradient(180deg, #fbfcff 0%, #f5f5f7 100%);
}

.top-nav {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(210, 210, 215, 0.72);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(18px);
}

.brand {
  margin-right: 18px;
  color: #1d1d1f;
  font-weight: 700;
  text-decoration: none;
}

.nav-link {
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: #515154;
  text-decoration: none;
  border-radius: 6px;
}

.nav-link.active,
.nav-link:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.warning-table-card {
  margin-top: 18px;
  padding: 18px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.warning-table-shell {
  width: 100%;
  max-width: 100%;
  max-height: 620px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 14px;
  background: #fff;
}

.warning-table {
  width: 100%;
  min-width: 1680px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}

.warning-table th,
.warning-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.warning-table .col-clinic_name { width: 190px; }
.warning-table .col-warning_level { width: 92px; }
.warning-table .col-warning_reason { width: 220px; }
.warning-table .col-item_code { width: 132px; }
.warning-table [class*="col-tag_"] { width: 92px; text-align: center; }
.warning-table .col-item_name { width: 180px; }
.warning-table .col-spec { width: 120px; }
.warning-table .col-unit { width: 86px; }
.warning-table .col-stock_qty,
.warning-table .col-daily_avg_qty,
.warning-table .col-daily_turnover_days,
.warning-table .col-recent4_max_weekly_qty,
.warning-table .col-peak_gap_ratio,
.warning-table .col-recent4_second_weekly_qty,
.warning-table .col-recent_peak_cover_weeks,
.warning-table .col-recent_double_peak_cover_weeks,
.warning-table .col-available_effective_week_count { width: 118px; }
.warning-table .col-consumption_level,
.warning-table .col-stability_type,
.warning-table .col-match_status { width: 110px; }
.warning-table .col-consumption_sequence {
  width: 320px;
  max-width: 320px;
}

.warning-table td.col-consumption_sequence {
  white-space: normal;
  text-overflow: clip;
}

.warning-table .sequence-cell {
  max-height: 66px;
  overflow: auto;
  line-height: 1.45;
  word-break: break-all;
  white-space: normal;
}

.warning-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}

.warning-table .warning-filter-row th {
  top: 37px;
  background: #fff;
  padding: 6px 8px;
}

.warning-filter-row input {
  width: 128px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, .38);
  border-radius: 9px;
  padding: 0 9px;
  font-size: 12px;
}

.warning-table td.level-both-warning {
  color: #b91c1c;
  font-weight: 800;
}

.warning-table td.level-peak-warning {
  color: #b45309;
  font-weight: 800;
}

.warning-table td.level-turnover-warning {
  color: #1d4ed8;
  font-weight: 800;
}

.warning-table td.support-severe,
.warning-table td.support-warning,
.warning-table td.support-attention,
.warning-table td.support-normal {
  font-weight: 800;
}

.warning-table td.support-severe {
  color: #991b1b;
  background: #fee2e2;
}

.warning-table td.support-warning {
  color: #92400e;
  background: #fef3c7;
}

.warning-table td.support-attention {
  color: #1e40af;
  background: #dbeafe;
}

.warning-table td.support-normal {
  color: #166534;
  background: #dcfce7;
}

.warning-threshold-panel {
  margin-top: 14px;
}

.warning-peak-head {
  align-items: start;
  gap: 14px;
}

.warning-peak-head > div:first-child {
  min-width: 220px;
}

.warning-formula-pill {
  justify-self: end;
  max-width: 560px;
  padding: 9px 12px;
  border: 1px solid rgba(59, 130, 246, .18);
  border-radius: 12px;
  color: #1d4ed8;
  background: linear-gradient(135deg, rgba(239, 246, 255, .92), rgba(240, 253, 244, .8));
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.warning-peak-factor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.warning-peak-factor-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .92)),
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, .12), transparent 34%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
}

.warning-peak-card-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.warning-peak-card-text strong {
  color: #172033;
  font-size: 15px;
}

.warning-peak-card-text span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.warning-factor-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 13px;
  background: #ffffff;
}

.warning-factor-control input {
  width: 86px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .34);
  border-radius: 9px;
  padding: 0 9px;
  color: #172033;
  font-size: 14px;
  font-weight: 800;
}

.warning-factor-control small {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.warning-peak-factor-card-readonly {
  background:
    linear-gradient(145deg, rgba(248, 250, 252, .98), rgba(241, 245, 249, .88)),
    radial-gradient(circle at 0% 0%, rgba(167, 139, 250, .1), transparent 34%);
}

.warning-factor-static {
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 13px;
  color: #475569;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

.warning-peak-result-note {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 185, 129, .18);
  border-radius: 14px;
  color: #475569;
  background: rgba(240, 253, 244, .72);
  font-size: 12px;
  line-height: 1.55;
}

.warning-rule-split {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr);
  gap: 12px;
  margin-top: 12px;
}

.warning-rule-card {
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 14px;
  background: rgba(248, 250, 252, .88);
}

.warning-rule-card > div:first-child {
  display: grid;
  gap: 4px;
}

.warning-rule-card strong {
  color: #26364a;
  font-size: 14px;
}

.warning-rule-card > div:first-child span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.warning-rule-card .peak-ratio-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.warning-rule-card .peak-ratio-field span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.warning-rule-card .peak-ratio-field input,
.warning-rule-card .peak-ratio-field select {
  width: 86px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .34);
  border-radius: 9px;
  padding: 0 9px;
  font-size: 13px;
}

.warning-rule-card .peak-ratio-field select {
  width: 168px;
}

.warning-rule-card .peak-ratio-field small {
  color: #64748b;
  font-size: 12px;
}

.warning-peak-rule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.warning-peak-rule-grid .rule-switch,
.warning-peak-rule-grid .peak-ratio-field {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 12px;
  background: #fff;
}

.warning-peak-rule-grid .peak-ratio-field input {
  width: 92px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .34);
  border-radius: 9px;
  padding: 0 9px;
}

.warning-stability-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}

.warning-stability-checks > span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.warning-stability-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 999px;
  background: #fff;
}

.warning-stability-checks b {
  color: #475569;
  font-size: 12px;
}

@media (max-width: 760px) {
  .warning-peak-head {
    grid-template-columns: 1fr;
  }

  .warning-formula-pill {
    justify-self: stretch;
  }

  .warning-peak-factor-grid {
    grid-template-columns: 1fr;
  }

  .warning-peak-factor-card {
    grid-template-columns: 1fr;
  }

  .warning-factor-control {
    justify-content: space-between;
  }
}

.warning-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 22px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(10px);
}

.warning-fullscreen-overlay[hidden] {
  display: none;
}

.warning-fullscreen-panel {
  height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.warning-fullscreen-target {
  min-height: 0;
  flex: 1;
}

.warning-fullscreen-target .warning-table-shell {
  height: 100%;
  max-height: none;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.analysis-workspace {
  width: min(1500px, 100%);
  padding-top: 20px;
}

.table-workspace {
  width: min(1800px, 100%);
  padding: 18px 22px;
}

.embedded-table-workspace {
  width: 100%;
  padding: 0;
  height: 100vh;
  min-height: 0;
}

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

.analysis-head {
  min-height: 116px;
  align-items: flex-end;
  padding: 20px 22px;
  border: 1px solid rgba(210, 210, 215, 0.68);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(241, 248, 255, 0.74)),
    radial-gradient(circle at 82% 16%, rgba(0, 199, 190, 0.16), transparent 30%),
    radial-gradient(circle at 52% 8%, rgba(255, 159, 10, 0.13), transparent 28%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.analysis-title-block {
  max-width: 720px;
}

.page-kicker {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-bottom: 8px;
  padding: 0 9px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 999px;
  color: #0068d9;
  background: rgba(234, 244, 255, 0.78);
  font-size: 12px;
  font-weight: 650;
}

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

.button-link.secondary-button {
  border-color: #d2d2d7;
  background: #ffffff;
  color: var(--blue);
  box-shadow: none;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin: 24px 0 12px;
  font-size: 18px;
}

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

code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef2f7;
}

button,
.button-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #0071e3;
  border-radius: 6px;
  background: linear-gradient(180deg, #0a84ff, #0071e3);
  color: #ffffff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 113, 227, 0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

button:hover:not(:disabled),
.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.22);
}

.primary-action {
  min-width: 126px;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 9px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input,
select {
  height: 34px;
}

textarea {
  min-height: 58px;
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(0, 122, 255, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: #8e8e93;
  background: #f7f7fb;
}

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

.toolbar,
.progress-panel,
.run-console,
.process-panel,
.query-panel,
.table-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.run-console {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.run-console::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(0, 122, 255, 0.1), transparent 48%, rgba(88, 86, 214, 0.07));
  opacity: 0.9;
}

.run-console > * {
  position: relative;
}

.run-console.running {
  border-color: #9acbff;
}

.run-console.finished {
  border-color: #b7f0c6;
}

.run-console.failed {
  border-color: #ffb4ae;
}

.run-visual {
  display: flex;
  align-items: center;
  gap: 14px;
}

.orb {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f2f2f7;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.run-console.running .orb {
  background: var(--blue-soft);
}

.run-console.finished .orb {
  background: var(--mint-soft);
}

.run-console.failed .orb {
  background: var(--rose-soft);
}

.spinner-ring {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 122, 255, 0.16);
  border-top-color: var(--blue);
  border-radius: 50%;
}

.run-console.running .spinner-ring,
.mini-spinner {
  animation: spin 0.9s linear infinite;
}

.run-console.idle .spinner-ring,
.run-console.finished .spinner-ring,
.run-console.failed .spinner-ring {
  animation: none;
  border-top-color: rgba(0, 122, 255, 0.16);
}

.run-console.finished .spinner-ring {
  border-color: var(--mint);
}

.run-console.failed .spinner-ring {
  border-color: var(--rose);
}

.mini-spinner {
  width: 14px;
  height: 14px;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
}

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

.run-state {
  margin-top: 2px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 750;
}

.run-details {
  display: grid;
  gap: 10px;
}

.stage-line {
  min-height: 24px;
  color: #242426;
  font-size: 15px;
  font-weight: 600;
}

.activity-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e9ee;
}

.activity-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ac8fa, var(--blue), var(--violet));
}

.run-console.running .activity-bar span {
  animation: sweep 1.6s ease-in-out infinite;
}

.activity-bar.idle span {
  width: 0;
}

.run-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.run-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(242, 242, 247, 0.9);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.section-heading.compact h2 {
  margin: 0;
}

.section-heading.compact span {
  color: var(--muted);
  font-size: 13px;
}

.section-heading a {
  color: var(--blue);
  text-decoration: none;
}

.alias-config-panel {
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow);
}

.alias-config-panel .section-heading {
  align-items: flex-start;
  margin-bottom: 12px;
}

.alias-config-panel h2 {
  margin: 0;
}

.alias-config-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.config-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0f5a74;
  background: #e8f7fb;
  font-size: 12px;
  font-weight: 750;
}

.alias-rule-form {
  display: grid;
  gap: 8px;
}

.alias-rule-head,
.alias-rule-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 64px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.alias-rule-head {
  color: #6b7280;
  font-size: 12px;
  font-weight: 750;
}

.alias-rule-row span {
  color: #516071;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

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

.alias-empty-state {
  display: none;
  padding: 14px;
  border: 1px dashed #cbd8e6;
  border-radius: 8px;
  color: #64748b;
  background: #f8fbff;
  font-size: 13px;
  text-align: center;
}

.alias-empty-state.visible {
  display: block;
}

.alias-delete-button {
  min-width: 62px;
  height: 34px;
}

.compact-action {
  min-width: 128px;
  height: 34px;
}

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

.process-panel {
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.process-current {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f5f8ff);
}

.process-current strong {
  color: var(--ink);
  font-size: 14px;
}

.process-current p {
  color: #3a3a3c;
  line-height: 1.55;
}

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

.progress-log-head {
  margin: 14px 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.progress-events {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: #fbfbfd;
}

.progress-events.empty {
  color: var(--muted);
  font-size: 13px;
}

.progress-event {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  background: #ffffff;
  border-left: 3px solid #b9dcff;
  color: #3a3a3c;
  font-size: 13px;
  line-height: 1.45;
}

.progress-event time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-event span {
  min-width: 0;
  white-space: normal;
}

.process-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 94px;
  padding: 12px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: #ffffff;
}

.step-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #636366;
  background: #f2f2f7;
  font-weight: 700;
  font-size: 13px;
}

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

.step-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--ink);
  font-weight: 700;
}

.step-title span {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: #636366;
  background: #f2f2f7;
  font-size: 12px;
  font-weight: 600;
}

.step-copy p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
}

.process-step.done {
  border-color: #b7f0c6;
  background: var(--mint-soft);
}

.process-step.done .step-index {
  color: #ffffff;
  background: var(--mint);
}

.process-step.done .step-title span {
  color: #147a34;
  background: #dbf8e3;
}

.process-step.current {
  border-color: #9acbff;
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.1);
}

.process-step.current .step-index {
  color: #ffffff;
  background: var(--blue);
}

.process-step.current .step-title span {
  color: #0057b8;
  background: #ddebff;
}

.process-step.failed {
  border-color: #ffb4ae;
  background: var(--rose-soft);
}

.process-step.failed .step-index {
  color: #ffffff;
  background: #dc2626;
}

.process-step.failed .step-title span {
  color: #991b1b;
  background: #fee2e2;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.status {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-panel {
  display: grid;
  gap: 6px;
  margin: 0 0 20px;
  padding: 12px 14px;
}

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

.analysis-source-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(150px, 0.75fr) minmax(240px, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(0, 35, 78, 0.06);
  backdrop-filter: blur(16px);
}

.source-overview-card {
  border-color: rgba(0, 122, 255, 0.22);
  border-left: 4px solid var(--blue);
  background:
    linear-gradient(135deg, rgba(234, 244, 255, 0.88), rgba(255, 255, 255, 0.92)),
    radial-gradient(circle at 96% 12%, rgba(50, 173, 230, 0.13), transparent 28%);
}

.overview-card-label {
  grid-column: 1 / -1;
  width: fit-content;
  min-width: 0;
  padding: 4px 9px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 999px;
  color: #0068d9;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 700;
}

.analysis-source-card > div {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.analysis-source-card > .overview-card-label {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.analysis-source-card span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-source-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #0057b8;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-message {
  margin-bottom: 14px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 14px;
}

.page-message.success {
  color: #147a34;
  border: 1px solid #b7f0c6;
  background: var(--mint-soft);
}

.page-message.error {
  color: #991b1b;
  border: 1px solid #ffb4ae;
  background: var(--rose-soft);
}

.analysis-step-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  margin: 12px 0 18px;
}

.analysis-step-nav,
.analysis-step-panel-wrap {
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 34px rgba(0, 35, 78, 0.06);
  backdrop-filter: blur(16px);
}

.analysis-step-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 8px;
}

.analysis-step-tab {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #3a3a3c;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.analysis-step-tab:hover,
.analysis-step-tab.active {
  transform: none;
  border-color: #cfe4ff;
  background: #f2f8ff;
  box-shadow: none;
}

.analysis-step-tab span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, #0a84ff, #5856d6);
  font-size: 12px;
  font-weight: 750;
}

.analysis-step-tab strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-step-tab em {
  height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: #6e6e73;
  background: #f2f2f7;
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.analysis-step-tab.done span {
  background: linear-gradient(180deg, var(--mint), var(--teal));
}

.analysis-step-tab.done em {
  color: #147a34;
  background: #dbf8e3;
}

.analysis-step-tab.ready em {
  color: #0057b8;
  background: #ddebff;
}

.analysis-step-tab.locked {
  color: #8e8e93;
}

.analysis-step-tab.locked span {
  color: #8e8e93;
  background: #f2f2f7;
}

.analysis-step-panel-wrap {
  min-width: 0;
  padding: 14px 16px 16px;
}

.analysis-step-panel[hidden] {
  display: none;
}

.analysis-panel-head {
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid #edf1f7;
}

.analysis-panel-head span {
  display: inline-flex;
  height: 22px;
  align-items: center;
  margin-bottom: 6px;
  padding: 0 8px;
  border-radius: 999px;
  color: #0057b8;
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 650;
}

.analysis-panel-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.analysis-panel-head p {
  font-size: 13px;
  line-height: 1.5;
}

.analysis-step-panel form {
  margin: 0;
}

.analysis-step-panel textarea {
  min-height: 148px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(150px, 240px));
}

.analysis-check {
  margin-top: 8px;
}

.anchor-editor {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #edf1f7;
  border-radius: 12px;
  background: #f8fbff;
}

.anchor-editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.anchor-editor-head strong {
  color: #3a3a3c;
  font-size: 13px;
}

.anchor-editor-head > div {
  display: inline-flex;
  gap: 8px;
}

.anchor-table-head,
.anchor-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) 72px;
  align-items: center;
  gap: 8px;
}

.anchor-table-head {
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.anchor-list {
  display: grid;
  gap: 6px;
}

.anchor-row {
  padding: 7px;
  border: 1px solid #e8edf5;
  border-radius: 9px;
  background: #ffffff;
}

.anchor-row input {
  height: 32px;
}

.anchor-row button {
  width: 100%;
  height: 32px;
  padding: 0 8px;
}

.result-stat.wide {
  grid-column: span 2;
}

.analysis-current-result {
  grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(140px, 1fr));
  align-items: stretch;
}

.result-hero {
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
  color: #ffffff;
  background:
    linear-gradient(135deg, #007aff, #00c7be);
  box-shadow: 0 16px 34px rgba(0, 122, 255, 0.18);
}

.result-hero span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.result-hero strong {
  display: block;
  font-size: 19px;
  line-height: 1.25;
}

.analysis-result-summary .result-stat strong {
  white-space: normal;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(0, 199, 190, 0.24);
  border-top: 4px solid var(--teal);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 253, 252, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.result-summary.empty {
  display: block;
  padding: 18px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 14px;
}

.result-stat {
  min-width: 0;
  padding: 10px;
  border: 1px solid #edf1f7;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.result-stat span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.result-stat strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  padding-top: 4px;
}

.result-actions form {
  margin: 0;
}

.table-open-button {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 14px;
}

.result-actions a {
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  text-decoration: none;
}

.result-error {
  color: var(--rose);
}

.forecast-workspace {
  display: grid;
  gap: 14px;
}

.forecast-source-card {
  grid-template-columns: minmax(160px, 0.7fr) minmax(240px, 1fr) repeat(3, minmax(140px, 0.7fr));
}

.forecast-config-shell {
  display: grid;
  gap: 12px;
}

.forecast-card {
  padding: 14px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.9));
  box-shadow: 0 14px 36px rgba(0, 35, 78, 0.07);
  backdrop-filter: blur(16px);
}

.forecast-primary-card {
  border-color: rgba(0, 122, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 247, 255, 0.88));
}

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

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

.forecast-card-head span {
  display: block;
  margin-bottom: 3px;
  color: #007aff;
  font-size: 12px;
  font-weight: 700;
}

.forecast-card-head h2 {
  margin: 0;
  font-size: 18px;
}

.forecast-card-head button {
  flex: 0 0 auto;
}

.compact-status {
  display: grid;
  gap: 3px;
  justify-items: end;
  color: #637083;
  font-size: 12px;
  text-align: right;
}

.compact-status strong {
  color: #172033;
  font-size: 14px;
}

.compact-status span {
  margin: 0;
  color: #637083;
  font-size: 12px;
}

.forecast-check {
  align-self: end;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #edf1f7;
  border-radius: 9px;
  background: #ffffff;
}

.forecast-rule-note {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 10px;
  color: #314158;
  background: rgba(255, 255, 255, 0.72);
}

.forecast-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.forecast-mode-row > div:first-child strong,
.forecast-mode-row > div:first-child span {
  display: block;
}

.forecast-mode-row > div:first-child strong {
  color: #27364b;
  font-size: 13px;
}

.forecast-mode-row > div:first-child span {
  margin-top: 3px;
  color: #7a8699;
  font-size: 11px;
}

.forecast-mode-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid #dce4ee;
  border-radius: 9px;
  background: #f3f6fa;
}

.forecast-mode-control label {
  position: relative;
  cursor: pointer;
}

.forecast-mode-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.forecast-mode-control span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 7px;
  color: #637083;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.forecast-mode-control input:checked + span {
  color: #075eba;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 35, 65, 0.12);
}

.forecast-formula-control {
  gap: 4px;
}

.forecast-formula-board {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(246, 251, 255, 0.86)),
    radial-gradient(circle at top left, rgba(0, 122, 255, 0.11), transparent 34%);
}

.formula-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: #26364f;
  font-size: 13px;
  font-weight: 800;
}

.formula-equation span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(204, 216, 231, 0.86);
  border-radius: 8px;
  color: #31506f;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
}

.formula-candidate-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(170px, 1fr) minmax(270px, 1.55fr);
  gap: 8px;
}

.formula-candidate {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 92px;
  padding: 10px;
  border: 1px solid rgba(205, 216, 230, 0.9);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.82);
}

.formula-candidate.fixed {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 248, 255, 0.9));
}

.formula-candidate-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #24344e;
  font-size: 13px;
  font-weight: 800;
}

.formula-candidate-head input {
  width: 16px;
  height: 16px;
  accent-color: #1479e6;
}

.formula-candidate-head em {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: #6f7e91;
  background: #eef4fb;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.formula-expression {
  color: #5c697c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.formula-peak-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.formula-peak-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 6px;
  border: 1px solid #e0e8f1;
  border-radius: 8px;
  background: #f8fbff;
}

.formula-peak-grid label span {
  color: #637083;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.formula-factor-input {
  width: 58px;
  height: 26px;
  border: 1px solid #dce4ee;
  border-radius: 7px;
  padding: 0 6px;
  color: #27364b;
  font-size: 12px;
  font-weight: 800;
  background: #ffffff;
}

.formula-factor-input[readonly] {
  color: #9aa7b7;
  background: #f3f6fa;
}

.older-peak-mode {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.older-peak-mode strong {
  color: #384962;
  font-size: 11px;
  font-weight: 900;
}

.older-peak-mode label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid #e0e8f1;
  border-radius: 8px;
  color: #536176;
  background: #fbfdff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.older-peak-mode input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  accent-color: #1479e6;
}

.older-peak-mode input:checked + span {
  color: #075eba;
}

.forecast-formula-control .formula-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border-radius: 8px;
}

.forecast-formula-control .formula-chip small {
  color: #8a96a8;
  font-size: 11px;
  font-weight: 700;
}

.peak-factor-band-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(108px, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.peak-factor-band-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  grid-template-areas:
    "title input"
    "note input";
  align-items: center;
  column-gap: 8px;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid rgba(205, 216, 230, 0.9);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.peak-factor-band-grid span {
  grid-area: title;
  color: #23314a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.peak-factor-band-grid small {
  grid-area: note;
  color: #78869a;
  font-size: 11px;
  line-height: 1.2;
}

.forecast-formula-control .formula-factor-input {
  grid-area: input;
  position: static;
  width: 62px;
  height: 28px;
  opacity: 1;
  pointer-events: auto;
}

.forecast-number-control {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #dce4ee;
  border-radius: 9px;
  background: #ffffff;
}

.forecast-number-control input {
  width: 88px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  color: #27364b;
  background: transparent;
  font: inherit;
  font-weight: 700;
}

@media (max-width: 760px) {
  .formula-candidate-grid,
  .formula-peak-grid {
    grid-template-columns: 1fr;
  }

  .peak-factor-band-grid {
    grid-template-columns: 1fr;
  }
}

.forecast-number-control span {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid #e4eaf2;
  color: #637083;
  background: #f5f7fa;
  font-size: 12px;
}

.forecast-rule-note strong {
  color: #0057b8;
  font-size: 13px;
}

.forecast-rule-note span {
  font-size: 14px;
  line-height: 1.55;
}

.coverage-matrix-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

.coverage-matrix {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.coverage-matrix th,
.coverage-matrix td {
  padding: 7px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
}

.coverage-matrix thead th {
  color: #5b667a;
  font-size: 12px;
  font-weight: 700;
  background: #f5f8fc;
}

.coverage-matrix tbody th {
  width: 96px;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.coverage-matrix input {
  width: 100%;
  min-width: 72px;
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  text-align: center;
}

.forecast-result-summary {
  grid-template-columns: minmax(210px, 1fr) repeat(4, minmax(130px, 0.75fr));
}

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

.settings-summary-grid,
.settings-reset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.settings-summary-card,
.settings-panel {
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.settings-summary-card {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.settings-summary-card span,
.settings-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.settings-summary-card strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.settings-panel {
  padding: 14px;
  margin-bottom: 14px;
}

.settings-reset-grid {
  grid-template-columns: repeat(4, max-content);
  margin-bottom: 0;
}

.settings-json-input {
  min-height: 170px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.settings-json-preview {
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  background: #fbfbfd;
  color: #30343b;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.doctor-query-panel,
.doctor-table-panel {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.doctor-query-panel form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(130px, 0.7fr)) auto auto;
  align-items: end;
  gap: 12px;
}

.doctor-picker-label {
  position: relative;
}

.doctor-picker {
  position: relative;
  display: block;
}

.doctor-picker input {
  padding-right: 32px;
}

.doctor-picker::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #6e6e73;
  border-bottom: 1.5px solid #6e6e73;
  transform: translateY(-68%) rotate(45deg);
  pointer-events: none;
}

.doctor-picker-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 286px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(210, 210, 215, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(0, 35, 78, 0.14);
  backdrop-filter: blur(16px);
}

.doctor-picker-menu button,
.doctor-picker-empty {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: #1d1d1f;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doctor-picker-menu button:hover,
.doctor-picker-menu button.active {
  transform: none;
  color: #0057d9;
  background: var(--blue-soft);
  box-shadow: none;
}

.doctor-picker-empty {
  color: var(--muted);
}

.doctor-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.doctor-summary-grid article {
  padding: 14px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(234, 244, 255, 0.78), rgba(255, 255, 255, 0.92));
  box-shadow: 0 10px 26px rgba(0, 35, 78, 0.055);
}

.doctor-summary-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.doctor-summary-grid strong {
  color: var(--ink);
  font-size: 20px;
}

.doctor-empty {
  padding: 18px;
  border: 1px dashed #c7c7cc;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
}

.doctor-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.doctor-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doctor-table-toolbar .doctor-pager {
  margin-bottom: 10px;
}

.doctor-table-panel .doctor-pager:last-child {
  margin: 10px 0 0;
}

.doctor-table-wrap {
  max-height: 68vh;
  overflow: auto;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  background: #ffffff;
}

.doctor-matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.doctor-matrix-table th,
.doctor-matrix-table td {
  min-width: 96px;
  max-width: 220px;
  padding: 7px 8px;
  border-right: 1px solid #edf1f7;
  border-bottom: 1px solid #edf1f7;
  text-align: right;
  white-space: nowrap;
}

.doctor-matrix-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f5f9ff;
  color: #334155;
  font-weight: 750;
}

.doctor-filter-row th {
  top: 34px;
  padding: 5px;
  background: #ffffff;
}

.doctor-col-filter {
  height: 26px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
}

.doctor-col-filter.compact {
  width: 58px;
}

.doctor-matrix-table th a {
  color: inherit;
  text-decoration: none;
}

.doctor-matrix-table td:nth-child(-n+6),
.doctor-matrix-table th:nth-child(-n+6) {
  text-align: left;
}

.doctor-matrix-table th:nth-child(1),
.doctor-matrix-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 210px;
  background: #ffffff;
}

.doctor-matrix-table th:nth-child(2),
.doctor-matrix-table td:nth-child(2) {
  position: sticky;
  left: 210px;
  z-index: 4;
  min-width: 110px;
  background: #ffffff;
}

.doctor-matrix-table th:nth-child(3),
.doctor-matrix-table td:nth-child(3) {
  position: sticky;
  left: 320px;
  z-index: 4;
  min-width: 140px;
  background: #ffffff;
}

.doctor-matrix-table th:nth-child(4),
.doctor-matrix-table td:nth-child(4) {
  position: sticky;
  left: 460px;
  z-index: 4;
  min-width: 120px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
  box-shadow: 8px 0 16px rgba(15, 23, 42, 0.05);
}

.doctor-matrix-table th:nth-child(-n+4) {
  z-index: 5;
  background: #eaf4ff;
}

.doctor-week-head,
.doctor-week-cell {
  min-width: 72px !important;
  max-width: 88px !important;
  text-align: right;
}

.doctor-max-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  padding: 16px;
}

.doctor-max-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(10px);
}

.doctor-max-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1760px, 100%);
  height: calc(100vh - 32px);
  margin: 0 auto;
  border: 1px solid rgba(210, 210, 215, 0.86);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 35, 78, 0.24);
  overflow: hidden;
}

.doctor-max-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
}

.doctor-max-head strong,
.doctor-max-head span {
  display: block;
}

.doctor-max-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.doctor-max-body {
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.doctor-max-body .doctor-table-wrap {
  height: 100%;
  max-height: none;
}

body.doctor-max-open {
  overflow: hidden;
}

.inventory-page-config {
  border: 1px solid rgba(210, 210, 215, 0.78);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 9px 26px rgba(0, 35, 78, 0.055);
  overflow: visible;
}

.inventory-page-config summary {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 10px 13px;
  cursor: pointer;
  list-style: none;
}

.inventory-page-config summary::-webkit-details-marker {
  display: none;
}

.inventory-page-config summary > div:first-child span,
.inventory-page-config summary > div:first-child strong,
.inventory-page-config summary > div:first-child small {
  display: block;
}

.inventory-page-config summary > div:first-child span {
  margin-bottom: 2px;
  color: #007aff;
  font-size: 11px;
  font-weight: 750;
}

.inventory-page-config summary > div:first-child strong {
  color: #172033;
  font-size: 15px;
}

.inventory-page-config summary > div:first-child small {
  margin-top: 3px;
  color: #7a8699;
  font-size: 12px;
}

.inventory-config-status {
  display: grid;
  gap: 3px;
  min-width: 190px;
  text-align: right;
}

.inventory-config-status strong {
  color: #344054;
  font-size: 13px;
}

.inventory-config-status span {
  color: #7a8699;
  font-size: 11px;
}

.inventory-config-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  color: #075eba;
  background: #eaf3ff;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.inventory-page-config[open] .inventory-config-action {
  color: #536071;
  border-color: #dfe5ee;
  background: #f8fafc;
}

.inventory-config-panel {
  display: grid;
  grid-template-columns: minmax(200px, 0.7fr) minmax(340px, 1.3fr);
  gap: 18px;
  padding: 14px;
  border-top: 1px solid #e8edf3;
  background: #f8fafc;
}

.inventory-config-copy strong {
  color: #27364b;
  font-size: 13px;
}

.inventory-config-copy p {
  margin: 5px 0 0;
  color: #637083;
  font-size: 12px;
  line-height: 1.55;
}

.inventory-config-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 9px 12px;
  align-items: end;
}

.inventory-config-form label {
  gap: 5px;
}

.inventory-config-form input[type="file"] {
  height: auto;
  padding: 8px;
  background: #ffffff;
}

.inventory-config-form .inventory-field-note {
  grid-column: 1 / -1;
}

.inventory-config-form button {
  white-space: nowrap;
}

.config-entry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.94)),
    radial-gradient(circle at 12% 0%, rgba(52, 199, 89, 0.14), transparent 32%);
  box-shadow: 0 16px 42px rgba(31, 44, 71, 0.08);
}

.config-entry-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

.config-entry-main > div:first-child span,
.config-modal-head span {
  display: block;
  margin-bottom: 3px;
  color: #007aff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.config-entry-main > div:first-child strong,
.config-modal-head strong {
  display: block;
  color: #172033;
  font-size: 16px;
}

.config-entry-main > div:first-child small,
.config-modal-head small {
  display: block;
  margin-top: 4px;
  color: #687385;
  font-size: 12px;
  line-height: 1.45;
}

.config-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.config-modal[hidden] {
  display: none;
}

.config-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 14px;
}

.config-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.36);
  backdrop-filter: blur(10px);
}

.config-modal-panel {
  position: relative;
  width: min(1480px, 98vw);
  height: min(94vh, 980px);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 20px;
  background: rgba(248, 251, 255, 0.96);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.22);
}

.config-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(214, 222, 232, 0.9);
  background: rgba(255, 255, 255, 0.78);
}

.config-modal-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(560px, 1.28fr);
  gap: 14px;
  padding: 14px;
  overflow: auto;
}

.config-upload-card,
.config-view-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(214, 222, 232, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 32px rgba(31, 44, 71, 0.06);
}

.config-upload-card.inventory-config-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.config-form-head,
.config-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.config-form-head {
  display: grid;
  gap: 4px;
}

.config-form-head strong,
.config-view-head strong {
  display: block;
  color: #243043;
  font-size: 14px;
}

.config-form-head span,
.config-view-head span {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.config-simple-table-wrap {
  margin-top: 12px;
  max-height: calc(94vh - 230px);
  overflow: auto;
  border: 1px solid #e4eaf2;
  border-radius: 12px;
  background: #ffffff;
}

.config-simple-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.config-simple-table th,
.config-simple-table td {
  padding: 9px 10px;
  border-right: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
  color: #2f3a4c;
  text-align: left;
  white-space: nowrap;
}

.config-simple-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #17324d;
  font-weight: 800;
  background: #eef6ff;
}

.config-simple-table thead .config-filter-row th {
  top: 35px;
  background: #f8fbff;
}

.config-simple-table th.key-column {
  color: #7a4b00;
  background: #fff4d6;
}

.config-simple-table td.key-column {
  background: #fffaf0;
  color: #49351a;
  font-weight: 700;
}

.config-simple-table th.effective-column {
  color: #075985;
  background: #dff5ff;
}

.config-simple-table td.effective-column {
  background: #f0fbff;
}

.config-simple-table thead .config-filter-row th.key-column {
  background: #fff8e6;
}

.config-simple-table thead .config-filter-row th.effective-column {
  background: #eefbff;
}

.config-simple-table th:last-child,
.config-simple-table td:last-child {
  border-right: 0;
}

.config-simple-table input {
  width: 100%;
  min-width: 110px;
  height: 30px;
  padding: 5px 8px;
  border: 1px solid #d8e2ee;
  border-radius: 8px;
  color: #27364b;
  background: #ffffff;
  font-size: 12px;
}

.config-table-empty {
  margin-top: 10px;
  color: #667085;
  font-size: 12px;
}

@media (max-width: 860px) {
  .config-entry-card,
  .config-entry-main,
  .config-modal-head,
  .config-view-head {
    align-items: stretch;
  }

  .config-entry-card,
  .config-modal-head,
  .config-view-head {
    flex-direction: column;
  }

  .config-entry-main,
  .config-modal-body {
    grid-template-columns: 1fr;
  }

  .config-entry-actions {
    justify-content: flex-start;
  }

  .config-modal {
    padding: 8px;
  }

  .config-modal-panel {
    width: 100%;
    height: 96vh;
    max-height: 96vh;
    border-radius: 16px;
  }

  .config-simple-table-wrap {
    max-height: 48vh;
  }
}

.inventory-input-panel {
  display: grid;
  gap: 12px;
}

.inventory-upload-form input[type="file"] {
  height: auto;
  padding: 9px;
  background: #ffffff;
}

.inventory-upload-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
}

.inventory-file-row {
  padding: 12px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.inventory-upload-action button {
  height: auto;
  min-height: 66px;
  align-self: stretch;
  padding: 0 20px;
  white-space: nowrap;
}

.inventory-rule-panel {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-left: 4px solid var(--blue);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(234, 244, 255, 0.84), rgba(255, 255, 255, 0.88));
}

.boost-rule-panel {
  border-color: rgba(0, 199, 190, 0.22);
  border-left-color: var(--teal);
  background:
    linear-gradient(135deg, rgba(232, 251, 250, 0.78), rgba(255, 255, 255, 0.88));
}

.inventory-rule-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(210, 210, 215, 0.62);
}

.inventory-rule-title strong {
  color: #1d2433;
  font-size: 15px;
}

.inventory-rule-title span,
.inventory-rule-note {
  color: #6c7585;
  font-size: 12px;
}

.inventory-rule-group {
  padding-top: 8px;
}

.inventory-rule-group + .inventory-rule-group {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(210, 210, 215, 0.52);
}

.inventory-rule-subtitle {
  margin-bottom: 4px;
  color: #1d2433;
  font-size: 13px;
  font-weight: 800;
}

.inventory-rule-matrix-block {
  margin-top: 10px;
}

.compact-matrix-wrap {
  overflow-x: auto;
}

.compact-check-matrix {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.compact-check-matrix th,
.compact-check-matrix td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(210, 210, 215, 0.52);
}

.compact-check-matrix th:first-child {
  text-align: left;
  color: #536071;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-check input {
  width: 16px;
  height: 16px;
  accent-color: #007aff;
}

.round-rule-row {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) 86px auto 80px auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.round-rule-row span,
.round-rule-row small {
  color: #6c7585;
  font-size: 12px;
  font-weight: 700;
}

.round-rule-row input,
.round-rule-row select {
  min-width: 0;
}

.round-rule-remove {
  height: 30px;
  padding: 0 10px;
}

.inventory-rule-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 42px;
}

.inventory-rule-row .rule-label {
  color: #536071;
  font-size: 13px;
  font-weight: 700;
}

.rule-control,
.range-control,
.rule-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.compact-number input {
  max-width: 120px;
}

.range-control input {
  max-width: 145px;
}

.range-control small,
.compact-number small {
  color: #6c7585;
  font-size: 12px;
}

.rule-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 11px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #1d2433;
  font-size: 13px;
  font-weight: 700;
}

.rule-pills label {
  display: inline-flex;
  align-items: center;
}

.rule-pills input,
.rule-switch input {
  width: auto;
  min-height: auto;
}

.rule-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(210, 210, 215, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #536071;
  font-size: 13px;
  font-weight: 700;
}

.rule-pills input:checked + span {
  border-color: rgba(0, 122, 255, 0.38);
  background: rgba(0, 122, 255, 0.1);
  color: #0057d9;
}

.inventory-rule-note {
  margin: 6px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(210, 210, 215, 0.52);
}

.inventory-rule-note.formula-note {
  line-height: 1.7;
  padding: 10px 12px;
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 10px;
  background: rgba(0, 122, 255, 0.055);
  color: #3f4a5f;
}

.purchase-unit-summary-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(210, 221, 235, 0.92);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.9));
  box-shadow: 0 12px 30px rgba(21, 55, 92, 0.07);
}

.purchase-unit-summary-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.purchase-unit-summary-head span {
  display: block;
  margin-bottom: 3px;
  color: #007aff;
  font-size: 12px;
  font-weight: 800;
}

.purchase-unit-summary-head h3 {
  margin: 0;
  color: #172033;
  font-size: 17px;
}

.purchase-unit-summary-head small {
  max-width: 420px;
  color: #6a7688;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.purchase-unit-summary-scroll {
  overflow-x: auto;
  border: 1px solid #e1e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.purchase-unit-summary-scroll table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.purchase-unit-summary-scroll th,
.purchase-unit-summary-scroll td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f6;
  color: #29374d;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.purchase-unit-summary-scroll th:first-child,
.purchase-unit-summary-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: #ffffff;
}

.purchase-unit-summary-scroll thead th {
  color: #43546b;
  background: #f4f8fc;
  font-weight: 900;
}

.purchase-unit-summary-scroll thead th:first-child {
  z-index: 2;
  background: #f4f8fc;
}

.purchase-unit-total-row th,
.purchase-unit-total-row td {
  color: #075eba;
  background: #eef6ff;
  font-weight: 900;
}

.purchase-unit-row-total {
  color: #174a7c;
  background: #f6faff;
  font-weight: 900;
}

@media (max-width: 860px) {
  .inventory-upload-action {
    grid-template-columns: 1fr;
  }

  .inventory-upload-action button {
    min-height: 42px;
  }

  .inventory-rule-title,
  .inventory-rule-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inventory-rule-title {
    display: grid;
  }

  .range-control,
  .rule-pills {
    flex-wrap: wrap;
  }
}

.inventory-field-note {
  padding: 10px 12px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 10px;
  color: #536071;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.trend-view {
  min-height: 100vh;
  padding: 12px;
  background:
    linear-gradient(180deg, #f5f9ff 0%, #ffffff 38%, #f7f8fb 100%);
}

.trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 34px rgba(0, 35, 78, 0.06);
}

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

.trend-head strong {
  color: var(--ink);
  font-size: 18px;
}

.trend-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.trend-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(440px, 48vw);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trend-search a {
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.trend-search .trend-download {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 8px;
  background: var(--blue-soft);
  font-weight: 650;
}

.trend-page-size {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.trend-page-size select {
  width: 78px;
}

.trend-view-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.trend-view-switch > span {
  margin-right: 3px;
  font-weight: 700;
}

.trend-view-switch label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #ffffff;
  white-space: nowrap;
  cursor: pointer;
}

.trend-view-switch label:has(input:checked) {
  color: #075eba;
  border-color: #9ecbff;
  background: #eaf3ff;
}

.trend-view-switch input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.trend-column-settings {
  position: relative;
}

.trend-settings-button {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  color: #425066;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.trend-settings-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 20;
  display: grid;
  width: min(520px, 88vw);
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid #dce3ec;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(15, 35, 65, 0.18);
}

.trend-settings-panel[hidden] {
  display: none;
}

.trend-settings-panel section {
  min-width: 0;
}

.trend-settings-panel strong,
.trend-settings-panel section > span {
  display: block;
}

.trend-settings-panel strong {
  color: #1f2937;
  font-size: 13px;
}

.trend-settings-panel section > span {
  margin: 3px 0 9px;
  color: #7a8699;
  font-size: 11px;
}

.trend-settings-panel section > div {
  display: grid;
  gap: 5px;
}

.trend-settings-panel label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: #425066;
  font-size: 12px;
  cursor: pointer;
}

.trend-settings-panel input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.trend-settings-reset {
  grid-column: 1 / -1;
  justify-self: end;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #dfe5ee;
  border-radius: 7px;
  color: #536071;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.trend-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 9px;
  padding: 7px 8px 7px 11px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 7px 20px rgba(0, 35, 78, 0.045);
}

.trend-legend,
.trend-view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trend-legend {
  color: var(--muted);
  font-size: 12px;
}

.trend-view-controls {
  justify-content: flex-end;
}

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

.trend-legend i {
  width: 12px;
  height: 12px;
  border: 1px solid transparent;
  border-radius: 3px;
}

.trend-legend i.normal {
  border-color: #cfd6df;
  background: #ffffff;
}

.trend-legend i.zero {
  border-color: #c7cbd1;
  background: #e5e7eb;
}

.trend-legend i.holiday {
  border-color: #f4c36d;
  background: #fff0d5;
}

.trend-legend i.incomplete {
  border-color: #f3aaa4;
  background: #ffe1df;
}

.trend-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 170px);
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.trend-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.trend-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 9px 10px;
  color: #536071;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
  background: #f5f8fc;
  border-bottom: 1px solid #e5eaf2;
}

.trend-table thead tr:first-child th {
  height: 50px;
}

.trend-filter-row th {
  top: 50px;
  z-index: 4;
  height: 44px;
  padding: 7px 8px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.trend-filter-row input,
.trend-filter-row select {
  width: 100%;
  min-width: 86px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  color: #1d2736;
  font-size: 12px;
  background: #ffffff;
}

.trend-table th a {
  color: inherit;
  text-decoration: none;
}

.trend-table th a:hover {
  color: var(--blue);
}

.trend-table td {
  height: 52px;
  max-width: 220px;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
  color: #1d2736;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  background: #ffffff;
}

.trend-table tbody tr:hover td {
  box-shadow: inset 0 1px rgba(0, 122, 255, 0.14), inset 0 -1px rgba(0, 122, 255, 0.14);
}

.trend-sticky-col {
  position: sticky !important;
  z-index: 3;
  border-right: 1px solid #e5eaf2;
  background: #ffffff !important;
}

.trend-table thead .trend-sticky-col {
  z-index: 7;
  background: #f5f8fc !important;
}

.trend-table thead .trend-filter-row .trend-sticky-col {
  background: #ffffff !important;
}

.trend-last-sticky {
  box-shadow: 8px 0 14px rgba(15, 23, 42, 0.07);
}

[data-base-col="clinic_name"] {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}

[data-base-col="item_code"] {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
}

[data-base-col="item_name"] {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}

[data-base-col="spec"] {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
}

[data-base-col="unit"] {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.trend-metric-head,
.trend-metric-filter,
.trend-metric-cell {
  width: 148px;
  min-width: 148px;
  max-width: 148px;
}

.trend-metric-cell {
  color: #344054;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: #f8fafc !important;
}

[data-metric-col][hidden] {
  display: none !important;
}

.trend-week-head,
.trend-week-filter,
.trend-week-cell {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  text-align: right !important;
}

.trend-week-head span {
  display: block;
}

.trend-week-head span {
  color: #27364b;
  font-size: 12px;
}

.trend-week-cell {
  padding: 6px 7px !important;
  border-right: 1px solid #f0f3f7;
}

.trend-week-cell strong,
.trend-week-cell span {
  display: block;
}

.trend-week-cell strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trend-week-cell span {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 700;
}

.trend-week-cell.normal {
  color: #1f2937;
  background: #ffffff;
}

.trend-week-cell.zero {
  color: #4b5563;
  background: #e5e7eb;
}

.trend-week-cell.holiday {
  color: #a45100;
  background: #fff0d5;
}

.trend-week-cell.incomplete {
  color: #b42318;
  background: #ffe1df;
}

.trend-week-cell.unmarked {
  color: #4b5563;
  background: #f3f4f6;
}

.trend-week-cell.muted,
.trend-week-cell.missing {
  color: #c3cad4;
  background: #fafbfc;
}

.trend-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.trend-pager a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}

.summary-workspace {
  display: grid;
  gap: 16px;
}

.summary-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.summary-config-card,
.summary-chart-card,
.summary-table-card {
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(0, 35, 78, 0.07);
}

.summary-config-card {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.summary-source {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.12), rgba(52, 199, 89, 0.1));
}

.summary-source span,
.summary-source em {
  color: #536071;
  font-size: 12px;
  font-style: normal;
}

.summary-source strong {
  color: #111827;
  font-size: 22px;
}

.summary-head-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 9px;
  color: #0062cc;
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 750;
}

.summary-loading-panel {
  display: grid;
  min-height: 360px;
  place-items: center;
  gap: 10px;
  padding: 34px;
  border: 1px solid rgba(210, 210, 215, 0.72);
  border-radius: 14px;
  color: #536071;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.94));
  box-shadow: 0 16px 42px rgba(0, 35, 78, 0.07);
  text-align: center;
}

.summary-loading-panel[hidden] {
  display: none;
}

.summary-loading-panel strong {
  color: #172033;
  font-size: 18px;
}

.summary-loading-panel span {
  font-size: 13px;
}

.summary-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(246, 249, 252, 0.62);
  backdrop-filter: blur(6px);
}

.summary-loading-overlay[hidden] {
  display: none;
}

.summary-loading-box {
  display: grid;
  justify-items: center;
  gap: 9px;
  min-width: min(320px, 88vw);
  padding: 22px 24px;
  border: 1px solid rgba(210, 210, 215, 0.86);
  border-radius: 14px;
  color: #536071;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 54px rgba(0, 35, 78, 0.16);
  text-align: center;
}

.summary-loading-box strong {
  color: #172033;
  font-size: 17px;
}

.summary-loading-box span {
  font-size: 13px;
}

.summary-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 122, 255, 0.18);
  border-top-color: #007aff;
  border-radius: 999px;
  animation: summary-spin 0.8s linear infinite;
}

@keyframes summary-spin {
  to {
    transform: rotate(360deg);
  }
}

.summary-template {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-template button,
.summary-template a {
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.summary-fieldset {
  display: grid;
  gap: 8px;
}

.summary-fieldset > strong,
.summary-card-head span {
  color: #007aff;
  font-size: 12px;
  font-weight: 750;
}

.summary-check-grid,
.summary-filter-grid,
.summary-date-grid {
  display: grid;
  gap: 8px;
}

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

.summary-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  color: #314158;
  font-size: 13px;
  background: #ffffff;
}

.summary-check input {
  width: 14px;
  height: 14px;
}

.summary-filter-grid label,
.summary-date-grid label,
.summary-page-size {
  display: grid;
  gap: 5px;
  color: #536071;
  font-size: 12px;
  font-weight: 650;
}

.summary-filter-grid input,
.summary-date-grid input,
.summary-page-size select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

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

.summary-chart-card,
.summary-table-card {
  padding: 14px;
}

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

.summary-card-head h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.summary-card-head small {
  display: block;
  margin-top: 4px;
  color: #6b788c;
  font-size: 12px;
  font-weight: 650;
}

.summary-card-head strong {
  color: #536071;
  font-size: 12px;
}

.summary-chart-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-chart-actions button {
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 750;
}

.summary-chart-actions button.active {
  color: #ffffff;
  border-color: #007aff;
  background: #007aff;
}

.weekday-chart-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.weekday-chart-actions button {
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 750;
}

.summary-line-wrap {
  overflow-x: auto;
  padding: 8px 8px 2px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.summary-line-chart {
  width: 100%;
  min-width: 960px;
  height: auto;
}

.summary-grid line {
  stroke: #e7edf6;
  stroke-width: 1;
}

.summary-grid text {
  fill: #7a8699;
  font-size: 11px;
}

.summary-axis line {
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.summary-axis text {
  fill: #6b7280;
  font-size: 11px;
}

.summary-line-chart polyline {
  vector-effect: non-scaling-stroke;
}

.summary-series polygon,
.summary-series polyline {
  pointer-events: none;
}

.summary-series circle {
  pointer-events: all;
}

.summary-prescription-line {
  stroke-dasharray: 7 5;
  opacity: 0.82;
}

.summary-prescription-axis {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.summary-prescription-bars {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.summary-prescription-bars rect {
  opacity: 0.28;
}

.summary-prescription-value {
  fill: #258d3f;
  font-size: 10.5px;
  font-weight: 850;
  opacity: 0;
  paint-order: stroke;
  pointer-events: none;
  stroke: #ffffff;
  stroke-width: 3px;
}

.summary-line-wrap.is-focusing .summary-prescription-axis {
  opacity: 1;
}

.summary-line-wrap.is-focusing .summary-prescription-bars.is-focused {
  opacity: 1;
  pointer-events: auto;
}

.summary-line-wrap.is-focusing .summary-prescription-bars.is-focused .summary-prescription-value {
  opacity: 1;
}

.summary-dual-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: #536071;
  font-size: 12px;
  font-weight: 750;
}

.summary-dual-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-dual-legend i {
  width: 20px;
  height: 3px;
  border-radius: 999px;
}

.summary-dual-legend i.consumption {
  background: #007aff;
}

.summary-dual-legend i.prescription {
  background: repeating-linear-gradient(90deg, #34c759 0 6px, transparent 6px 10px);
}

.summary-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
}

.summary-chart-controls label {
  display: grid;
  gap: 4px;
  min-width: 132px;
  color: #536071;
  font-size: 11px;
  font-weight: 750;
}

.summary-chart-controls select {
  min-height: 32px;
  border: 1px solid #dbe3ef;
  border-radius: 9px;
  padding: 4px 8px;
  color: #172033;
  background: #ffffff;
  font: inherit;
}

.summary-line-wrap.is-focusing .summary-series {
  opacity: 0.13;
}

.summary-line-wrap.is-focusing .summary-series.is-focused {
  opacity: 1;
}

.summary-line-wrap.is-focusing .summary-series.is-focused polyline {
  stroke-width: 4;
}

.summary-line-wrap.is-focusing .summary-series.is-focused circle {
  r: 5.8;
}

.summary-line-chart circle {
  stroke: #ffffff;
  stroke-width: 2.6;
  transition: r 0.15s ease, stroke-width 0.15s ease;
}

.summary-line-chart circle:hover {
  r: 6;
  stroke-width: 2.4;
}

.summary-point-value {
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  fill: #263348;
  font-size: 10.5px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
}

.summary-point-value.is-sampled,
.summary-line-wrap.is-focusing .summary-series.is-focused .summary-point-value {
  opacity: 1;
}

.summary-line-wrap.is-focusing .summary-series:not(.is-focused) .summary-point-value {
  opacity: 0;
}

.summary-chart-legend {
  display: flex;
  gap: 9px 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: #536071;
  font-size: 12px;
}

.summary-chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #536071;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.summary-chart-legend button:hover,
.summary-chart-legend button.active {
  border-color: rgba(0, 122, 255, 0.24);
  color: #0b63ce;
  background: rgba(0, 122, 255, 0.08);
}

.summary-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.summary-empty-chart {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: #637083;
  border: 1px dashed #dbe3ef;
  border-radius: 12px;
  background: #f8fbff;
}

.summary-bar-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.summary-dual-bar-chart {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.summary-dual-bar-row {
  display: grid;
  grid-template-columns: 28px minmax(90px, 170px) minmax(180px, 1fr) 132px;
  gap: 10px;
  align-items: center;
  color: #425066;
  font-size: 12px;
}

.summary-dual-bar-row em {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  font-style: normal;
  font-weight: 800;
}

.summary-dual-bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-dual-bars {
  display: grid;
  gap: 4px;
}

.summary-dual-bars i {
  display: block;
  height: 8px;
  border-radius: 999px;
}

.summary-dual-bars i.consumption {
  background: linear-gradient(90deg, #007aff, #5ac8fa);
}

.summary-dual-bars i.prescription {
  background: linear-gradient(90deg, #34c759, #b7f267);
}

.summary-dual-bar-row strong {
  text-align: right;
}

.summary-dual-note {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
  color: #536071;
  font-size: 12px;
}

.summary-dual-note b {
  display: inline-block;
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: #007aff;
}

.summary-dual-note b.prescription {
  background: #34c759;
}

.summary-bar-row {
  display: grid;
  grid-template-columns: 28px minmax(90px, 160px) minmax(180px, 1fr) 86px;
  gap: 10px;
  align-items: center;
  color: #425066;
  font-size: 12px;
}

.summary-bar-row em {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  font-style: normal;
  font-weight: 800;
}

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

.summary-bar-row div {
  height: 12px;
  border-radius: 999px;
  background: #edf3fb;
  overflow: hidden;
}

.summary-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #007aff, #34c759);
  box-shadow: 0 5px 14px rgba(0, 122, 255, 0.2);
}

.summary-bar-row strong {
  text-align: right;
}

.summary-chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 10px;
}

.summary-chart-modal[hidden] {
  display: none;
}

.summary-chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
}

.summary-chart-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1680px, 98vw);
  height: min(980px, 96vh);
  border: 1px solid rgba(210, 210, 215, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 80px rgba(0, 35, 78, 0.24);
  overflow: hidden;
}

.summary-chart-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  background: #ffffff;
}

.summary-chart-modal-head strong,
.summary-chart-modal-head span {
  display: block;
}

.summary-chart-modal-head strong {
  color: #172033;
  font-size: 17px;
}

.summary-chart-modal-head span {
  margin-top: 3px;
  color: #637083;
  font-size: 12px;
}

.summary-chart-modal-head button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  color: #425066;
  background: #ffffff;
  font-weight: 750;
}

.summary-chart-modal-body {
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.summary-chart-modal-body .summary-line-wrap,
.summary-chart-modal-body .summary-bar-chart {
  min-height: 100%;
}

.summary-chart-modal-body .summary-line-chart {
  min-width: 1320px;
}

.summary-chart-tooltip {
  position: fixed;
  z-index: 1300;
  display: grid;
  gap: 3px;
  min-width: 128px;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #ffffff;
  background: rgba(23, 32, 51, 0.94);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}

.summary-chart-tooltip[hidden] {
  display: none;
}

.summary-chart-tooltip strong,
.summary-chart-tooltip span {
  display: block;
}

.summary-chart-tooltip strong {
  font-size: 12px;
  font-weight: 750;
}

.summary-chart-tooltip span {
  color: #dbeafe;
  font-size: 14px;
  font-weight: 850;
}

.summary-table-wrap {
  overflow: auto;
  border: 1px solid #e5eaf2;
  border-radius: 12px;
}

.summary-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.summary-table th,
.summary-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  white-space: nowrap;
}

.summary-table th {
  position: sticky;
  top: 0;
  color: #536071;
  font-size: 12px;
  background: #f5f8fc;
}

.summary-table th a {
  color: inherit;
  text-decoration: none;
}

.summary-table th a:hover {
  color: var(--blue);
}

.summary-table td {
  color: #1d2736;
  font-size: 13px;
}

.summary-matrix-card {
  display: grid;
  gap: 14px;
}

.summary-matrix-grid {
  display: grid;
  gap: 16px;
}

.summary-matrix-grid > section {
  display: grid;
  gap: 8px;
}

.summary-matrix-grid > section > strong {
  color: #172033;
  font-size: 14px;
}

.summary-matrix-wrap {
  max-height: 460px;
}

.summary-matrix-table {
  min-width: 1120px;
}

.summary-matrix-table .summary-week-col {
  min-width: 74px;
  text-align: right;
}

.summary-matrix-pair,
.summary-matrix-number,
.summary-matrix-total {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.summary-matrix-pair {
  color: #253044;
  font-size: 12px;
  white-space: nowrap;
}

.summary-matrix-total {
  color: #0b63ce !important;
  font-weight: 850;
  background: #f5f9ff;
}

.summary-pager {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: #637083;
  font-size: 13px;
}

.summary-pager a {
  color: var(--blue);
  text-decoration: none;
}

.weekday-workspace {
  display: grid;
  gap: 14px;
  width: min(1560px, 100%);
}

.weekday-head {
  min-height: 142px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.96) 58%, rgba(239, 251, 246, 0.94));
}

#weekdayMount {
  display: grid;
  gap: 14px;
}

.weekday-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(210, 210, 215, 0.76);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(0, 35, 78, 0.05);
}

.weekday-filter-bar label {
  display: grid;
  gap: 5px;
  color: #637083;
  font-size: 11px;
  font-weight: 700;
}

.weekday-filter-bar input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  color: #27364b;
  background: #ffffff;
}

.weekday-filter-bar button {
  height: 34px;
  padding: 0 17px;
}

.weekday-card-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(210, 210, 215, 0.78);
  border-radius: 9px;
  color: #536071;
  background: rgba(255, 255, 255, 0.94);
  text-decoration: none;
}

.weekday-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  content: "";
  opacity: calc(0.22 + var(--weekday-strength) * 0.78);
  background: linear-gradient(90deg, #0878ed, #20a177);
}

.weekday-card:hover,
.weekday-card.active {
  border-color: rgba(0, 122, 255, 0.32);
  background: linear-gradient(145deg, #ffffff, #eef7ff);
  box-shadow: 0 10px 24px rgba(0, 73, 148, 0.09);
}

.weekday-card.active {
  color: #075eba;
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.12), 0 10px 24px rgba(0, 73, 148, 0.09);
}

.weekday-card span {
  font-size: 12px;
  font-weight: 800;
}

.weekday-card strong {
  overflow: hidden;
  color: #172033;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekday-card small {
  color: #7a8699;
  font-size: 10px;
  white-space: nowrap;
}

.weekday-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
}

.weekday-chart-grid.secondary {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.weekday-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(210, 210, 215, 0.76);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 38px rgba(0, 35, 78, 0.06);
}

.weekday-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.weekday-panel header span {
  color: #007aff;
  font-size: 11px;
  font-weight: 800;
}

.weekday-panel h2 {
  margin: 3px 0 0;
  color: #172033;
  font-size: 18px;
}

.weekday-panel header > strong {
  color: #6b7789;
  font-size: 11px;
}

.weekday-heatmap-wrap {
  max-height: 500px;
  overflow: auto;
  border: 1px solid #e7ecf3;
  border-radius: 8px;
}

.weekday-heatmap {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
}

.weekday-heatmap th,
.weekday-heatmap td {
  height: 31px;
  padding: 5px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid #edf1f6;
  text-align: center;
  white-space: nowrap;
}

.weekday-heatmap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #536071;
  background: #f5f8fc;
  font-size: 11px;
}

.weekday-heatmap tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  max-width: 150px;
  overflow: hidden;
  color: #27364b;
  background: #ffffff;
  font-size: 11px;
  text-align: left;
  text-overflow: ellipsis;
}

.weekday-heatmap td {
  min-width: 63px;
  color: #172033;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.weekday-range-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  color: #6b7789;
  font-size: 11px;
}

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

.weekday-range-legend i {
  width: 22px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #9ed1ff, #4aa5f5);
}

.weekday-range-legend b {
  width: 8px;
  height: 8px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #13845e;
  box-shadow: 0 0 0 1px #13845e;
}

.weekday-range-chart {
  display: grid;
  gap: 9px;
  max-height: 500px;
  padding-right: 4px;
  overflow-y: auto;
}

.weekday-range-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(180px, 1fr) 112px;
  align-items: center;
  gap: 10px;
  color: #425066;
  font-size: 11px;
}

.weekday-range-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekday-range-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #edf2f7;
}

.weekday-range-track i {
  position: absolute;
  top: 2px;
  height: 8px;
  min-width: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #9ed1ff, #4aa5f5);
}

.weekday-range-track b {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #13845e;
  box-shadow: 0 0 0 1px #13845e;
  transform: translate(-50%, -50%);
}

.weekday-range-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.weekday-table-wrap {
  max-height: min(680px, 72vh);
  overflow: auto;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
}

.weekday-table-wrap.compact {
  max-height: 430px;
}

.weekday-prep-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
}

.weekday-table-wrap.compact .weekday-prep-table {
  min-width: 720px;
}

.weekday-prep-table th,
.weekday-prep-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  white-space: nowrap;
}

.weekday-prep-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #536071;
  background: #f5f8fc;
  font-size: 11px;
}

.weekday-prep-table td {
  color: #27364b;
  font-size: 12px;
}

.weekday-prep-table tbody tr:hover td {
  background: #f8fbff;
}

.weekday-suggested {
  color: #075eba !important;
  background: rgba(0, 122, 255, 0.06);
  font-weight: 800;
}

.weekday-week-total {
  color: #08704f !important;
  background: rgba(52, 199, 89, 0.08);
  font-weight: 800;
}

.weekday-tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  color: #536071;
  background: #f1f4f8;
  font-size: 10px;
  font-weight: 750;
}

.weekday-tag.规律明显 {
  color: #08704f;
  background: rgba(52, 199, 89, 0.12);
}

.weekday-tag.有一定规律 {
  color: #075eba;
  background: rgba(0, 122, 255, 0.1);
}

.weekday-tag.波动较大,
.weekday-tag.偶发使用 {
  color: #9a5c00;
  background: rgba(255, 149, 0, 0.13);
}

.weekday-prep-result > header {
  align-items: flex-end;
}

.weekday-result-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.weekday-result-actions input {
  width: min(260px, 30vw);
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  background: #ffffff;
}

.weekday-note {
  margin: 10px 2px 0;
  color: #7a8699;
  font-size: 11px;
}

.weekday-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: #6b7789;
}

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

.column-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f6;
}

.column-picker > span {
  color: var(--muted);
  font-size: 13px;
}

.check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.check input {
  width: 14px;
  height: 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
}

.analysis-step-panel .form-actions {
  padding-top: 0;
}

.analysis-step-panel .form-actions button {
  min-width: 124px;
  height: 34px;
}

.form-actions a,
td a,
.pager a,
.data-table th a {
  color: var(--blue);
  text-decoration: none;
}

.active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 0;
  padding: 0 14px;
  background: #fbfbfd;
}

.active-filters:not(:empty) {
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e5ea;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 360px;
  padding: 5px 8px;
  border: 1px solid #b9dcff;
  border-radius: 999px;
  color: #0057b8;
  background: var(--blue-soft);
  font-size: 12px;
}

.filter-chip strong {
  color: var(--ink);
}

.filter-chip a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.table-shell {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.embedded-table-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.table-export-action {
  height: 32px;
  margin-left: auto;
  padding: 0 11px;
  font-size: 13px;
}

.embedded-table-shell .table-export-action {
  margin-left: 0;
}

.table-filter-actions,
.table-result-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.table-result-actions {
  padding-left: 10px;
  border-left: 1px solid #e5e5ea;
}

.table-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e5ea;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  flex-wrap: wrap;
}

.embedded-table-shell .table-bar {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto auto auto;
  gap: 10px;
  padding: 10px 12px;
}

.embedded-table-shell .table-result-actions {
  justify-content: flex-end;
}

.embedded-table-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.embedded-table-title strong {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.embedded-table-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.segments {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #d2d2d7;
  border-radius: 7px;
  background: #f2f2f7;
}

.seg {
  min-width: 104px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #515154;
  text-decoration: none;
  border-radius: 5px;
}

.seg.active {
  color: var(--blue);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 35, 78, 0.12);
}

.result-meta {
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}

.embedded-table-shell .result-meta {
  margin-left: 0;
  white-space: nowrap;
}

.current-result-pill {
  max-width: min(520px, 100%);
  overflow: hidden;
  padding: 7px 10px;
  border-radius: 999px;
  color: #0057b8;
  background: var(--blue-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-control {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  min-width: 120px;
}

.inline-control select {
  min-width: 110px;
}

.embedded-table-shell .inline-control {
  min-width: auto;
  white-space: nowrap;
}

.embedded-table-shell .inline-control select {
  min-width: 82px;
}

.ghost-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--blue);
  text-decoration: none;
}

.column-drawer {
  border-bottom: 1px solid #e5e5ea;
  background: #fbfbfd;
}

.column-drawer summary {
  cursor: pointer;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap,
.table-scroll {
  overflow: auto;
  overscroll-behavior-x: contain;
  background: #ffffff;
}

.table-scroll {
  max-height: calc(100vh - 250px);
  min-height: 520px;
  scrollbar-gutter: stable both-edges;
}

.embedded-table-shell .table-scroll {
  min-height: 0;
  max-height: none;
  height: 100%;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table {
  width: max-content;
  min-width: 100%;
}

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid #ececf1;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
  white-space: nowrap;
}

.sequence-table-cell {
  width: min(850px, 60vw);
  min-width: 460px;
  max-width: 850px;
  white-space: normal;
}

.sequence-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sequence-chip {
  flex: 0 0 auto;
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  color: #344054;
  background: #ffffff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.sequence-chip.zero {
  color: #4b5563;
  border-color: #c7cbd1;
  background: #e5e7eb;
}

.sequence-chip.holiday {
  color: #a45100;
  border-color: #f4c36d;
  background: #fff0d5;
}

.sequence-chip.incomplete {
  color: #b42318;
  border-color: #f3aaa4;
  background: #ffe1df;
}

.sequence-chip.unmarked {
  color: #536071;
  background: #f3f4f6;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%);
  color: #3a3a3c;
  font-weight: 650;
}

.filter-row th {
  top: 36px;
  z-index: 2;
  padding: 7px 8px;
  background: #fbfbfd;
  border-bottom: 1px solid #d2d2d7;
}

.label-row th {
  height: 36px;
}

.th-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.th-sort {
  min-width: 0;
  overflow: hidden;
  color: #3a3a3c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-filter {
  width: auto;
  height: 26px;
  padding: 0 8px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  background: #ffffff;
  color: #515154;
  font-size: 12px;
}

.th-filter.active {
  border-color: var(--blue);
  color: #0057b8;
  background: var(--blue-soft);
}

.filter-cell input,
.filter-cell select {
  height: 28px;
  min-width: 118px;
  font-size: 12px;
  padding: 0 7px;
  border-radius: 5px;
}

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

.text-filter {
  grid-template-columns: 76px minmax(128px, 1fr);
}

.range-filter {
  grid-template-columns: minmax(90px, 1fr) minmax(90px, 1fr);
}

.column-filter-menu {
  position: fixed;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(210, 210, 215, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 54px rgba(0, 35, 78, 0.16);
  backdrop-filter: blur(18px);
  overflow: auto;
  overscroll-behavior: contain;
}

.column-filter-menu[hidden] {
  display: none;
}

.filter-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-menu-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
}

.column-filter-menu label {
  gap: 6px;
}

.advanced-filter {
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: #fbfbfd;
}

.advanced-filter summary {
  cursor: pointer;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.advanced-filter label {
  margin: 0 10px 10px;
}

.column-filter-menu input,
.column-filter-menu select {
  height: 34px;
}

.filter-values {
  max-height: min(220px, 32vh);
  overflow: auto;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: #f7f7fa;
}

.value-check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 3px 4px;
  border-radius: 5px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.value-check:hover,
.value-check.selected {
  background: var(--blue-soft);
}

.value-check:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.value-check input {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.value-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.value-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.filter-menu-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: -14px;
  margin: 0 -14px -14px;
  padding: 10px 14px 14px;
  border-top: 1px solid #e5e5ea;
  background: rgba(255, 255, 255, 0.96);
}

.value-tools button,
.secondary-button {
  border-color: #cbd8e6;
  background: #ffffff;
  color: #334155;
}

.value-tools button {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.empty-values {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}

body.modal-open {
  overflow: hidden;
}

.table-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
}

.table-overlay[hidden] {
  display: none;
}

.table-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(10px);
}

.table-overlay-panel {
  position: absolute;
  inset: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(210, 210, 215, 0.86);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 35, 78, 0.24);
  overflow: hidden;
}

.table-overlay-panel:fullscreen {
  inset: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.table-overlay-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
}

.table-overlay-head strong,
.table-overlay-head span {
  display: block;
}

.table-overlay-head strong {
  color: var(--ink);
  font-size: 16px;
}

.table-overlay-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.table-overlay-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-overlay-actions button {
  height: 32px;
}

.table-overlay-frame {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  border: 0;
  background: #ffffff;
}

tbody tr:nth-child(even) {
  background: #fbfbfd;
}

tbody tr.review-highlight-row,
tbody tr.review-highlight-row:nth-child(even) {
  background: #fff8df;
}

tbody tr:hover {
  background: #eaf4ff;
}

tbody tr.review-highlight-row:hover {
  background: #ffefbd;
}

.data-table .table-summary-row td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  color: #17324d;
  font-weight: 800;
  background: #eef6ff;
  border-top: 1px solid #b9d7f5;
  box-shadow: 0 -6px 16px rgba(15, 23, 42, .06);
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pager.large {
  padding: 12px 14px;
  border-top: 1px solid #e5e5ea;
  background: #fbfbfd;
}

.embedded-table-shell .pager.large {
  padding: 9px 12px;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-jump input {
  width: 72px;
}

.page-jump button {
  height: 32px;
}

@media (max-width: 900px) {
  .top-nav {
    height: 52px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 14px;
  }

  .top-nav .brand,
  .top-nav .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .top-nav .brand {
    margin-right: 8px;
  }

  .workspace {
    padding: 16px;
  }

  .analysis-head {
    min-height: 128px;
    padding: 18px;
    border-radius: 14px;
  }

  .analysis-source-card {
    grid-template-columns: 1fr;
  }

  .forecast-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-summary-grid,
  .settings-reset-grid,
  .doctor-summary-grid,
  .doctor-query-panel form {
    grid-template-columns: 1fr;
  }

  .settings-reset-grid {
    justify-items: stretch;
  }

  .settings-reset-grid button {
    width: 100%;
  }

  .forecast-mode-row {
    align-items: stretch;
    flex-direction: column;
  }

  .forecast-mode-control {
    align-self: flex-start;
  }

  .inventory-page-config summary,
  .inventory-config-panel,
  .inventory-config-form,
  .warning-rule-split,
  .alias-rule-head,
  .alias-rule-row {
    grid-template-columns: 1fr;
  }

  .alias-rule-head span:nth-child(2) {
    display: none;
  }

  .alias-rule-row span {
    text-align: left;
  }

  .alias-delete-button {
    justify-self: start;
  }

  .inventory-config-status {
    min-width: 0;
    text-align: left;
  }

  .inventory-config-action {
    justify-self: start;
  }

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

  .weekday-filter-bar button {
    grid-column: 1 / -1;
  }

  .weekday-card-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .weekday-chart-grid,
  .weekday-chart-grid.secondary {
    grid-template-columns: 1fr;
  }

  .weekday-panel > header,
  .weekday-prep-result > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .weekday-result-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .weekday-result-actions input {
    width: 100%;
  }

  .weekday-range-row {
    grid-template-columns: minmax(80px, 110px) minmax(120px, 1fr) 94px;
  }


  .inventory-config-form .inventory-field-note {
    grid-column: auto;
  }

  .sequence-table-cell {
    width: min(760px, 82vw);
    min-width: 320px;
  }

  .trend-head,
  .trend-search {
    align-items: stretch;
    flex-direction: column;
  }

  .trend-search {
    min-width: 0;
  }

  .trend-search input {
    min-width: 0;
  }

  .trend-view-toolbar,
  .trend-view-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .trend-view-toolbar {
    padding: 9px;
  }

  .trend-view-controls {
    gap: 8px;
  }

  .trend-view-switch {
    width: 100%;
  }

  .trend-column-settings {
    align-self: flex-end;
  }

  .trend-settings-panel {
    position: fixed;
    inset: 72px 12px auto;
    width: auto;
    max-height: calc(100vh - 92px);
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .page-head,
  .table-bar,
  .toolbar,
  .run-console {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

  .analysis-step-shell,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .analysis-step-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(178px, 1fr);
    overflow-x: auto;
  }

  .analysis-step-tab {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .analysis-step-tab em {
    grid-column: 2;
    justify-self: start;
  }

  .analysis-step-panel-wrap {
    padding: 14px;
  }

  .anchor-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .anchor-table-head {
    display: none;
  }

  .anchor-row {
    grid-template-columns: 1fr 1fr;
  }

  .anchor-row button {
    grid-column: 1 / -1;
  }

  .result-stat.wide {
    grid-column: auto;
  }

  .analysis-current-result,
  .forecast-result-summary,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .process-steps {
    grid-template-columns: 1fr;
  }

  .section-heading.compact {
    align-items: flex-start;
    flex-direction: column;
  }

  .column-filter-menu {
    left: 12px !important;
    right: 12px;
    width: auto !important;
    max-height: calc(100vh - 24px);
  }

  .embedded-table-shell .table-bar {
    grid-template-columns: 1fr;
  }

  .table-filter-actions,
  .table-result-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-result-actions {
    padding-left: 0;
    border-left: 0;
  }

  .clinic-coverage-row-head {
    grid-template-columns: 1fr;
  }

  .clinic-coverage-picker,
  .clinic-coverage-picker select {
    width: 100%;
  }

  .tag-coverage-row {
    grid-template-columns: 1fr;
  }
}

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

@keyframes sweep {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(80%);
  }
  100% {
    transform: translateX(240%);
  }
}

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

.upload-preview-actions span {
  color: #667085;
  font-size: 13px;
}

.upload-preview-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(120, 144, 180, 0.28);
  border-radius: 10px;
  background: rgba(248, 251, 255, 0.92);
}

.upload-preview-panel select {
  min-height: 40px;
  border: 1px solid rgba(120, 144, 180, 0.42);
  border-radius: 9px;
  padding: 0 10px;
  background: #fff;
}

.upload-column-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.upload-column-option,
.upload-column-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(120, 144, 180, 0.3);
  border-radius: 999px;
  background: #fff;
  color: #24364f;
  font-size: 13px;
}

.upload-column-option input {
  margin: 0;
}

.muted-text {
  color: #667085;
  font-size: 13px;
}

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

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

.tag-coverage-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(120, 144, 180, 0.24);
  border-radius: 12px;
  background: rgba(248, 251, 255, 0.82);
}

.tag-coverage-row.attention {
  border-color: rgba(30, 136, 229, 0.65);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}

.tag-coverage-row select,
.tag-coverage-row input {
  min-height: 40px;
  border: 1px solid rgba(120, 144, 180, 0.38);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
}

.clinic-coverage-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.clinic-coverage-picker select {
  min-height: 40px;
  min-width: 220px;
  border: 1px solid rgba(120, 144, 180, 0.38);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
}

.clinic-coverage-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(120, 144, 180, 0.28);
  border-radius: 12px;
  background: rgba(248, 251, 255, 0.82);
}

.clinic-coverage-row.attention {
  border-color: rgba(30, 136, 229, 0.65);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}

.clinic-coverage-row-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.clinic-coverage-row input {
  min-height: 40px;
  border: 1px solid rgba(120, 144, 180, 0.38);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
}

.clinic-coverage-name[readonly] {
  background: #f8fbff;
  color: #17324d;
  font-weight: 700;
}

.clinic-coverage-matrix {
  min-width: 720px;
}

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

.sync-source-card {
  display: grid;
  gap: 14px;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid rgba(64, 115, 255, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(237, 246, 255, 0.94), rgba(255, 255, 255, 0.96)),
    #fff;
  box-shadow: 0 12px 34px rgba(31, 78, 121, 0.08);
}

.preprocess-sync-card {
  margin-top: 18px;
}

.sync-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.sync-source-head > div {
  display: grid;
  gap: 4px;
}

.sync-source-head strong {
  color: #17324d;
  font-size: 16px;
}

.sync-source-head span,
.sync-source-status,
.sync-source-use {
  color: #617083;
  font-size: 13px;
}

.sync-source-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(93, 121, 155, 0.26);
}

.sync-source-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.sync-source-use {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sync-source-use input {
  margin: 0;
}

.inventory-source-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(120, 144, 180, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(250, 252, 255, 0.96), rgba(255, 255, 255, 0.9));
}

.inventory-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inventory-source-head strong {
  color: #17324d;
  font-size: 15px;
}

.inventory-source-head span {
  color: #667085;
  font-size: 13px;
}

.inventory-source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.inventory-source-option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "radio title"
    "icon note";
  column-gap: 12px;
  row-gap: 5px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(120, 144, 180, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: #24364f;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.inventory-source-option input {
  grid-area: radio;
  margin-top: 2px;
}

.inventory-source-option strong {
  grid-area: title;
  color: #17324d;
  font-size: 15px;
}

.inventory-source-option em {
  grid-area: note;
  color: #667085;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}

.inventory-source-icon {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.inventory-source-option:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.62);
  background: linear-gradient(135deg, #eef6ff, #fff);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.11), inset 0 0 0 1px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.inventory-source-option:has(input:checked) .inventory-source-icon {
  background: #2563eb;
  color: #fff;
}

.inventory-source-option:has(input:disabled) {
  opacity: 0.52;
}

.inventory-source-pane {
  display: grid;
  gap: 10px;
}

.inventory-source-status {
  min-height: 38px;
}

.inventory-run-action {
  justify-content: flex-start;
}

.sync-range-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.sync-range-grid label {
  display: grid;
  gap: 6px;
  color: #526071;
  font-size: 13px;
}

.sync-range-grid input {
  min-height: 42px;
  border: 1px solid rgba(120, 144, 180, 0.38);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: #1f2937;
}

.source-file-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(120, 144, 180, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.source-file-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.source-file-overlay[hidden] {
  display: none;
}

.source-file-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.source-file-overlay-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  width: min(1120px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 44px));
  margin: 22px auto;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.26);
}

.source-file-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(120, 144, 180, 0.18);
}

.source-file-overlay-head > div:first-child {
  display: grid;
  gap: 4px;
}

.source-file-overlay-head strong {
  color: #17324d;
  font-size: 17px;
}

.source-file-overlay-head span {
  color: #667085;
  font-size: 13px;
}

.source-file-overlay-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.source-file-upload {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid rgba(120, 144, 180, 0.18);
  border-radius: 12px;
  background: #f8fbff;
}

.source-file-upload > div {
  display: grid;
  gap: 4px;
}

.source-file-upload strong {
  color: #17324d;
  font-size: 14px;
  line-height: 1.25;
}

.source-file-upload span,
.source-file-upload-status {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.source-file-upload-picker input {
  width: 100%;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid rgba(120, 144, 180, 0.28);
  border-radius: 10px;
  background: #fff;
  color: #17324d;
  font-size: 13px;
}

.source-file-upload > button {
  min-height: 38px;
  padding-inline: 18px;
  white-space: nowrap;
}

.source-file-upload-status {
  min-height: 16px;
  padding: 0 2px;
  margin-top: -4px;
}

.source-file-upload-status.error {
  color: #b42318;
  font-weight: 700;
}

.source-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-file-head > div {
  display: grid;
  gap: 4px;
}

.source-file-head strong {
  color: #17324d;
  font-size: 15px;
}

.source-file-head span {
  color: #667085;
  font-size: 13px;
}

.source-file-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid rgba(120, 144, 180, 0.2);
  border-radius: 12px;
  background: #fff;
}

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

.source-file-table th,
.source-file-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(120, 144, 180, 0.16);
  text-align: left;
  vertical-align: middle;
}

.source-file-table th {
  background: #f5f8fc;
  color: #526071;
  font-weight: 800;
}

.source-file-table tr.latest-source-file td {
  background: #eef6ff;
}

.source-file-name {
  max-width: 390px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #17324d;
  font-weight: 700;
}

.source-file-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.source-file-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.danger-button {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff7f6;
}

@media (max-width: 760px) {
  .source-file-upload {
    grid-template-columns: 1fr;
  }
}

.purchase-plan-workspace {
  display: grid;
  gap: 18px;
}

.plan-data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.plan-run-form {
  display: grid;
  gap: 16px;
}

.plan-flow-board {
  border-color: rgba(85, 115, 170, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.94)),
    #fff;
}

.plan-flow-board .forecast-card-head {
  align-items: flex-start;
  border-bottom: 1px solid rgba(120, 144, 180, 0.18);
  padding-bottom: 12px;
}

.plan-run-now {
  display: grid;
  justify-items: end;
  gap: 4px;
  max-width: 430px;
  text-align: right;
}

.plan-run-now span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.plan-run-now strong {
  color: #17324d;
  font-size: 14px;
  line-height: 1.35;
}

.plan-flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.plan-flow-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(92px, 1fr) auto;
  gap: 12px;
  min-height: 285px;
  padding: 14px;
  border: 1px solid rgba(120, 144, 180, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(30, 72, 116, 0.06);
}

.plan-flow-card::after {
  content: "";
  position: absolute;
  top: 31px;
  right: -18px;
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.24), rgba(13, 148, 136, 0.2));
}

.plan-flow-card:last-child::after {
  display: none;
}

.plan-flow-top,
.plan-flow-title,
.plan-flow-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-flow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.plan-flow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(120, 144, 180, 0.24);
  border-radius: 999px;
  background: #f8fbff;
  color: #24364f;
  font-size: 12px;
  font-weight: 900;
}

.plan-flow-toggle input {
  margin: 0;
}

.plan-flow-title {
  align-items: flex-start;
}

.plan-flow-title h3 {
  margin: 0;
  color: #17324d;
  font-size: 18px;
  letter-spacing: 0;
}

.plan-flow-title p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.plan-flow-title .button-link {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
}

.plan-flow-summary {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border-radius: 14px;
  background: rgba(246, 249, 253, 0.78);
}

.plan-flow-status {
  align-items: flex-start;
  padding-top: 10px;
  border-top: 1px solid rgba(120, 144, 180, 0.16);
}

.plan-flow-status strong {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.plan-flow-status em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
  text-align: right;
}

.plan-flow-card.running {
  border-color: rgba(37, 99, 235, 0.54);
  background: linear-gradient(135deg, #eef6ff, #fff);
}

.plan-flow-card.running .plan-flow-status strong {
  background: #2563eb;
  color: #fff;
}

.plan-flow-card.finished {
  border-color: rgba(22, 163, 74, 0.36);
  background: linear-gradient(135deg, #f0fdf4, #fff);
}

.plan-flow-card.finished .plan-flow-status strong {
  background: #16a34a;
  color: #fff;
}

.plan-flow-card.failed {
  border-color: rgba(220, 38, 38, 0.38);
  background: linear-gradient(135deg, #fff7f6, #fff);
}

.plan-flow-card.failed .plan-flow-status strong {
  background: #dc2626;
  color: #fff;
}

.plan-flow-card.skipped {
  opacity: 0.72;
}

.plan-inventory-picker {
  margin-top: 2px;
}

.plan-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.plan-check-grid .check {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 144, 180, 0.26);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
  color: #24364f;
}

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

.plan-summary-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(120, 144, 180, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(31, 78, 121, 0.06);
}

.plan-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(120, 144, 180, 0.16);
}

.plan-summary-head strong {
  color: #17324d;
  font-size: 16px;
}

.plan-summary-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 24px;
}

.plan-summary-row span {
  color: #667085;
  font-size: 13px;
}

.plan-summary-row strong {
  overflow: hidden;
  color: #24364f;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-run-state {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(120, 144, 180, 0.24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.94));
}

.plan-run-head span {
  display: block;
  color: #667085;
  font-size: 13px;
}

.plan-run-head strong {
  color: #17324d;
  font-size: 17px;
}

.plan-step-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.plan-step-item {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid rgba(120, 144, 180, 0.24);
  border-radius: 14px;
  background: #fff;
}

.plan-step-item span {
  color: #526071;
  font-size: 13px;
}

.plan-step-item strong {
  color: #24364f;
  font-size: 15px;
}

.plan-step-item em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.plan-step-item.running {
  border-color: rgba(37, 99, 235, 0.5);
  background: #eef6ff;
}

.plan-step-item.finished {
  border-color: rgba(22, 163, 74, 0.38);
  background: #f0fdf4;
}

.plan-step-item.failed {
  border-color: rgba(220, 38, 38, 0.38);
  background: #fff7f6;
}

.plan-step-item.skipped {
  opacity: 0.68;
}

.plan-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .plan-data-grid,
  .plan-summary-grid,
  .plan-step-list,
  .plan-flow-grid {
    grid-template-columns: 1fr 1fr;
  }

  .plan-flow-card::after {
    display: none;
  }
}

@media (max-width: 760px) {
  .plan-data-grid,
  .plan-summary-grid,
  .plan-step-list,
  .plan-check-grid,
  .plan-flow-grid,
  .inventory-source-options {
    grid-template-columns: 1fr;
  }

  .plan-flow-board .forecast-card-head,
  .plan-run-now {
    display: grid;
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 820px) {
  .sync-source-head,
  .sync-range-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}
