/**
 * Jane's Home (ported from LiveWell Hub 2026-04-19) — Popout Window Framework styles
 *
 * Global chrome for draggable/resizable/dockable floating windows.
 * Aesthetic ported from Hub's mockup and repainted for Home's dark
 * palette: charcoal surfaces, dark chrome, warm-gold accent, DM Serif
 * Display + DM Sans typography. HARDCODED — does NOT alias to theme
 * tokens, because the popout is its own visual surface that should
 * look the same on any theme.
 */

:root {
    /* ─── motion ─── */
    --popout-ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --popout-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --popout-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ─── mockup palette (hardcoded, not themed) ─── */
    --popout-bg-window:      #26262a;
    --popout-bg-cream:       #212127;
    --popout-bg-chart:       #1e1e23;
    --popout-bg-subtle:      #1e1e23;
    --popout-paper-1:        #26262a;
    --popout-paper-2:        #222227;
    --popout-paper-3:        #1e1e23;

    --popout-ink-1:          #e2dfda;
    --popout-ink-2:          #d5d2cc;
    --popout-ink-3:          #a09d96;
    --popout-ink-4:          #747069;
    --popout-ink-5:          #d5d2cc;
    --popout-ink-muted:      #747069;

    --popout-title-bg:       #1a1a1d;
    --popout-title-bg-alt:   #26262a;

    --popout-accent:         #d4b478;   /* coral */
    --popout-accent-soft:    rgba(212, 180, 120, 0.12);
    --popout-accent-deep:    #c4a060;

    --popout-success:        #3a7d5a;
    --popout-success-soft:   #e0ede5;
    --popout-success-live:   #3bd67b;

    --popout-border:         rgba(255, 255, 255, 0.08);
    --popout-border-light:   rgba(255, 255, 255, 0.05);

    --popout-radius:         14px;
    --popout-radius-pill:    999px;

    --popout-shadow-sm:      0 1px 2px rgba(26, 26, 29, 0.06), 0 1px 1px rgba(26, 26, 29, 0.04);
    --popout-shadow-md:      0 4px 16px rgba(26, 26, 29, 0.08), 0 2px 4px rgba(26, 26, 29, 0.04);
    --popout-shadow-lg:      0 24px 60px rgba(26, 26, 29, 0.18), 0 8px 20px rgba(26, 26, 29, 0.10);
    --popout-shadow-focus:   0 28px 80px rgba(26, 26, 29, 0.22), 0 10px 24px rgba(26, 26, 29, 0.12);

    /* ─── fonts ─── */
    --popout-font-display:   'DM Serif Display', ui-serif, Georgia, serif;
    --popout-font-body:      'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --popout-font-mono:      'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

/* ────────── POPOUT WINDOW ────────── */

.popout {
    position: fixed;
    font-family: var(--popout-font-body);
    font-size: 0.875rem;
    color: var(--popout-ink-1);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-radius: calc(var(--popout-radius) + 8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        var(--popout-shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.2);
    padding: 8px;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 320px;
    min-height: 240px;
    z-index: 8000;
    transition:
        box-shadow 220ms var(--popout-ease-out),
        transform 220ms var(--popout-ease-out),
        backdrop-filter 220ms var(--popout-ease-out),
        background 220ms var(--popout-ease-out),
        filter 220ms var(--popout-ease-out);
    will-change: transform;
}

.popout.focused {
    box-shadow: var(--popout-shadow-focus);
    transform: scale(1);
}

/* Unfocused: both popouts dim + scale back slightly.
   No glassmorph/transparency — body stays solid so the
   color-mixed backgrounds are always visible, never flash
   to a different color when focus changes. */
.popout:not(.focused):not(.minimizing) {
    transform: scale(0.985);
    filter: brightness(0.88);
}

.popout.minimizing {
    transition:
        transform 340ms var(--popout-ease-in-out),
        opacity 220ms var(--popout-ease-out),
        left 340ms var(--popout-ease-in-out),
        top 340ms var(--popout-ease-in-out),
        width 340ms var(--popout-ease-in-out),
        height 340ms var(--popout-ease-in-out),
        border-radius 340ms var(--popout-ease-in-out);
    opacity: 0;
    pointer-events: none;
}

.popout.restoring {
    animation: popout-restore 380ms var(--popout-ease-spring);
}

@keyframes popout-restore {
    0% { transform: scale(0.5) translateY(40px); opacity: 0; }
    60% { opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.popout.snap-preview {
    box-shadow: 0 0 0 3px var(--popout-accent), var(--popout-shadow-focus);
}

.popout-title {
    height: 40px;
    background: #1a1a1d;
    color: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 12px 0 16px;
    cursor: grab;
    border-bottom: 1px solid #000;
    flex-shrink: 0;
    position: relative;
    border-radius: var(--popout-radius) var(--popout-radius) 0 0;
}
.popout-title::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent 50%);
    pointer-events: none;
}
.popout-title.dragging { cursor: grabbing; }

.popout-title-dots {
    display: flex;
    gap: 8px;
    margin-right: 12px;
    align-items: center;
}
.popout-title-dots span {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #3a3a3f;
    transition: background 140ms ease, transform 120ms ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    border: 0.5px solid rgba(0, 0, 0, 0.2);
}
.popout-title-dots .dot-close,
.popout-title-dots .dot-min { cursor: pointer; }
.popout.focused .popout-title-dots .dot-close  { background: #ff5f56; }
.popout.focused .popout-title-dots .dot-min    { background: #ffbd2e; }
.popout.focused .popout-title-dots .dot-noop   { background: #27c93f; cursor: default; }

/* Hover glyphs: inline SVG marks drawn inside each dot, only visible
   on hover over the whole dot group (Mac convention). */
.popout-title-dots span::before {
    content: '';
    width: 7px;
    height: 7px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0;
    transition: opacity 100ms ease;
}
.popout-title:hover .popout-title-dots .dot-close::before {
    opacity: 0.72;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 2 L8 8 M8 2 L2 8' stroke='%234c0101' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
.popout-title:hover .popout-title-dots .dot-min::before {
    opacity: 0.72;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cline x1='2' y1='5' x2='8' y2='5' stroke='%23995700' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
.popout-title-dots .dot-close:hover { transform: scale(1.08); }
.popout-title-dots .dot-min:hover { transform: scale(1.08); }

.popout-title-label {
    font-family: var(--popout-font-display);
    font-size: 0.9375rem;
    font-style: italic;
    letter-spacing: 0.01em;
    opacity: 0.92;
    flex: 1;
}
.popout-title-label em {
    color: var(--popout-accent);
    font-style: normal;
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(212, 180, 120, 0.15);
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: 2px;
    letter-spacing: 0.05em;
}

.popout-title-actions {
    display: flex;
    gap: 2px;
}
.popout-title-btn {
    width: 28px; height: 28px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 120ms ease;
    padding: 0;
}
.popout-title-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}
.popout-title-btn.close-btn:hover {
    background: var(--popout-accent);
    color: #ffffff;
}
.popout-title-btn svg { width: 14px; height: 14px; }

.popout-body {
    flex: 1;
    overflow: auto;
    background: var(--popout-bg-window);
    color: var(--popout-ink-1);
    position: relative;
    font-family: var(--popout-font-body);
    border-radius: 0 0 var(--popout-radius) var(--popout-radius);
}

/* Resize handles */
.popout-resize {
    position: absolute;
    background: transparent;
    z-index: 2;
}
.popout-resize-r { right: 0; top: 0; bottom: 8px; width: 6px; cursor: ew-resize; }
.popout-resize-b { left: 0; right: 8px; bottom: 0; height: 6px; cursor: ns-resize; }
.popout-resize-br {
    right: 0; bottom: 0;
    width: 16px; height: 16px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 50%, var(--popout-ink-muted) 50%, var(--popout-ink-muted) 55%, transparent 55%, transparent 65%, var(--popout-ink-muted) 65%, var(--popout-ink-muted) 70%, transparent 70%);
    opacity: 0.4;
}

/* ────────── PILL DOCK ──────────
   All .pill rules below are scoped to .popout-pill-dock because the class
   name is generic — other pages (Studio, activity, etc.) legitimately use
   .pill for their own tag-style components and were being overridden by
   this dock's 220px-wide status widget. 2026-04-20 scope fix. */

.popout-pill-dock {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap-reverse;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 8px;
    z-index: 8500;
    pointer-events: none;
    max-width: min(676px, calc(100vw - 40px));
}

.popout-pill-dock .pill {
    pointer-events: auto;
    background: #1a1a1d;
    color: #ffffff;
    border-radius: 999px;
    height: 40px;
    padding: 0 6px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    animation: pill-in 340ms var(--popout-ease-spring);
    transition: transform 160ms var(--popout-ease-out), box-shadow 160ms ease;
    width: 220px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.06);
    font-family: inherit;
}
.popout-pill-dock .pill:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--popout-shadow-lg);
}
.popout-pill-dock .pill-leaving {
    animation: pill-out 280ms var(--popout-ease-in-out) forwards;
}
@keyframes pill-in {
    0% { transform: translateY(24px) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes pill-out {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(24px) scale(0.7); opacity: 0; }
}

.popout-pill-dock .pill-icon {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--popout-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.popout-pill-dock .pill-phone .pill-icon { background: #3bd67b; }
.popout-pill-dock .pill-scribe .pill-icon { background: var(--popout-accent); }
.popout-pill-dock .pill-icon svg { width: 12px; height: 12px; }

.popout-pill-dock .pill-label {
    font-family: var(--popout-font-display);
    font-size: 0.9375rem;
    font-style: italic;
    opacity: 0.92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.popout-pill-dock .pill-sub {
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.55);
    padding-right: 4px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.popout-pill-dock .pill-close {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.06);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 120ms ease;
    padding: 0;
}
.popout-pill-dock .pill-close:hover { background: var(--popout-accent); }
.popout-pill-dock .pill-close svg { width: 12px; height: 12px; }

/* ────────── SNAP PREVIEW ────────── */

.popout-snap-overlay {
    position: fixed;
    background: rgba(212, 180, 120, 0.14);
    border: 2px solid var(--popout-accent);
    border-radius: 14px;
    pointer-events: none;
    z-index: 7500;
    opacity: 0;
    transition: opacity 140ms ease;
    box-shadow: inset 0 0 40px rgba(212, 180, 120, 0.15);
}
.popout-snap-overlay.visible { opacity: 1; }

/* ────────── CYCLE-FOCUS TOAST ────────── */

.popout-cycle-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    background: rgba(26, 26, 29, 0.92);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    color: #ffffff;
    padding: 18px 28px;
    border-radius: 14px;
    box-shadow: var(--popout-shadow-lg);
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 9500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 140ms ease, transform 200ms var(--popout-ease-out);
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
}
.popout-cycle-toast.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.popout-cycle-toast .kbd {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-weight: 500;
    font-size: 0.6875rem;
    padding: 3px 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    letter-spacing: 0.05em;
}
.popout-cycle-toast .arrow {
    color: var(--popout-accent);
    font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════
   POPOUT BODY CONTENT (scoped to .popout-phone only — never
   bleed into scribe which uses hub theme vars).
   ═══════════════════════════════════════════════════════════ */

.popout-phone .popout-body h1,
.popout-phone .popout-body h2,
.popout-phone .popout-body h3,
.popout-phone .popout-body h4 {
    font-family: var(--popout-font-display);
    font-weight: 400;
    color: var(--text, var(--popout-ink-1));
}
.popout-phone .popout-body .meta-muted {
    font-size: 0.75rem;
    color: var(--text-muted, var(--popout-ink-3));
}
.popout-phone .popout-body .empty-state {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--popout-ink-3));
    font-style: italic;
    padding: 20px;
    text-align: center;
}
.popout-phone .popout-body .btn {
    padding: 8px 14px;
    border: 1px solid var(--border, var(--popout-border));
    background: var(--bg-2, var(--popout-paper-1));
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text, var(--popout-ink-1));
    cursor: pointer;
    transition: all 140ms ease;
}
.popout-phone .popout-body .btn:hover {
    border-color: var(--text-muted, var(--popout-ink-3));
    background: var(--bg-3, var(--popout-paper-2));
}
.popout-phone .popout-body .btn-primary {
    background: var(--primary, var(--popout-ink-1));
    color: #fff;
    border-color: var(--primary, var(--popout-ink-1));
}
.popout-phone .popout-body .btn-primary:hover {
    background: var(--popout-accent);
    border-color: var(--popout-accent);
}

/* ─── PHONE POPOUT BODY ─── */

.popout-phone .popout-body {
    background: var(--popout-bg-window);
}

.phone-tab-bar {
    display: flex;
    gap: 2px;
    padding: 10px 12px 0;
    background: var(--bg-2, var(--popout-paper-2));
    border-bottom: 1px solid var(--border, var(--popout-border));
}
.phone-tab {
    padding: 9px 14px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted, var(--popout-ink-3));
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 140ms ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.phone-tab:hover { color: var(--text, var(--popout-ink-1)); }
.phone-tab.active {
    color: var(--text, var(--popout-ink-1));
    border-bottom-color: var(--primary, var(--popout-accent));
}
.phone-tab-badge {
    background: var(--popout-accent);
    color: #fff;
    font-family: var(--popout-font-mono);
    font-size: 0.5625rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 8px;
    letter-spacing: 0;
}
.phone-tab .live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--popout-success-live);
    animation: popout-pulse-green 1.8s infinite ease-in-out;
}
@keyframes popout-pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.phone-tab-pane { display: none; background: var(--popout-bg-window); }
.phone-tab-pane.active { display: block; }

