:root {
  color-scheme: light;
  --paper: #fff;
  --surface: #f5f7fa;
  --ink: #182637;
  --muted: #526478;
  --line: #dce3eb;
  --blue: #175ba5;
  --blue-soft: #edf4fd;
  --blue-border: #bdd3ed;
  --green: #156544;
  --amber: #865200;
  --red: #a02b29;
  --radius: 12px;
  font: 15px/1.48 Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button, a, select { touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip:focus { position: fixed; z-index: 20; background: var(--paper); top: 8px; left: 8px; padding: 12px; }

.shell { display: grid; grid-template-columns: 228px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; padding: 25px 14px 16px; border-right: 1px solid var(--line); background: var(--paper); z-index: 7; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 6px 28px; }
.brand img { flex: 0 0 38px; width: 38px; height: 38px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.2; letter-spacing: .08em; }
.brand small, .nav-label { color: var(--muted); font-size: 10px; letter-spacing: .09em; font-weight: 750; }
.brand small { margin-top: 3px; }
.nav-label { padding: 0 10px 7px; }
.side-nav { display: grid; gap: 3px; }
.nav-item { display: flex; align-items: center; min-height: 42px; gap: 8px; padding: 8px 9px; border-radius: 7px; color: #37495d; font-size: 12px; font-weight: 700; }
.nav-item:hover, .nav-item[aria-current="page"] { background: var(--blue-soft); color: #164c86; }
.nav-no { font-size: 11px; color: #5c6f84; min-width: 22px; font-variant-numeric: tabular-nums; }
.nav-item .status-dot { margin-left: auto; }
.nav-divider { border-top: 1px solid var(--line); margin: 8px 0; }
.side-foot { display: grid; gap: 12px; margin-top: auto; padding: 16px 9px 0; color: var(--muted); font-size: 13px; }
.workspace-badge { font-size: 10px; color: var(--amber); font-weight: 750; }
.workspace-badge .status-dot { margin-right: 5px; background: var(--amber); }
.home-link:hover { color: var(--blue); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 59px; padding: 7px clamp(16px,3.5vw,46px); border-bottom: 1px solid var(--line); background: var(--paper); }
.crumb { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 11px; letter-spacing: .05em; font-weight: 750; }
.crumb span { padding: 0 5px; }
.top-actions, .date-tools { display: flex; align-items: center; gap: 7px; }
.top-actions { flex: 0 0 auto; }
.role-field select, .select-control select, .date-control, .indicator-picker select, .icon-btn {
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 6px 9px; font-size: 13px;
}
.demo-top { font-size: 10px; color: var(--amber); background: #fff6df; border-radius: 4px; font-weight: 800; padding: 3px 5px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 39px; padding: 0 5px; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--surface); }
.menu-toggle { display: none; }
main { max-width: 1320px; margin: 0 auto; padding: 24px clamp(16px,3.5vw,46px) 44px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 21px; }
.segments { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.segments button { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 11px; min-height: 33px; color: var(--muted); font-size: 13px; font-weight: 700; }
.segments button[aria-pressed="true"] { background: var(--paper); color: #164c86; border-color: var(--blue-border); }
.date-control { position: relative; min-width: 115px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.date-control input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-control:focus-within { outline: 2px solid var(--blue); }
.date-control input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

.hero { padding: 3px 0 18px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .075em; }
.hero h1, .slide-head h1, .work h1 { margin: 0; font-size: clamp(27px,4vw,45px); letter-spacing: -.032em; line-height: 1.13; text-wrap: balance; }
.hero > p:not(.eyebrow), .slide-head > p:not(.eyebrow), .work-head > p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.period-compare { display: inline-block; margin-left: 9px; }
.hero-counts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 15px; }
.hero-counts > * { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 9px 11px; border-radius: 8px; background: var(--surface); }
.hero-counts a:hover { background: var(--blue-soft); }
.hero-counts strong { font-size: 24px; line-height: 1.12; font-variant-numeric: tabular-nums; }
.hero-counts span { font-size: 12px; color: var(--muted); }
.negative { color: var(--red); }
.positive { color: var(--green); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin: 20px 0 9px; }
.section-head h2, .panel h2, .related-section h2 { font-size: 18px; line-height: 1.25; margin: 0; }
.section-head p, .panel p { color: var(--muted); }
.section-head p { font-size: 12px; margin: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.kpi { display: flex; flex-direction: column; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); }
.kpi:hover { border-color: var(--blue-border); background: #fbfdff; }
.kpi-head, .kpi-footer, .kpi-values { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; flex-wrap: wrap; }
.kpi-head { font-weight: 800; font-size: 12px; }
.kpi-label { margin-top: 8px; min-height: 2.55em; color: var(--muted); font-size: 13px; }
.kpi-value { font-size: clamp(19px,2.4vw,27px); font-variant-numeric: tabular-nums; }
.kpi-values > span, .kpi-footer > span:first-child { color: var(--muted); font-size: 12px; }
.kpi-footer { margin-top: 6px; }
.block-note { margin: 9px 0 0; padding-top: 6px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
.tile-no, .go { color: var(--blue); }
.pill { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; color: var(--signal); background: var(--signal-bg); font-size: 11px; font-weight: 750; white-space: nowrap; padding: 3px 7px; border-radius: 20px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--signal,var(--muted)); }
.status-ok { --signal: var(--green); --signal-bg: #e9f6ee; }
.status-warn { --signal: var(--amber); --signal-bg: #fff5de; }
.status-bad { --signal: var(--red); --signal-bg: #fceceb; }
.status-unknown { --signal: #53657a; --signal-bg: #edf1f5; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; min-width: 0; }
.panel > h2 { margin-bottom: 8px; }
.lower-grid, .work-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 10px; }
.list, .compact-list { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover strong { color: var(--blue); }
.list-row small, .side-value { color: var(--muted); }
.list-row strong, .list-row small { display: block; }
.side-value { text-align: right; white-space: nowrap; }
.compact-list .list-row { grid-template-columns: minmax(0,1fr) auto; }
.change-col + .change-col { margin-top: 13px; }
.change-col h3 { font-size: 12px; color: var(--muted); margin: 0; }

.slide-head { padding: 3px 0 14px; }
.slide-top { display: flex; align-items: center; justify-content: space-between; gap: 6px 13px; flex-wrap: wrap; }
.slide-top h1 { font-size: clamp(26px,3.4vw,40px); }
.indicator-picker { margin-top: 10px; max-width: min(100%,510px); }
.indicator-picker label { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.indicator-picker select { min-width: 0; width: 100%; max-width: 100%; color: var(--ink); font-weight: 620; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.stat { min-width: 0; padding: 11px; border-radius: 9px; background: var(--surface); }
.fact-stat { background: var(--blue-soft); }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; font-size: clamp(19px,3vw,31px); line-height: 1.18; overflow-wrap: anywhere; }
.stat-context { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.slide-foot, .metric-info, .related-section { margin-top: 12px; }
.metric-info > summary, .chart-appendix > summary { color: #31485e; font-weight: 700; }
.metric-info[open] > summary, .chart-appendix[open] > summary { margin-bottom: 8px; }
.detail-meta { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 8px 0; }
.detail-meta div { padding: 5px 0; border-bottom: 1px solid var(--line); }
.detail-meta dt { color: var(--muted); font-size: 11px; }
.detail-meta dd { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.related-section h2 { margin-bottom: 6px; font-size: 16px; }
.slide-nav { display: flex; justify-content: space-between; gap: 7px; margin-top: 14px; }
.slide-nav a { text-align: center; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 37px; padding: 6px 10px; border: 1px solid var(--blue-border); border-radius: 7px; color: #174c83; background: var(--blue-soft); font-size: 13px; font-weight: 700; }
.button.ghost { border-color: var(--line); background: var(--paper); }
.button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button:hover { background: #e2eefb; }
.button.primary:hover { background: #134d8b; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.note { padding: 9px 10px; margin: 7px 0; border-radius: 7px; background: var(--surface); color: #334b61; font-size: 13px; }
.note.warn { background: #fff5de; color: #774800; }
.note.err { background: #fceceb; color: #962625; }
.loading, .chart-empty { color: var(--muted); padding: 14px 0; }
.work-head { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.form-grid label { display: block; min-width: 0; }
.form-grid .wide { grid-column: 1/-1; }
.form-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 13px; font-weight: 650; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; min-height: 41px; padding: 6px 8px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; }
.form-grid textarea { resize: vertical; }
.upload { display: grid; gap: 5px; color: var(--muted); }
.upload input { width: 100%; border: 1px dashed var(--line); border-radius: 7px; padding: 6px; }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.data-table th, .data-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 750; }
.data-table a { color: var(--blue); }
dialog { width: min(710px,calc(100vw - 18px)); max-height: 88dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #18263768; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-head h2 { font-size: 19px; margin: 0; }
#detailBody { margin-top: 8px; }
#toast { position: fixed; bottom: 12px; right: 12px; z-index: 15; max-width: calc(100vw - 24px); padding: 9px 11px; border: 1px solid #b9d7c6; border-radius: 7px; color: var(--green); background: #eef8f2; }
#toast.error { border-color: #edc0bb; color: var(--red); background: #fceceb; }

.chart-header { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.chart-header p { font-size: 13px; margin: 3px 0 0; }
.chart-header .button { flex-shrink: 0; }
.chart-content { min-width: 0; margin-top: 8px; }
.chart-key { display: flex; flex-wrap: wrap; gap: 5px 13px; margin-bottom: 2px; color: #35485f; font-size: 13px; }
.series-key { display: inline-flex; align-items: center; gap: 5px; }
.series-key i { display: inline-block; width: 19px; height: 0; border-top: 3px solid var(--blue); }
.series-key.bar i { height: 8px; background: var(--blue); border: 0; border-radius: 2px; }
.series-key.goal i { border-top: 2px dashed #526277; }
.series-key.forecast i { border-top: 2px dashed #936012; }
.chart-svg { display: block; width: 100%; height: auto; overflow: hidden; }
.chart-svg text { fill: #465c71; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: #e0e6ed; stroke-width: 1; }
.chart-zero { stroke: #a5b3c2; stroke-width: 1; }
.chart-column, .chart-point { fill: var(--blue); }
.data-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.data-line.actual { stroke: var(--blue); stroke-width: 2.5; }
.data-line.goal { stroke: #526277; stroke-dasharray: 6 4; }
.data-line.forecast { stroke: #936012; stroke-dasharray: 3 4; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover, .chart-hit:focus-visible { fill: #175ba513; outline: 0; stroke: #175ba575; }
.chart-control { margin-bottom: 7px; }
.comparison-chart { display: grid; gap: 5px; margin: 5px 0 10px; }
.comparison-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 7px; width: 100%; min-height: 40px; padding: 3px 0; align-items: baseline; color: var(--ink); background: none; border: 0; text-align: left; }
.comparison-row:hover .comparison-label { color: var(--blue); }
.comparison-row strong { color: #223e5d; font-variant-numeric: tabular-nums; text-align: right; }
.comparison-label { color: var(--muted); overflow-wrap: anywhere; }
.bar-track { display: block; grid-column: 1/-1; height: 7px; border-radius: 20px; background: var(--surface); }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.bar-fill.goal { background: #677b91; }
.bar-fill.forecast { background: #a77120; }
.bar-fill.negative { background: var(--red); }
.chart-appendix { border-top: 1px solid var(--line); padding-top: 8px; }
.chart-context { font-size: 13px; margin: 5px 0; }
.units { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin: 3px 0 9px; }
.unit { display: grid; gap: 1px; text-align: left; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 5px 7px; }
.unit[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue-border); }
.unit small { color: var(--muted); font-size: 11px; }
.unit b { font-size: 15px; }

@media(max-width:950px) { .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:800px) {
  .shell { display: block; }
  .sidebar { display: none; position: fixed; top: 0; left: 0; width: min(270px,85vw); padding-top: 58px; box-shadow: 0 0 0 100vmax #18263754; }
  .sidebar.open { display: flex; }
  .menu-toggle { display: grid; flex: 0 0 auto; }
  .topbar { position: sticky; top: 0; z-index: 8; }
  .crumb { flex: 1 1 auto; }
  .role-field select { max-width: 138px; }
}
@media(max-width:560px) {
  .topbar { padding: 5px 9px; gap: 5px; min-height: 51px; }
  .top-actions, .date-tools { gap: 4px; }
  .topbar .icon-btn { min-width: 34px; }
  .role-field select { max-width: 112px; }
  main { padding: 10px 10px 30px; }
  .filter-bar { margin-bottom: 11px; gap: 5px; }
  #periods, .date-tools { width: 100%; }
  #periods button { flex: 1; padding-inline: 4px; }
  .date-tools .date-control { min-width: 95px; }
  .select-control { margin-left: auto; }
  .select-control select { max-width: 123px; }
  .period-compare { display: block; margin: 2px 0 0; }
  .hero-counts { gap: 5px; margin-top: 11px; }
  .hero-counts > * { padding: 7px; }
  .hero-counts span { font-size: 11px; }
  .section-head { margin: 14px 0 7px; }
  .kpi-grid { gap: 6px; }
  .kpi { padding: 8px; }
  .kpi-head { font-size: 11px; }
  .kpi-label { font-size: 12px; }
  .kpi-values { align-items: start; flex-direction: column; }
  .slide-head { padding-bottom: 9px; }
  .slide-top h1 { font-size: 27px; }
  .slide-head > p:not(.eyebrow) { font-size: 13px; }
  .indicator-picker label { gap: 6px; font-size: 12px; }
  .indicator-picker select { font-size: 13px; padding: 4px 5px; }
  .stats { gap: 5px; margin-bottom: 8px; }
  .stat { padding: 7px; }
  .stat small { font-size: 12px; }
  .stat strong { font-size: clamp(17px,5vw,23px); }
  .stat-context { font-size: 10px; }
  .panel { padding: 9px; }
  .chart-header h2 { font-size: 17px; }
  .chart-key { gap: 4px 9px; font-size: 12px; }
  .lower-grid, .work-grid { grid-template-columns: minmax(0,1fr); }
  .detail-meta, .units { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:345px) {
  .crumb { font-size: 9px; }
  .role-field select, .select-control select { max-width: 96px; }
  .list-row { grid-template-columns: minmax(0,1fr) auto; }
}

.chart-svg .value-label { fill: #173d64; font-weight: 750; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }

.crumb-short { display: none; }
@media(max-width:560px) {
  .crumb { display: none; }
  .crumb-short { display: inline; flex: 1 1 auto; color: var(--muted); font-size: 12px; font-weight: 760; }
}
