:root {
  color-scheme: light;
  --cream: #f3f6f7; --ink: #183b35; --mint: #dceee8; --yellow: #eef4f0;
  --line: #dce5e3; --muted: #586b68; --danger: #bd2938;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--ink); background: var(--cream); font-size: 15px;
}
* { box-sizing: border-box; }
html { min-width: 320px; height: 100%; overflow: hidden; }
body { margin: 0; height: 100%; overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: #cde9df; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: #126c5d; text-underline-offset: 3px; }
a:hover { color: #084e40; }
:focus-visible { outline: 3px solid #197eae; outline-offset: 4px; }
h1,h2,h3 { text-wrap: balance; }
p, li { line-height: 1.6; }
button, input, select, textarea, .pill { max-width: 100%; }
.skip-link { position: fixed; left: -100vw; top: 8px; z-index: 20; padding: 12px; background: white; }
.skip-link:focus { left: 12px; }
.app-shell { display: grid; grid-template-columns: 240px minmax(0,1fr); height: 100dvh; overflow: hidden; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: #123f38; color: white; padding: 28px 18px 18px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 0 8px; }
.brand img { border-radius: 50%; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.3px; }
.brand small { display: block; margin-top: 3px; color: #b6d2c9; font-size: 12px; }
.nav-list { display: grid; gap: 3px; }
.nav-group { margin: 18px 12px 4px; color: #b6d2c9; font-size: 12px; font-weight: 600; }
.nav-list a, .mobile-nav a { text-decoration: none; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px; min-height: 44px; font-weight: 550; }
.nav-list a { color: #e0ede8; }
.nav-list a span { width: 20px; text-align: center; font-size: 21px; }
.nav-list a:hover { background: #21564c; color: white; }
.nav-list a[aria-current=page] { background: #e5f3ec; color: #123f38; font-weight: 700; }
.side-note { color: #b6d2c9; margin-top: auto; padding: 30px 12px 0; font-size: 12px; }
.work { --work-top: 34px; min-width: 0; min-height: 0; width: 100%; height: 100%; max-width: 1360px; margin: 0 auto; padding: var(--work-top) clamp(20px,3.5vw,52px) 60px; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding-top: 110px; }
.topbar { position: sticky; top: calc(-1 * var(--work-top)); z-index: 4; background: var(--cream); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; margin-bottom: 28px; flex-wrap: wrap; }
.topbar h1 { font-size: clamp(26px,3vw,34px); font-weight: 650; letter-spacing: -.7px; margin: 0; }
.topbar .hint { margin: 6px 0 0; }
.identity { font-size: 13px; color: var(--muted); max-width: 260px; overflow-wrap: anywhere; }
.stack, .grid { display: grid; gap: 20px; min-width: 0; }
.panel, .editor-card, .customer-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 24px; min-width: 0; }
.panel h2, .editor-card h2 { margin: 0 0 14px; font-size: 20px; font-weight: 650; }
.panel h3 { margin: 0 0 10px; font-size: 17px; }
.panel > p, .editor-card > p { max-width: 76ch; }
.panel p, .hint { color: var(--muted); }
.panel p:last-child { margin-bottom: 0; }
.hint { font-size: 13px; line-height: 1.6; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2, .section-head p { margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric { padding: 18px 0; min-width: 0; border-bottom: 1px solid var(--line); }
.metric strong { display: block; margin-top: 6px; font-size: clamp(23px,2.3vw,32px); line-height: 1.25; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric small { font-size: 13px; color: var(--muted); }
.two-col { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 20px; }
.three-col { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.field-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; min-width: 0; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #a8bab5; border-radius: 7px; background: white; color: var(--ink); padding: 10px 12px; }
textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin: 1px 0 0; padding: 0; accent-color: #126c5d; flex: none; }
label:has(>input[type=checkbox]) { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; font-weight: 500; }
.panel form>label+label { margin-top: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid #126c5d; border-radius: 8px; padding: 10px 16px; background: #126c5d; color: white; font-weight: 650; text-decoration: none; }
.button:hover { background: #0a5447; color: white; }
.button.secondary { background: white; color: var(--ink); border-color: #a8bab5; }
.button.secondary:hover { background: #edf4f1; }
.button.danger { color: var(--danger); background: #fff4f4; border-color: #eab5bb; }
.quiet { min-height: 44px; border: 0; padding: 6px 0; background: transparent; color: #126c5d; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.quiet:hover { color: #084e40; }
.notice, .inline-status { background: #e2f1ea; color: #154b39; padding: 14px 18px; border-radius: 8px; margin: 0 0 20px; overflow-wrap: anywhere; line-height: 1.5; }
.notice[data-error=true], .inline-status[data-error=true] { background: #fff0f1; color: #9d2130; }
.pill { display: inline-block; padding: 5px 10px; border-radius: 6px; background: #e9f2ee; font-size: 12px; font-weight: 650; }
.pill.warn { background: #fff0f1; color: #9d2130; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 540px; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 10px; vertical-align: top; line-height: 1.5; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tbody tr:hover { background: #f6f9f7; }
.customer-list { display: grid; gap: 16px; }
.customer-search { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 20px; }
.customer-search label { flex: 1; }
.tariff-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 26px; }
.tariff-filter { display: inline-flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.tariff-filter span { font-weight: 700; min-width: 1.3em; text-align: right; }
.tariff-filter[aria-pressed="true"] { background: #dceee8; border-color: #126c5d; color: #125548; }
.tariff-filter:hover { border-color: #126c5d; }
.tariff-filter:focus-visible { outline: 3px solid #126c5d; outline-offset: 2px; }
.customer-extra .field-grid { margin-top: 16px; }
.customer-results { padding: 0 20px; }
.customers-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.customers-table th, .customers-table td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.customers-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.customers-table td { font-size: 13px; overflow-wrap: anywhere; }
.customers-table tbody tr:hover { background: #edf4f1; }
.customers-table small { display: block; margin-top: 4px; color: var(--muted); }
.customer-name { background: transparent; color: #126c5d; border: 0; padding: 7px 0; min-height: 44px; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.customer-name:hover { text-decoration: underline; }
.customer-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 0; }
.customer-pagination span { text-align: center; font-size: 13px; }
.customer-pagination small { display: block; color: var(--muted); margin-top: 5px; }
.customer-dialog { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(640px,100%); max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid var(--line); padding: 24px; background: white; color: var(--ink); overflow-y: auto; }
.customer-dialog::backdrop { background: rgb(18 63 56 / 32%); }
.customer-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: -24px; background: white; padding: 16px 0; z-index: 1; border-bottom: 1px solid var(--line); }
.customer-dialog-head h2 { font-size: 22px; margin: 0; }
.customer-dialog .customer-card { border: 0; padding: 20px 0; content-visibility: visible; contain-intrinsic-size: none; }
.customer-dialog .customer-card dl { grid-template-columns: repeat(2,minmax(0,1fr)); }
.customer-dialog .panel-disclosure { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
@media(max-width:700px) {
  .customer-search { flex-wrap: wrap; }
  .customer-search label { flex-basis: 100%; }
  .customer-directory .customer-results { padding: 0 16px; }
  .customers-table, .customers-table tbody { display: block; }
  .customers-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .customers-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .customers-table td { display: block; border: 0; padding: 0; }
  .customers-table td:first-child { grid-column: 1 / -1; }
  .customers-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
  .customer-dialog { padding: 16px; }
  .customer-dialog-head { top: -16px; }
  .customer-dialog-head h2 { font-size: 19px; }
}
.customer-card { padding: 20px; content-visibility: auto; contain-intrinsic-size: auto 280px; }
.customer-card dl, .facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; margin: 18px 0 0; }
dt { font-size: 12px; color: var(--muted); margin-bottom: 5px; line-height: 1.4; }
dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; line-height: 1.5; }
.editor-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(260px,1fr); gap: 24px; align-items: start; }
.editor-card { display: grid; gap: 18px; }
.preview { position: sticky; top: 24px; padding: 20px; border-radius: 16px; background: #dbece3; }
.bubble { background: white; border-radius: 12px 12px 12px 3px; overflow: hidden; }
.bubble img { width: 100%; max-height: 260px; object-fit: contain; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; margin: 0; line-height: 1.5; }
.preview-buttons { display: grid; gap: 6px; padding: 0 12px 12px; }
.preview-buttons span { padding: 10px; text-align: center; background: #e8f2ed; border-radius: 6px; }
details { min-width: 0; }
.panel details, .editor-card details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
summary { cursor: pointer; font-weight: 600; line-height: 1.5; min-height: 28px; }
details[open]>summary { margin-bottom: 20px; }
.panel>.section-disclosure { border: 0; padding: 0; margin: 0; }
.section-disclosure>summary { font-size: 18px; padding: 3px 0; }
.step-list { display: flex; gap: 8px; flex-wrap: wrap; padding: 0; list-style: none; }
.step-list button { min-height: 44px; padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 7px; }
.step-list button[aria-current=true] { background: var(--mint); border-color: #83b8a6; }
.photo-upload { font-weight: 400; }
.photo-upload input { font-size: 12px; }
.empty { padding: 24px; border: 1px dashed #b8cbc4; border-radius: 8px; color: var(--muted); }
.loading { padding: 30px 0; color: var(--muted); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.runtime-panel { border: 1px solid #c7dcd3; background: white; border-radius: 16px; padding: 28px; }
.runtime-copy { display: flex; align-items: flex-start; gap: 14px; }
.runtime-copy h2 { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -.4px; }
.runtime-copy p { margin: 8px 0 0; color: var(--muted); }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #137747; flex: none; margin-top: 12px; }
.status-dot.is-paused { background: #bb6430; }
.runtime-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.runtime-button { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 68px; padding: 16px 18px; border: 2px solid transparent; border-radius: 10px; color: white; font-size: 19px; font-weight: 700; }
.runtime-button.stop { background: #bd2938; }
.runtime-button.start { background: #137747; }
.runtime-button.stop:hover:not(:disabled) { background: #9e1f2d; }
.runtime-button.start:hover:not(:disabled) { background: #0b6037; }
.runtime-button:disabled { opacity: 1; color: #fff; filter: saturate(.55); }
.runtime-button:disabled.stop { background: #aa7279; }
.runtime-button:disabled.start { background: #618772; }
.runtime-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.runtime-help { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; color: var(--muted); font-size: 13px; }
.runtime-help p { max-width: 78ch; }
.summary-strip { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-bottom: 1px solid var(--line); padding: 8px 0 26px; }
.summary-strip>div { padding: 0 20px; border-left: 1px solid var(--line); min-width: 0; }
.summary-strip>div:first-child { padding-left: 0; border: 0; }
.summary-strip span { display: block; color: var(--muted); font-size: 13px; }
.summary-strip strong { display: block; margin-top: 8px; font-size: clamp(23px,2.5vw,30px); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 20px; }
.attention-row { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.attention-row strong { font-variant-numeric: tabular-nums; }
.error-count { color: var(--danger); }
.quick-links a { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 550; }
.quick-links a:hover { text-decoration: underline; }
.section-links { display: flex; flex-wrap: wrap; gap: 8px; }
.section-links a { min-height: 44px; display: flex; align-items: center; padding: 10px 14px; border-radius: 7px; background: white; border: 1px solid var(--line); font-size: 13px; text-decoration: none; }
.section-links a:hover { border-color: #126c5d; }
.budget-facts { grid-template-columns: repeat(4,minmax(0,1fr)); margin-top: 0; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.budget-facts dd { font-size: clamp(20px,2.4vw,28px); font-variant-numeric: tabular-nums; }
.budget-remaining dd { color: #137747; }
.service-flags { margin-top: 20px; }
.control-group { margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 16px; min-width: 0; }
.control-group legend { padding: 0 6px; font-weight: 650; }
.platform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.platform { min-width: 0; border-left: 3px solid #a8cdbd; padding-left: 18px; overflow-wrap: anywhere; }
.service-list { list-style: none; padding: 0; margin: 20px 0; }
.service-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.service-list small { color: var(--muted); }
.report-preview { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; background: #f3f7f5; border-radius: 8px; padding: 20px; max-width: 80ch; }
.report-preview:empty { display: none; }
.incident { border-left: 3px solid var(--danger); padding: 16px 0 16px 20px; margin-top: 20px; overflow-wrap: anywhere; }
.incident+.incident { border-top: 1px solid var(--line); }
.mobile-nav { display: none; }
@media(max-width:1150px) {
  .app-shell { grid-template-columns: 214px minmax(0,1fr); }
  .work { --work-top: 26px; padding: var(--work-top) 24px 48px; }
  .metrics, .field-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .runtime-button { font-size: 17px; }
}
@media(max-width:850px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .work { --work-top: 24px; padding: var(--work-top) 18px calc(95px + env(safe-area-inset-bottom)); }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; overflow-x: auto; background: white; border-top: 1px solid var(--line); padding: 6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .mobile-nav a { flex: 0 0 auto; display: grid; gap: 2px; text-align: center; min-width: 76px; padding: 6px 10px; font-size: 11px; }
  .mobile-nav a span { font-size: 20px; }
  .mobile-nav a[aria-current=page] { background: #e5f3ec; color: #123f38; }
  .dashboard-columns { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: minmax(0,1fr); }
  .preview { position: static; }
  .topbar { margin-bottom: 20px; }
}
@media(max-width:580px) {
  .work { padding-left: 14px; padding-right: 14px; }
  .panel, .editor-card, .runtime-panel { padding: 20px; }
  .runtime-actions { grid-template-columns: 1fr; gap: 10px; }
  .runtime-button { min-height: 60px; }
  .runtime-copy h2 { font-size: 23px; }
  .runtime-footer { align-items: flex-start; flex-direction: column; gap: 0; }
  .summary-strip { grid-template-columns: 1fr 1fr; gap: 22px 16px; padding: 4px 0 24px; }
  .summary-strip>div { padding: 0; border: 0; }
  .two-col, .three-col, .field-grid, .field-grid.three, .platform-grid { grid-template-columns: minmax(0,1fr); }
  .customer-card dl, .facts, .budget-facts { grid-template-columns: 1fr 1fr; }
  .section-head a { font-size: 13px; }
  .table { min-width: 480px; }
  .identity { max-width: 100%; }
  .topbar { align-items: flex-start; gap: 10px; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