.phone-active {
    padding: 28px 24px;
    text-align: center;
    background: linear-gradient(180deg, #1a1a1d, #26262a);
    color: #ffffff;
    border-bottom: 1px solid #000;
}
.phone-active .avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--popout-accent), var(--popout-accent-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--popout-font-display);
    font-style: italic;
    font-size: 1.625rem;
    margin: 0 auto 12px;
    box-shadow: 0 8px 24px rgba(212, 180, 120, 0.3);
    color: #fff;
}
.phone-active .name {
    font-family: var(--popout-font-display);
    font-size: 1.375rem;
    font-style: italic;
    margin-bottom: 2px;
}
.phone-active .sub {
    font-size: 0.6875rem;
    color: #9a9aa0;
    font-family: var(--popout-font-mono);
    letter-spacing: 0.04em;
}
.phone-active .timer {
    margin-top: 14px;
    font-family: var(--popout-font-mono);
    font-size: 1.125rem;
    letter-spacing: 0.04em;
    color: var(--popout-success-live);
}
.phone-active .timer-dot {
    display: inline-block;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--popout-success-live);
    margin-right: 6px;
    vertical-align: 2px;
    animation: popout-pulse-green 1.8s infinite ease-in-out;
}
.phone-call-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}
.call-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 160ms ease;
}
.call-btn:hover { background: rgba(255,255,255,0.16); transform: translateY(-1px); }
.call-btn.hangup { background: var(--popout-accent); border-color: var(--popout-accent); }
.call-btn.hangup:hover { background: var(--popout-accent-deep); }
.call-btn svg { width: 18px; height: 18px; }

