/* Waymark Owner Command Center · isolated preview styles.
   Grove palette from mobile/lib/core/design-system/LifePalette.dart, reinterpreted for a dense desktop console.
   DEMO ONLY: no network requests are made by this stylesheet (fonts are local OFL copies). */

@font-face { font-family: "Inter"; src: url("../fonts/Inter-Variable-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/Fraunces-Variable-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #F7F4EE; --surface: #FFFFFF; --sunken: #EFEBE3; --raised: #FFFFFF;
  --hairline: #E5DFD3; --border: #CFC7B8;
  --text: #17211C; --text-2: #5C6962; --text-3: #7D8781;
  --primary: #2F7D57; --on-primary: #FFFFFF; --primary-soft: #E2F0E7; --primary-ink: #1F5E40; --primary-line: #C3DFCD;
  --success: #2F9E6B; --success-ink: #1C6B49; --success-soft: #E2F4EA;
  --warning: #D27A12; --warning-ink: #8F4A00; --warning-soft: #FDF0DC;
  --danger: #B42323; --danger-icon: #D63B3B; --danger-soft: #FCE9E8;
  --info: #5B6CFF; --info-ink: #3F4FE0; --info-soft: #EEF0FF;
  --amber: #E08A3C; --plum: #7357D9; --rose: #C84A64; --teal: #2E9C7A;
  --sidebar: #17211C; --sidebar-2: #212B26; --sidebar-text: #DDE6E0; --sidebar-muted: #9DB0A5; --sidebar-active: #2D5A42;
  --demo: #8F4A00; --demo-soft: #FDF0DC;
  --shadow: 0 1px 2px rgba(23,33,28,.05), 0 1px 3px rgba(23,33,28,.07);
  --shadow-float: 0 18px 40px rgba(23,33,28,.16), 0 3px 8px rgba(23,33,28,.08);
  --radius: 14px; --radius-sm: 9px; --radius-lg: 20px;
  --chart-1: #2F7D57; --chart-2: #E08A3C; --chart-3: #5B6CFF; --chart-4: #C84A64; --chart-5: #7357D9; --chart-grid: #E9E3D8;
  --focus: #1F5E40;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1512; --surface: #171F1B; --sunken: #212B26; --raised: #1D2621;
  --hairline: #2B3731; --border: #46544C;
  --text: #ECF2EE; --text-2: #A5B4AB; --text-3: #85948B;
  --primary: #6CCB98; --on-primary: #06200F; --primary-soft: #1C3829; --primary-ink: #93DDB4; --primary-line: #2D5A42;
  --success: #5CC995; --success-ink: #94DFB9; --success-soft: #173726;
  --warning: #F0A64A; --warning-ink: #F6C482; --warning-soft: #3A2B15;
  --danger: #F7A3A3; --danger-icon: #F07070; --danger-soft: #3D1D1D;
  --info: #9DA8FF; --info-ink: #C3CAFF; --info-soft: #222645;
  --amber: #F0A64A; --plum: #B3A2F5; --rose: #EE8FA3; --teal: #6CCBAE;
  --sidebar: #0B100D; --sidebar-2: #141B17; --sidebar-text: #DDE6E0; --sidebar-muted: #8FA298; --sidebar-active: #1C3829;
  --demo: #F6C482; --demo-soft: #3A2B15;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-float: 0 18px 40px rgba(0,0,0,.5), 0 3px 8px rgba(0,0,0,.3);
  --chart-1: #6CCB98; --chart-2: #F0A64A; --chart-3: #9DA8FF; --chart-4: #EE8FA3; --chart-5: #B3A2F5; --chart-grid: #26302B;
  --focus: #93DDB4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum", "cv11"; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* Inline UI icons default to text size; components below override where needed. */
svg[stroke="currentColor"] { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
a { color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Shell ---------- */
.demo-strip {
  position: sticky; top: 0; z-index: 40; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: repeating-linear-gradient(135deg, var(--demo-soft) 0 14px, color-mix(in srgb, var(--demo-soft) 70%, var(--bg)) 14px 28px);
  color: var(--demo); font-weight: 700; font-size: 12px; letter-spacing: .04em; padding: 5px 12px; border-bottom: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}
.demo-strip span { font-weight: 500; letter-spacing: 0; }
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 27px); }
.app.with-phone { grid-template-columns: 248px minmax(0, 1fr) 372px; }

.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 16px 12px; position: sticky; top: 27px; height: calc(100vh - 27px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: #2F7D57; display: grid; place-items: center; flex: none; }
.brand b { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 18px; display: block; line-height: 1.1; color: #F3F6F4; }
.brand small { color: var(--sidebar-muted); font-size: 11.5px; }
.nav-group { margin-top: 10px; }
.nav-group h2 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--sidebar-muted); margin: 0 10px 4px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--sidebar-text); text-decoration: none; font-weight: 500; font-size: 13.5px; position: relative; }
.nav-link:hover { background: var(--sidebar-2); }
.nav-link[aria-current="page"] { background: var(--sidebar-active); color: #fff; }
.nav-link svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-link .count { margin-left: auto; background: #D63B3B; color: #fff; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; min-width: 18px; text-align: center; }
.nav-link .count.warn { background: #D27A12; }
.nav-link :focus-visible, .sidebar :focus-visible { outline-color: #93DDB4; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid #2B3731; font-size: 11.5px; color: var(--sidebar-muted); }
.sidebar-foot b { color: var(--sidebar-text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 27px; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hairline); padding: 10px 24px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search input { width: 100%; padding: 8px 12px 8px 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-2); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; box-shadow: var(--shadow-float); z-index: 50; padding: 6px; max-height: 340px; overflow: auto; }
.search-results button { display: flex; width: 100%; text-align: left; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.search-results button:hover, .search-results button:focus-visible { background: var(--sunken); }
.search-results small { color: var(--text-2); margin-left: auto; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ctl select { max-width: 200px; padding: 7px 28px 7px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text); }
.env-PRODUCTION select.env-select { border-color: var(--danger-icon); color: var(--danger); background: var(--danger-soft); }
.env-STAGING select.env-select { border-color: var(--warning); color: var(--warning-ink); background: var(--warning-soft); }
.topbar .spacer { flex: 1; }
.app.with-phone .ctl .lbl-txt { display: none; }
.app.with-phone .search { max-width: 260px; }
.icon-btn { position: relative; width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: -5px; right: -5px; background: var(--danger-icon); color: #fff; border-radius: 99px; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.icon-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-ink); }

.env-banner { margin: 14px 24px 0; padding: 9px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.env-banner.PRODUCTION { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger-icon) 40%, transparent); }
.env-banner.STAGING { background: var(--warning-soft); color: var(--warning-ink); }
.env-banner.DEV { background: var(--info-soft); color: var(--info-ink); }

.content { padding: 18px 24px 48px; min-width: 0; }
.page-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-kpi { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.sunken { background: var(--sunken); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15px; margin: 0; font-weight: 650; }
.card-head p { margin: 2px 0 0; color: var(--text-2); font-size: 12.5px; }
.card-head .tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); font-weight: 650; margin: 22px 0 10px; }
.mt { margin-top: 14px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
hr.sep { border: 0; border-top: 1px solid var(--hairline); margin: 14px 0; }

.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.kpi .label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--text-2); margin-left: 3px; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.kpi .foot { margin-top: auto; display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.up { color: var(--success-ink); } .down { color: var(--danger); } .flat-d { color: var(--text-2); }
.kpi.is-unavailable .value { color: var(--text-3); font-size: 18px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--sunken); color: var(--text-2); white-space: nowrap; line-height: 1.6; border: 1px solid transparent; }
.badge .bd { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--success-soft); color: var(--success-ink); }
.badge.warn { background: var(--warning-soft); color: var(--warning-ink); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.brand { background: var(--primary-soft); color: var(--primary-ink); }
.badge.demo { background: var(--demo-soft); color: var(--demo); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge.outline { background: transparent; border-color: var(--border); }
.badge.est { background: transparent; border: 1px dashed var(--border); color: var(--text-2); }
.src { font-size: 11px; color: var(--text-2); display: inline-flex; gap: 4px; align-items: center; }
.src b { font-weight: 600; color: var(--text); }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; min-height: 36px; white-space: nowrap; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
:root[data-theme="dark"] .btn.danger { color: #2A0B0B; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.btn svg { width: 15px; height: 15px; }
.seg { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label.field > span.hint { font-weight: 400; font-size: 11.5px; }
.input, .select, .textarea { width: 100%; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger-icon); }
.err { color: var(--danger); font-size: 12px; font-weight: 500; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: 12.5px; }
.slider b { font-weight: 700; color: var(--text); }
.slider input { grid-column: 1 / -1; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--hairline); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 650; padding: 9px 12px; background: var(--sunken); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
table.t th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.t th button:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
table.t tbody tr.sel { background: var(--primary-soft); }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
table.t .who b { display: block; font-weight: 600; }
table.t .who small { color: var(--text-2); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px 0; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-ink); }

/* ---------- States ---------- */
.state { border: 1px dashed var(--border); border-radius: 12px; padding: 22px 18px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.state h4 { margin: 0; color: var(--text); font-size: 14px; }
.state p { margin: 0; font-size: 12.5px; max-width: 460px; }
.state .ico svg { width: 20px; height: 20px; }
.state .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--sunken); }
.state.bad .ico { background: var(--danger-soft); color: var(--danger); }
.state.warn .ico { background: var(--warning-soft); color: var(--warning-ink); }
.state.info .ico { background: var(--info-soft); color: var(--info-ink); }
.skeleton { background: linear-gradient(90deg, var(--sunken) 0%, color-mix(in srgb, var(--sunken) 50%, var(--surface)) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.stale-note { display: flex; gap: 8px; align-items: center; background: var(--warning-soft); color: var(--warning-ink); padding: 7px 10px; border-radius: 9px; font-size: 12.5px; margin-bottom: 10px; }
.callout { border-left: 3px solid var(--info); background: var(--info-soft); color: var(--text); padding: 10px 12px; border-radius: 0 10px 10px 0; font-size: 13px; }
.callout.warn { border-color: var(--warning); background: var(--warning-soft); }
.callout.bad { border-color: var(--danger-icon); background: var(--danger-soft); }
.callout.ok { border-color: var(--success); background: var(--success-soft); }
.callout b { font-weight: 650; }

/* ---------- Alert banner ---------- */
.alert-banner { margin: 14px 24px 0; padding: 11px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border: 1px solid; }
.alert-banner.sev1 { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger-icon) 45%, transparent); color: var(--danger); }
.alert-banner.sev2 { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 45%, transparent); color: var(--warning-ink); }
.alert-banner.sev3 { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 40%, transparent); color: var(--info-ink); }
.alert-banner b { font-weight: 700; }
.alert-banner .grow { flex: 1; min-width: 220px; color: var(--text); }

/* ---------- Status tiles ---------- */
.status-tile { display: flex; flex-direction: column; gap: 6px; border-radius: 14px; padding: 14px; border: 1px solid var(--hairline); background: var(--surface); position: relative; overflow: hidden; }
.status-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--success); }
.status-tile.degraded::before { background: var(--warning); }
.status-tile.down::before { background: var(--danger-icon); }
.status-tile.unknown::before { background: var(--border); }
.status-tile h3 { margin: 0; font-size: 13.5px; font-weight: 650; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.status-tile .big { font-size: 22px; font-weight: 700; }
.status-tile.hero { padding: 18px; }
.status-tile.hero .big { font-size: 30px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: pulse 2s infinite; display: inline-block; }
.down .pulse { background: var(--danger-icon); }
.degraded .pulse { background: var(--warning); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 40%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Meters ---------- */
.meter { height: 9px; border-radius: 99px; background: var(--sunken); overflow: hidden; position: relative; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.meter.warn > i { background: var(--warning); }
.meter.bad > i { background: var(--danger-icon); }
.meter .mark { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--text); box-shadow: 0 0 0 1px var(--surface); }
.stackbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--sunken); }
.stackbar > i { display: block; height: 100%; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-2); font-size: 11px; }
.chart .grid line { stroke: var(--chart-grid); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible + .focus-ring, .chart .hit:hover + .focus-ring { opacity: 1; }
.chart .focus-ring { opacity: 0; pointer-events: none; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 7px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5; box-shadow: var(--shadow-float); }
.tip b { font-weight: 700; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.data-toggle { font-size: 12px; }
details.as-table summary { cursor: pointer; font-size: 12px; color: var(--text-2); margin-top: 8px; }
details.as-table table { margin-top: 6px; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 70px 64px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-row .bar { height: 24px; border-radius: 7px; background: var(--primary-soft); position: relative; overflow: hidden; }
.funnel-row .bar i { display: block; height: 100%; background: var(--primary); border-radius: 7px; opacity: .85; }
.funnel-row .num { text-align: right; font-weight: 650; }
.funnel-row .conv { text-align: right; color: var(--text-2); font-size: 12px; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; width: 100%; }
.heat td, .heat th { text-align: center; padding: 6px 4px; border-radius: 6px; }
.heat th { color: var(--text-2); font-weight: 600; font-size: 11.5px; }
.heat td.lab { text-align: left; color: var(--text-2); white-space: nowrap; }

/* ---------- Timeline / lists ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 74px 14px minmax(0, 1fr); gap: 8px; padding: 6px 0; font-size: 13px; }
.timeline li time { color: var(--text-2); font-size: 12px; text-align: right; }
.timeline li .tdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--border); }
.timeline li .tdot.bad { background: var(--danger-icon); } .timeline li .tdot.warn { background: var(--warning); } .timeline li .tdot.ok { background: var(--success); } .timeline li .tdot.info { background: var(--info); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--hairline); display: flex; gap: 10px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t1 { font-weight: 600; }
.list .t2 { color: var(--text-2); font-size: 12.5px; }
.prio { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.prio.p1 { background: var(--danger-soft); color: var(--danger); } .prio.p2 { background: var(--warning-soft); color: var(--warning-ink); } .prio.p3 { background: var(--info-soft); color: var(--info-ink); }

/* Dependency map */
.depmap svg { width: 100%; height: auto; display: block; }
.depmap .node rect { stroke-width: 1.5; }
.depmap text { font-size: 12px; fill: var(--text); font-weight: 600; }
.depmap text.sub { font-size: 10.5px; fill: var(--text-2); font-weight: 500; }
.depmap .edge { stroke: var(--border); stroke-width: 1.6; fill: none; }
.depmap .edge.hot { stroke: var(--danger-icon); stroke-dasharray: 5 4; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -18; } }

/* Diff */
.diff { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; border: 1px solid var(--hairline); border-radius: 10px; overflow: hidden; }
.diff div { padding: 3px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .del { background: var(--danger-soft); color: var(--danger); }
.diff .add { background: var(--success-soft); color: var(--success-ink); }
.diff .ctx { color: var(--text-2); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
code { background: var(--sunken); padding: 1px 5px; border-radius: 5px; }

/* Steps */
.steps { display: flex; gap: 0; counter-reset: s; margin-bottom: 14px; flex-wrap: wrap; }
.steps button { all: unset; flex: 1; min-width: 110px; padding: 8px 10px; border-bottom: 3px solid var(--hairline); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.steps button[aria-current="step"] { border-color: var(--primary); color: var(--text); }
.steps button.done { border-color: var(--primary-line); color: var(--primary-ink); }
.steps button:focus-visible { outline: 2px solid var(--focus); }
.steps button::before { counter-increment: s; content: counter(s) ". "; }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10,16,13,.48); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-float); border: 1px solid var(--hairline); }
.modal.wide { width: min(820px, 100%); }
.modal header { padding: 18px 20px 6px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.modal header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.modal .body { padding: 6px 20px 14px; }
.modal footer { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--hairline); }
.drawer-scrim { position: fixed; inset: 0; background: rgba(10,16,13,.35); z-index: 70; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--bg); z-index: 75; box-shadow: var(--shadow-float); display: flex; flex-direction: column; animation: slidein .2s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer header { padding: 16px 20px; border-bottom: 1px solid var(--hairline); background: var(--surface); display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.drawer header h2 { margin: 0; font-size: 18px; }
.drawer .body { padding: 16px 20px; overflow: auto; flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 8px 12px; font-weight: 600; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1B2420; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow-float); display: flex; gap: 10px; align-items: center; animation: fade .2s; max-width: min(560px, calc(100vw - 32px)); }
:root[data-theme="dark"] .toast { background: #E9EEEA; color: #15201A; }
.toast .tick { color: #6CCB98; font-weight: 800; }
:root[data-theme="dark"] .toast .tick { color: #1F5E40; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow-float); z-index: 60; padding: 12px; }
.rel { position: relative; }

/* ---------- Phone companion ---------- */
.phone-dock { border-left: 1px solid var(--hairline); background: var(--sunken); position: sticky; top: 27px; height: calc(100vh - 27px); overflow-y: auto; padding: 14px 16px 24px; }
.phone-dock h2 { font-size: 13px; margin: 0; }
.phone-dock .row.between { margin-bottom: 10px; }
.phone { --p-bg: #F7F4EE; --p-surface: #FFFFFF; --p-text: #17211C; --p-text-2: #5C6962; --p-line: #E5DFD3; --p-primary: #2F7D57; --p-soft: #E2F0E7; --p-amber: #E08A3C; --p-sunken: #EFEBE3;
  width: 340px; max-width: 100%; height: 700px; margin: 0 auto; border-radius: 42px; background: #0E1310; padding: 10px; box-shadow: var(--shadow-float); position: relative; }
.phone.dark { --p-bg: #0F1512; --p-surface: #171F1B; --p-text: #ECF2EE; --p-text-2: #A5B4AB; --p-line: #2B3731; --p-primary: #6CCB98; --p-soft: #1C3829; --p-amber: #F0A64A; --p-sunken: #212B26; }
.phone .screen { width: 100%; height: 100%; border-radius: 33px; background: var(--p-bg); color: var(--p-text); overflow: hidden; position: relative; display: flex; flex-direction: column; font-size: 13.5px; }
.phone .status { display: flex; justify-content: space-between; padding: 10px 22px 4px; font-size: 11.5px; font-weight: 600; }
.phone .notch { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 82px; height: 20px; border-radius: 12px; background: #0E1310; }
.phone .p-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 16px; }
.phone .p-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 8px; gap: 8px; }
.phone .p-head h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 24px; margin: 0; }
.phone .p-head .sub { font-size: 12px; color: var(--p-text-2); }
.phone .p-icon { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--p-line); background: var(--p-surface); display: grid; place-items: center; position: relative; cursor: pointer; color: var(--p-text); }
.phone .p-icon svg { width: 18px; height: 18px; }
.phone .p-badge { position: absolute; top: -3px; right: -3px; background: #D63B3B; color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--p-bg); }
.phone .p-card { background: var(--p-surface); border: 1px solid var(--p-line); border-radius: 18px; padding: 12px 14px; margin-bottom: 10px; }
.phone .p-sec { font-size: 12px; font-weight: 650; color: var(--p-text-2); margin: 12px 2px 6px; }
.phone .p-item { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--p-line); }
.phone .p-item:last-child { border-bottom: 0; }
.phone .p-circle { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--p-line); flex: none; }
.phone .p-circle.done { background: var(--p-primary); border-color: var(--p-primary); }
.phone .msg { display: flex; gap: 10px; padding: 11px 12px; border-radius: 16px; background: var(--p-surface); border: 1px solid var(--p-line); margin-bottom: 8px; cursor: pointer; text-align: left; width: 100%; color: var(--p-text); }
.phone .msg.unread { border-color: color-mix(in srgb, var(--p-primary) 45%, var(--p-line)); }
.phone .msg .mi { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--p-soft); color: var(--p-primary); }
.phone .msg .mi svg { width: 17px; height: 17px; }
.phone .msg .mt1 { font-weight: 650; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.phone .msg .mt2 { color: var(--p-text-2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.phone .msg .mt3 { color: var(--p-text-2); font-size: 11px; margin-top: 3px; }
.phone .udot { width: 8px; height: 8px; border-radius: 50%; background: var(--p-primary); flex: none; }
.phone .p-chips { display: flex; gap: 6px; margin: 4px 0 10px; }
.phone .p-chip { border: 1px solid var(--p-line); background: var(--p-surface); color: var(--p-text-2); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.phone .p-chip[aria-pressed="true"] { background: var(--p-soft); color: var(--p-primary); border-color: transparent; }
.phone .p-btn { width: 100%; border: 0; background: var(--p-primary); color: #fff; font-weight: 650; border-radius: 14px; padding: 11px; cursor: pointer; margin-top: 8px; }
.phone.dark .p-btn { color: #06200F; }
.phone .p-btn.sec { background: var(--p-soft); color: var(--p-primary); }
.phone .p-back { border: 0; background: none; color: var(--p-text); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; padding: 4px 0; }
.phone .p-nav { display: flex; justify-content: space-around; border-top: 1px solid var(--p-line); background: var(--p-surface); padding: 6px 0 12px; }
.phone .p-nav span { font-size: 10.5px; color: var(--p-text-2); display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; }
.phone .p-nav span.on { color: var(--p-primary); }
.phone .p-nav svg { width: 18px; height: 18px; }
.phone .push { position: absolute; top: 34px; left: 10px; right: 10px; background: color-mix(in srgb, var(--p-surface) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--p-line); border-radius: 18px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 5; animation: drop .3s ease-out; cursor: pointer; text-align: left; color: var(--p-text); width: calc(100% - 20px); }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }
.phone .push .pt { font-size: 11px; color: var(--p-text-2); display: flex; justify-content: space-between; }
.phone .p-toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--p-line); font-size: 13px; }
.phone .p-toggle small { display: block; color: var(--p-text-2); font-size: 11.5px; }
.phone .p-note { background: var(--p-sunken); border-radius: 12px; padding: 9px 11px; font-size: 12px; color: var(--p-text-2); margin: 8px 0; }
.phone-caption { font-size: 11.5px; color: var(--text-2); text-align: center; margin-top: 10px; }
.phone-solo { display: grid; place-items: center; padding: 20px 12px; }

/* ---------- Simulator ---------- */
.sim-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.toggle-card { border: 1px solid var(--hairline); border-radius: 12px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.toggle-card.on { border-color: var(--warning); background: var(--warning-soft); }
.opt-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.opt-card { border: 2px solid var(--hairline); border-radius: 14px; padding: 12px; cursor: pointer; background: var(--surface); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.opt-card[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.opt-card b { font-size: 14px; }
.opt-card span { font-size: 12px; color: var(--text-2); }
.tier-table td, .tier-table th { vertical-align: top; }
.tier-table .rec { background: var(--primary-soft); }
.yes { color: var(--success-ink); font-weight: 650; } .no { color: var(--danger); font-weight: 650; } .part { color: var(--warning-ink); font-weight: 650; }

/* ---------- Responsive ---------- */
@media (max-width: 1439px) {
  .app.with-phone { grid-template-columns: 248px minmax(0, 1fr); }
  .app.with-phone .phone-dock { position: fixed; right: 0; top: 27px; bottom: 0; width: 380px; z-index: 65; box-shadow: var(--shadow-float); }
}
@media (max-width: 1279px) {
  .app, .app.with-phone { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 14px 8px; }
  .brand > div, .nav-group h2, .nav-link .lbl, .sidebar-foot { display: none; }
  .brand { justify-content: center; padding-bottom: 8px; }
  .nav-link { justify-content: center; padding: 9px; }
  .nav-link .count { position: absolute; top: 1px; right: 1px; font-size: 9.5px; min-width: 15px; padding: 0 3px; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opt-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app, .app.with-phone { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 27px; bottom: 0; width: 260px; z-index: 72; transform: translateX(-105%); transition: transform .2s; height: auto; padding: 16px 12px; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-float); }
  .sidebar .brand > div, .sidebar .nav-group h2, .sidebar .nav-link .lbl, .sidebar .sidebar-foot { display: block; }
  .sidebar .brand { justify-content: flex-start; }
  .sidebar .nav-link { justify-content: flex-start; padding: 7px 10px; }
  .sidebar .nav-link .count { position: static; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 40px; }
  .env-banner, .alert-banner { margin-left: 16px; margin-right: 16px; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .funnel-row { grid-template-columns: 120px minmax(0, 1fr) 56px; }
  .funnel-row .conv { display: none; }
  .app.with-phone .phone-dock { width: 100%; }
}
@media (max-width: 560px) {
  .ctl .lbl-txt { display: none; }
  .page-head h1 { font-size: 23px; }
  .kv { grid-template-columns: 1fr; }
}
