/* =========================================================================
   Blueprint Replay — player UI
   Light, quiet surfaces (Apple-ish) with a single orange accent for replay
   activity (clicks, playhead, highlights). Green always means "live".
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
    --bg: #fbfbfd;
    --bg-stage: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f7f7f9;
    --fill: #f2f2f5;
    --fill-2: #ececf0;
    --line: #e5e5ea;
    --line-soft: #f0f0f3;
    --line-strong: #d2d2d7;

    --text: #1d1d1f;
    --text-2: #424245;
    --muted: #6e6e73;
    --faint: #8e8e93;

    --accent: #f6821f;
    --accent-text: #c2410c;
    --accent-soft: #fff4ea;
    --accent-fill: #ffedd5;

    --live: #16a34a;
    --live-text: #15803d;
    --live-soft: #e7f6ec;

    --blue-text: #1d4ed8;
    --blue-fill: #e0e7ff;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-window: 0 1px 2px rgba(0, 0, 0, .04), 0 24px 60px rgba(0, 0, 0, .10);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 var(--font);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }

.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #000; }

.btn-icon { width: 32px; padding: 0; justify-content: center; }

.btn-ghost-round {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.btn-ghost-round:hover { background: var(--fill); }

.btn-play {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--text);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .1s;
}
.btn-play:active { transform: scale(.94); }

.btn-live {
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-2);
}
.btn-live .dot { background: var(--faint); }
.btn-live.on { background: var(--live-soft); color: var(--live-text); border-color: transparent; }
.btn-live.on .dot { background: var(--live); animation: pulse 1.6s infinite; }

/* Segmented control (status filter, speed) */
.segmented { display: inline-flex; background: var(--fill-2); border-radius: 9px; padding: 2px; }
.segmented button {
    height: 28px;
    min-width: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}
.segmented button[aria-checked="true"],
.segmented button[aria-selected="true"] {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

/* iOS-style switch */
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--line-strong);
    position: relative;
    transition: background .15s;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s;
}
.switch input:checked + .track { background: #34c759; }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------- Pills */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    background: var(--fill);
    border-radius: 999px;
    padding: 3px 10px 3px 8px;
    white-space: nowrap;
}
.pill .dot { background: #aeaeb2; }
.pill.live { color: var(--live-text); background: var(--live-soft); font-weight: 600; }
.pill.live .dot { background: var(--live); animation: pulse 1.6s infinite; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

.count-badge {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--live-text);
    background: var(--live-soft);
    border-radius: 999px;
    padding: 1px 8px;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
    70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* --------------------------------------------------------------- Top bar */

.topbar {
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
}
.topbar .spacer { flex: 1 1 20px; }
.vsep { width: 1px; height: 20px; background: var(--line); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.site-switch .dot { background: var(--accent); width: 8px; height: 8px; }
.site-switch select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--text);
    padding-right: 18px;
    cursor: pointer;
    outline: none;
}
.site-switch svg { position: absolute; right: 10px; pointer-events: none; }

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px 0 12px;
    border-radius: var(--radius-sm);
    background: var(--fill);
    color: var(--muted);
    flex: 0 1 300px;
    min-width: 160px;
}
.search input { border: 0; background: transparent; font: inherit; color: var(--text); outline: none; width: 100%; }
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.kbd { font-size: 11px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; color: var(--muted); }

/* ===================================================== Sessions screen */

.app { display: flex; flex-wrap: wrap; min-height: calc(100vh - 56px); }

.sidenav {
    flex: 1 1 200px;
    max-width: 232px;
    padding: 20px 12px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidenav button, .sidenav a {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}
.sidenav button:hover, .sidenav a:hover { background: var(--fill); }
.sidenav .active { background: var(--fill-2); font-weight: 500; }
.sidenav .sep { height: 1px; background: var(--line); margin: 12px 10px; }

.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 48px; }
.main-inner { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--muted); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.table-wrap { overflow-x: auto; }
.table { min-width: 900px; }
.table .row {
    display: grid;
    grid-template-columns: 110px minmax(0, 2.2fr) minmax(0, 1.3fr) 90px 70px minmax(0, 1.4fr) 110px;
    gap: 16px;
    align-items: center;
    padding: 0 20px;
}
.table .head { height: 40px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); }
.table a.row { height: 60px; border-bottom: 1px solid var(--line-soft); transition: background .1s; }
.table a.row:last-child { border-bottom: 0; }
.table a.row:hover { background: var(--surface-2); }
.table .right { text-align: right; }