.call-idle {
    padding: 40px 24px;
    text-align: center;
    color: var(--popout-ink-3);
}
.call-idle .big-icon {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--popout-paper-3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--popout-ink-3);
}
.call-idle .big-icon svg { width: 26px; height: 26px; }
.call-idle .idle-title {
    font-family: var(--popout-font-display);
    font-size: 1.125rem;
    font-style: italic;
    color: var(--popout-ink-1);
    margin-bottom: 4px;
}
.call-idle .idle-sub {
    font-size: 0.75rem;
    color: var(--popout-ink-3);
}

/* SMS conversation list */
.sms-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--popout-border);
    background: var(--popout-bg-window);
}
.sms-search svg {
    width: 14px; height: 14px;
    color: var(--popout-ink-3);
    flex-shrink: 0;
}
.sms-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--popout-ink-1);
    outline: none;
}
.sms-search input::placeholder { color: var(--popout-ink-4); }
.sms-new-btn {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--popout-ink-1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 140ms ease;
}
.sms-new-btn:hover { background: var(--popout-accent); }
.sms-new-btn svg { width: 14px; height: 14px; }

.sms-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sms-thread {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--popout-border);
    cursor: pointer;
    transition: background 120ms ease;
    position: relative;
}
.sms-thread:hover { background: var(--popout-paper-2); }
.sms-thread.unread { background: linear-gradient(90deg, rgba(212, 180, 120, 0.04), transparent 30%); }
.sms-thread.unread .sms-name { color: var(--popout-ink-1); font-weight: 600; }
.sms-thread.unread .sms-preview { color: var(--popout-ink-2); font-weight: 500; }

