:root {
  color-scheme: light;
  --ink: #233047;
  --muted: #68758a;
  --soft: #f4f6f9;
  --line: #e5e9ef;
  --white: #ffffff;
  --brand: #be2d82;
  --brand-dark: #972161;
  --brand-soft: #fff0f8;
  --teal: #268b8a;
  --blue: #4d74bd;
  --amber: #c47b2d;
  --red: #ba515b;
  --green: #27866d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--soft);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--soft); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #eaa1cb; outline-offset: 2px; }
.app-frame { min-height: 100vh; }
.topbar { height: 76px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 34px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; color: white; background: var(--brand); font-size: 17px; font-weight: 800; letter-spacing: -1px; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.2px; }
.brand-copy small { font-size: 11px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 13px; position: relative; }
.range-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.range-control select, .filter-control select, .control-select { height: 37px; border: 1px solid var(--line); border-radius: 8px; padding: 0 30px 0 10px; background: white; color: var(--ink); }
.button { border: 0; border-radius: 8px; height: 39px; padding: 0 14px; font-weight: 650; font-size: 12px; transition: background .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--brand); box-shadow: 0 2px 5px #be2d8228; }
.button-primary:hover { background: var(--brand-dark); }
.button-quiet { color: var(--ink); background: #f1f3f6; }
.button-quiet:hover { background: #e8ebef; }
.button span { font-size: 17px; vertical-align: -1px; margin-right: 4px; }
.icon-button { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 8px; width: 37px; height: 37px; font-weight: 800; letter-spacing: 2px; }
.icon-button:hover { background: #f3f5f8; border-color: var(--line); }
.more-button { font-size: 14px; }
.menu-popover { position: absolute; top: 48px; right: 0; z-index: 15; width: 220px; background: white; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 12px 30px #23304720; padding: 6px; }
.menu-popover button, .menu-upload { width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 11px; font-size: 12px; color: var(--ink); border-radius: 7px; display: block; cursor: pointer; }
.menu-popover button:hover, .menu-upload:hover { background: var(--soft); }
.menu-popover .danger-text { color: var(--red); border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; }
.menu-upload input { display: none; }
.hidden { display: none !important; }
.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar { border-right: 1px solid var(--line); background: #fbfcfd; padding: 25px 13px; display: flex; flex-direction: column; }
.sidebar-label { color: #929bad; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; font-weight: 750; padding: 0 13px 11px; }
.main-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: #627086; text-align: left; height: 42px; padding: 0 13px; border-radius: 8px; font-weight: 550; font-size: 12px; }
.nav-item:hover { background: #f2f3f6; color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.nav-icon { width: 17px; text-align: center; font-size: 16px; font-weight: 600; }
.sidebar-note { margin-top: auto; display: flex; gap: 9px; align-items: flex-start; border-top: 1px solid var(--line); padding: 17px 11px 0; color: var(--ink); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 10px; }
.sidebar-note small { color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 4px; }
.local-dot { margin-top: 3px; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #e6f4ee; }
.content { padding: 29px 34px 55px; min-width: 0; max-width: 1600px; width: 100%; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 23px; }
.eyebrow { display: block; text-transform: uppercase; color: var(--brand); letter-spacing: 1.1px; font-weight: 750; font-size: 10px; margin-bottom: 6px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(23px, 2.1vw, 30px); letter-spacing: -.8px; line-height: 1.2; }
.page-subtitle { color: var(--muted); margin: 0; font-size: 12px; line-height: 1.55; max-width: 750px; }
.heading-meta { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.heading-meta strong { color: var(--ink); font-size: 13px; display: block; margin-bottom: 4px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.kpi-card, .panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 7px #17253b05; }
.kpi-card { padding: 16px 17px 14px; min-height: 108px; }
.kpi-label { color: var(--muted); font-size: 10px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 25px; font-weight: 760; letter-spacing: -.8px; margin-top: 13px; line-height: 1; }
.kpi-note { color: #8a95a7; font-size: 10px; margin-top: 8px; }
.kpi-accent { color: var(--brand); }
.panel { padding: 19px; margin-bottom: 16px; }
.panel-heading { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; margin-bottom: 16px; }
.panel-heading h2, .panel-heading h3 { font-size: 14px; margin: 0; letter-spacing: -.2px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; background: #f3f5f8; color: #657187; font-size: 10px; font-weight: 650; white-space: nowrap; }
.tag.pink { background: var(--brand-soft); color: var(--brand-dark); }
.tag.green { background: #eaf6f1; color: var(--green); }
.tag.amber { background: #fff4e7; color: #9c611d; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(270px, .8fr); gap: 16px; align-items: start; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.empty-state { padding: 50px 20px; text-align: center; border: 1px dashed #cfd6e1; border-radius: 12px; background: #fbfcfd; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 23px; margin: 0 auto 14px; }
.empty-state h2 { font-size: 17px; margin-bottom: 7px; }
.empty-state p { color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 500px; margin: 0 auto 17px; }
.empty-state .button { display: inline-flex; align-items: center; justify-content: center; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
table { border-collapse: collapse; width: 100%; min-width: 700px; font-size: 11px; }
thead { background: #f7f8fa; color: #637087; }
th { padding: 10px 11px; font-size: 9px; text-transform: uppercase; letter-spacing: .55px; font-weight: 750; white-space: nowrap; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 10px 11px; border-bottom: 1px solid #edf0f4; color: #354257; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.positive { color: var(--green) !important; font-weight: 700; }
.negative { color: var(--red) !important; font-weight: 700; }
.neutral { color: var(--muted) !important; }
.service-cell { display: flex; align-items: center; gap: 7px; }
.service-mark { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--brand); }
.service-mark.hcfs { background: var(--teal); }
.service-mark.pcs { background: var(--blue); }
.service-mark.other { background: #a5adba; }
.chart { width: 100%; min-height: 230px; }
.chart svg { width: 100%; height: 230px; overflow: visible; }
.chart .axis-label { fill: #8490a2; font-size: 10px; }
.chart .grid-line { stroke: #e8ecf1; stroke-width: 1; }
.chart .series-line { fill: none; stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-dot { stroke: white; stroke-width: 2; }
.legend { display: flex; gap: 15px; flex-wrap: wrap; padding-top: 8px; }
.legend-item { color: #59677e; font-size: 10px; display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.chart-empty { min-height: 230px; display: grid; place-items: center; color: #8c97a7; font-size: 12px; }
.metric-list { display: grid; gap: 9px; }
.metric-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0f4; font-size: 11px; }
.metric-row:last-child { border-bottom: 0; }
.metric-row span { color: var(--muted); }
.metric-row strong { font-variant-numeric: tabular-nums; }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 9px; padding: 12px 13px; background: #fff7e9; border: 1px solid #f4e4c6; color: #805821; font-size: 11px; line-height: 1.5; }
.notice strong { display: block; margin-bottom: 2px; }
.notice.info { background: #eef5fc; border-color: #dce9f6; color: #3d5e7e; }
.notice.good { background: #eef8f3; border-color: #dcefe5; color: #3f6c59; }
.filter-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.filter-control select { height: 33px; font-size: 11px; }
.search-input { height: 34px; width: min(230px, 100%); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 11px; background: white; }
.data-table-footer { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; padding-top: 11px; }
.table-link { padding: 0; border: 0; background: transparent; color: var(--brand-dark); text-align: left; font-size: 11px; }
.table-link:hover { text-decoration: underline; }
.selected-row { background: #fff7fb; }
.selected-site-panel { border-color: #e8c3d8; }
.pricing-layout { display: grid; grid-template-columns: minmax(265px, .8fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
.control-section { padding: 15px 0; border-top: 1px solid var(--line); }
.control-section:first-of-type { border-top: 0; padding-top: 0; }
.control-section h3 { font-size: 11px; margin: 0 0 11px; }
.field-row { display: grid; grid-template-columns: 1fr 100px; align-items: center; gap: 10px; margin: 9px 0; }
.field-row label { font-size: 10px; color: #59677e; }
.field-row input, .number-input { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 9px; background: white; text-align: right; font-size: 11px; color: var(--ink); }
.field-row input[type="number"]::-webkit-inner-spin-button { opacity: .6; }
.currency-input { position: relative; }
.currency-input::before { content: "£"; position: absolute; left: 9px; top: 9px; color: #8893a4; font-size: 11px; z-index: 1; }
.currency-input input { padding-left: 20px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 10px; color: #59677e; padding: 6px 0; }
.checkbox-line input { accent-color: var(--brand); }
.tier-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.tier-button { border: 1px solid var(--line); background: white; color: #58667c; border-radius: 7px; padding: 7px 10px; font-size: 10px; font-weight: 650; }
.tier-button:hover, .tier-button.selected { border-color: #e5a2ca; color: var(--brand-dark); background: var(--brand-soft); }
.scenario-total { background: #28364d; color: white; border-radius: 11px; padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.scenario-total span { display: block; color: #c1cbd9; font-size: 9px; margin-bottom: 8px; }
.scenario-total strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.scenario-total .result strong { color: #f5add5; }
.callout-line { display: flex; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 8px; background: var(--brand-soft); color: #773158; font-size: 10px; line-height: 1.5; }
.projection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 11px 0 14px; }
.projection-grid label { color: var(--muted); font-size: 9px; display: block; }
.projection-grid input { margin-top: 5px; }
.import-dialog { border: 0; width: min(760px, calc(100vw - 28px)); max-height: min(90vh, 900px); padding: 0; border-radius: 15px; box-shadow: 0 25px 80px #15213642; color: var(--ink); }
.import-dialog::backdrop { background: #17223570; backdrop-filter: blur(2px); }
.dialog-shell { padding: 23px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { font-size: 20px; margin: 0; }
.close-dialog { font-size: 25px; font-weight: 400; line-height: 1; letter-spacing: 0; }
.dialog-intro { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 12px 0 16px; }
.drop-zone { border: 1px dashed #cbd3de; border-radius: 11px; min-height: 145px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--ink); background: #fcfcfd; cursor: pointer; text-align: center; padding: 18px; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--brand); background: #fff8fc; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone strong { font-size: 11px; }
.drop-zone small { color: var(--muted); font-size: 10px; }
.upload-symbol { display: grid; place-items: center; width: 31px; height: 31px; background: var(--brand-soft); color: var(--brand); border-radius: 9px; font-size: 19px; font-weight: 700; }
.import-preview { margin-top: 14px; max-height: 310px; overflow: auto; }
.preview-item { border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin-bottom: 8px; }
.preview-item.error { border-color: #efc2c4; background: #fff7f7; }
.preview-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 7px; }
.preview-item-head strong { font-size: 11px; }
.preview-item-head small { color: var(--muted); font-size: 9px; }
.preview-stats { display: flex; gap: 14px; flex-wrap: wrap; color: #66738a; font-size: 9px; }
.preview-stats b { color: var(--ink); }
.preview-note { color: #956321; font-size: 9px; margin-top: 7px; line-height: 1.4; }
.period-select { height: 29px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 10px; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 14px; }
.dialog-actions > div { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 10px; }
.empty-table { text-align: center; color: #7d899b; padding: 23px; }
.import-history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; align-items: center; }
.history-main strong { font-size: 11px; display: block; }
.history-main small { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.history-stats { display: flex; gap: 14px; color: #66738a; font-size: 9px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 8px; }
.toast { max-width: 360px; color: white; background: #25364d; padding: 11px 14px; border-radius: 9px; box-shadow: 0 9px 30px #16223930; font-size: 11px; animation: toast-in .18s ease-out; }
.toast.error { background: #963e49; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.rule-copy { color: var(--muted); font-size: 10px; line-height: 1.6; }
.rule-copy code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #713052; background: var(--brand-soft); padding: 2px 4px; border-radius: 4px; }
.service-checks { display: grid; gap: 2px; }
.service-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f5; font-size: 10px; }
.service-switch:last-child { border-bottom: 0; }
.service-switch label { display: flex; align-items: center; gap: 7px; color: #58667c; }
.service-switch input[type="checkbox"] { accent-color: var(--brand); }
.service-switch input[type="number"] { width: 74px; height: 29px; text-align: right; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 10px; }
.unit-note { font-size: 9px; color: #9aa3b1; margin-top: 3px; }
.scroll-x { overflow-x: auto; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .content { padding-left: 23px; padding-right: 23px; }
  .topbar { padding: 0 23px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; padding: 12px 15px; gap: 10px; align-items: flex-start; }
  .topbar-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .range-control > span { display: none; }
  .range-control select { height: 35px; max-width: 130px; }
  .button-primary { padding: 0 10px; }
  .workspace { display: block; min-height: calc(100vh - 68px); }
  .sidebar { padding: 0; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar-label, .sidebar-note { display: none; }
  .main-nav { display: flex; padding: 7px 10px; min-width: max-content; gap: 4px; }
  .nav-item { height: 37px; padding: 0 11px; font-size: 10px; }
  .nav-icon { display: none; }
  .content { padding: 23px 14px 45px; }
  .grid-two, .grid-equal, .pricing-layout { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .heading-meta { text-align: left; }
  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 13px; min-height: 100px; }
  .kpi-value { font-size: 22px; }
  .panel { padding: 14px; }
  .scenario-total { grid-template-columns: 1fr; }
  .projection-grid { grid-template-columns: 1fr; }
  .dialog-shell { padding: 17px; }
  .dialog-actions { align-items: flex-start; flex-direction: column; }
  .history-item { grid-template-columns: 1fr; }
}