.cell-page { display: flex; flex-direction: column; min-width: 0; }
.cell-page .title, .cell-page .path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-page .title { font-weight: 500; }
.cell-page .path { color: var(--muted); }

.cell-device { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.cell-device > span { display: flex; flex-direction: column; min-width: 0; }
.cell-device > span > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-device small { font-size: 12px; color: var(--muted); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.spark span { flex: 1; border-radius: 1px; background: var(--line-strong); min-height: 2px; }
.spark span.hot { background: var(--accent); }

.foot-note { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

.empty { padding: 48px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h2 { margin: 0; font-size: 18px; }
.empty p { margin: 0; color: var(--muted); max-width: 460px; }

.snippet {
    position: relative;
    width: 100%;
    max-width: 720px;
    text-align: left;
    background: var(--text);
    color: #f5f5f7;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font: 12.5px/1.6 var(--mono);
    overflow-x: auto;
    white-space: pre;
}
.snippet-row { display: flex; gap: 8px; align-items: flex-start; width: 100%; max-width: 720px; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; }

/* ======================================================== Watch screen */

.watch-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-stage); }
.watch-body .topbar { position: static; background: var(--surface); }

.title-block { display: flex; flex-direction: column; min-width: 0; }
.title-block .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.title-block .sub { font-size: 11px; color: var(--muted); }

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.back:hover { color: var(--text); }

.watch { flex: 1; min-height: 0; display: flex; }

.player { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-stage); }

.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: 20px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    overflow: hidden;
}

.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--muted); min-height: 26px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

.stage-msg { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; }
.toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(29, 29, 31, .92);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    white-space: nowrap;
}
.toast.warn { background: #fff7ed; color: var(--accent-text); border: 1px solid #fed7aa; white-space: normal; max-width: 560px; border-radius: 10px; }

/* The fake browser window around the replay */
.window {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-window);
    overflow: hidden;
    flex: none;
}
.window-bar {
    height: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.lights { display: flex; gap: 7px; }
.lights span { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); }
.urlbar-wrap { flex: 1; display: flex; justify-content: center; min-width: 0; }
.urlbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 26px;
    padding: 0 14px;
    border-radius: 7px;
    background: var(--fill-2);
    color: var(--text-2);
    font-size: 12px;
    width: 100%;
    max-width: 440px;
    min-width: 0;
}
.urlbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.read-only { font-size: 11px; color: var(--muted); white-space: nowrap; }