.sms-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--popout-font-display);
    font-style: italic;
    font-size: 0.9375rem;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4a4f5a, #1a1e28);
}
.sms-avatar[data-color="coral"] { background: linear-gradient(135deg, #d4b478, #c4a060); }
.sms-avatar[data-color="dusk"]  { background: linear-gradient(135deg, #5e6b8a, #2d3448); }
.sms-avatar[data-color="sage"]  { background: linear-gradient(135deg, #6a8c6e, #3a5b40); }
.sms-avatar[data-color="plum"]  { background: linear-gradient(135deg, #7a4e6e, #4a2d42); }
.sms-avatar-sys {
    background: var(--popout-paper-3);
    color: var(--popout-ink-3);
}
.sms-avatar-sys svg { width: 16px; height: 16px; }

.sms-thread-body {
    flex: 1;
    min-width: 0;
}
.sms-thread-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.sms-name {
    font-size: 0.8125rem;
    color: var(--popout-ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sms-time {
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    color: var(--popout-ink-3);
    flex-shrink: 0;
}
.sms-preview {
    font-size: 0.75rem;
    color: var(--popout-ink-3);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sms-unread-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--popout-accent);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Thread view (open conversation inside popout) */
.sms-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--popout-border);
    background: var(--popout-paper-2);
    flex-shrink: 0;
}
.sms-back-btn {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--popout-ink-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease;
    padding: 0;
    flex-shrink: 0;
}
.sms-back-btn:hover { background: var(--popout-paper-3); }
.sms-back-btn svg { width: 16px; height: 16px; }
.sms-thread-header-body {
    flex: 1;
    min-width: 0;
}
.sms-thread-header-name {
    font-family: var(--popout-font-display);
    font-size: 1.0625rem;
    font-style: italic;
    color: var(--popout-ink-1);
    line-height: 1.2;
}
.sms-thread-header-number {
    font-family: var(--popout-font-mono);
    font-size: 0.6875rem;
    color: var(--popout-ink-3);
    margin-top: 1px;
}

.sms-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--popout-bg-window);
    min-height: 0;
}
.sms-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.8125rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.sms-bubble.in {
    background: var(--popout-paper-3);
    color: var(--popout-ink-1);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.sms-bubble.out {
    background: var(--popout-ink-1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.sms-bubble.pending { opacity: 0.65; }
.sms-bubble.failed { border: 1px solid var(--popout-accent); }
.sms-bubble-body { white-space: pre-wrap; }
.sms-bubble-meta {
    font-family: var(--popout-font-mono);
    font-size: 0.5625rem;
    margin-top: 3px;
    opacity: 0.65;
}
.sms-bubble.out .sms-bubble-meta { color: rgba(255,255,255,0.8); }

.sms-compose {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 12px;
    background: var(--popout-paper-2);
    border-top: 1px solid var(--popout-border);
    flex-shrink: 0;
}
.sms-compose textarea {
    flex: 1;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 10px;
    border: 1px solid var(--popout-border);
    border-radius: 18px;
    background: var(--popout-bg-window);
    color: var(--popout-ink-1);
    font-family: inherit;
    font-size: 0.8125rem;
    resize: none;
    outline: none;
    line-height: 1.4;
}
.sms-compose textarea:focus {
    border-color: var(--popout-accent);
    box-shadow: 0 0 0 2px rgba(212, 180, 120, 0.15);
}
.sms-compose textarea::placeholder { color: var(--popout-ink-4); }
.sms-send-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--popout-ink-1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 140ms ease, transform 140ms ease;
}
.sms-send-btn:hover { background: var(--popout-accent); transform: scale(1.05); }
.sms-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.sms-send-btn svg { width: 14px; height: 14px; }
.sms-compose-status {
    padding: 4px 14px 8px;
    font-size: 0.6875rem;
    color: var(--popout-accent);
    background: var(--popout-paper-2);
    min-height: 16px;
}

/* Make the messages tab pane a flex column so the thread view
   can fill available height (header + messages + compose stack). */
.phone-tab-pane[data-phone-pane="messages"] {
    height: 100%;
    display: none;
}
.phone-tab-pane[data-phone-pane="messages"].active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--popout-bg-window);
}
.phone-tab-pane[data-phone-pane="messages"] [data-sub-view="list"],
.phone-tab-pane[data-phone-pane="messages"] [data-sub-view="compose-new"] {
    flex: 1;
    overflow-y: auto;
}
.phone-tab-pane[data-phone-pane="messages"] [data-sub-view="thread"] {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* Phone: 50/50 mix with a deep teal — clean, medical, clearly
   not the dashboard and not shit-colored. */
.popout-phone .popout-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: color-mix(in srgb, var(--bg, #1a1a1f) 50%, #0a2e2e);
    color: var(--text, #e5e5e7);
}

/* ═══════════════════════════════════════════════════════════
   SCRIBE POPOUT — uses the hub's own dark theme inside the body
   The scribe content loaded via /scribe _partial=1 is server-
   rendered with hub CSS vars (--bg, --text, --primary etc). Rather
   than fight that, let the body use those variables so real scribe
   content looks native inside the popout. The title bar + pill
   keep the mockup chrome.
   ═══════════════════════════════════════════════════════════ */

/* Scribe: 50/50 mix with a rich indigo so it's unmistakably
   different — not a subtle tint, a real color shift. */
.popout-scribe .popout-body {
    background: color-mix(in srgb, var(--bg, #1a1a1f) 50%, #1a0a3e);
    color: var(--text, #e5e5e7);
    font-family: 'DM Sans', -apple-system, sans-serif;
    padding: 14px;
}
.popout-scribe .popout-body * {
    font-family: inherit;
}
.popout-scribe:not(.focused):not(.minimizing) .popout-body {
    background: color-mix(in srgb, var(--bg, #1a1a1f) 50%, #1a0a3e);
    opacity: 0.92;
}

/* Pill icon for scribe stays coral per mockup */
.pill-scribe .pill-icon { background: var(--popout-accent); }

/* ─── Thread header call button ─── */
.sms-thread-call-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--popout-success);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 120ms ease, background 140ms ease;
}
.sms-thread-call-btn:hover { transform: scale(1.08); background: #2e5f45; }
.sms-thread-call-btn svg { width: 16px; height: 16px; }

/* ═══════════════ CALL TAB DIALER ═══════════════ */

.call-dialer {
    padding: 18px 22px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    position: relative;
}

.dialer-display {
    width: 100%;
    padding: 10px 4px;
    border: none;
    border-bottom: 2px solid var(--popout-border);
    background: transparent;
    color: var(--popout-ink-1);
    font-family: var(--popout-font-mono);
    font-size: 1.375rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.04em;
    outline: none;
    transition: border-color 140ms ease;
}
.dialer-display:focus { border-bottom-color: var(--popout-accent); }
.dialer-display::placeholder {
    color: var(--popout-ink-4);
    font-weight: 400;
    letter-spacing: 0;
    font-family: var(--popout-font-body);
}

.dialer-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.dial-key {
    height: 54px;
    border: 1px solid var(--popout-border);
    background: var(--popout-paper-2);
    border-radius: 10px;
    font-family: var(--popout-font-body);
    font-size: 1.375rem;
    font-weight: 500;
    color: var(--popout-ink-1);
    cursor: pointer;
    transition: all 120ms ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    line-height: 1;
    user-select: none;
}
.dial-key:hover {
    background: var(--popout-paper-3);
    border-color: var(--popout-ink-4);
    transform: scale(1.02);
}
.dial-key:active { transform: scale(0.98); }
.dial-key-sub {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
    color: var(--popout-ink-3);
    margin-top: 3px;
    font-weight: 500;
}

.dialer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.dial-btn {
    flex: 1;
    height: 42px;
    border: 1px solid var(--popout-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 140ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    color: var(--popout-ink-1);
    background: var(--popout-paper-2);
}
.dial-btn-backspace {
    flex: 0 0 42px;
    padding: 0;
    color: var(--popout-ink-3);
}
.dial-btn-backspace:hover { background: var(--popout-paper-3); color: var(--popout-ink-1); }
.dial-btn-oliver {
    background: var(--popout-ink-1);
    color: #fff;
    border-color: var(--popout-ink-1);
}
.dial-btn-oliver:hover { background: var(--popout-accent); border-color: var(--popout-accent); }
.dial-btn-self {
    background: var(--popout-success);
    color: #fff;
    border-color: var(--popout-success);
}
.dial-btn-self:hover { background: #2e5f45; }

/* Call confirm panel (slides in over dialer after choosing Oliver/self) */
.call-confirm {
    position: absolute;
    inset: 0;
    background: var(--popout-paper-2);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
}
.call-confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.call-confirm-mode {
    font-family: var(--popout-font-display);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--popout-ink-1);
    line-height: 1.1;
}
.call-confirm-target {
    font-family: var(--popout-font-mono);
    font-size: 0.75rem;
    color: var(--popout-ink-3);
    margin-top: 2px;
}
.call-purpose {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--popout-border);
    border-radius: 8px;
    background: var(--popout-bg-window);
    color: var(--popout-ink-1);
    font-family: inherit;
    font-size: 0.8125rem;
    resize: vertical;
    outline: none;
    line-height: 1.4;
    min-height: 72px;
}
.call-purpose:focus {
    border-color: var(--popout-accent);
    box-shadow: 0 0 0 2px rgba(212, 180, 120, 0.15);
}
.call-confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.call-confirm-actions .btn { flex: 1; height: 40px; }
.call-confirm-status {
    font-size: 0.75rem;
    color: var(--popout-accent);
    min-height: 16px;
    text-align: center;
}

/* History tab */
.history-chip {
    padding: 4px 10px;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid var(--popout-border);
    background: var(--popout-bg-window);
    color: var(--popout-ink-3);
    cursor: pointer;
    transition: all 140ms ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.history-chip:hover { background: var(--popout-paper-2); color: var(--popout-ink-1); }
.history-chip.active { background: var(--popout-ink-1); color: #fff; border-color: var(--popout-ink-1); }
.recent-item .call-duration {
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    color: var(--popout-ink-4);
    margin-left: 4px;
}
.recent-item .call-outcome {
    font-size: 0.5625rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
}
.call-outcome.missed { background: var(--popout-accent-soft); color: var(--popout-accent); }
.call-outcome.voicemail { background: var(--popout-success-soft); color: var(--popout-success); }
.call-outcome.completed { background: var(--popout-paper-3); color: var(--popout-ink-3); }
.phone-recent { padding: 8px 0; }
.phone-recent-head {
    padding: 10px 20px 6px;
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--popout-ink-3);
}
.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 120ms ease;
}
.recent-item:hover { background: var(--popout-paper-2); }
.recent-item .caller {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--popout-ink-1);
    font-weight: 500;
}
.recent-item .caller .num {
    display: block;
    font-family: var(--popout-font-mono);
    font-size: 0.6875rem;
    color: var(--popout-ink-3);
    font-weight: 400;
    margin-top: 1px;
}
.recent-item .dir {
    width: 22px; height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    flex-shrink: 0;
}
.dir.in  { background: var(--popout-success-soft); color: var(--popout-success); }
.dir.out { background: var(--popout-accent-soft); color: var(--popout-accent-deep); }
.dir.mis { background: rgba(212, 180, 120, 0.18); color: var(--popout-accent); }
.recent-item .when {
    font-family: var(--popout-font-mono);
    font-size: 0.625rem;
    color: var(--popout-ink-3);
}

/* ─── PHONE TOPBAR LAUNCHER BUTTON ─── */

.phone-topbar-btn {
    height: 32px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    position: relative;
    transition: all 140ms var(--popout-ease-out);
}
.phone-topbar-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
}
.phone-topbar-btn svg {
    width: 16px; height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
.phone-topbar-btn.state-ringing { background: var(--popout-accent); color: #fff; border-color: var(--popout-accent); animation: popout-ring 1.2s infinite; }
.phone-topbar-btn.state-active { background: var(--popout-success); color: #fff; border-color: var(--popout-success); }
@keyframes popout-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 180, 120, 0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(212, 180, 120, 0); }
}
.phone-topbar-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--popout-accent);
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    font-family: var(--popout-font-mono);
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-2, #1a1a1d);
}
.phone-topbar-badge.visible { display: flex; }
