:root {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #1d2925;
  background: #eef1f0;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; }
body { margin: 0; min-width: 0; overflow-y: scroll; background: #eef1f0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
h1, h2, p { margin: 0; letter-spacing: 0; }
h1 { font-size: 21px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; background: #17231f; color: #edf4f1; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-weight: 600; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: #d08a2e; color: #fff; font-size: 12px; }
.nav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 5px; display: flex; align-items: center; justify-content: space-between; background: transparent; color: #b9c7c1; text-align: left; }
.nav-item:hover { background: #22332d; color: #fff; }
.nav-item.is-active { background: #2a4038; color: #fff; }
.nav-item b { color: #86a397; font-size: 11px; font-weight: 500; }
.source-status { width: 100%; margin-top: auto; padding: 14px 8px 0; border: 0; border-top: 1px solid #30433c; display: grid; grid-template-columns: 8px 1fr; gap: 9px; align-items: start; background: transparent; color: inherit; text-align: left; }
.source-status strong, .source-status small { display: block; }
.source-status strong { font-size: 12px; font-weight: 500; }
.source-status small { margin-top: 4px; color: #94a9a0; font-size: 11px; line-height: 1.5; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #3dd48b; }

.workspace { min-width: 0; }
.topbar { min-height: 82px; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #dfe5e2; background: #fff; }
.topbar p, .section-heading p { margin-top: 4px; color: #6e7b76; font-size: 12px; }
.primary-button, .reset-button, .pagination button { min-height: 34px; padding: 0 12px; border-radius: 5px; }
.primary-button { border: 1px solid #17885a; background: #17885a; color: #fff; }
.reset-button, .pagination button { border: 1px solid #ccd6d1; background: #fff; color: #27352f; }
.filter-band { padding: 14px 28px; display: grid; grid-template-columns: repeat(6, minmax(112px, 1fr)) auto; gap: 10px; align-items: end; border-bottom: 1px solid #dfe5e2; background: #f8faf9; }
.filter-band label, .inline-select { display: grid; gap: 5px; color: #5e6b66; font-size: 11px; }
.filter-band input, .filter-band select, .inline-select select { width: 100%; height: 34px; padding: 0 9px; border: 1px solid #cbd5d1; border-radius: 4px; background: #fff; color: #22302a; }
.rule-band { margin: 18px 28px 0; padding: 12px 14px; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.15fr); gap: 24px; align-items: center; border-left: 3px solid #17885a; background: #e7efeb; }
.rule-band strong, .rule-band span { display: block; }
.rule-band strong { font-size: 12px; }
.rule-band span { margin-top: 4px; color: #6d675e; font-size: 11px; }
.rule-scale { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; gap: 9px; align-items: center; }
.rule-band .scale-start, .rule-band .scale-finish { margin: 0; color: #53645d; font-size: 11px; font-weight: 500; }
.rule-band .scale-track { position: relative; height: 10px; margin: 0; background: #cad8d2; }
.scale-fill { position: absolute; inset: 0; background: #17885a; }
.scale-noon, .scale-fallback { position: absolute; top: 14px; transform: translateX(-50%); color: #65756e; font-size: 10px; font-weight: 500; }
.scale-noon { left: 33.333%; }
.scale-fallback { left: 88.889%; }
.scale-noon::before, .scale-fallback::before { content: ""; position: absolute; left: 50%; bottom: 15px; width: 1px; height: 10px; background: #fff; }
.loading-state, .error-state { margin: 28px; padding: 18px; border: 1px solid #d9e1dd; background: #fff; color: #61706a; }
.error-state { border-color: #e6bcbc; color: #9e3535; }
#dashboard { padding: 16px 28px 32px; }

.kpi-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 16px; border: 1px solid #d9e1dd; background: #fff; }
.kpi { min-height: 94px; padding: 15px 16px; border-right: 1px solid #e1e6e4; }
.kpi:last-child { border-right: 0; }
.kpi-label { color: #68766f; font-size: 11px; }
.kpi-value { margin-top: 8px; color: #14211c; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-note { margin-top: 5px; color: #7a8882; font-size: 10px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 16px; margin-bottom: 16px; }
.panel, .table-section { border: 1px solid #d9e1dd; background: #fff; }
.panel { padding: 16px; }
.table-section { margin-bottom: 16px; }
.section-heading { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.table-section > .section-heading { padding: 14px 16px 8px; }
.inline-select { grid-template-columns: auto 150px; align-items: center; }

.allocation-list { display: grid; gap: 22px; margin-top: 12px; }
.allocation-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 150px; gap: 12px; align-items: center; font-size: 12px; }
.allocation-row strong { font-size: 13px; }
.stacked-track { height: 20px; display: flex; overflow: hidden; background: #edf1ef; }
.segment-onsite { background: #17885a; }
.segment-travel { background: #d08a2e; }
.segment-company { background: #6f7d87; }
.allocation-value { color: #60706a; text-align: right; font-variant-numeric: tabular-nums; }
.bar-list { display: grid; gap: 14px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 155px) 1fr 80px; gap: 10px; align-items: center; font-size: 11px; }
.bar-track { height: 12px; overflow: hidden; background: #edf1ef; }
.bar-fill { display: block; height: 100%; min-width: 2px; background: #2474a9; }
.bar-value { color: #66746e; text-align: right; font-variant-numeric: tabular-nums; }

.hour-panel { margin-bottom: 16px; }
.legend { display: flex; gap: 14px; color: #64716c; font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 9px; height: 9px; display: inline-block; }
.swatch.onsite { background: #17885a; }
.swatch.travel { background: #d08a2e; }
.swatch.company { background: #6f7d87; }
.hour-chart { min-height: 250px; display: grid; grid-template-columns: repeat(9, minmax(42px, 1fr)); gap: 10px; align-items: end; padding: 8px 4px 0; }
.hour-column { min-width: 0; display: grid; grid-template-rows: 28px 190px 22px; gap: 5px; text-align: center; }
.hour-value { color: #65736d; font-size: 10px; font-variant-numeric: tabular-nums; }
.hour-stack { height: 190px; display: flex; flex-direction: column-reverse; justify-content: flex-start; background: linear-gradient(to top, #eef2f0 1px, transparent 1px); background-size: 100% 25%; border-bottom: 1px solid #cad4cf; }
.hour-block { width: 100%; min-height: 1px; }
.hour-label { color: #596862; font-size: 11px; }

.table-responsive { max-height: min(68vh, 680px); overflow: auto; scrollbar-gutter: stable; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { position: sticky; top: 0; z-index: 2; background: #f6f8f7; color: #6f7c77; font-weight: 500; text-align: left; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e4e9e7; vertical-align: top; }
tbody tr:hover { background: #f7faf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wide-table table { min-width: 1320px; }
.detail-table table { min-width: 1420px; }
.responsibility-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.responsibility-pool table { min-width: 1100px; }
.pool-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; align-items: center; }
.section-export { min-height: 34px; border: 1px solid #bfcac5; border-radius: 4px; padding: 0 11px; background: #fff; color: #176f4d; }
.section-export:hover { border-color: #17885a; background: #f3f8f5; }
.responsibility-page .table-section { border-radius: 8px; overflow: hidden; box-shadow: 0 8px 24px rgba(23, 35, 31, .04); }
.responsibility-page .table-section > .section-heading { min-height: 92px; padding: 24px 28px 16px; align-items: flex-start; }
.responsibility-page .section-heading h2 { font-size: 22px; line-height: 1.25; }
.responsibility-page .section-heading p { margin-top: 8px; font-size: 14px; line-height: 1.5; }
.responsibility-page .dense-table-scroll { max-height: min(62vh, 700px); }
.responsibility-layer-table { min-width: 1120px; }
.responsibility-layer-table th { height: 52px; padding: 0 22px; background: #f3f7f5; font-size: 14px; }
.responsibility-layer-table td { min-height: 68px; padding: 16px 22px; font-size: 14px; vertical-align: middle; }
.responsibility-layer-table .sticky-column-one { min-width: 250px; }
.responsibility-layer-table .sticky-column-two { min-width: 170px; }
.responsibility-page .responsibility-person { font-size: 14px; }
.responsibility-page .subtext { font-size: 12px; }
.responsibility-layer-table tbody tr:hover { background: #f7faf8; }
.responsibility-layer-table .sticky-column-one,
.responsibility-layer-table .sticky-column-two { position: sticky; z-index: 3; background: #fff; }
.responsibility-layer-table thead .sticky-column-one,
.responsibility-layer-table thead .sticky-column-two { z-index: 5; background: #f3f7f5; }
.responsibility-layer-table .sticky-column-one { left: 0; }
.responsibility-layer-table .sticky-column-two { left: 250px; box-shadow: 1px 0 0 #dce5e1; }
.responsibility-layer-table .responsibility-owner-cell { min-width: 250px; border-right: 1px solid #dce5e1; background: #f7faf8; font-weight: 600; }
.responsibility-layer-table .responsibility-owner-cell .subtext { font-weight: 400; }
.responsibility-layer-table .responsibility-owner-empty { background: #fff; }
.responsibility-layer-table .responsibility-group-start:not(:first-child) td { border-top: 2px solid #d5e0db; }
.subtext { display: block; margin-top: 3px; color: #7a8782; line-height: 1.45; }
.status { display: inline-block; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.status-red { background: #f8e4e4; color: #a53636; }
.status-amber { background: #f8ecd7; color: #9a5d0c; }
.status-green { background: #e2f2e9; color: #176f4d; }
.geo-button, .person-button { padding: 0; border: 0; background: transparent; color: #166f4d; font-weight: 600; text-align: left; }
.region-row td { background: #eef6f2; font-weight: 600; }
.city-row td { background: #f8faf9; }
.county-label { padding-left: 24px; color: #596862; }

.timeline-panel { margin-bottom: 16px; }
.timeline-empty { min-height: 100px; display: grid; place-items: center; color: #77857f; font-size: 12px; }
.timeline-board { padding: 12px 0 2px; }
.timeline-axis { position: relative; height: 24px; margin-left: 112px; border-bottom: 1px solid #cad4cf; }
.timeline-axis span { position: absolute; bottom: 4px; transform: translateX(-50%); color: #6d7a75; font-size: 10px; }
.timeline-row { display: grid; grid-template-columns: 102px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 32px; }
.timeline-row-label { overflow: hidden; color: #596862; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-track { position: relative; height: 22px; background: #edf1ef; }
.timeline-block { position: absolute; top: 0; height: 100%; min-width: 2px; overflow: hidden; color: #fff; font-size: 9px; line-height: 22px; text-align: center; white-space: nowrap; }
.timeline-block.onsite { background: #17885a; }
.timeline-block.travel { background: #d08a2e; }
.timeline-block.inferred { background: #a35b5b; }
.pagination { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.pagination button:disabled { cursor: default; opacity: .45; }
#paginationInfo { color: #6b7973; font-size: 11px; }

dialog { width: min(680px, calc(100% - 32px)); padding: 20px; border: 1px solid #cad5d0; border-radius: 7px; color: #1d2925; box-shadow: 0 22px 70px rgba(18, 31, 26, .24); }
dialog::backdrop { background: rgba(16, 27, 23, .45); }
.dialog-heading { display: flex; justify-content: space-between; gap: 16px; }
.dialog-heading p { margin-top: 4px; color: #71807a; font-size: 11px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #cbd5d1; border-radius: 5px; background: #fff; color: #27352f; font-size: 22px; }
.definition-list { display: grid; grid-template-columns: 110px 1fr; gap: 12px 18px; margin: 22px 0 0; font-size: 12px; line-height: 1.6; }
.definition-list dt { color: #53625c; font-weight: 600; }
.definition-list dd { margin: 0; color: #67756f; }

@media (max-width: 1100px) {
  .filter-band { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi:nth-child(4n) { border-right: 0; }
  .kpi:nth-child(n+5) { border-top: 1px solid #e1e6e4; }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; padding-bottom: 12px; }
  .brand { padding-bottom: 12px; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-status { display: none; }
  .topbar { padding: 16px; align-items: flex-start; }
  .filter-band { padding: 12px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-band { margin: 12px 16px 0; grid-template-columns: 1fr; gap: 18px; padding-bottom: 24px; }
  .rule-scale { grid-template-columns: auto minmax(170px, 1fr) auto; }
  #dashboard { padding: 12px 16px 24px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid #e1e6e4; }
  .allocation-row { grid-template-columns: 54px minmax(0, 1fr); }
  .allocation-value { grid-column: 2; text-align: left; }
  .hour-chart { gap: 4px; overflow-x: auto; }
  .hour-column { min-width: 46px; }
  .section-heading { flex-wrap: wrap; }
}
