/* Schools + waste demos (identical except route hover index 0 vs 2) */

  @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Serif:ital,wght@0,400;1,300&display=swap');

  :root {
    --green: #3C9E76;
    --green-dark: #1F6B4D;
    --green-deep: #0F3D2C;
    --mint: #D8ECE3;
    --mint-pale: #EAF4EE;
    --blush: #FAEFE8;
    --amber: #E8AC58;
    --amber-soft: #F5DEB5;
    --coral: #D4704A;
    --blue: #5B8FB5;
    --blue-soft: #D6E6F0;
    --ink: #0B1A14;
    --ink-2: #2A3A33;
    --ink-3: #56675F;
    --ink-4: #8A9892;
    --line: #E6EBE8;
    --line-2: #F0F3F1;
    --paper: #FFFFFF;
    --paper-off: #F7F9F8;

    --nav-w: 220px;
    --header-h: 56px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    width: 100%; height: 100%;
    font-family: 'IBM Plex Sans', sans-serif;
    background: transparent;
    color: var(--ink);
    overflow: hidden;
  }

  #stage-wrap {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
  }
  #stage {
    width: 1440px; height: 900px;
    flex: none;
    background: var(--paper-off);
    position: relative;
    transform-origin: center;
    overflow: hidden;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.4);
    display: flex;
  }

  /* ========== SIDEBAR (real Klappir Platform) ========== */
  .sidebar {
    width: var(--nav-w);
    background: #FFFFFF;
    color: var(--ink);
    display: flex; flex-direction: column;
    flex: none;
    border-right: 1px solid #EDEDED;
    padding: 0;
  }
  .sidebar-top {
    padding: 14px 16px 4px;
    display: flex; align-items: center;
  }
  .sidebar-burger {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 6px;
    color: #1A1A1A;
    cursor: default;
  }
  .sidebar-brand {
    padding: 4px 18px 16px;
    display: flex; align-items: flex-start; gap: 6px;
    margin-bottom: 4px;
  }
  .sidebar-brand img.logo-mark {
    width: 22px; height: 22px; flex: none;
    margin-top: 1px;
  }
  .sidebar-brand .wordmark-img {
    height: 18px; width: auto; flex: none;
  }
  .sidebar-brand .brand-text {
    display: inline-flex; align-items: flex-start; gap: 4px;
  }
  .sidebar-brand .tag {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 9.5px; letter-spacing: 0; text-transform: none;
    color: #6B8F7C;
    padding: 0; border: none; border-radius: 0;
    font-weight: 500;
    margin-top: 2px;
  }
  .nav-list { padding: 4px 12px 4px; display: flex; flex-direction: column; gap: 2px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    height: 30px; padding: 0 8px;
    font-size: 12.5px;
    color: #1A1A1A;
    font-weight: 500;
    cursor: default;
    position: relative;
    border-radius: 6px;
  }
  .nav-item .nav-line-icon {
    width: 16px; height: 16px; flex: none;
    color: #2E8B5F;
    stroke: currentColor; stroke-width: 1.6;
    fill: none;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .nav-item .caret {
    margin-left: auto; font-size: 10px; color: #9AA39E;
  }
  .nav-item.active {
    background: #E8F3EC;
    color: #1E8A5A;
    font-weight: 600;
  }
  .nav-item.active .nav-line-icon { color: #1E8A5A; }
  .nav-footer {
    margin-top: auto;
    padding: 8px 12px 14px;
    display: flex; flex-direction: column; gap: 2px;
  }
  .nav-footer .nav-item .nav-line-icon { color: #4A524E; }
  .nav-footer .nav-item .ext {
    margin-left: auto; width: 11px; height: 11px; color: #8A9691;
    stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round;
  }

  /* ========== MAIN PANE ========== */
  .main {
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0;
    position: relative;
  }

  /* Top bar (real Klappir — no breadcrumbs, right-aligned pills only) */
  .topbar {
    height: var(--header-h);
    background: white;
    border-bottom: 1px solid #EDEDED;
    display: flex; align-items: center;
    padding: 0 20px;
    gap: 10px;
    flex: none;
  }
  .topbar-right {
    margin-left: auto;
    display: flex; align-items: center; gap: 10px;
    white-space: nowrap;
  }
  .topbar-pill {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    color: #1A1A1A;
    background: transparent;
  }
  .topbar-pill .chev { color: #6A736F; font-size: 11px; display: inline-block; transform: translateY(0); }
  .topbar-pill .prod-mark {
    width: 18px; height: 18px; flex: none;
  }
  .topbar-pill.entity {
    border: 1px solid #DDE2DF;
    border-radius: 999px;
    padding: 0 12px;
    background: #fff;
  }
  .topbar-pill.entity .org-chip {
    width: 18px; height: 18px; border-radius: 999px;
    background: #E8F3EC;
    display: grid; place-items: center;
    color: #1E8A5A;
  }
  .topbar-pill.entity .org-chip::before {
    content: ""; width: 8px; height: 8px; border-radius: 999px; background: #1E8A5A;
  }
  .topbar-pill.entity .kbd {
    color: #8A9691; font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
  }

  /* ========== CONTENT ========== */
  .content {
    flex: 1;
    padding: 18px 28px 20px;
    display: flex; flex-direction: column;
    gap: 12px;
    overflow: hidden;
  }

  .welcome-row {
    display: flex; align-items: center; gap: 16px;
    justify-content: space-between;
    margin-bottom: -2px;
  }
  .welcome {
    display: flex; align-items: center; gap: 12px;
  }
  .welcome h1 {
    font-size: 22px; font-weight: 500; letter-spacing: -0.01em;
    color: var(--ink);
    white-space: nowrap;
  }
  .welcome h1 .name { font-weight: 600; }
  .platform-guide {
    padding: 4px 10px;
    background: var(--mint); color: var(--green-dark);
    border-radius: 14px;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.02em;
  }
  .plan-note {
    font-size: 12px; color: var(--ink-3);
  }
  .plan-note a { color: var(--green-dark); font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; }

  /* ========== SABIA PANEL (NEW) ========== */
  .sabia-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 18px 14px;
    display: flex; flex-direction: column; gap: 10px;
    position: relative;
    overflow: hidden;
    /* Initial empty-state: nudge prompt window down so it sits closer to centre.
       Once KPIs/results appear, body.results-shown removes the nudge and the
       panel slides up to its natural position above the data. */
    transform: translateY(120px);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.results-shown .sabia-panel { transform: translateY(0); }
  .sabia-panel::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px; background: linear-gradient(90deg, var(--green) 0%, #8EE3BA 100%);
  }
  .sabia-head {
    display: flex; align-items: center; gap: 12px;
  }
  .sabia-badge {
    padding: 5px 10px; border-radius: 999px;
    background: var(--mint-pale); color: var(--green-dark);
    font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 6px;
  }
  .sabia-badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    animation: pulse 1.6s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
  }
  .source-chip {
    font-size: 11px; color: var(--ink-4);
    display: inline-flex; align-items: center; gap: 6px;
  }
  .source-chip .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); }

  /* Prompt bar */
  .prompt-bar {
    background: var(--paper-off);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
  }
  .prompt-bar.active {
    border-color: var(--green);
    background: white;
    box-shadow: 0 4px 18px -6px rgba(60,158,118,0.2);
  }
  .prompt-icon {
    flex: none; width: 24px; height: 24px; border-radius: 6px;
    background: var(--ink); color: #8EE3BA;
    display: flex; align-items: center; justify-content: center;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  }
  .prompt-text {
    flex: 1; font-size: 14px; color: var(--ink); min-height: 20px;
  }
  .prompt-text .caret {
    display: inline-block; width: 2px; height: 16px;
    background: var(--green); margin-left: 2px; vertical-align: middle;
    animation: blink 0.9s steps(2) infinite;
  }
  .prompt-text .caret.hidden { display: none; }
  @keyframes blink { 50% { opacity: 0; } }
  .prompt-submit {
    flex: none; padding: 7px 12px; border-radius: 6px;
    background: var(--ink); color: white; font-size: 11px; font-weight: 500;
    opacity: 0.4; transition: opacity 0.3s, background 0.3s;
  }
  .prompt-submit.ready { opacity: 1; background: var(--green-dark); }

  /* Clarification chips (Embla asks a follow-up before answering) */
  .clarify-row {
    display: flex; gap: 8px; align-items: center;
    min-height: 0; max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease, margin 0.3s ease;
  }
  .clarify-row.shown { max-height: 40px; margin: 4px 0 2px; }
  .clarify-row .clarify-label {
    font-size: 10px; color: var(--ink-4); margin-right: 4px;
    opacity: 0; transition: opacity 0.25s ease 0.05s;
  }
  .clarify-row.shown .clarify-label { opacity: 1; }
  .clarify-chip {
    font-size: 10.5px; line-height: 1; color: var(--ink-2);
    padding: 6px 10px; border-radius: 999px;
    background: var(--bg-1); border: 1px solid var(--line-1);
    opacity: 0; transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
  }
  .clarify-row.shown .clarify-chip { opacity: 1; transform: translateY(0); }
  .clarify-chip.picked {
    background: color-mix(in srgb, var(--green) 14%, var(--bg-1));
    border-color: color-mix(in srgb, var(--green) 50%, var(--line-1));
    color: var(--green-dark);
  }
  .clarify-chip.dim { opacity: 0.4; }

  /* Status line */
  .status-line {
    display: flex; gap: 14px;
    font-size: 10px; color: var(--ink-4);
    min-height: 14px;
  }
  .status-item {
    display: flex; align-items: center; gap: 5px;
    opacity: 0; transition: opacity 0.35s ease;
  }
  .status-item.shown { opacity: 1; }
  .status-item .tick { color: var(--green); font-weight: 600; }

  /* Thinking indicator (shows during pause between submit and first status) */
  .thinking {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10px; color: var(--ink-4);
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .thinking.shown { opacity: 1; }
  .thinking .dots {
    display: inline-flex; gap: 3px; margin-left: 2px;
  }
  .thinking .dots span {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--green);
    animation: thinkBounce 1.1s ease-in-out infinite;
  }
  .thinking .dots span:nth-child(2) { animation-delay: 0.15s; }
  .thinking .dots span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes thinkBounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
  }

  /* ========== OUTPUT: KPIs + HEATMAP ========== */
  .output-wrap {
    display: flex; flex-direction: column; gap: 10px;
    flex: 1;
    min-height: 0;
  }

  /* ===== Route options — Embla offers three ways to find savings ===== */
  .routes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    align-content: center;
    padding: 4px 2px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
  }
  .routes.gone { display: none; }
  .routes.shown { opacity: 1; pointer-events: auto; }
  /* While the route cards are on screen, collapse the KPI row + drill panel so
     the cards fill the output area instead of floating in the top half. */
  body.routes-active #kpi-row,
  body.routes-active #panel { display: none; }
  .route-card {
    background: white;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 22px 22px 18px;
    display: flex; flex-direction: column; gap: 11px;
    position: relative;
    overflow: hidden;
    opacity: 0; transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4,0,0.2,1),
                border-color 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
  }
  .route-card.in { opacity: 1; transform: none; }
  .route-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--line);
    transition: background 0.35s ease;
  }
  .route-card .route-num {
    width: 30px; height: 30px; border-radius: 9px;
    background: var(--mint-pale); color: var(--green-deep);
    display: grid; place-items: center;
    font-size: 14px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: background 0.3s ease, color 0.3s ease;
  }
  .route-card .route-title {
    font-size: 16px; font-weight: 600; color: var(--ink);
    line-height: 1.3; letter-spacing: -0.01em;
  }
  .route-card .route-sub {
    font-size: 13px; color: var(--ink-3); line-height: 1.5;
  }
  .route-card .route-stat {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 2px;
  }
  .route-card .route-stat .rs-fig {
    font-size: 30px; font-weight: 600; letter-spacing: -0.02em;
    color: var(--green-deep);
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }
  .route-card .route-stat .rs-fig .rs-sep {
    color: var(--ink-4); font-weight: 400; margin: 0 1px;
  }
  .route-card .route-stat .rs-cap {
    font-size: 11.5px; color: var(--ink-3); line-height: 1.4;
    margin-top: 5px;
  }
  .route-card .route-stat .rs-save {
    margin-top: 11px;
    display: flex; align-items: baseline; gap: 8px;
    white-space: nowrap;
  }
  .route-card .route-stat .rs-save .rsv-label {
    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-4); font-weight: 600;
  }
  .route-card .route-stat .rs-save .rsv-fig {
    margin-left: auto;
    font-size: 18px; font-weight: 600; color: var(--green-dark);
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
    line-height: 1;
  }
  .route-card .route-stat .rs-save .rsv-fig .rsv-unit {
    font-size: 11px; color: var(--ink-3); font-weight: 500;
    letter-spacing: 0; margin-left: 3px;
  }
  .route-card.selected .route-stat { border-top-color: rgba(31,107,77,0.20); }
  .route-card .route-pick {
    margin-top: auto; padding-top: 6px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-4);
    display: inline-flex; align-items: center; gap: 6px;
    transition: color 0.3s ease;
  }
  .route-card .route-pick::after { content: "→"; transition: transform 0.25s ease; }
  /* Auto-pick beat: frequency card selected, the others dim back */
  .route-card.selected {
    border-color: var(--green-dark);
    background: linear-gradient(180deg, #FAFFFB 0%, #EFF8F2 100%);
    box-shadow: 0 12px 30px -12px rgba(31,107,77,0.40);
  }
  .route-card.selected::before { background: linear-gradient(90deg, var(--green) 0%, #8EE3BA 100%); }
  .route-card.selected .route-num { background: var(--green-dark); color: #fff; }
  .route-card.selected .route-pick { color: var(--green-dark); }
  .route-card.selected .route-pick::after { transform: translateX(4px); }
  .route-card.dimmed { opacity: 0.42; }
  /* Frequency tile is clickable (= pressing Next): signal it on hover. */
  .route-card[data-route="0"]:hover,
  .route-card[data-route="2"]:hover {
    border-color: var(--green-dark);
    box-shadow: 0 12px 30px -12px rgba(31,107,77,0.35);
  }
  .route-card[data-route="0"]:hover,
  .route-card[data-route="2"]:hover .route-pick { color: var(--green-dark); }
  .route-card[data-route="0"]:hover,
  .route-card[data-route="2"]:hover .route-pick::after { transform: translateX(4px); }

  /* Opportunity quadrant */
  .quadrant {
    flex: 1; min-height: 0; width: 100%; position: relative;
    background: linear-gradient(180deg, #FBF7F0 0%, #F6F2EA 100%);
    border-radius: 8px; overflow: hidden;
  }
  .quad-legend {
    display: flex; gap: 12px; align-items: center;
    font-family: 'IBM Plex Mono', monospace; font-size: 10px;
    color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em;
  }
  .ql { display: inline-flex; align-items: center; gap: 4px; }
  .ql-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .quadrant svg { width: 100%; height: 100%; }
  .quadrant .grid line { stroke: rgba(15,61,44,0.08); stroke-width: 1; }
  .quadrant .grid .strong { stroke: rgba(15,61,44,0.18); }
  .quadrant .axis-label {
    font-family: 'IBM Plex Mono', monospace; font-size: 10px;
    fill: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
  }
  .quadrant .tick {
    font-family: 'IBM Plex Mono', monospace; font-size: 10px; fill: var(--ink-4);
  }
  .quadrant .band {
    fill: var(--ink-4); fill-opacity: 0.04;
  }
  .quadrant .band-label {
    font-family: 'IBM Plex Mono', monospace; font-size: 9px;
    fill: var(--ink-4); text-transform: uppercase; letter-spacing: 0.08em;
    font-weight: 600;
  }
  .quadrant circle.bub {
    fill-opacity: 0.85; stroke: white; stroke-width: 1.5;
    transition: opacity 0.6s, transform 0.6s;
    transform-origin: center;
  }
  .quadrant circle.bub.entering {
    opacity: 0; transform: scale(0);
  }
  .quadrant .callout-line {
    stroke: var(--ink-3); stroke-width: 1; fill: none;
    stroke-dasharray: 2 2;
  }
  .quadrant .callout-box {
    fill: white; stroke: var(--ink-3); stroke-width: 1;
    rx: 4;
  }
  .quadrant .callout-box.warn { fill: #FFF4E6; stroke: #D4704A; }
  .quadrant .callout-box.good { fill: #EAF4EE; stroke: #3C9E76; }
  .quadrant .callout-title {
    font-family: 'IBM Plex Sans', sans-serif; font-size: 10px;
    font-weight: 600; fill: var(--ink);
  }
  .quadrant .callout-sub {
    font-family: 'IBM Plex Mono', monospace; font-size: 9px;
    fill: var(--ink-3);
  }
  .quadrant .callout {
    opacity: 0; transition: opacity 0.5s;
  }
  .quadrant .callout.shown { opacity: 1; }

    /* KPI row */
  .kpi-row {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
    opacity: 0; transition: opacity 0.4s ease;
  }
  .kpi-row.shown { opacity: 1; }
  .kpi {
    background: white; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 13px;
    display: flex; flex-direction: column; gap: 2px;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.4s, transform 0.4s, border-color 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
  }
  .kpi.in { opacity: 1; transform: none; }
  .kpi.highlight { border-color: var(--green-dark); background: var(--mint-pale); }
  .kpi.alert { border-color: var(--coral); background: #FFF5F0; }
  .kpi .eyebrow {
    font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-4); font-weight: 600;
  }
  .kpi .big {
    font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
    color: var(--ink); font-variant-numeric: tabular-nums;
    line-height: 1.1; margin-top: 1px;
  }
  .kpi.highlight .big { color: var(--green-deep); font-weight: 600; }
  .kpi.alert .big { color: #A04530; }

  /* ===== UNIFIED HIGHLIGHT PATTERN (shared across demos) ===== */
  .hl, .hl-warn, .hl-pos {
    font-weight: 600;
    border-bottom: 2px solid;
    padding-bottom: 0;
    line-height: 1.15;
    white-space: nowrap;
  }
  .hl       { color: var(--ink);        border-bottom-color: var(--green); }
  .hl-warn  { color: #A04530;           border-bottom-color: var(--coral); }
  .hl-pos   { color: var(--green-dark); border-bottom-color: var(--green); }
  .insight-body .hl,
  .insight-body .hl-pos { color: #FFF; border-bottom-color: var(--mint); }
  .insight-body .hl-warn { color: #F5DEB5; border-bottom-color: var(--coral); }
  .kpi .delta {
    font-size: 10px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 3px;
    margin-top: 1px;
  }
  .kpi .delta.good { color: var(--green-dark); }
  .kpi .delta.bad { color: var(--coral); }
  .kpi .spark {
    margin-top: 3px;
    height: 16px; width: 100%;
  }

  /* Main panel: longitudinal heatmap */
  .panel {
    background: white; border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 16px 12px;
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.5s, transform 0.5s;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
  }
  .panel.in { opacity: 1; transform: none; }

  .panel-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 8px;
  }
  .panel-title { font-size: 14px; font-weight: 600; color: var(--ink); }
  .panel-sub { font-size: 11px; color: var(--ink-4); letter-spacing: 0.02em; margin-top: 2px; }
  .panel-legend {
    display: flex; gap: 14px; align-items: center;
    font-size: 9px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
  }
  .legend-scale { display: flex; align-items: center; gap: 6px; }
  .legend-scale .label { font-size: 10px; color: var(--ink-4); text-transform: none; letter-spacing: 0; }
  .legend-scale .swatches { display: flex; gap: 2px; }
  .legend-scale .sw { width: 16px; height: 10px; border-radius: 2px; }

  /* Heatmap grid */
  .heatmap {
    display: grid;
    grid-template-columns: 140px repeat(12, 1fr) 70px 70px;
    gap: 2px;
    align-items: center;
    font-size: 10px;
    flex: 1;
    min-height: 0;
  }
  .hm-h {
    font-size: 9px; color: var(--ink-4); font-weight: 500;
    text-align: center; padding-bottom: 6px;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line-2);
  }
  .hm-h.left { text-align: left; text-transform: uppercase; letter-spacing: 0.12em; }
  .hm-h.right { text-align: right; text-transform: uppercase; letter-spacing: 0.12em; }
  .hm-name {
    font-size: 11px; font-weight: 500; color: var(--ink-2);
    padding-right: 10px;
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .hm-name .asset-dot {
    width: 6px; height: 6px; border-radius: 1px;
    flex: none;
  }
  .hm-cell {
    height: 20px; border-radius: 3px;
    background: var(--line-2);
    transform: scale(0.4);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
    position: relative;
  }
  .hm-cell.in { opacity: 1; transform: scale(1); }
  .hm-cell.annotated::after {
    content: ""; position: absolute; inset: -2px;
    border: 1.5px solid var(--coral); border-radius: 4px;
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  .hm-cell.annotated.show-ann::after { opacity: 1; }

  .hm-spark {
    height: 20px; width: 100%;
  }
  .hm-spark svg { width: 100%; height: 100%; overflow: visible; }

  .hm-val {
    font-size: 11px; font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
    padding-right: 2px;
  }
  .hm-val .trend { font-size: 9px; color: var(--ink-4); margin-left: 3px; }
  .hm-val.up { color: var(--coral); }
  .hm-val.down { color: var(--green-dark); }

  /* Row pulse for Reykjavík selection */
  .hm-row-pulse {
    box-shadow: 0 0 0 0 rgba(212,112,74,0);
    transition: box-shadow 0.4s;
  }
  .hm-row-pulse.pulsing {
    box-shadow: 0 0 0 2px rgba(212,112,74,0.55);
  }

  /* ===== DRILL-DOWN VIEW ===== */
  .drill {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    padding: 12px 16px 12px;
    background: white;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none;
  }
  .drill.in { opacity: 1; transform: none; pointer-events: auto; }
  .drill-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 10px;
  }
  .drill-title { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
  .drill-title .site-tag {
    display: inline-block;
    background: var(--blush); color: #A04530;
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
    margin-right: 8px;
    letter-spacing: 0.02em;
  }
  .drill-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; white-space: nowrap; }
  .drill-tabs {
    display: flex; gap: 4px;
    background: var(--paper-off);
    border: 1px solid var(--line);
    border-radius: 6px; padding: 3px;
  }
  .drill-tab {
    font-size: 11px; padding: 4px 10px; border-radius: 4px;
    color: var(--ink-3);
  }
  .drill-tab.active { background: white; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

  .drill-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
  }

  .chart-wrap {
    display: flex; flex-direction: column;
    border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px;
    min-height: 0;
    position: relative;
  }
  .scatter-tip {
    position: absolute; z-index: 20;
    pointer-events: none;
    min-width: 156px;
    background: var(--ink); color: #fff;
    border-radius: 8px;
    padding: 8px 11px 9px;
    box-shadow: 0 14px 30px -8px rgba(11,26,20,0.5), 0 2px 6px rgba(11,26,20,0.2);
    opacity: 0; transform: translateY(3px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    font-family: 'IBM Plex Sans', sans-serif;
  }
  .scatter-tip.show { opacity: 1; transform: none; }
  .scatter-tip .st-name {
    font-size: 11px; font-weight: 600; letter-spacing: -0.01em;
    margin-bottom: 5px; padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.16);
    color: #fff; line-height: 1.25;
  }
  .scatter-tip .st-row {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 16px; font-size: 10.5px; line-height: 1.55;
    color: rgba(255,255,255,0.72);
  }
  .scatter-tip .st-row b { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
  .scatter-tip .st-row b.st-save { color: #8EE3BA; }
  .chart-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 6px;
  }
  .chart-title { font-size: 11px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.04em; text-transform: uppercase; }
  .chart-sub { font-size: 10px; color: var(--ink-4); }
  .chart-svg { flex: 1; width: 100%; min-height: 0; }
  .chart-svg svg { width: 100%; height: 100%; overflow: visible; }

  .legend-row {
    display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 6px;
    font-size: 10px; color: var(--ink-3); white-space: nowrap;
  }
  .legend-row .key { flex: 0 0 auto; }
  .legend-row .key {
    display: inline-flex; align-items: center; gap: 4px;
  }
  .legend-row .sw {
    width: 10px; height: 10px; border-radius: 2px;
  }

  /* Treatment breakdown: stacked bars per month */
  .treatment-chart { flex: 1; display: flex; flex-direction: column; min-height: 0; }

  /* Right-side cards */
  .drill-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .side-card {
    border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px;
  }
  .side-card .eyebrow { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
  .side-card h4 { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 3px; margin-bottom: 6px; }
  .side-card .big {
    font-size: 22px; font-weight: 500; color: var(--coral); letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
  }
  .side-card .sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

  .cause-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
  .cause-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11px;
    padding: 5px 8px;
    border-left: 2px solid var(--coral);
    background: #FFF5F0;
    border-radius: 0 4px 4px 0;
  }
  .cause-item .label { color: var(--ink-2); }
  .cause-item .val { color: #A04530; font-weight: 600; font-variant-numeric: tabular-nums; }

  /* Drill-anim reveal for chart paths */
  .area-reveal {
    opacity: 0;
    transition: opacity 0.8s ease;
  }
  .area-reveal.in { opacity: 1; }
  .area-stroke {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.4s cubic-bezier(0.4,0,0.2,1);
  }
  .area-stroke.in { stroke-dashoffset: 0; }

  .bar-col { opacity: 0; transform: scaleY(0); transform-origin: bottom; transition: opacity 0.3s, transform 0.3s cubic-bezier(0.4,0,0.2,1); }
  .bar-col.in { opacity: 1; transform: scaleY(1); }

  /* Totals row */
  .hm-total-name {
    font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-3);
    padding-right: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--line-2);
  }
  .hm-total-cell {
    height: 20px; border-radius: 3px;
    background: var(--line-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity 0.3s;
    margin-top: 6px;
    border-top: 1px solid var(--line-2);
    border-radius: 0;
    padding-top: 2px;
  }
  .hm-total-cell.in { opacity: 1; }

  /* Insight strip */
  body.hide-insight .insight-strip { display: none !important; }
  .insight-strip {
    background: var(--ink); color: white;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex; align-items: center; gap: 16px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s, transform 0.4s;
  }
  .insight-strip.in { opacity: 1; transform: none; }
  .insight-icon {
    flex: none; width: 28px; height: 28px; border-radius: 8px;
    background: var(--green); color: white;
    display: flex; align-items: center; justify-content: center;
    font-family: 'IBM Plex Serif'; font-style: italic;
    font-size: 14px; font-weight: 500;
  }
  .insight-body {
    flex: 1;
    font-size: 12px; line-height: 1.45; color: rgba(255,255,255,0.92);
  }
  .insight-body strong { color: #8EE3BA; font-weight: 600; }
  .insight-body em {
    font-family: 'IBM Plex Serif'; font-style: italic; font-weight: 400;
    color: #8EE3BA;
  }
  .insight-cta {
    flex: none;
    padding: 7px 12px; border-radius: 6px;
    background: #8EE3BA; color: var(--green-deep);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.02em;
  }

  /* ===== CROSS-RESOURCE SIGNAL BUBBLE ===== */
  .signal-bubble {
    position: absolute;
    bottom: 74px;
    right: 28px;
    max-width: 280px;
    background: white;
    border: 1px solid var(--blue);
    border-radius: 10px;
    padding: 10px 12px 11px;
    box-shadow: 0 14px 30px -10px rgba(91,143,181,0.35), 0 2px 6px rgba(11,26,20,0.06);
    display: flex; flex-direction: column; gap: 6px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.45s cubic-bezier(0.34,1.56,0.64,1), transform 0.45s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
    z-index: 5;
  }
  .signal-bubble.in {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .signal-bubble::after {
    content: "";
    position: absolute;
    bottom: -7px; right: 24px;
    width: 12px; height: 12px;
    background: white;
    border-right: 1px solid var(--blue);
    border-bottom: 1px solid var(--blue);
    transform: rotate(45deg);
  }
  .signal-bubble .sb-head {
    display: flex; align-items: center; gap: 7px;
  }
  .signal-bubble .sb-badge {
    padding: 2px 7px; border-radius: 999px;
    background: var(--blue-soft); color: #2E5A7A;
    font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 5px;
  }
  .signal-bubble .sb-badge::before {
    content: ""; width: 5px; height: 5px; border-radius: 50%;
    background: var(--blue);
    animation: pulse 1.6s ease-in-out infinite;
  }
  .signal-bubble .sb-drop {
    color: var(--blue); font-size: 12px; line-height: 1;
  }
  .signal-bubble .sb-title {
    font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.3;
  }
  .signal-bubble .sb-body {
    font-size: 11px; color: var(--ink-2); line-height: 1.4;
  }
  .signal-bubble .sb-body b {
    color: #2E5A7A; font-weight: 600;
  }
  .signal-bubble .sb-foot {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 2px;
  }
  .signal-bubble .sb-link {
    font-size: 10.5px; color: var(--blue); font-weight: 600;
  }
  .signal-bubble .sb-dismiss {
    font-size: 14px; color: var(--ink-4); line-height: 1;
    cursor: default;
  }

  /* ===== ACTION PLAN VIEW ===== */
  .action {
    position: absolute; top: 250px; left: 28px; right: 28px; bottom: 20px;
    display: flex; flex-direction: column;
    padding: 8px 0 0;
    background: var(--paper-off);
    z-index: 5;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none;
  }
  .action.in { opacity: 1; transform: none; pointer-events: auto; }
  .action-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 10px;
  }
  .action-title { font-size: 14px; font-weight: 600; color: var(--ink); }
  .action-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
  .action-tag {
    display: inline-block;
    background: var(--mint); color: var(--green-deep);
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
    margin-right: 8px;
    letter-spacing: 0.02em;
  }
  .action-body {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
  }
  .action-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    gap: 10px;
    align-content: start;
    min-height: 0;
  }
  .action-row {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 14px 16px;
    background: white;
    display: grid;
    grid-template-columns: 1fr 176px;
    gap: 22px;
    align-items: stretch;
    opacity: 0; transform: translateY(6px);
    transition: opacity 0.4s, transform 0.4s, border-color 0.2s, box-shadow 0.2s;
  }
  .a-main { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
  .action-row.in { opacity: 1; transform: none; }
  .action-row:hover { border-color: var(--green-deep); box-shadow: 0 1px 3px rgba(31,107,77,0.08); }
  .action-row.expanded {
    grid-column: 1 / -1;
    border-color: var(--green-deep);
    background: linear-gradient(180deg, #FBFEFC 0%, white 60%);
  }
  .action-row-head {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 11px;
    align-items: start;
  }
  .action-num {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--mint-pale); color: var(--green-deep);
    display: grid; place-items: center;
    font-size: 11px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: 1px;
  }
  .action-row .a-title {
    font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.3;
    letter-spacing: -0.01em;
  }
  .action-row .a-owner {
    font-size: 10px; color: var(--ink-4); margin-top: 2px;
    font-variant-numeric: tabular-nums;
  }
  .action-row .a-owner b { color: var(--ink-3); font-weight: 500; }
  .a-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--line);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid var(--line);
    align-self: start;
  }
  .a-metric {
    background: #fff;
    padding: 7px 11px 8px;
    display: flex; flex-direction: column; gap: 1px;
    min-width: 0;
  }
  .a-metric .lab {
    font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-4); font-weight: 600;
  }
  .a-metric .val {
    font-size: 13.5px; font-weight: 600; color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
  }
  .a-metric.save .val { color: var(--green-dark); }
  .a-metric.carbon .val { color: var(--green-deep); }
  .a-metric.cost .val { color: var(--ink-2); }
  .a-metric .val .unit {
    font-size: 9px; color: var(--ink-4); font-weight: 500;
    margin-left: 2px; letter-spacing: 0.04em;
  }
  .a-foot {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto;
  }
  .a-readmore {
    font-size: 14px; color: var(--green-dark); font-weight: 700;
    cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--mint-pale);
    line-height: 1;
  }
  .a-readmore:hover { background: var(--mint); color: var(--green-deep); }
  .a-readmore .arr { transition: transform 0.2s; display: inline-block; }
  .a-readmore-text { display: none; }
  .action-row.expanded .a-readmore .arr { transform: rotate(90deg); }
  .a-detail {
    display: none;
    font-size: 11px; color: var(--ink-2); line-height: 1.5;
    border-top: 1px solid var(--line-2);
    padding-top: 8px;
  }
  .action-row.expanded .a-detail { display: block; }
  .a-detail p { margin: 0 0 5px; }
  .a-detail p:last-child { margin-bottom: 0; }

  /* ===== Next-step button + hover email / alert preview ===== */
  .a-when { font-size: 10px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
  .ns-wrap { position: relative; }
  .a-nextstep {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 6px;
    background: var(--mint-pale); color: var(--green-deep);
    font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
    cursor: pointer; user-select: none;
    border: 1px solid transparent;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
  }
  .a-nextstep .ns-arr { transition: transform 0.18s; display: inline-block; }
  .ns-wrap:hover .a-nextstep {
    background: var(--green-dark); color: #fff; border-color: var(--green-dark);
  }
  .ns-wrap:hover .a-nextstep .ns-arr { transform: translateX(3px); }
  .ns-pop {
    position: absolute; z-index: 30;
    top: calc(100% + 8px); right: 0;
    width: 292px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 18px 40px -12px rgba(11,26,20,0.40), 0 3px 10px rgba(11,26,20,0.08);
    overflow: hidden;
    opacity: 0; transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
  }
  .ns-wrap:hover .ns-pop { opacity: 1; transform: none; pointer-events: auto; }
  .ns-pop::after {
    content: ""; position: absolute; top: -6px; right: 22px;
    width: 11px; height: 11px; background: var(--paper-off);
    border-left: 1px solid var(--line); border-top: 1px solid var(--line);
    transform: rotate(45deg);
  }
  .ns-head {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 13px 8px;
    border-bottom: 1px solid var(--line-2);
    background: var(--paper-off);
  }
  .ns-tag {
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--green-dark);
    display: inline-flex; align-items: center; gap: 6px;
  }
  .ns-tag::before { content: "\270E"; font-size: 11px; }
  .ns-tag.alert::before { content: "\1F514"; }
  .ns-to { font-size: 10px; color: var(--ink-4); margin-left: auto; }
  .ns-subj {
    display: block;
    padding: 9px 13px 2px;
    font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.3;
  }
  .ns-body {
    display: block;
    padding: 4px 13px 12px;
    font-size: 11px; color: var(--ink-2); line-height: 1.5;
  }
  .ns-body b { color: var(--green-deep); font-weight: 600; }

  .action-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .total-card {
    border: 1px solid var(--green-dark);
    background: linear-gradient(135deg, #F2FAF5 0%, #EAF4EE 100%);
    border-radius: 8px;
    padding: 14px 16px;
  }
  .total-card .eyebrow {
    font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--green-dark); font-weight: 700;
  }
  .total-card .big {
    font-size: 32px; font-weight: 500; color: var(--green-deep);
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
    margin-top: 4px; line-height: 1.05;
  }
  .total-card .sub {
    font-size: 11px; color: var(--ink-2); margin-top: 4px; line-height: 1.4;
  }
  .total-card .split {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(31,107,77,0.18);
    display: flex; justify-content: space-between;
    font-size: 10.5px; color: var(--ink-3);
  }
  .total-card .split b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

  .receipt-card {
    border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px;
  }
  .receipt-card .eyebrow {
    font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-4); font-weight: 600;
  }
  .receipt-card h4 {
    font-size: 12.5px; font-weight: 600; color: var(--ink);
    margin: 4px 0 6px;
  }
  .receipt-card ul {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 4px;
  }
  .receipt-card li {
    font-size: 10.5px; color: var(--ink-2); line-height: 1.4;
    display: flex; gap: 6px; align-items: baseline;
  }
  .receipt-card li::before {
    content: "→"; color: var(--green); font-weight: 600; font-size: 10px;
    flex: none;
  }

  /* ===== Stage 4 — Embla offers to send the report ===== */
  .embla-offer {
    margin-top: 8px;
    border: 1px solid var(--green-dark);
    border-radius: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #FAFFFB 0%, #F0F8F2 100%);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column; gap: 6px;
  }
  .embla-offer.in { opacity: 1; transform: none; }
  .embla-offer .row1 {
    display: flex; align-items: center; gap: 7px;
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--green-dark); font-weight: 700;
  }
  .embla-offer .row1::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--green); flex: none;
    box-shadow: 0 0 0 3px rgba(31,107,77,0.16);
    animation: emblaPulse 2.2s ease-in-out infinite;
  }
  @keyframes emblaPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(31,107,77,0.10); }
    50%      { box-shadow: 0 0 0 5px rgba(31,107,77,0.22); }
  }
  .embla-offer .ask {
    font-size: 12.5px; line-height: 1.35; color: var(--ink);
    font-weight: 500;
  }
  .embla-offer .ask em {
    font-style: normal; color: var(--green-deep); font-weight: 600;
  }
  .embla-offer .actions-row {
    display: flex; gap: 6px; margin-top: 2px;
  }
  .embla-offer .btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 11.5px; font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid var(--line);
    background: white; color: var(--ink-2);
  }
  .embla-offer .btn.primary {
    background: var(--green-dark); color: white; border-color: var(--green-dark);
  }
  .embla-offer .btn.primary.armed {
    box-shadow: 0 0 0 3px rgba(31,107,77,0.20);
  }

  /* Email draft card */
  .email-card {
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.4,0,0.2,1);
    position: relative;
  }
  .email-card.in { opacity: 1; transform: none; }
  .email-head {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--paper-off);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-3); font-weight: 700;
  }
  .email-head .compose-tag {
    color: var(--green-dark);
    display: flex; align-items: center; gap: 6px;
  }
  .email-head .compose-tag::before {
    content: "✎"; font-size: 11px;
  }
  .email-head .draft-stamp {
    font-size: 9px; color: var(--ink-4);
    font-variant-numeric: tabular-nums;
  }
  .email-meta {
    padding: 7px 12px 6px;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    font-size: 10.5px;
    line-height: 1.5;
  }
  .email-meta .lab {
    color: var(--ink-4); font-weight: 600;
    font-size: 9.5px; text-transform: uppercase;
    letter-spacing: 0.1em;
    align-self: center;
  }
  .email-meta .val {
    color: var(--ink); font-weight: 500;
    font-variant-numeric: tabular-nums;
  }
  .email-meta .val.subj { font-weight: 600; color: var(--ink); }
  .email-body {
    padding: 9px 12px 11px;
    font-size: 11px;
    line-height: 1.55;
    color: var(--ink);
    min-height: 90px;
    position: relative;
    font-family: 'Source Serif Pro', 'Source Serif 4', Georgia, serif;
  }
  .email-body p { margin: 0 0 6px; }
  .email-body p:last-child { margin: 0; }
  .email-body .typewriter { white-space: pre-wrap; }
  .email-body .typewriter::after {
    content: "▌";
    color: var(--green-dark);
    animation: emailCaret 0.7s steps(2) infinite;
    font-size: 10px;
    margin-left: 1px;
  }
  .email-body.done .typewriter::after { display: none; }
  @keyframes emailCaret { 50% { opacity: 0; } }
  .email-body .ref {
    display: inline-block;
    background: rgba(31,107,77,0.10);
    color: var(--green-deep);
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 600;
    font-family: var(--font-sans, system-ui);
    font-size: 10px;
  }

  .email-foot {
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    background: var(--paper-off);
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
  }
  .email-foot .attach {
    font-size: 10px; color: var(--ink-3);
    display: flex; align-items: center; gap: 5px;
  }
  .email-foot .attach::before {
    content: "📎"; font-size: 11px;
    filter: grayscale(0.4);
  }
  .email-foot .send-btn {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--green-dark); color: white;
    font-size: 11px; font-weight: 600;
    border: 1px solid var(--green-dark);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    opacity: 0;
    transform: translateY(4px);
  }
  .email-foot .send-btn.in { opacity: 1; transform: none; }
  .email-foot .send-btn.armed {
    box-shadow: 0 0 0 3px rgba(31,107,77,0.22);
  }
  .email-foot .send-btn.sending {
    background: var(--ink-3); border-color: var(--ink-3);
    pointer-events: none;
  }

  /* Sent overlay */
  .email-card .sent-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(242,250,245,0.98) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
  }
  .email-card.sent .sent-overlay { opacity: 1; }
  .sent-overlay .check {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--green-dark); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(31,107,77,0.30);
    transform: scale(0.6);
    transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1);
  }
  .email-card.sent .sent-overlay .check { transform: scale(1); }
  .sent-overlay .lbl1 {
    font-size: 12.5px; font-weight: 600; color: var(--green-deep);
    letter-spacing: -0.005em;
  }
  .sent-overlay .lbl2 {
    font-size: 10px; color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
  }

  body { animation: __klappir_fade_in 600ms ease both; }
  @keyframes __klappir_fade_in { from { opacity: 0; } to { opacity: 1; } }

  /* ===== Stage controls (editor toolbar — hidden when embedded in deck iframe) ===== */
  .stage-controls {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
    z-index: 100;
    display: flex; align-items: center; gap: 8px;
    background: rgba(11,26,20,0.94); color: white;
    padding: 6px 8px 6px 6px; border-radius: 999px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.32), 0 2px 4px rgba(0,0,0,0.18);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
    font-weight: 600; user-select: none;
  }
  body.embedded .stage-controls { display: none; }
  .sc-btn {
    appearance: none; border: 0; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.10); color: white;
    font-size: 11px; transition: background 0.18s, transform 0.12s;
    padding: 0;
  }
  .sc-btn:hover { background: rgba(255,255,255,0.22); }
  .sc-btn:active { transform: scale(0.92); }
  .sc-btn svg { display: block; }
  .sc-btn.sc-play { background: #3C9E76; width: 34px; height: 34px; }
  .sc-btn.sc-play:hover { background: #1F6B4D; }
  .sc-info {
    padding: 0 12px 0 6px; display: flex; align-items: center; gap: 6px;
    color: rgba(255,255,255,0.92);
  }
  .sc-info .sc-num { color: #8EE3BA; font-weight: 700; font-size: 11px; }
  .sc-info .sep { color: rgba(255,255,255,0.32); }
  .sc-info .sc-label { color: rgba(255,255,255,0.78); min-width: 56px; }

  /* Pause: freeze every CSS animation in flight. CSS transitions can't be paused
     mid-flight, but most motion in this demo is opacity/transform via class toggles
     which are step-functions driven by setTimeout — the scheduler suspends those. */
  body.paused *, body.paused *::before, body.paused *::after {
    animation-play-state: paused !important;
  }

  /* Settling: temporarily kill ALL transitions while we snap the prior stage's
     content into its end-state. Without this, the user would see the prior
     stage's reveal animations replay during a Next press. We only flip this on
     for ~one frame inside goToStage, then take it off before kicking the next
     stage's natural eraseText → type → reveal flow. */
  body.settling *, body.settling *::before, body.settling *::after {
    transition: none !important;
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
  }