.window { background: var(--surface-2); }
.screen { position: relative; }
.sizer { position: relative; background: #fff; margin: 0 auto; }
.viewport { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; background: #fff; }
.zoomer { position: absolute; inset: 0; transform-origin: 0 0; }

/* ---- Device frames ----------------------------------------------------
   is-desktop: browser window (above). is-phone / is-tablet: a device body
   with the page on its screen. Sizes here are on-screen pixels; fit() measures
   them, so they can be tweaked freely. */

.device-top, .device-bottom { display: none; }

.window.is-phone,
.window.is-tablet {
    background: #1d1d1f;
    border: 0;
    box-shadow: 0 0 0 1px #3a3a3c, var(--shadow-window);
}
.is-phone .window-bar,
.is-tablet .window-bar { display: none; }

.window.is-phone { border-radius: 48px; padding: 12px; }
.is-phone .screen { background: var(--surface-2); border-radius: 36px; overflow: hidden; }
.is-phone .device-top { display: flex; height: 40px; align-items: center; justify-content: center; }
.is-phone .device-top .urlbar { display: none; }
.island { width: 92px; height: 26px; border-radius: 999px; background: #1d1d1f; }
.is-phone .device-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 62px;
    padding: 0 14px;
}
.device-bottom .urlbar, .device-top .urlbar {
    max-width: none;
    height: 30px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.home-bar { width: 120px; height: 5px; border-radius: 3px; background: #1d1d1f; flex: none; }

/* Phone on its side: no room for the island strip above the page. */
.is-phone.landscape .device-top { height: 10px; }
.is-phone.landscape .island { display: none; }
.is-phone.landscape .device-bottom { height: 50px; gap: 6px; }
.is-phone.landscape .home-bar { width: 160px; }

.window.is-tablet { border-radius: 30px; padding: 18px; }
.is-tablet .screen { background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.is-tablet .device-top { display: flex; height: 44px; align-items: center; justify-content: center; padding: 0 16px; }
.is-tablet .island { display: none; }
.is-tablet .device-top .urlbar { max-width: 380px; height: 28px; background: var(--fill-2); box-shadow: none; }

/* Finger marker for touch sessions (sized from JS to stay constant on screen). */
.finger {
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(29, 29, 31, .22);
    border: 2px solid rgba(255, 255, 255, .95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    pointer-events: none;
    opacity: 0;
    z-index: 3;
    will-change: transform, opacity;
    transition: background .12s;
}
.finger.down { background: rgba(246, 130, 31, .45); }
.viewport iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* Above the iframe: blocks interaction and draws the cursor, trail and clicks. */
.overlay { position: absolute; inset: 0; z-index: 2; cursor: default; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 6; opacity: .6; }

.cursor {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    pointer-events: none;
    will-change: transform;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
    z-index: 3;
    transition: opacity .2s;
}

.ripple {
    position: absolute;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    pointer-events: none;
    animation: ripple .8s ease-out forwards;
}
@keyframes ripple {
    from { transform: scale(.35); opacity: 1; }
    to { transform: scale(1.8); opacity: 0; }
}

.click-label {
    position: absolute;
    background: var(--text);
    color: #fff;
    font: 500 12px var(--font);
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .15s, transform .15s;
}
.click-label.show { opacity: 1; transform: none; }

.veil {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(245, 245, 247, .82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--text-2);
    font-size: 22px;
    font-weight: 600;
    z-index: 5;
}
.veil.show { display: flex; }

/* ----------------------------------------------------------- Transport */

.transport {
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 16px 32px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: none;
}

.timeline { position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer; touch-action: none; user-select: none; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 30px; }
.hist span { flex: 1; border-radius: 1.5px; background: var(--line); min-height: 2px; }
.hist span.p { background: var(--faint); }
.hist span.n { background: var(--accent); }

.segments { position: relative; height: 22px; }
.segments span {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--fill-2);
    color: var(--text-2);
    border-radius: 5px;
    font: 11px/22px var(--mono);
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-right: 2px solid var(--surface);
}
.segments span.on { background: var(--text); color: #fff; }

.dots { position: absolute; left: 0; right: 0; top: 36px; height: 12px; pointer-events: none; }
.dots span {
    position: absolute;
    top: 0;
    width: 8px;
    height: 8px;
    margin-left: -6px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-sizing: content-box;
}

.playhead { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; pointer-events: none; }
.playhead::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.tl-tip {
    position: absolute;
    top: -30px;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    padding: 3px 7px;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .1s;
}
.timeline:hover .tl-tip { opacity: 1; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls .spacer { flex: 1 1 20px; }
.time { font-variant-numeric: tabular-nums; font-weight: 500; margin-left: 4px; min-width: 96px; }
.time .total { color: var(--muted); font-weight: 400; }

/* ----------------------------------------------------------- Inspector */

.inspector {
    flex: 0 0 340px;
    background: var(--surface);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.summary { padding: 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.who { display: flex; align-items: center; gap: 12px; }
.who-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--fill); display: flex; align-items: center; justify-content: center; flex: none; }
.who div { display: flex; flex-direction: column; min-width: 0; }
.who strong { font-weight: 600; }
.who small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts dt { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs button {
    height: 42px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
}
.tabs button[aria-selected="true"] { border-bottom-color: var(--text); color: var(--text); font-weight: 600; }

.panel { flex: 1; overflow-y: auto; min-height: 0; }

.activity { list-style: none; margin: 0; padding: 8px 0 20px; }
.act-page {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}
.act-page .p { font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-page .t { margin-left: auto; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

.act-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 16px);
    margin: 0 8px;
    padding: 7px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}
.act-item:hover { background: var(--fill); }
.act-item .ic { width: 22px; height: 22px; border-radius: 6px; background: var(--fill); display: flex; align-items: center; justify-content: center; flex: none; color: var(--text-2); }
.act-item.k-click .ic { background: var(--accent-fill); color: var(--accent-text); }
.act-item .tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-item .t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.act-item.future { color: var(--faint); }
.act-item.future .ic { opacity: .55; }
.act-item.current { background: var(--accent-soft); }
.act-item.current .t { color: var(--accent-text); }

.pages-list { list-style: none; margin: 0; padding: 12px; display: grid; gap: 6px; }
.pages-list button {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
}
.pages-list button:hover { border-color: var(--line-strong); }
.pages-list button.on { border-color: var(--text); }
.pages-list .pt { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pages-list .pp { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pages-list .pd { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
.pages-list .pc { font-size: 12px; color: var(--muted); text-align: right; }

.details { margin: 0; padding: 16px 20px; display: grid; gap: 14px; }
.details div { display: grid; gap: 3px; }
.details dt { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.details dd { margin: 0; word-break: break-word; }

/* --------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
    .watch { flex-direction: column; overflow-y: auto; }
    .player { min-height: 70vh; }
    .inspector { flex: none; border-left: 0; border-top: 1px solid var(--line); }
    .watch-body { height: auto; min-height: 100vh; overflow: visible; }
}

@media (max-width: 720px) {
    .main { padding: 24px 16px 40px; }
    .sidenav { max-width: none; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
    .sidenav .sep { display: none; }
    .stage, .transport { padding-left: 16px; padding-right: 16px; }
}

/* ========================================================== Live view */

.live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--live-text); font-weight: 600; }
.live-tag .dot { background: var(--live); animation: pulse 1.6s infinite; }

.live-side { overflow-y: auto; }
.side-section { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.side-section:last-child { border-bottom: 0; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 18px 20px 10px; }
.side-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.side-head .muted { font-size: 12px; }

.live-pages, .live-visitors { list-style: none; margin: 0; padding: 0 12px; display: grid; gap: 4px; }
.side-empty { padding: 4px 8px 8px; color: var(--muted); font-size: 13px; }

.live-pages button {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.live-pages button:hover { background: var(--fill); }
.live-pages button.on { background: var(--surface); border-color: var(--text); }
.live-pages .lp-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pages .lp-path { font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pages .lp-count { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; line-height: 1; }
.live-pages .lp-devices { display: flex; gap: 6px; justify-content: flex-end; color: var(--muted); font-size: 11px; align-items: center; }
.live-pages .lp-devices span { display: inline-flex; align-items: center; gap: 2px; }
.live-pages .lp-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.live-pages .lp-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.live-visitors li {
    display: grid;
    grid-template-columns: 12px 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 9px 12px;
    border-radius: 10px;
}
.live-visitors li:hover, .live-visitors li.focus { background: var(--fill); }
.live-visitors li.side-empty, .live-visitors li.side-empty:hover { display: block; background: none; }
.live-visitors .swatch { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line-strong); }
.live-visitors .who-ic { color: var(--text-2); display: flex; }
.live-visitors .lv-text { display: flex; flex-direction: column; min-width: 0; }
.live-visitors .lv-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-visitors .lv-status { font-size: 12px; color: var(--muted); }
.live-visitors .lv-status.active { color: var(--live-text); }
.live-visitors .lv-actions { display: flex; gap: 6px; }
.live-visitors .lv-actions button, .live-visitors .lv-actions a {
    height: 28px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.live-visitors .lv-actions button:hover, .live-visitors .lv-actions a:hover { background: var(--surface-2); }

/* ============================================================ Reports */

.notice {
    padding: 12px 16px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #7c2d12;
    font-size: 13px;
}
.notice code { font-size: 12px; background: rgba(255, 255, 255, .7); padding: 1px 5px; border-radius: 4px; }

.reports-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.reports-side { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.report-list { display: flex; flex-direction: column; gap: 10px; }
.card.empty.small { padding: 20px; }

.report-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.report-card.selected { border: 2px solid var(--text); margin: -1px; }
.report-open {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px 64px 16px 16px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 12px;
}
.report-open:hover { background: var(--surface-2); }
.rc-name { font-weight: 600; font-size: 15px; }
.rc-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--text-2); }
.rc-site { font-size: 12px; color: var(--muted); }
.rc-when { font-size: 13px; color: var(--text-2); }
.rc-next { font-size: 12px; color: var(--muted); }

.mini-switch {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 20px;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: var(--line-strong);
    cursor: pointer;
}
.mini-switch span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s;
}
.mini-switch[aria-checked="true"] { background: #34c759; }
.mini-switch[aria-checked="true"] span { transform: translateX(14px); }

.history { padding: 6px 0 8px; }
.history-head { padding: 12px 16px 4px; }
.history-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.history ol { list-style: none; margin: 0; padding: 0 8px; }
.history li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; font-size: 13px; }
.history li.muted { display: block; padding: 8px; }
.history .h-ic { color: var(--muted); display: flex; }
.history .h-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history .h-to { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-meta { font-size: 12px; color: var(--muted); }
.history .h-status { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.history .h-status.ok { background: var(--live-soft); color: var(--live-text); }
.history .h-status.bad { background: #fee2e2; color: #b91c1c; }
.history a { font-size: 12px; font-weight: 600; color: var(--accent-text); }

.editor { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; }
.editor-row { display: flex; flex-wrap: wrap; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.editor-row.schedule { padding: 0; border: 0; align-items: flex-end; gap: 20px; }
.editor-row.tight { padding: 0; border: 0; gap: 8px; }
.editor-block { display: flex; flex-direction: column; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.grow-1 { flex: 1 1 180px; }
.grow-2 { flex: 2 1 240px; }
.grow { flex: 1 1 200px; }

.field { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 500; color: var(--muted); }
.field-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field input, .field select, .add-recipient input {
    height: 38px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    background: var(--surface);
}
.field input:focus, .field select:focus, .add-recipient input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.add-recipient { display: flex; }
.add-recipient input { flex: 1; min-width: 0; }

.editor .segmented button { height: 30px; }

.day-chips { display: flex; gap: 4px; }
.day-chip {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
}
.day-chip.on { background: var(--text); color: #fff; border-color: var(--text); }

.hint { margin: 0; font-size: 12px; color: var(--muted); }
.hint.warn { color: #b45309; }

.recipient-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; align-items: center; }
.recipient {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 12px;
    border-radius: 999px;
    background: var(--fill);
    font-size: 13px;
}
.recipient .kind { font-size: 11px; color: var(--muted); }
.recipient.skipped { opacity: .5; text-decoration: line-through; }
.recipient button {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: var(--line);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.recipient button:hover { background: var(--line-strong); }

.section-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.section-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}
.section-check:hover { border-color: var(--line-strong); }
.section-check input { margin-top: 2px; accent-color: var(--text); }
.section-check > span { display: flex; flex-direction: column; }
.sc-name { font-weight: 500; }
.sc-detail { font-size: 12px; color: var(--muted); }

.previews { flex-direction: row; flex-wrap: wrap; gap: 16px; }
.preview-col { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.email-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.email-meta { padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); background: var(--surface); }
.email-meta strong { font-weight: 600; font-size: 13px; }
.email-meta .muted { font-size: 12px; }
.email-frame-wrap { height: 380px; overflow: hidden; position: relative; }
.email-frame-wrap iframe { width: 166.67%; height: 166.67%; border: 0; transform: scale(.6); transform-origin: 0 0; background: #f5f5f7; }
.sms-preview { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.sms-bubble {
    align-self: flex-start;
    max-width: 92%;
    background: #e9e9eb;
    border-radius: 16px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}
.sms-count { font-size: 12px; font-weight: 500; color: var(--live-text); }
.sms-count.bad { color: #b91c1c; }

.editor-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 24px; }
.editor-foot .hint.error, .editor-foot .error { color: #b91c1c; }
.btn-danger-text { border-color: transparent; color: #b91c1c; background: transparent; }
.btn-danger-text:hover { background: #fee2e2; }

/* ============================================================ Install */

.install-grid { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.install-site { max-width: 420px; }
.install-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.install-head { display: flex; gap: 14px; align-items: flex-start; }
.install-head h2 { margin: 0 0 2px; font-size: 17px; }
.install-head p { margin: 0; }
.install-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--fill); display: flex; align-items: center; justify-content: center; flex: none; color: var(--text-2); }
.install-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.install-option { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.install-option .steps { font-size: 13px; }
.small { font-size: 12px; margin: 0; }
.install-why { border-top: 1px solid var(--line); padding-top: 14px; }
.install-why summary { cursor: pointer; font-weight: 600; }
.install-why p { color: var(--text-2); margin: 10px 0 0; max-width: 760px; }
.install-card .switch { font-size: 13px; }
.install-card .segmented { width: fit-content; }

/* Sessions list paging */
.load-more { display: flex; justify-content: center; padding: 16px; border-top: 1px solid var(--line); }

/* Signed-in account, top right */
.account { display: flex; align-items: center; gap: 10px; margin-left: 4px; }
.account-email { color: var(--text-2); font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .account-email { display: none; } }
.auth-banner { margin: 0; padding: 10px 16px; background: #fef2f2; color: #b91c1c; font-size: 13px; text-align: center; }
