:root {
    --paper: #FAFAF7;
    --surface: #FFFFFF;
    --surface-2: #F4F3EE;
    --surface-sunken: #F0EFEA;
    --surface-hover: #F6F5F0;
    --ink-1: #111110;
    --ink-2: #3B3A37;
    --ink-3: #73726C;
    --ink-4: #A3A29B;
    --ink-5: #C9C7BF;
    --rule-1: #E8E6E0;
    --rule-2: #DCDAD1;
    --rule-3: #111110;
    --accent: #3567B7;
    --accent-hover: #244F96;
    --accent-soft: #F0F5FF;
    --accent-border: #C5D5F2;
    --accent-ink: #1F4B8F;
    --ok: #2A8A6A;
    --ok-soft: #EEF8F3;
    --ok-border: #C8E6D9;
    --ok-ink: #256B52;
    --warn: #B98523;
    --warn-soft: #FCF6E8;
    --warn-border: #E9D7A8;
    --warn-ink: #805D18;
    --alert: #B05A43;
    --alert-soft: #FCF1ED;
    --alert-border: #E6C9BF;
    --alert-ink: #87402E;
    --neutral-chip: #EFEEE8;
    --bg-page: var(--paper);
    --bg-card: var(--surface);
    --bg-raised: var(--surface);
    --bg-inset: var(--surface-2);
    --border-subtle: var(--rule-1);
    --border-strong: var(--rule-2);
    --text-primary: var(--ink-1);
    --text-secondary: var(--ink-2);
    --text-muted: var(--ink-3);
    --text-on-primary: #FFFFFF;
    --primary: var(--ink-1);
    --primary-strong: #000000;
    --primary-stronger: #000000;
    --primary-rgb: 17, 17, 16;
    --secondary: #5F7D6F;
    --accent-reject: var(--alert);
    --status-optimal-bg: var(--ok-soft);
    --status-optimal-text: var(--ok-ink);
    --status-suboptimal-bg: var(--warn-soft);
    --status-suboptimal-text: var(--warn-ink);
    --status-critical-bg: var(--alert-soft);
    --status-critical-text: var(--alert-ink);
    --status-critical-rgb: 176, 90, 67;
    --status-unknown-bg: var(--neutral-chip);
    --status-unknown-text: var(--ink-2);
    --chart-optimal: var(--ok);
    --chart-suboptimal: var(--warn);
    --chart-critical: var(--alert);
    --surface-cinema: #1E1C1A;
    --font-family-base: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: var(--font-family-base);
    --font-family-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* State utilities must win over component display rules because compiled Tailwind loads before this file. */
.hidden,
[hidden] {
    display: none !important;
}

        @layer base {
            html {
                font-family: var(--font-family-base);
            }

            body {
                margin: 0;
                padding: 0;
                background-color: var(--bg-page);
                color: var(--text-primary);
                font-variant-numeric: tabular-nums;
                font-family: var(--font-family-base);
            }

            button,
            input,
            select,
            textarea {
                font-family: var(--font-family-heading);
            }

            button {
                letter-spacing: 0.015em;
            }
        }

        @layer components {
            .saa-page {
                background-color: var(--bg-page);
                color: var(--text-primary);
                min-height: 100vh;
            }

            .saa-panel,
            .saa-card {
                background-color: var(--bg-card);
                border: 1px solid var(--border-subtle);
                border-radius: 6px;
                box-shadow: none;
                transition: box-shadow 150ms ease;
            }

            .saa-card:hover {
                box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
            }

            .saa-panel-header {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 16px;
                padding: 16px 24px;
                border-bottom: 1px solid var(--border-subtle);
            }

            .saa-title-h1 {
                font-size: 22px;
                line-height: 28px;
                font-weight: 500;
                letter-spacing: 0;
            }

            .saa-title-h2 {
                font-size: 16px;
                line-height: 22px;
                font-weight: 500;
                letter-spacing: 0;
            }

            .saa-title-h3 {
                font-size: 14px;
                line-height: 20px;
                font-weight: 600;
            }

            .saa-overline {
                font-size: 10.5px;
                line-height: 13px;
                font-weight: 500;
                letter-spacing: 0.08em;
                text-transform: uppercase;
                color: var(--text-muted);
            }

            .saa-btn {
                --saa-btn-bg: var(--bg-card);
                --saa-btn-border: var(--border-strong);
                --saa-btn-color: var(--text-primary);
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 6px;
                min-height: 30px;
                padding: 0 12px;
                border-radius: 4px;
                font-size: 12.5px;
                line-height: 1;
                font-weight: 500;
                font-family: var(--font-family-heading);
                letter-spacing: 0;
                border: 1px solid var(--saa-btn-border);
                background-color: var(--saa-btn-bg);
                color: var(--saa-btn-color);
                cursor: pointer;
                box-shadow: none;
                text-decoration: none;
                transition: background 90ms ease, border-color 90ms ease, color 90ms ease, box-shadow 90ms ease;
            }

            .saa-btn:hover:not(:disabled) {
                background-color: var(--bg-inset);
            }

            .saa-btn.sm {
                min-height: 26px;
                padding: 0 9px;
                font-size: 12px;
            }

            .saa-btn.saa-btn-primary {
                --saa-btn-bg: var(--primary);
                --saa-btn-border: var(--primary);
                --saa-btn-color: var(--text-on-primary);
                background-color: var(--primary) !important;
                color: var(--text-on-primary) !important;
                border-color: var(--primary) !important;
                box-shadow: none;
            }

            .saa-btn.saa-btn-primary:hover:not(:disabled) {
                --saa-btn-bg: var(--primary-strong);
                --saa-btn-border: var(--primary-strong);
                background-color: var(--primary-strong) !important;
                border-color: var(--primary-strong) !important;
                box-shadow: none;
            }

            .saa-btn.saa-btn-primary:active:not(:disabled) {
                --saa-btn-bg: var(--primary-stronger);
                --saa-btn-border: var(--primary-stronger);
                background-color: var(--primary-stronger) !important;
                border-color: var(--primary-stronger) !important;
                box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
            }

            .saa-btn.saa-btn-secondary {
                --saa-btn-bg: var(--bg-card);
                --saa-btn-border: var(--border-strong);
                --saa-btn-color: var(--text-primary);
                background-color: var(--bg-card);
                color: var(--text-primary);
            }

            .saa-btn.saa-btn-secondary:hover:not(:disabled) {
                --saa-btn-bg: var(--bg-inset);
                --saa-btn-border: var(--border-strong);
                background-color: var(--bg-inset);
                border-color: var(--border-strong);
                box-shadow: none;
            }

            .saa-btn.saa-btn-secondary:active:not(:disabled) {
                box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
            }

            .saa-btn-ghost {
                background-color: transparent;
                color: var(--text-secondary);
                border-color: transparent;
                box-shadow: none;
            }

            .saa-btn-ghost:hover:not(:disabled) {
                background-color: var(--bg-inset);
                border-color: var(--border-strong);
                color: var(--text-primary);
                box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
            }

            .saa-btn:disabled,
            .saa-btn[aria-disabled="true"] {
                opacity: 0.6;
                cursor: not-allowed;
            }

            .saa-input,
            .saa-select,
            .saa-textarea {
                background-color: var(--bg-card);
                border: 1px solid var(--border-strong);
                border-radius: 4px;
                padding: 0 10px;
                font-size: 12.5px;
                line-height: 18px;
                font-family: var(--font-family-heading);
                font-weight: 500;
                letter-spacing: 0;
                color: var(--text-primary);
                min-height: 32px;
            }

            textarea.saa-input,
            .saa-textarea {
                padding-top: 9px;
                padding-bottom: 9px;
                line-height: 20px;
            }

            .saa-select {
                font-weight: 500;
                appearance: none;
                -webkit-appearance: none;
                -moz-appearance: none;
                background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
                background-repeat: no-repeat;
                background-position: right 12px center;
                background-size: 16px;
                padding-right: 40px;
            }

            .saa-control-text {
                font-family: var(--font-family-heading);
                font-weight: 500;
                font-size: 12.5px;
                line-height: 18px;
                letter-spacing: 0;
            }

            .saa-input::placeholder,
            .saa-textarea::placeholder {
                color: var(--text-muted);
            }

            .saa-input:focus-visible,
            .saa-select:focus-visible,
            .saa-textarea:focus-visible,
            .saa-btn:focus-visible,
            .saa-link:focus-visible {
                outline: none;
                box-shadow: 0 0 0 2px var(--accent);
            }

            .saa-pill {
                position: relative;
                display: inline-flex;
                align-items: center;
                gap: 6px;
                padding: 4px 12px 4px 24px;
                border-radius: 9999px;
                font-size: 12px;
                line-height: 18px;
                font-weight: 600;
                white-space: nowrap;
            }

            .saa-pill::before {
                content: '';
                position: absolute;
                left: 10px;
                top: 50%;
                width: 8px;
                height: 8px;
                border-radius: 9999px;
                background-color: currentColor;
                transform: translateY(-50%);
            }

            .saa-pill-optimal {
                background-color: var(--status-optimal-bg);
                color: var(--status-optimal-text);
            }

            .saa-pill-suboptimal {
                background-color: var(--status-suboptimal-bg);
                color: var(--status-suboptimal-text);
            }

            .saa-pill-critical {
                background-color: var(--status-critical-bg);
                color: var(--status-critical-text);
            }

            .saa-pill-unknown {
                background-color: var(--status-unknown-bg);
                color: var(--status-unknown-text);
            }

            .saa-pill-pulse {
                animation: saaPillPulse 520ms cubic-bezier(.2, .8, .2, 1) 1;
            }

            .saa-data-value {
                font-family: var(--font-family-mono);
                font-variant-numeric: tabular-nums;
                letter-spacing: 0.02em;
            }

            .saa-header {
                background-color: rgba(255, 255, 255, 0.95);
                backdrop-filter: blur(10px);
                box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
                position: static;
            }

            .saa-chat-scroll {
                max-height: 420px;
            }

            .saa-typing-dot-delay-1 {
                animation-delay: 0.1s;
            }

            .saa-typing-dot-delay-2 {
                animation-delay: 0.2s;
            }

            .saa-chat-expanded {
                position: fixed;
                top: 16px;
                right: 16px;
                bottom: 16px;
                width: min(92vw, 640px);
                height: calc(100vh - 32px);
                z-index: 60;
                box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
            }

            .saa-chat-expanded .saa-chat-scroll {
                max-height: none;
            }

            .saa-interactive {
                cursor: pointer;
                transition: background-color 130ms cubic-bezier(.2, .8, .2, 1),
                    border-color 130ms cubic-bezier(.2, .8, .2, 1),
                    box-shadow 130ms cubic-bezier(.2, .8, .2, 1),
                    color 130ms cubic-bezier(.2, .8, .2, 1);
            }

            .saa-interactive:hover {
                background-color: var(--bg-raised);
                border-color: var(--border-strong);
                box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
            }

            .saa-interactive:active {
                box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
            }

            .saa-interactive:focus-visible {
                outline: none;
                box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.3);
            }

            .saa-skeleton {
                position: relative;
                overflow: hidden;
                border-radius: 12px;
                background-color: var(--bg-inset);
            }

            .saa-skeleton::after {
                content: '';
                position: absolute;
                inset: 0;
                background: linear-gradient(90deg,
                        rgba(255, 255, 255, 0) 0%,
                        rgba(255, 255, 255, 0.65) 50%,
                        rgba(255, 255, 255, 0) 100%);
                transform: translateX(-100%);
                animation: saaShimmer 1.2s ease-in-out infinite;
            }

            .saa-image-frame {
                position: relative;
                overflow: hidden;
                border-radius: 16px;
                background-color: var(--bg-inset);
            }

            .saa-cinema-frame {
                background-color: var(--surface-cinema);
            }

            .saa-image-overlay {
                position: absolute;
                inset: 0;
                background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
                pointer-events: none;
            }

            .saa-stepper {
                display: flex;
                flex-wrap: wrap;
                gap: 12px;
            }

            .saa-step {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                font-size: 12px;
                line-height: 18px;
                font-weight: 600;
                color: var(--text-muted);
            }

            .saa-step::before {
                content: '';
                width: 8px;
                height: 8px;
                border-radius: 9999px;
                background-color: var(--border-strong);
            }

            .saa-step.is-complete {
                color: var(--text-secondary);
            }

            .saa-step.is-complete::before {
                background-color: var(--primary);
            }

            .saa-step.is-active {
                color: var(--text-primary);
            }

            .saa-step.is-active::before {
                background-color: var(--primary);
                box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
            }

            .saa-step.is-error {
                color: var(--status-critical-text);
            }

            .saa-step.is-error::before {
                background-color: var(--status-critical-text);
                box-shadow: 0 0 0 3px rgba(var(--status-critical-rgb), 0.2);
            }

            .saa-auth-page {
                position: relative;
                overflow: hidden;
                background:
                    radial-gradient(circle at 14% 18%, rgba(var(--primary-rgb), 0.1), transparent 24%),
                    radial-gradient(circle at 82% 14%, rgba(13, 148, 136, 0.07), transparent 22%),
                    linear-gradient(180deg, #f7fbff 0%, #eef4fa 48%, #e7eef5 100%);
            }

            .saa-auth-ambient,
            .saa-auth-beam {
                position: absolute;
                inset: 0;
                pointer-events: none;
            }

            .saa-auth-ambient {
                background:
                    linear-gradient(rgba(15, 23, 42, 0.018) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(15, 23, 42, 0.018) 1px, transparent 1px);
                background-size: 140px 140px;
                mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 82%);
            }

            .saa-auth-beam {
                inset: auto;
                top: 50%;
                right: -10rem;
                width: min(42rem, 88vw);
                height: 28rem;
                transform: translateY(-50%);
                border-radius: 9999px;
                background:
                    radial-gradient(circle at 28% 50%, rgba(var(--primary-rgb), 0.12), rgba(var(--primary-rgb), 0.02) 54%, transparent 72%),
                    radial-gradient(circle at 70% 50%, rgba(13, 148, 136, 0.08), transparent 46%);
                filter: blur(42px);
                opacity: 0.85;
                animation: saaFloat 16s ease-in-out infinite;
            }

            .saa-auth-shell {
                position: relative;
                z-index: 1;
                min-height: 100vh;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 32px 20px;
            }

            .saa-auth-card {
                position: relative;
                overflow: hidden;
                width: min(29.5rem, 100%);
                display: flex;
                flex-direction: column;
                gap: 26px;
                padding: 44px 38px 36px;
                border-radius: 32px;
                border: 1px solid rgba(148, 163, 184, 0.2);
                background: rgba(255, 255, 255, 0.88);
                backdrop-filter: blur(18px);
                box-shadow:
                    0 34px 74px -48px rgba(15, 23, 42, 0.34),
                    0 16px 30px -24px rgba(15, 23, 42, 0.22);
                animation: fadeIn 180ms ease-out;
            }

            .saa-auth-card::before {
                content: "";
                position: absolute;
                inset: 0 0 auto 0;
                height: 1px;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
            }

            .saa-auth-card::after {
                content: "";
                position: absolute;
                right: -4rem;
                top: -4rem;
                width: 16rem;
                height: 16rem;
                border-radius: 9999px;
                background: radial-gradient(circle, rgba(13, 148, 136, 0.08), transparent 64%);
                filter: blur(18px);
                pointer-events: none;
            }

            .saa-auth-brand {
                display: flex;
                align-items: center;
                gap: 14px;
                position: relative;
                z-index: 1;
            }

            .saa-auth-logo {
                width: 54px;
                height: 54px;
                border-radius: 18px;
                object-fit: contain;
                background: rgba(255, 255, 255, 0.92);
                border: 1px solid rgba(148, 163, 184, 0.18);
                padding: 7px;
                box-shadow: 0 12px 24px -20px rgba(15, 23, 42, 0.16);
            }

            .saa-auth-mark {
                width: 54px;
                height: 54px;
                border-radius: 18px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                color: var(--text-on-primary);
                background: linear-gradient(145deg, var(--primary), var(--secondary));
                box-shadow:
                    0 18px 34px -24px rgba(var(--primary-rgb), 0.92),
                    inset 0 1px 0 rgba(255, 255, 255, 0.24);
            }

            .saa-auth-brand-name {
                margin: 0;
                font-family: "Manrope", var(--font-family-heading);
                font-size: 17px;
                line-height: 20px;
                font-weight: 800;
                letter-spacing: -0.03em;
                color: var(--text-primary);
                max-width: 18ch;
            }

            .saa-auth-copy {
                display: flex;
                flex-direction: column;
                gap: 10px;
                position: relative;
                z-index: 1;
            }

            .saa-auth-title {
                margin: 0;
                font-family: "Manrope", var(--font-family-heading);
                font-size: clamp(3rem, 8vw, 3.6rem);
                line-height: 0.88;
                font-weight: 800;
                letter-spacing: -0.05em;
                color: var(--text-primary);
                text-wrap: balance;
            }

            .saa-auth-subtitle {
                margin: 0;
                color: var(--text-secondary);
                font-size: 14.5px;
                line-height: 22px;
                max-width: 28ch;
            }

            .saa-auth-alert {
                position: relative;
                z-index: 1;
                padding: 14px 15px;
                border-radius: 16px;
                border: 1px solid rgba(185, 28, 28, 0.12);
                background: rgba(254, 242, 242, 0.96);
                color: var(--status-critical-text);
                font-size: 14px;
                line-height: 20px;
                font-weight: 600;
            }

            .saa-auth-form {
                display: flex;
                flex-direction: column;
                gap: 20px;
                position: relative;
                z-index: 1;
            }

            .saa-auth-field {
                display: flex;
                flex-direction: column;
                gap: 8px;
            }

            .saa-auth-field .saa-overline {
                color: var(--text-muted);
            }

            .saa-auth-field .saa-input {
                min-height: 56px;
                padding: 15px 16px;
                border-radius: 16px;
                border: 1px solid rgba(148, 163, 184, 0.28);
                background: rgba(248, 250, 252, 0.96);
                box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.72);
                color: var(--text-primary);
                font-size: 15px;
            }

            .saa-auth-field .saa-input::placeholder {
                color: #94a3b8;
                font-weight: 500;
            }

            .saa-auth-field .saa-input:focus-visible {
                outline: none;
                border-color: rgba(var(--primary-rgb), 0.62);
                box-shadow:
                    0 0 0 4px rgba(var(--primary-rgb), 0.12),
                    inset 0 1px 1px rgba(255, 255, 255, 0.8);
            }

            .saa-auth-form .saa-btn.saa-btn-primary {
                min-height: 56px;
                margin-top: 2px;
                border-radius: 16px;
                font-size: 16px;
                font-weight: 700;
                letter-spacing: 0;
                background: linear-gradient(135deg, var(--primary), var(--primary-strong)) !important;
                border-color: rgba(var(--primary-rgb), 0.24) !important;
                box-shadow: 0 16px 28px -20px rgba(var(--primary-rgb), 0.48) !important;
            }

            .saa-auth-form .saa-btn.saa-btn-primary:hover:not(:disabled) {
                background: linear-gradient(135deg, var(--primary-strong), var(--primary-stronger)) !important;
                transform: translateY(-1px);
                box-shadow: 0 18px 30px -20px rgba(var(--primary-rgb), 0.54) !important;
            }

            .saa-auth-form .saa-btn.saa-btn-primary:active:not(:disabled) {
                transform: translateY(0);
                box-shadow: 0 12px 20px -16px rgba(var(--primary-rgb), 0.75) !important;
            }

        @media (max-width: 640px) {
                .saa-auth-shell {
                    align-items: flex-start;
                    padding: 18px 14px 26px;
                }

                .saa-auth-card {
                    gap: 22px;
                    padding: 30px 22px 24px;
                    border-radius: 24px;
                }

                .saa-auth-logo,
                .saa-auth-mark {
                    width: 48px;
                    height: 48px;
                    border-radius: 16px;
                }

                .saa-auth-title {
                    font-size: clamp(2.6rem, 14vw, 3rem);
                }
            }

            .saa-demo-hover {
                background-color: var(--primary-strong);
                border-color: var(--primary-strong);
                color: var(--text-on-primary);
            }

            .saa-demo-focus {
                box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.3);
            }

            .saa-app-shell {
                display: flex;
                min-height: 100vh;
                background: var(--paper);
                color: var(--ink-1);
            }

            .saa-rail {
                width: 224px;
                flex: 0 0 224px;
                min-height: 100vh;
                position: sticky;
                top: 0;
                align-self: flex-start;
                display: flex;
                flex-direction: column;
                border-right: 1px solid var(--rule-1);
                background: var(--paper);
                overflow-y: auto;
            }

            .saa-rail-brand {
                display: flex;
                align-items: center;
                gap: 12px;
                padding: 16px 14px 12px;
                border-bottom: 1px solid var(--rule-1);
            }

            .saa-rail-mark {
                width: 34px;
                height: 34px;
                border-radius: 6px;
                display: grid;
                place-items: center;
                border: 1px solid var(--rule-2);
                background: var(--surface);
                color: var(--ink-1);
                font-family: var(--font-family-mono);
                font-size: 12px;
                font-weight: 600;
            }

            .saa-rail-logo {
                width: 34px;
                height: 34px;
                border-radius: 6px;
                object-fit: contain;
                border: 1px solid var(--rule-2);
                background: var(--surface);
                padding: 4px;
            }

            .saa-rail-section {
                padding: 14px 14px 6px;
            }

            .saa-rail-section-title {
                padding: 0 6px 7px;
                color: var(--ink-4);
                font-size: 10.5px;
                line-height: 1;
                letter-spacing: 0.08em;
                text-transform: uppercase;
                font-weight: 600;
            }

            .saa-rail-link {
                display: flex;
                align-items: center;
                gap: 10px;
                min-height: 32px;
                padding: 0 10px;
                border-radius: 4px;
                color: var(--ink-2);
                text-decoration: none;
                font-size: 12.5px;
                font-weight: 500;
                border: 1px solid transparent;
                transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
            }

            .saa-rail-link:hover {
                background: var(--surface-hover);
                color: var(--ink-1);
            }

            .saa-rail-link.is-active {
                background: var(--surface);
                border-color: var(--rule-1);
                color: var(--ink-1);
            }

            .saa-rail-icon {
                width: 16px;
                height: 16px;
                flex: none;
                color: var(--ink-3);
            }

            .saa-rail-link.is-active .saa-rail-icon {
                color: var(--ink-1);
            }

            .saa-rail-foot {
                margin-top: auto;
                padding: 12px;
                border-top: 1px solid var(--rule-1);
            }

            .saa-user-panel {
                border: 1px solid var(--rule-1);
                border-radius: 6px;
                background: var(--surface);
                padding: 10px;
            }

            .saa-topbar {
                height: 44px;
                flex: 0 0 44px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 16px;
                padding: 0 14px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--surface);
            }

            .saa-topbar-context {
                display: flex;
                align-items: center;
                min-width: 0;
                gap: 10px;
                color: var(--ink-3);
                font-size: 12px;
            }

            .saa-content-col {
                flex: 1 1 auto;
                min-width: 0;
                display: flex;
                flex-direction: column;
            }

            .saa-main {
                flex: 1 1 auto;
                min-width: 0;
                background: var(--paper);
            }

            .saa-page-head {
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto;
                gap: 20px;
                align-items: end;
                padding: 22px 28px 18px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--paper);
            }

            .saa-page-body {
                padding: 22px 28px 40px;
            }

            .saa-crumbs {
                display: flex;
                align-items: center;
                gap: 6px;
                margin-bottom: 6px;
                color: var(--ink-3);
                font-family: var(--font-family-mono);
                font-size: 11px;
            }

            .saa-chip {
                display: inline-flex;
                align-items: center;
                gap: 6px;
                min-height: 22px;
                padding: 2px 8px;
                border: 1px solid var(--rule-1);
                border-radius: 3px;
                background: var(--surface);
                color: var(--ink-2);
                font-size: 11.5px;
                font-weight: 600;
                white-space: nowrap;
            }

            .saa-chip.ok {
                color: var(--ok-ink);
                border-color: var(--ok-border);
                background: var(--ok-soft);
            }

            .saa-chip.warn {
                color: var(--warn-ink);
                border-color: var(--warn-border);
                background: var(--warn-soft);
            }

            .saa-chip.alert {
                color: var(--alert-ink);
                border-color: var(--alert-border);
                background: var(--alert-soft);
            }

            .saa-chip.accent {
                color: var(--accent-ink);
                border-color: var(--accent-border);
                background: var(--accent-soft);
            }

            .saa-chip.ghost {
                color: var(--ink-3);
                background: var(--surface-2);
            }

            .saa-dot {
                width: 6px;
                height: 6px;
                border-radius: 999px;
                background: var(--ink-4);
                flex: none;
            }

            .saa-dot.ok { background: var(--ok); }
            .saa-dot.warn { background: var(--warn); }
            .saa-dot.alert { background: var(--alert); }
            .saa-dot.accent { background: var(--accent); }

            .saa-stat-strip {
                display: grid;
                grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
                border: 1px solid var(--rule-1);
                border-radius: 6px;
                background: var(--surface);
                overflow: hidden;
            }

            .saa-stat {
                min-width: 0;
                padding: 14px 16px;
                border-right: 1px solid var(--rule-1);
            }

            .saa-stat:last-child {
                border-right: 0;
            }

            .saa-stat-label {
                color: var(--ink-3);
                font-size: 10.5px;
                letter-spacing: 0.06em;
                text-transform: uppercase;
                font-weight: 600;
            }

            .saa-stat-value {
                margin-top: 7px;
                font-size: 22px;
                line-height: 1.1;
                font-weight: 600;
                font-variant-numeric: tabular-nums;
            }

            .saa-stat-note {
                margin-top: 5px;
                color: var(--ink-3);
                font-size: 11.5px;
                line-height: 1.35;
            }

            .saa-tenant-index-panel {
                overflow: hidden;
            }

            .saa-tenant-index-toolbar,
            .saa-tenant-index-header,
            .saa-tenant-index-row {
                display: grid;
                grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1.05fr) minmax(300px, 1.05fr) 188px;
                gap: 18px;
                align-items: center;
            }

            .saa-tenant-index-toolbar {
                grid-template-columns: minmax(0, 1fr) auto;
                padding: 14px 16px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--surface);
            }

            .saa-tenant-index-header {
                padding: 9px 16px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--surface-2);
                color: var(--ink-3);
                font-family: var(--font-family-mono);
                font-size: 10.5px;
                letter-spacing: 0.08em;
                text-transform: uppercase;
            }

            .saa-tenant-index-row {
                padding: 15px 16px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--surface);
            }

            .saa-tenant-index-row:last-child {
                border-bottom: 0;
            }

            .saa-tenant-index-row:hover {
                background: var(--surface-hover);
            }

            .saa-tenant-index-actions {
                display: flex;
                flex-wrap: wrap;
                justify-content: flex-end;
                align-items: center;
                gap: 6px;
            }

            .saa-tenant-index-actions form {
                margin: 0;
            }

            .saa-tenant-index-actions .saa-btn {
                white-space: nowrap;
            }

            .saa-data-campaign-list {
                max-height: 640px;
                overflow-y: auto;
            }

            .saa-data-campaign-row {
                display: grid;
                grid-template-columns: minmax(240px, 1.15fr) minmax(300px, 1fr) auto;
                gap: 18px;
                align-items: center;
                padding: 14px 16px;
                border-bottom: 1px solid var(--rule-1);
                background: var(--surface);
            }

            .saa-data-campaign-row:last-child {
                border-bottom: 0;
            }

            .saa-data-campaign-row:hover {
                background: var(--surface-hover);
            }

            .saa-data-campaign-metrics {
                display: grid;
                grid-template-columns: minmax(140px, 1.3fr) minmax(70px, 0.5fr) minmax(110px, 0.8fr);
                gap: 14px;
                min-width: 0;
            }

            .saa-login-shell {
                min-height: 100vh;
                display: grid;
                grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
                background: var(--paper);
            }

            .saa-login-hero {
                position: relative;
                overflow: hidden;
                padding: 52px 56px;
                color: #FFFFFF;
                background: linear-gradient(180deg, rgba(17, 17, 16, 0.78), rgba(17, 17, 16, 0.94)), #111110;
                display: flex;
                flex-direction: column;
                min-height: 100vh;
            }

            .saa-login-hero::before {
                content: "";
                position: absolute;
                inset: 0;
                background-image:
                    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
                background-size: 40px 40px;
                opacity: 0.72;
                mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.14));
            }

            .saa-login-hero > * {
                position: relative;
                z-index: 1;
            }

            .saa-login-form-panel {
                display: grid;
                place-items: center;
                min-height: 100vh;
                padding: 48px;
            }

            .saa-login-card {
                width: min(100%, 420px);
                padding: 36px 40px;
                border: none;
                border-radius: 10px;
                background: var(--surface);
                box-shadow: 0 4px 6px rgba(17,17,16,0.04), 0 12px 40px rgba(17,17,16,0.10);
            }

            .saa-login-card .saa-btn-primary {
                min-height: 36px;
                font-size: 13.5px;
            }
        }

        @media (max-width: 1024px) {
            .saa-rail {
                position: fixed;
                inset: 0 auto 0 0;
                z-index: 50;
                transform: translateX(-100%);
                transition: transform 180ms ease;
                box-shadow: 0 18px 48px rgba(17, 17, 16, 0.16);
            }

            .saa-rail.is-open {
                transform: translateX(0);
            }

            .saa-app-shell {
                display: block;
            }

            .saa-content-col {
                min-height: 100vh;
            }

            .saa-page-head {
                grid-template-columns: 1fr;
                padding: 18px 18px 16px;
            }

            .saa-page-body {
                padding: 18px 18px 32px;
            }

            .saa-stat-strip {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .saa-stat {
                border-right: 0;
                border-bottom: 1px solid var(--rule-1);
            }

            .saa-tenant-index-header {
                display: none;
            }

            .saa-tenant-index-row {
                grid-template-columns: 1fr;
                gap: 12px;
            }

            .saa-tenant-index-actions {
                justify-content: flex-start;
            }

            .saa-data-campaign-row {
                grid-template-columns: 1fr;
                gap: 12px;
            }

            .saa-data-campaign-metrics {
                grid-template-columns: 1fr;
            }

            .saa-login-shell {
                grid-template-columns: 1fr;
            }

            .saa-login-hero {
                min-height: auto;
                padding: 34px 24px;
            }

            .saa-login-form-panel {
                min-height: auto;
                padding: 28px 20px 40px;
            }

            .saa-login-card {
                padding: 22px;
            }
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(6px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(8px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes pulseSoft {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.7;
            }
        }

        @keyframes saaShimmer {
            0% {
                transform: translateX(-100%);
            }

            100% {
                transform: translateX(100%);
            }
        }

        @keyframes saaPillPulse {
            0% {
                box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.4);
            }

            100% {
                box-shadow: 0 0 0 10px rgba(var(--primary-rgb), 0);
            }
        }

        @keyframes saaFloat {
            0%,
            100% {
                transform: translate3d(0, 0, 0) scale(1);
            }

            50% {
                transform: translate3d(0, -18px, 0) scale(1.04);
            }
        }

        .htmx-indicator {
            display: none;
            opacity: 0;
            transition: opacity 150ms ease-in;
        }

        .htmx-request .htmx-indicator,
        .htmx-request.htmx-indicator {
            display: inline-block;
            opacity: 1;
        }

        .htmx-swapping {
            opacity: 0;
            transform: translateY(5px);
            transition: opacity 160ms cubic-bezier(.2, .8, .2, 1), transform 160ms cubic-bezier(.2, .8, .2, 1);
        }

        .htmx-settling {
            opacity: 1;
            transform: translateY(0);
            transition: opacity 160ms cubic-bezier(.2, .8, .2, 1), transform 160ms cubic-bezier(.2, .8, .2, 1);
        }

        @media (prefers-reduced-motion: reduce) {

            .htmx-swapping,
            .htmx-settling {
                transform: none;
                transition: opacity 120ms ease-in-out;
            }

            .saa-skeleton::after,
            .saa-pill-pulse,
            .saa-auth-beam {
                animation: none;
            }
        }

/* Prototype primitive overrides.
   These are intentionally outside CSS @layer so Tailwind's runtime reset cannot erase control borders. */
.saa-panel,
.saa-card {
    background: var(--surface);
    border: 1px solid var(--rule-1);
    border-radius: 6px;
    box-shadow: none;
}

.saa-title-h1 {
    font-size: 22px;
    line-height: 28px;
    font-weight: 500;
    letter-spacing: 0;
}

.saa-title-h2 {
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    letter-spacing: 0;
}

.saa-overline {
    font-size: 10.5px;
    line-height: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.saa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--rule-2);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink-1);
    font-family: var(--font-family-base);
    font-size: 12.5px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: background 90ms ease, border-color 90ms ease, color 90ms ease;
}

.saa-btn:hover:not(:disabled) {
    background: var(--surface-hover);
}

.saa-btn.sm {
    min-height: 26px;
    padding: 0 9px;
    font-size: 12px;
}

.saa-btn.saa-btn-primary {
    background: var(--ink-1) !important;
    border-color: var(--ink-1) !important;
    color: #fff !important;
}

.saa-btn.saa-btn-primary:hover:not(:disabled) {
    background: #000 !important;
    border-color: #000 !important;
}

.saa-btn.saa-btn-secondary {
    background: var(--surface);
    border-color: var(--rule-2);
    color: var(--ink-1);
}

.saa-btn.saa-btn-secondary:hover:not(:disabled),
.saa-btn-ghost:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--rule-2);
    color: var(--ink-1);
}

.saa-btn:disabled,
.saa-btn[aria-disabled="true"] {
    background: var(--surface-2) !important;
    background-color: var(--surface-2) !important;
    border-color: var(--rule-2) !important;
    color: var(--ink-4) !important;
    cursor: not-allowed;
    opacity: 1;
}

.saa-btn.saa-btn-primary:disabled,
.saa-btn.saa-btn-primary[aria-disabled="true"] {
    background: var(--surface-2) !important;
    background-color: var(--surface-2) !important;
    border-color: var(--rule-2) !important;
    color: var(--ink-4) !important;
}

.saa-input,
.saa-select,
.saa-textarea {
    width: 100%;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--rule-2);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink-1);
    font-family: var(--font-family-base);
    font-size: 12.5px;
    line-height: 18px;
    font-weight: 500;
    letter-spacing: 0;
}

textarea.saa-input,
.saa-textarea {
    padding-top: 9px;
    padding-bottom: 9px;
    line-height: 20px;
}

.saa-select {
    padding-right: 34px;
}

.saa-input:focus-visible,
.saa-select:focus-visible,
.saa-textarea:focus-visible,
.saa-btn:focus-visible,
.saa-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

.saa-app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--paper);
}

.saa-rail {
    width: 224px;
    flex: 0 0 224px;
    min-height: 100vh;
    border-right: 1px solid var(--rule-1);
    background: var(--paper);
}

.saa-content-col {
    flex: 1 1 auto;
    min-width: 0;
}

.saa-page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--rule-1);
    background: var(--paper);
}

.saa-page-body {
    padding: 22px 28px 40px;
}

@media (max-width: 1024px) {
    .saa-app-shell {
        display: block;
    }

    .saa-rail {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 180ms ease;
        box-shadow: 0 18px 48px rgba(17, 17, 16, 0.16);
    }

    .saa-rail.is-open {
        transform: translateX(0);
    }

    .saa-page-head {
        grid-template-columns: 1fr;
        padding: 18px 18px 16px;
    }

    .saa-page-body {
        padding: 18px 18px 32px;
    }

    .saa-tenant-index-header {
        display: none;
    }

    .saa-tenant-index-row,
    .saa-data-campaign-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.saa-workspace {
    display: grid;
    gap: 16px;
}

.saa-situation-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 0.8fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--rule-1);
    border-radius: 6px;
    background: var(--surface);
}

.saa-situation-title {
    margin: 2px 0 0;
    color: var(--ink-1);
    font-size: 18px;
    line-height: 24px;
    font-weight: 500;
    letter-spacing: 0;
}

.saa-situation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    margin-top: 8px;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 18px;
}

.saa-situation-status {
    min-width: 0;
    color: var(--ink-3);
}

.saa-situation-actions {
    display: flex;
    justify-content: flex-end;
}

.saa-workspace-notice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid var(--rule-1);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 12px;
    line-height: 18px;
}

.saa-workspace-stage-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.saa-workspace-stage,
.saa-workspace-rail {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.saa-workspace-rail {
    position: sticky;
    top: 16px;
}

.saa-stage-section,
.saa-history-panel,
.saa-analysis-card,
.saa-workspace-side-panel {
    border: 1px solid var(--rule-1);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: none;
}

.saa-stage-section {
    padding: 14px;
}

.saa-stage-section-head,
.saa-side-panel-head,
.saa-analysis-card-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
}

.saa-stage-section-head {
    margin-bottom: 12px;
}

.saa-inline-note {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid var(--rule-1);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 500;
}

.saa-feed-grid {
    gap: 12px;
}

.saa-feed {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--rule-1);
    border-radius: 6px;
    background: var(--surface);
}

.saa-feed-head,
.saa-feed-foot {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
}

.saa-feed-head {
    border-bottom: 1px solid var(--rule-1);
}

.saa-feed-foot {
    min-height: 32px;
    border-top: 1px solid var(--rule-1);
    color: var(--ink-3);
    font-size: 11.5px;
    line-height: 16px;
}

.saa-feed-kicker {
    margin: 0;
    color: var(--ink-4);
    font-size: 10px;
    line-height: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.saa-feed-title {
    margin: 2px 0 0;
    color: var(--ink-1);
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
}

.saa-feed-body {
    border-radius: 0;
}

.saa-image-frame {
    border: 0;
}

.saa-workspace-side-panel,
.saa-scheduler-control {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.saa-scheduler-times {
    display: grid;
    gap: 0;
    border: 1px solid var(--rule-1);
    border-radius: 4px;
    overflow: hidden;
}

.saa-scheduler-times div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--rule-1);
    color: var(--ink-3);
    font-size: 12px;
    line-height: 18px;
}

.saa-scheduler-times div:last-child {
    border-bottom: 0;
}

.saa-scheduler-times strong {
    color: var(--ink-1);
    font-weight: 500;
    text-align: right;
}

.saa-scheduler-actions,
.saa-scheduler-interval {
    display: grid;
    gap: 8px;
}

.saa-scheduler-interval {
    grid-template-columns: minmax(0, 1fr) auto;
}

.saa-analysis-card {
    overflow: hidden;
}

.saa-analysis-card-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--rule-1);
    background: var(--surface);
}

.saa-analysis-card-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.saa-history-panel {
    padding: 14px;
}

.saa-session-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
}

.saa-session-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--rule-1);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink-1);
    transition: background 90ms ease, border-color 90ms ease;
}

.saa-session-row:hover {
    background: var(--surface-hover);
    border-color: var(--rule-2);
}

.saa-session-thumbs {
    display: flex;
    gap: 6px;
    align-items: center;
}

.saa-session-thumb {
    width: 58px;
    height: 42px;
    overflow: hidden;
    border: 1px solid var(--rule-1);
    border-radius: 4px;
    background: var(--surface-2);
}

.saa-row-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 1px solid var(--rule-1);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--ink-3);
}

#assistant-panel {
    border-radius: 6px;
    box-shadow: none;
}

#assistant-panel > div:first-child,
#chat-interface {
    padding: 14px;
}

#chat-messages {
    padding: 14px;
    background: var(--surface-2);
}

.session-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 66;
    background: rgba(17, 17, 16, 0.34);
    display: flex;
    justify-content: flex-end;
}

.session-drawer-backdrop.hidden,
.session-drawer-backdrop[hidden] {
    display: none;
}

.session-drawer-panel {
    width: min(760px, 100vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-left: 1px solid var(--rule-2);
    box-shadow: -24px 0 48px rgba(17, 17, 16, 0.16);
    animation: sessionDrawerIn 160ms ease-out;
}

#session-popup-overlay:not(.session-drawer-backdrop) {
    justify-content: flex-end !important;
    align-items: stretch !important;
    padding: 0 !important;
    background: rgba(17, 17, 16, 0.34) !important;
}

#session-popup-overlay:not(.session-drawer-backdrop) > .panel {
    width: min(760px, 100vw) !important;
    height: 100vh !important;
    max-height: none !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    box-shadow: -24px 0 48px rgba(17, 17, 16, 0.16) !important;
    animation: sessionDrawerIn 160ms ease-out;
}

#session-popup-overlay:not(.session-drawer-backdrop) #session-popup-body {
    padding: 0 !important;
}

@keyframes sessionDrawerIn {
    from {
        opacity: 0.96;
        transform: translateX(28px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .session-drawer-panel,
    #session-popup-overlay:not(.session-drawer-backdrop) > .panel {
        animation: none;
    }
}

.session-detail {
    display: flex;
    min-height: 100%;
    flex-direction: column;
}

.session-detail-head {
    padding: 20px 22px;
    border-bottom: 1px solid var(--rule-1);
    background: var(--surface);
}

.session-detail-head h2 {
    margin: 0;
    color: var(--ink-1);
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0;
}

.session-camera-list {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.session-camera-card {
    display: grid;
    grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1fr);
    align-items: start;
    overflow: hidden;
    border: 1px solid var(--rule-1);
    border-radius: 8px;
    background: var(--surface);
}

.session-camera-media {
    position: relative;
    min-height: 160px;
    background: repeating-linear-gradient(135deg, #f7f7f4 0 14px, #eeeeea 14px 28px);
}

.session-camera-media img {
    width: 100%;
    height: auto;
    display: block;
}

.session-camera-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.session-camera-copy {
    padding: 18px;
    min-width: 0;
}

.session-detail-note {
    margin: 0 18px 18px;
    padding: 12px 14px;
    border: 1px solid var(--warn-border);
    border-radius: 8px;
    background: var(--warn-soft);
    color: var(--warn-ink);
    font-size: 12.5px;
    line-height: 1.55;
}

@media (max-width: 760px) {
    .session-camera-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .saa-workspace-stage-shell {
        grid-template-columns: 1fr;
    }

    .saa-workspace-rail {
        position: static;
    }
}

@media (max-width: 760px) {
    .saa-situation-bar {
        grid-template-columns: 1fr;
    }

    .saa-situation-actions {
        justify-content: stretch;
    }

    .saa-situation-actions .saa-btn,
    .saa-scheduler-interval {
        width: 100%;
    }

    .saa-scheduler-interval {
        grid-template-columns: 1fr;
    }

    .saa-feed-foot,
    .saa-session-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .saa-row-arrow {
        display: none;
    }
}
/* ============================================================
   Industrial Analysis Platform — Design Tokens
   Light, restrained, operational. Borders over shadows.
   ============================================================ */

:root {
  /* paper / surfaces */
  --paper: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F4F3EE;
  --surface-sunken: #F0EFEA;
  --surface-hover: #F6F5F0;

  /* ink */
  --ink-1: #111110;       /* primary text, headlines */
  --ink-2: #3B3A37;       /* body */
  --ink-3: #73726C;       /* secondary / label */
  --ink-4: #A3A29B;       /* tertiary / muted */
  --ink-5: #C9C7BF;       /* placeholder */

  /* rules */
  --rule-1: #E8E6E0;      /* standard hairline */
  --rule-2: #DCDAD1;      /* stronger hairline */
  --rule-3: #111110;      /* full ink rule (rare) */

  /* accent — single signal blue */
  --accent: oklch(55% 0.14 250);
  --accent-hover: oklch(48% 0.15 250);
  --accent-soft: oklch(96% 0.025 250);
  --accent-border: oklch(85% 0.06 250);
  --accent-ink: oklch(30% 0.08 250);

  /* state colors — muted, operational */
  --ok: oklch(52% 0.102 168);
  --ok-soft: oklch(97% 0.022 168);
  --ok-border: oklch(87% 0.05 168);
  --ok-ink: oklch(40% 0.072 168);

  --warn: oklch(65% 0.12 78);
  --warn-soft: oklch(97% 0.026 78);
  --warn-border: oklch(88% 0.058 78);
  --warn-ink: oklch(48% 0.09 78);

  --alert: oklch(58% 0.118 28);
  --alert-soft: oklch(97% 0.024 28);
  --alert-border: oklch(87% 0.055 28);
  --alert-ink: oklch(45% 0.094 28);

  --neutral-chip: #EFEEE8;

  /* type */
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* radii */
  --r-0: 0px;
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-4: 8px;

  /* spacing scale — 4px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;
  --s-10: 72px;

  /* density (overridden by tweaks) */
  --density: 1;
  --row-h: calc(32px * var(--density));
  --field-h: calc(32px * var(--density));
}

/* compact density */
[data-density="compact"] {
  --density: 0.88;
  --s-3: 10px;
  --s-4: 14px;
}

/* ------- Global reset-ish ------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  color: var(--ink-1);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 13px;
  line-height: 1.45;
}

code, pre, .mono, .num {
  font-family: var(--font-mono);
  font-feature-settings: "zero", "ss01";
}

.num, .tabular { font-variant-numeric: tabular-nums; }

/* -------- Type scale -------- */
.t-display {
  font-size: 40px; line-height: 1.05; letter-spacing: -0.025em;
  font-weight: 500;
}
.t-h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 500; }
.t-h2 { font-size: 20px; line-height: 1.2; letter-spacing: -0.012em; font-weight: 500; }
.t-h3 { font-size: 15px; line-height: 1.3; letter-spacing: -0.006em; font-weight: 550; }
.t-body { font-size: 13px; line-height: 1.5; }
.t-small { font-size: 12px; line-height: 1.4; }
.t-micro {
  font-size: 11px; line-height: 1.3;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px; line-height: 1; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}

/* -------- Primitives -------- */
.hr { height: 1px; background: var(--rule-1); border: 0; }
.vr { width: 1px; background: var(--rule-1); align-self: stretch; }

.panel {
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
}

.panel-flush {
  background: var(--surface);
  border-top: 1px solid var(--rule-1);
  border-bottom: 1px solid var(--rule-1);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border: 1px solid var(--rule-1);
  border-radius: 3px;
  font-size: 11.5px; font-weight: 500; color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}
.chip.mono { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0; }
.chip.ok     { color: var(--ok-ink);     border-color: var(--ok-border);     background: var(--ok-soft); }
.chip.warn   { color: var(--warn-ink);   border-color: var(--warn-border);   background: var(--warn-soft); }
.chip.alert  { color: var(--alert-ink);  border-color: var(--alert-border);  background: var(--alert-soft); }
.chip.accent { color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft); }
.chip.ghost  { background: transparent; }
/* saa-pill-* status classes applied to chip elements (camera card footer badges) */
.chip.saa-pill-optimal   { color: var(--ok-ink);    border-color: var(--ok-border);    background: var(--ok-soft); }
.chip.saa-pill-suboptimal{ color: var(--warn-ink);  border-color: var(--warn-border);  background: var(--warn-soft); }
.chip.saa-pill-critical  { color: var(--alert-ink); border-color: var(--alert-border); background: var(--alert-soft); }

.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4);
  flex: none;
}
.dot.ok    { background: var(--ok); }
.dot.warn  { background: var(--warn); }
.dot.accent { background: var(--accent); }
.dot.alert { background: var(--alert); }
.dot.live  { background: var(--alert); box-shadow: 0 0 0 0 rgba(0,0,0,0); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.55; transform: scale(0.85); }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto;
  min-height: 30px; height: auto; padding: 0 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink-1);
  font: inherit; font-size: 12.5px; font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-wrap: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 90ms ease, border-color 90ms ease, color 90ms ease, box-shadow 90ms ease;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { background: var(--surface-2); }
.btn:disabled {
  background: var(--surface-2);
  border-color: var(--rule-2);
  color: var(--ink-4);
  cursor: not-allowed;
  box-shadow: none;
}
.btn:disabled:hover,
.btn:disabled:active { background: var(--surface-2); color: var(--ink-4); }
.btn.primary {
  background: var(--ink-1); color: #fff; border-color: var(--ink-1);
}
.btn.primary:hover { background: #000; }
.btn.accent {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.sm { min-height: 26px; height: auto; padding: 0 9px; font-size: 12px; }
.btn.lg { min-height: 36px; height: auto; padding: 0 16px; font-size: 13.5px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }

/* fields */
.field {
  height: var(--field-h);
  padding: 0 10px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-2);
  background: var(--surface);
  font: inherit; font-size: 12.5px;
  color: var(--ink-1);
  width: 100%;
}
.field:focus { outline: none; border-color: var(--ink-1); }
.field::placeholder { color: var(--ink-5); }

/* labels */
.label {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; font-family: var(--font-sans);
}

/* key-value list */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 6px 0; }
.kv > :first-child { color: var(--ink-3); font-size: 12px; }
.kv > :last-child { color: var(--ink-1); font-size: 12.5px; }

/* scroll */
.scroll { overflow: auto; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: #D9D7D0; border: 2px solid transparent; background-clip: padding-box; border-radius: 8px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #C6C4BC; background-clip: padding-box; border: 2px solid transparent; }

/* grid helpers */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.grow { flex: 1 1 auto; min-width: 0; }
.none { flex: none; }

/* bordered table */
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--rule-1);
  vertical-align: middle;
}
.table th {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.table tr td { transition: background 80ms ease; }
.table tr:hover td { background: var(--surface-hover); }
.table tr.is-selected td { background: var(--surface-hover); }
.table tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--ink-1); }
.table tr:last-child td { border-bottom: 0; }

/* focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* placeholder image look — camera feeds, evidence */
.stripe-placeholder {
  background-color: #2A2825;
  background-image: repeating-linear-gradient(
    45deg,
    #2F2D29 0 10px,
    #262421 10px 20px
  );
  color: #8A857B;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.stripe-placeholder::after {
  content: attr(data-label);
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}
.stripe-placeholder .corners {
  position: absolute; inset: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: none;
}
.stripe-placeholder .corners::before,
.stripe-placeholder .corners::after {
  content: "";
  position: absolute; width: 10px; height: 10px;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.stripe-placeholder .corners::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.stripe-placeholder .corners::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* utility */
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.click { cursor: pointer; }
.click:hover { background: var(--surface-hover); }
.hover-surface:hover { background: var(--surface-hover); }
/* ==========================================================
   App-specific layout — shell, nav, page chrome, subpages
   ========================================================== */

/* root app shell */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* right column: topbar + content */
.right-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  height: 44px;
  flex-shrink: 0;
  padding-right: 10px;
}
.topbar .rail-toggle {
  flex-shrink: 0;
  height: 32px;
  margin-left: 8px;
  gap: 3px;
  width: auto;
  padding: 0 10px;
  color: var(--ink-3);
}
.topbar .rail-toggle:hover { color: var(--ink-1); }
.topbar .context { display: flex; align-items: center; gap: 2px; height: 100%; flex: 1; }
.topbar .context > * { height: 100%; }
.topbar .ctxbtn {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  color: var(--ink-1);
  font-size: 12.5px;
  cursor: pointer;
  border: 0; background: transparent;
  height: 100%;
  border-right: 1px solid var(--rule-1);
  transition: background 100ms ease;
}
.topbar .ctxbtn:hover { background: var(--surface-hover); }
.topbar .ctxbtn .sub { color: var(--ink-3); font-size: 11px; font-family: var(--font-mono); }
.topbar .ctxbtn.mode-active   .dot { background: var(--ok); }
.topbar .ctxbtn.mode-passive  .dot { background: var(--accent); }
.topbar .ctxbtn.mode-explore  .dot { background: var(--warn); }

.topbar-tenant-switcher {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-tenant-button {
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--rule-1);
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
  max-width: min(420px, 42vw);
}

.topbar-tenant-button:hover,
.topbar-tenant-button[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--ink-1);
}

.topbar-tenant-button .mono {
  color: var(--ink-1);
}

.topbar-tenant-button svg {
  color: var(--ink-4);
  flex: none;
}

.tenant-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  z-index: 60;
  width: min(420px, calc(100vw - 24px));
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: 0 18px 38px rgba(17,17,16,0.13), 0 2px 8px rgba(17,17,16,0.08);
  overflow: hidden;
}

.tenant-switcher-loading,
.tenant-switcher-empty {
  padding: 18px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.tenant-switcher-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-switcher-kicker {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 15px;
  font-weight: 500;
}

.tenant-switcher-title {
  color: var(--ink-1);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 17px;
  margin-top: 1px;
}

.tenant-switcher-list {
  display: grid;
  max-height: min(460px, 70vh);
  overflow-y: auto;
}

.tenant-switcher-row-form {
  margin: 0;
}

.tenant-switcher-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tenant-switcher-row:hover {
  background: var(--surface-hover);
}

.tenant-switcher-row.active {
  background: linear-gradient(90deg, rgba(15, 118, 99, 0.06), transparent 64%), var(--surface);
}

.tenant-switcher-row.disabled {
  cursor: default;
  color: var(--ink-4);
  background: var(--surface);
}

.tenant-switcher-row:last-child {
  border-bottom: 0;
}

.tenant-switcher-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tenant-switcher-name {
  color: var(--ink-1);
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-switcher-id {
  color: var(--ink-3);
  font-size: 11px;
}

.tenant-switcher-row-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: none;
}

.tenant-switcher-current {
  color: var(--ok-ink);
  font-size: 10.5px;
}

.topbar .util { display: flex; align-items: center; gap: 6px; padding-left: 10px; margin-left: auto; }

#mobile-nav-open {
  display: none;
}

@media (max-width: 1023px) {
  #mobile-nav-open {
    display: inline-flex;
  }
}

/* left rail */
.rail {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--rule-1);
  background: var(--paper);
  display: flex; flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width 220ms cubic-bezier(0.2, 0, 0, 1);
}
.rail.collapsed {
  width: 56px;
}
.rail.collapsed .nav-label,
.rail.collapsed .section-title {
  display: none;
}
.rail.collapsed .nav-item {
  justify-content: center;
  padding: 0;
  width: 36px;
  margin: 2px auto;
  height: 36px;
}
.rail .section {
  padding: 14px 14px 6px;
}
.rail .section-title {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-4); font-weight: 500;
  padding: 0 6px 6px;
}
.rail a, .rail button.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 10px;
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 450;
  text-decoration: none;
  border-radius: 4px;
  border: 0; background: transparent; width: 100%;
  cursor: pointer; text-align: left;
  transition: background 100ms ease, color 100ms ease;
}
.rail a:hover, .rail button.nav-item:hover { background: var(--surface-hover); color: var(--ink-1); }
.rail a.active, .rail button.nav-item.active {
  background: var(--surface);
  color: var(--ink-1); font-weight: 500;
  border: 1px solid var(--rule-1);
  box-shadow: 0 1px 0 rgba(17,17,16,0.02);
}
.rail .nav-icon {
  width: 16px; height: 16px; flex: none;
  color: var(--ink-3);
}
.rail .active .nav-icon { color: var(--ink-1); }
.rail .badge {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface-2); color: var(--ink-2);
  padding: 1px 5px; border-radius: 2px;
}
.rail .badge.alert { background: var(--alert); color: #fff; }
.rail .rail-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--rule-1);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.rail .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-2);
  border: 1px solid var(--rule-1);
}

/* content area */
.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--paper);
}

/* page route transition */
.page-enter {
  animation: pageEnter 160ms ease both;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* page header inside content */
.page-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--paper);
}
.page-head .crumbs {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.page-head .crumbs a { color: var(--ink-3); text-decoration: none; }
.page-head .crumbs a:hover { color: var(--ink-1); }
.page-head h1 {
  margin: 0;
  font-size: 22px; letter-spacing: -0.015em; font-weight: 500;
}
.page-head .sub {
  color: var(--ink-3); font-size: 13px; margin-top: 3px;
}
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* content sections */
.page-body {
  padding: 22px 28px 40px;
}
.page-body.flush { padding: 0; }

/* section heading */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 0 10px;
  gap: 20px;
}
.section-head h2 {
  margin: 0; font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
}
.section-head .hint { color: var(--ink-3); font-size: 12px; }

.situation-bar {
  padding: 6px 0 16px;
  border-bottom: 1px solid var(--rule-1);
}

.situation-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 16px 24px;
  align-items: end;
}

.situation-main { min-width: 0; }

.situation-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
}

.situation-kicker-sep {
  opacity: 0.45;
}

.situation-kicker-detail {
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font-sans);
}

.situation-headline {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.situation-state {
  font-size: clamp(30px, 2.25vw, 40px);
  letter-spacing: -0.035em;
  font-weight: 500;
  line-height: 0.98;
}

.situation-context {
  font-size: 13.5px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
}

.situation-chip-row {
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.situation-side {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 18px;
  min-width: 0;
  align-items: stretch;
}

.situation-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(138px, auto));
  gap: 0;
  min-width: 0;
}

.situation-metric-inline {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
  padding: 2px 18px 2px 18px;
  border-left: 1px solid var(--rule-1);
}

.situation-metric-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
}

.situation-metric-value {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.situation-metric-note {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.45;
}

.situation-action {
  padding-left: 18px;
  border-left: 1px solid var(--rule-1);
  align-items: flex-end;
  justify-self: end;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.situation-action-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: right;
}

.situation-action-note {
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: right;
}

.workspace-stage-shell {
  display: grid;
  gap: 20px;
  align-items: start;
}

.workspace-stage-shell.with-sidebar {
  grid-template-columns: minmax(0, 1fr) minmax(296px, 324px);
}

.cam-grid { display: grid; gap: 14px; }
.cam-grid.cam-1 { grid-template-columns: 1fr; }
.cam-grid.cam-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cam-grid.cam-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cam-grid.cam-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cam-grid.cam-5,
.cam-grid.cam-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.cam-filmstrip-wrap { position: relative; }
.cam-filmstrip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.cam-filmstrip::-webkit-scrollbar { display: none; }
.cam-filmstrip > .feed {
  flex: 0 0 calc(31.5% - 8px);
  min-width: 300px;
  scroll-snap-align: start;
}
.cam-filmstrip-wrap::before,
.cam-filmstrip-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 34px; width: 14px; pointer-events: none; z-index: 2;
  opacity: 0;
  transition: opacity 120ms ease;
}
.cam-filmstrip-wrap::before { left: 0; background: linear-gradient(90deg, rgba(246,245,240,0.38) 0%, transparent 100%); }
.cam-filmstrip-wrap::after  { right: 0; background: linear-gradient(-90deg, rgba(246,245,240,0.38) 0%, transparent 100%); }
.cam-filmstrip-wrap:not(.at-start)::before,
.cam-filmstrip-wrap:not(.at-end)::after { opacity: 1; }

.cam-filmstrip-nav {
  position: absolute; top: calc(50% - 24px); width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--rule-2); color: var(--ink-1); cursor: pointer;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  opacity: 0; pointer-events: none; transition: opacity 120ms; z-index: 3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 0;
}
.cam-filmstrip-wrap:hover .cam-filmstrip-nav:not(:disabled) { opacity: 1; pointer-events: auto; }
.cam-filmstrip-nav:disabled { opacity: 0; cursor: default; }
.cam-filmstrip-nav.prev { left: 8px; }
.cam-filmstrip-nav.next { right: 8px; }

.cam-filmstrip-dots {
  display: flex; gap: 6px; justify-content: center; margin-top: 12px;
}
.cam-filmstrip-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: var(--ink-3); opacity: 0.4; transition: opacity 120ms, transform 120ms;
}
.cam-filmstrip-dot.ok    { background: var(--ok); opacity: 0.7; }
.cam-filmstrip-dot.accent{ background: var(--accent); opacity: 0.7; }
.cam-filmstrip-dot.warn  { background: var(--warn); opacity: 0.7; }
.cam-filmstrip-dot.current { opacity: 1; transform: scale(1.25); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink-1); }

/* Group-tab adaptive grid: when a group has 1-3 cameras, switch filmstrip to grid. */
.cam-filmstrip-wrap.as-grid .cam-filmstrip,
.cam-filmstrip-wrap.as-grid-2 .cam-filmstrip,
.cam-filmstrip-wrap.as-grid-3 .cam-filmstrip {
  display: grid;
  overflow-x: hidden;
  scroll-snap-type: none;
  padding-bottom: 0;
}
.cam-filmstrip-wrap.as-grid   .cam-filmstrip { grid-template-columns: 1fr; }
.cam-filmstrip-wrap.as-grid-2 .cam-filmstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cam-filmstrip-wrap.as-grid-3 .cam-filmstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cam-filmstrip-wrap.as-grid   .cam-filmstrip > .feed,
.cam-filmstrip-wrap.as-grid-2 .cam-filmstrip > .feed,
.cam-filmstrip-wrap.as-grid-3 .cam-filmstrip > .feed { flex: unset; min-width: 0; }
.cam-filmstrip-wrap.as-grid   .cam-filmstrip-nav,
.cam-filmstrip-wrap.as-grid   .cam-filmstrip-dots,
.cam-filmstrip-wrap.as-grid-2 .cam-filmstrip-nav,
.cam-filmstrip-wrap.as-grid-2 .cam-filmstrip-dots,
.cam-filmstrip-wrap.as-grid-3 .cam-filmstrip-nav,
.cam-filmstrip-wrap.as-grid-3 .cam-filmstrip-dots { display: none; }
.cam-filmstrip-wrap.as-grid::before,   .cam-filmstrip-wrap.as-grid::after,
.cam-filmstrip-wrap.as-grid-2::before, .cam-filmstrip-wrap.as-grid-2::after,
.cam-filmstrip-wrap.as-grid-3::before, .cam-filmstrip-wrap.as-grid-3::after { display: none; }

/* Camera view toggle: 1-up or 2-up forces filmstrip scroll mode, overriding as-grid.
   scroll-snap-type intentionally omitted — navigation uses strip.scrollTo() for
   precise control; mandatory snap fights programmatic scroll position changes. */
.cam-filmstrip-wrap.view-1 .cam-filmstrip,
.cam-filmstrip-wrap.view-2 .cam-filmstrip,
.cam-filmstrip-wrap.view-3 .cam-filmstrip {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: none;
  padding-bottom: 8px;
}
.cam-filmstrip-wrap.view-1 .cam-filmstrip > .feed { flex: 0 0 100% !important; min-width: 0; }
.cam-filmstrip-wrap.view-2 .cam-filmstrip > .feed { flex: 0 0 calc((100% - 14px) / 2) !important; min-width: 0; }
.cam-filmstrip-wrap.view-3 .cam-filmstrip > .feed { flex: 0 0 calc((100% - 28px) / 3) !important; min-width: 0; }
.cam-filmstrip-wrap.view-1::before, .cam-filmstrip-wrap.view-1::after,
.cam-filmstrip-wrap.view-2::before, .cam-filmstrip-wrap.view-2::after,
.cam-filmstrip-wrap.view-3::before, .cam-filmstrip-wrap.view-3::after { display: block; }
/* Toggle button strip */
.cam-view-toggle { display: flex; gap: 2px; }
.cam-view-toggle button {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 26px;
  background: transparent; border: 1px solid var(--rule-2);
  border-radius: 4px; cursor: pointer; color: var(--ink-3);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cam-view-toggle button:hover { background: var(--surface-2); color: var(--ink-1); border-color: var(--rule-3); }
.cam-view-toggle button.on { background: var(--ink-1); color: #fff; border-color: var(--ink-1); }

.group-tab-count { color: var(--ink-3); font-weight: 400; }
.group-tab.active .group-tab-count { color: var(--ink-3); }

/* Stat cell (replaces KPI "card soup"): typographic, rule-separated */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
  overflow: hidden;
}
.stat {
  padding: 16px 18px;
  border-right: 1px solid var(--rule-1);
}
.stat:last-child { border-right: 0; }
.stat .lbl {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px; font-weight: 500;
}
.stat .val {
  font-size: 24px; letter-spacing: -0.015em; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-1);
}
.stat.compact .val {
  font-size: 19px;
  line-height: 1.2;
  white-space: nowrap;
}
.stat .val .unit {
  font-size: 13px; color: var(--ink-3); margin-left: 3px; font-weight: 400;
}
.stat .delta {
  font-family: var(--font-mono);
  font-size: 11px; margin-top: 6px;
  color: var(--ink-3);
}
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--alert); }
.stat .spark { height: 22px; margin-top: 8px; }

.tenant-flow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border-top: 1px solid var(--rule-1);
  padding-top: 16px;
}

.tenant-flow-step {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  min-width: 0;
  padding-right: 18px;
}

.tenant-flow-marker {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  border: 1px solid var(--rule-2);
  background: var(--surface);
  color: var(--ink-3);
  flex: none;
}

.tenant-flow-step.complete .tenant-flow-marker {
  border-color: var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.tenant-flow-step.current .tenant-flow-marker {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tenant-flow-copy {
  min-width: 0;
}

.tenant-flow-title {
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.tenant-flow-note {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-top: 4px;
}

.tenant-flow-rule {
  position: absolute;
  top: 12px;
  right: 0;
  width: 14px;
  height: 1px;
  background: var(--rule-1);
}

.point-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.point-card {
  overflow: hidden;
}

.point-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--rule-1);
}

.point-card-title {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.015em;
}

.point-card-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

.point-card-preview {
  aspect-ratio: 16 / 8.25;
  border-bottom: 1px solid var(--rule-1);
}

.point-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.point-card-metric {
  padding: 12px 14px 14px;
  border-right: 1px solid var(--rule-1);
}

.point-card-metric:last-child {
  border-right: 0;
}

.point-card-value {
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -0.012em;
  margin-top: 6px;
}

.point-card-note {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-top: 5px;
}

.point-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--rule-1);
  background: var(--surface-2);
}

.point-card-footnote {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.45;
}

.tenant-index-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 20px;
}

.tenant-index-summary-cell {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--rule-1);
}

.tenant-index-summary-cell:last-child {
  border-right: 0;
}

.tenant-index-summary-value {
  margin-top: 7px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.018em;
  font-variant-numeric: tabular-nums;
}

.tenant-index-summary-note {
  margin-top: 5px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.tenant-index-panel {
  overflow: hidden;
}

.tenant-index-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-index-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.15fr) minmax(320px, 1fr) 150px;
  gap: 18px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tenant-index-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.15fr) minmax(320px, 1fr) 150px;
  gap: 18px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  transition: background 80ms ease;
}

.tenant-index-row:last-child {
  border-bottom: 0;
}

.tenant-index-row:hover {
  background: var(--surface-hover);
}

.tenant-index-main,
.tenant-index-status,
.tenant-index-signals {
  min-width: 0;
}

.tenant-index-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.tenant-index-name {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.tenant-index-domain {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-index-meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.tenant-index-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.tenant-lifecycle-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: none;
}

.tenant-life-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--surface);
}

.tenant-life-dot.complete {
  background: var(--ok);
  border-color: var(--ok);
}

.tenant-life-dot.current {
  background: var(--accent);
  border-color: var(--accent);
}

.tenant-index-blocker-title {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-index-blocker-note {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-index-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tenant-index-signal-value {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-index-signal-note {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-index-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pipeline-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.pipeline-list-panel {
  overflow: hidden;
  position: sticky;
  top: 16px;
}

.pipeline-list {
  display: grid;
  gap: 0;
}

.pipeline-list-row {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  color: var(--ink-1);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pipeline-list-row:last-child {
  border-bottom: 0;
}

.pipeline-list-row:hover {
  background: var(--surface-hover);
}

.pipeline-list-row.active {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--ink-1);
}

.pipeline-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.8fr) minmax(140px, 0.7fr) minmax(180px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.pipeline-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto 76px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background: var(--surface);
}

.pipeline-add-field {
  display: grid;
  grid-template-columns: 220px 150px auto;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
}

.pipeline-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 72;
  background: rgba(17,17,16,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade 160ms ease;
}

.scheme-editor-shell {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.16);
  overflow: hidden;
}

.scheme-editor-body {
  display: grid;
  gap: 22px;
  padding: 20px;
}

.scheme-meaning-block {
  padding: 14px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: #fff;
}

.scheme-meaning-fields {
  display: grid;
  gap: 12px;
}

.scheme-meaning-row {
  display: grid;
  gap: 6px;
}

.scheme-meaning-row + .scheme-meaning-row {
  padding-top: 12px;
  border-top: 1px solid var(--rule-1);
}

.scheme-meaning-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.scheme-meaning-label {
  color: var(--ink-1);
  font-size: 12.5px;
  font-weight: 550;
}

.scheme-meaning-note,
.scheme-meaning-empty {
  color: var(--ink-4);
  font-size: 11px;
}

.scheme-meaning-empty {
  padding: 14px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-2);
  text-align: center;
}

.scheme-meaning-input.field {
  height: auto;
  min-height: 76px;
  margin: 0;
  padding: 9px 10px;
  resize: vertical;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.scheme-meaning-input.field[readonly] {
  color: var(--ink-2);
  background: #fff;
}

.scheme-meaning-help {
  margin-top: 7px;
  color: var(--ink-4);
  font-size: 11px;
  line-height: 1.45;
}

.pipeline-editor-shell {
  width: min(1080px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.14);
  overflow: hidden;
}

.pipeline-editor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule-1);
}

.pipeline-editor-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  background: var(--paper);
}

.pipeline-editor-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.pipeline-editor-side {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.pipeline-create-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 0;
  padding: 0;
  background: var(--surface);
}

.pipeline-create-section {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
  border-bottom: 1px solid var(--rule-1);
  min-width: 0;
}

.pipeline-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.pipeline-definition-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.pipeline-key-field {
  grid-column: 1 / -1;
  max-width: 420px;
}

.pipeline-source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.pipeline-source-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: space-between;
  min-height: 96px;
  text-align: left;
  padding: 13px 14px 12px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.pipeline-source-choice:hover {
  background: var(--surface-hover);
}

.pipeline-source-choice.active {
  border-color: var(--ink-1);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink-1);
}

.pipeline-source-choice.disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.pipeline-source-status {
  width: fit-content;
  padding: 2px 5px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-1);
  color: var(--ink-3);
  font-size: 10.5px;
}

.pipeline-source-choice.active .pipeline-source-status {
  border-color: var(--ink-1);
  background: var(--ink-1);
  color: #fff;
}

.pipeline-source-detail {
  display: grid;
  grid-template-columns: minmax(0, 420px);
  gap: 12px;
  align-items: start;
}

.pipeline-local-contract-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background: var(--surface);
  overflow: hidden;
  max-width: 560px;
}

.pipeline-local-contract-card > div {
  min-width: 0;
  padding: 11px 13px;
}

.pipeline-local-contract-card > div + div {
  border-left: 1px solid var(--rule-1);
}

.pipeline-local-contract-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-1);
}

.pipeline-local-contract-copy {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.55;
}

.pipeline-authoring-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 0;
  min-height: 440px;
}

.pipeline-authoring-grid.local-mode {
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 340px;
}

.pipeline-prompt-section {
  border-bottom: 0;
  border-right: 1px solid var(--rule-1);
}

.pipeline-prompt-section.local-mode {
  align-content: start;
  background: var(--surface);
}

.pipeline-prompt-editor {
  width: 100%;
  height: auto;
  min-height: clamp(210px, 28vh, 360px);
  resize: vertical;
  line-height: 1.55;
  font-size: 13px;
  padding: 11px 12px;
  letter-spacing: 0;
}

.pipeline-scheme-context {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: #fff;
}

.pipeline-scheme-context-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.pipeline-scheme-context-copy {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.pipeline-scheme-meaning-preview {
  display: grid;
  gap: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
}

.pipeline-scheme-meaning-preview.has-rows {
  padding: 0;
}

.pipeline-scheme-meaning-row {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 11px;
}

.pipeline-scheme-meaning-row + .pipeline-scheme-meaning-row {
  border-top: 1px solid var(--rule-1);
}

.pipeline-scheme-meaning-name {
  color: var(--ink-1);
  font-size: 12.5px;
  font-weight: 550;
}

.pipeline-scheme-meaning-description {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.5;
}

.pipeline-contract-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 16px 18px 18px;
  background: var(--surface);
  min-width: 0;
}

.pipeline-label-preview {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 25px;
  align-items: center;
  color: var(--ink-3);
  font-size: 12px;
}

.pipeline-contract-fields {
  display: grid;
  gap: 0;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  overflow: hidden;
}

.pipeline-contract-field,
.pipeline-output-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  background: var(--surface);
}

.pipeline-contract-field + .pipeline-output-toggle,
.pipeline-output-toggle + .pipeline-output-toggle {
  border-top: 1px solid var(--rule-1);
}

.pipeline-output-toggle {
  cursor: pointer;
  transition: background 120ms ease;
}

.pipeline-output-toggle:hover {
  background: var(--surface-hover);
}

.pipeline-output-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pipeline-toggle-copy {
  min-width: 50px;
  padding: 2px 5px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-1);
  color: var(--ink-3);
  font-size: 10.5px;
  text-align: center;
}

.pipeline-output-toggle[data-active="true"] {
  background: var(--surface);
}

.pipeline-output-toggle[data-active="true"] .pipeline-toggle-copy {
  border-color: var(--ink-1);
  background: var(--ink-1);
  color: #fff;
}

.pipeline-output-toggle[data-active="true"] .pipeline-toggle-copy::before {
  content: "include";
}

.pipeline-output-toggle[data-active="false"] .pipeline-toggle-copy::before {
  content: "omit";
}

.pipeline-json-preview {
  margin: 0;
  padding: 13px;
  min-height: 170px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pipeline-local-contract-note {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.pipeline-local-contract-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pipeline-local-contract-table {
  display: grid;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background: var(--surface);
  overflow: hidden;
}

.pipeline-local-contract-row {
  display: grid;
  grid-template-columns: 138px 124px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
}

.pipeline-local-contract-row + .pipeline-local-contract-row {
  border-top: 1px solid var(--rule-1);
}

.pipeline-local-contract-row > div {
  min-width: 0;
  padding: 10px 12px;
}

.pipeline-local-contract-row > div + div {
  border-left: 1px solid var(--rule-1);
}

.pipeline-local-contract-row.head {
  min-height: 34px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pipeline-local-contract-value {
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 550;
}

@media (max-width: 980px) {
  .pipeline-definition-grid,
  .pipeline-source-grid,
  .pipeline-authoring-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pipeline-prompt-section {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .pipeline-key-field {
    max-width: none;
  }

  .pipeline-local-contract-card,
  .pipeline-local-contract-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .pipeline-local-contract-card > div + div,
  .pipeline-local-contract-row > div + div {
    border-left: 0;
    border-top: 1px solid var(--rule-1);
  }
}

@media (max-width: 720px) {
  .scheme-editor-shell {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
  }

  .scheme-editor-body {
    gap: 18px;
    padding: 16px;
  }

  #cs-kind-selector {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .scheme-meaning-input.field {
    min-height: 96px;
  }

  .pipeline-scheme-meaning-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
}

.tenant-admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-admin-tab {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.tenant-admin-tab:hover {
  background: var(--surface-hover);
}

.tenant-admin-tab.active {
  background: var(--surface);
  border-color: var(--rule-2);
  color: var(--ink-1);
  position: relative;
}

.tenant-admin-tab.active::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--ink-1);
  border-radius: 1px;
}

.tenant-admin-tab span {
  font-size: 12.5px;
  font-weight: 550;
}

.tenant-admin-tab small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

.tenant-console {
  display: grid;
  gap: 16px;
}

.tenant-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.tenant-flow-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 13px 15px;
  border-right: 1px solid var(--rule-1);
  align-items: start;
}

.tenant-flow-step:last-child {
  border-right: 0;
}

.tenant-flow-step > span {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-1);
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 10px;
}

.tenant-flow-step.active > span {
  color: var(--ok-ink);
  background: var(--ok-soft);
  border-color: var(--ok-border);
}

.tenant-flow-step strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.tenant-flow-step small {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
}

.tenant-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.tenant-main-stack,
.tenant-side-stack {
  display: grid;
  gap: 16px;
}

.tenant-section {
  overflow: hidden;
}

.tenant-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 15px 17px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-section-head .t-small {
  color: var(--ink-3);
  margin-top: 3px;
}

.tenant-device-list,
.tenant-code-list,
.tenant-pipeline-options {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.tenant-device-list.compact {
  gap: 8px;
}

.tenant-device-card,
.tenant-code-card,
.tenant-pipeline-option {
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
  overflow: hidden;
}

.tenant-device-card {
  display: grid;
  gap: 0;
}

.tenant-device-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 13px 14px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-card-title {
  font-size: 13.5px;
  font-weight: 600;
}

.tenant-muted {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.tenant-status-cluster,
.tenant-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tenant-card-actions {
  padding: 12px 14px;
  border-top: 1px solid var(--rule-1);
}

.tenant-device-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-device-metrics > div {
  padding: 12px 14px;
  border-right: 1px solid var(--rule-1);
}

.tenant-device-metrics > div:last-child {
  border-right: 0;
}

.tenant-camera-strip {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 11px 14px;
}

.tenant-inline-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tenant-inline-form .field {
  width: 190px;
}

.tenant-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 15px 17px 17px;
}

.tenant-form-submit {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

.tenant-source-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(160px, 1fr) minmax(120px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
  padding: 11px 12px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
}

.tenant-code-card {
  padding: 12px 13px;
}

.tenant-code-card pre {
  margin: 10px -13px -12px;
  padding: 12px 13px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.8px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
}

.tenant-rule-list {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
}

.tenant-rule-list p {
  margin: 5px 0 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.45;
}

.tenant-point-list,
.tenant-binding-list {
  display: grid;
}

.tenant-point-row,
.tenant-binding-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-point-row {
  grid-template-columns: minmax(170px, 0.9fr) minmax(190px, 1fr) minmax(140px, 0.65fr) minmax(150px, 0.8fr) auto;
}

.tenant-binding-row {
  grid-template-columns: minmax(160px, 0.9fr) minmax(220px, 1.1fr) minmax(140px, 0.7fr) auto minmax(160px, 0.8fr) auto;
}

.tenant-point-row:last-child,
.tenant-binding-row:last-child {
  border-bottom: 0;
}

.tenant-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.tenant-pipeline-option {
  padding: 12px 13px;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.tenant-pipeline-option:hover {
  border-color: var(--rule-2);
  background: var(--surface-hover);
}

.tenant-pipeline-option:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .tenant-split,
  .tenant-flow,
  .tenant-form-grid,
  .tenant-source-form,
  .tenant-point-row,
  .tenant-binding-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .tenant-flow-step,
  .tenant-device-metrics > div {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .tenant-flow-step:last-child,
  .tenant-device-metrics > div:last-child {
    border-bottom: 0;
  }

  .tenant-device-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .tenant-card-actions,
  .tenant-inline-form {
    justify-content: flex-start;
  }
}

.tenant-workspace {
  display: grid;
  gap: 16px;
}

.tenant-order {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.tenant-order-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  align-items: start;
  padding: 12px 15px;
  border-right: 1px solid var(--rule-1);
  min-width: 0;
}

.tenant-order-item:last-child {
  border-right: 0;
}

.tenant-order-item > span {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-1);
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 10px;
}

.tenant-order-item.active > span {
  color: var(--ok-ink);
  background: var(--ok-soft);
  border-color: var(--ok-border);
}

.tenant-order-item strong {
  font-size: 12.5px;
  font-weight: 600;
  min-width: 0;
}

.tenant-order-item small {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
  min-width: 0;
}

.tenant-table-panel {
  min-width: 0;
}

.tenant-admin-table th,
.tenant-admin-table td {
  vertical-align: middle;
}

.tenant-admin-table .field {
  width: 100%;
  min-width: 150px;
  max-width: 340px;
}

.tenant-state-field {
  max-width: 132px !important;
}

.tenant-chipline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.tenant-token-reveal {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr);
  overflow: hidden;
  border-color: var(--ok-border);
}

.tenant-token-copy {
  padding: 16px 17px;
  background: var(--ok-soft);
  border-right: 1px solid var(--ok-border);
}

.tenant-token-copy .t-small {
  color: var(--ink-2);
  margin-top: 5px;
}

.tenant-token-reveal pre {
  margin: 0;
  padding: 16px 17px;
  background: var(--surface);
  color: var(--ink-1);
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
}

.tenant-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: 7vh 18px 24px;
  background: rgba(17, 17, 16, 0.28);
}

.tenant-modal-backdrop[hidden] {
  display: none;
}

.tenant-modal {
  width: min(620px, 100%);
  max-height: min(760px, 86vh);
  overflow: auto;
  box-shadow: 0 18px 60px rgba(17, 17, 16, 0.18);
}

.tenant-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 17px 18px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-modal-head .t-small {
  color: var(--ink-3);
  margin-top: 4px;
}

.tenant-modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 17px 18px 18px;
}

.tenant-modal-body.compact {
  grid-template-columns: minmax(0, 1fr);
}

.tenant-modal-body label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tenant-modal-body label small {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
}

.tenant-field-wide,
.tenant-modal-actions {
  grid-column: 1 / -1;
}

.tenant-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 4px;
}

.tenant-binding-form {
  margin: 0;
}

.analysis-setup-shell {
  grid-template-columns: minmax(0, 1.72fr) minmax(320px, 0.48fr);
  align-items: start;
}

.analysis-binding-panel {
  min-width: 0;
  overflow: hidden;
}

.analysis-setup-count {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--rule-1);
  border-radius: 999px;
  color: var(--ink-3);
  background: var(--surface-2);
  font-size: 11px;
  white-space: nowrap;
}

.analysis-binding-list {
  display: grid;
  gap: 0;
  background: var(--surface-2);
}

.analysis-binding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--rule-1);
}

.analysis-binding-row:last-child {
  border-bottom: 0;
}

.analysis-card-head,
.analysis-card-body,
.analysis-card-foot,
.analysis-point-cell,
.analysis-binding-toolbar {
  min-width: 0;
}

.analysis-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px 10px;
}

.analysis-point-cell {
  display: grid;
  align-content: start;
  gap: 5px;
}

.analysis-point-title {
  color: var(--ink-1);
  font-size: 14px;
  line-height: 19px;
  font-weight: 600;
}

.analysis-status-stack {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.analysis-card-body {
  display: grid;
  gap: 13px;
  padding: 0 18px 16px;
}

.analysis-binding-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px auto;
  gap: 10px;
  align-items: end;
}

.analysis-binding-field,
.analysis-save-cell {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.analysis-save-cell {
  justify-content: end;
}

.analysis-save-cell .btn {
  white-space: nowrap;
}

.analysis-contract-preview {
  min-width: 0;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0.34)),
    var(--surface);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}

.analysis-preview-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.analysis-preview-kicker {
  color: var(--ink-4);
  font-size: 10.5px;
  line-height: 14px;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.analysis-preview-title {
  color: var(--ink-1);
  font-size: 13.5px;
  line-height: 18px;
  font-weight: 600;
  margin-top: 2px;
}

.analysis-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding-top: 2px;
}

.analysis-preview-section {
  display: grid;
  gap: 4px;
}

.analysis-preview-section strong {
  font-size: 12.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.analysis-chipline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.analysis-empty-preview {
  display: grid;
  gap: 5px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
  align-content: center;
  min-height: 58px;
}

.analysis-empty-preview strong {
  color: var(--ink-1);
  font-size: 13px;
}

.analysis-binding-note {
  min-height: 24px;
  display: flex;
  align-items: center;
  font-size: 12px;
  line-height: 17px;
}

.analysis-catalog-list {
  gap: 0;
}

.analysis-catalog-card {
  display: grid;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.analysis-catalog-card:last-child {
  border-bottom: 0;
}

.analysis-catalog-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.analysis-catalog-title {
  color: var(--ink-1);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

.analysis-catalog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 16px;
}

.analysis-catalog-meta span + span::before {
  content: "/";
  margin-right: 10px;
  color: var(--ink-4);
}

.analysis-catalog-contract {
  display: grid;
  gap: 7px;
}

.analysis-catalog-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 16px;
}

.analysis-catalog-line strong {
  color: var(--ink-1);
  font-size: 11.5px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.pipeline-inspector-modal {
  width: min(760px, 100%);
}

.pipeline-inspector-body {
  display: grid;
  gap: 0;
}

.pipeline-inspector-section {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule-1);
}

.pipeline-inspector-section:last-child {
  border-bottom: 0;
}

.pipeline-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pipeline-inspector-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.pipeline-inspector-grid strong {
  color: var(--ink-1);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pipeline-inspector-prompt {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.66), rgba(255,255,255,0.36)),
    var(--surface);
  padding: 12px 13px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.68);
}

.pipeline-inspector-actions {
  padding: 14px 18px;
  border-top: 1px solid var(--rule-1);
}

.tenant-settings-shell {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.tenant-settings-form {
  display: grid;
  gap: 0;
  margin: 0;
}

.tenant-login-panel {
  max-width: 1180px;
}

.tenant-user-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tenant-user-card {
  padding: 20px 22px;
  border-top: 1px solid var(--line);
}

.tenant-login-card {
  padding: 24px;
}

.tenant-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.tenant-login-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr) auto;
  align-items: end;
  gap: 12px;
}

.tenant-login-create {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr) auto;
  align-items: end;
  gap: 12px;
  padding: 24px;
  margin: 0;
}

.tenant-login-actions,
.tenant-login-state-form {
  display: flex;
  justify-content: flex-end;
}

.tenant-login-state-form {
  margin: 12px 0 0;
}

.tenant-setting-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 17px 18px;
}

.tenant-identity-form {
  margin: 0;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-identity-card {
  align-items: flex-end;
}

.tenant-identity-edit {
  display: grid;
  gap: 6px;
  min-width: min(420px, 44%);
}

.tenant-identity-input-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tenant-identity-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule-1);
}

.tenant-identity-meta > div {
  display: grid;
  gap: 5px;
  padding: 13px 18px 15px;
}

.tenant-identity-meta > div + div {
  border-left: 1px solid var(--rule-1);
}

.tenant-assistant-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: none;
}

.tenant-setting-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
  max-width: 680px;
}

.tenant-setting-title {
  color: var(--ink-1);
  font-size: 14px;
  font-weight: 600;
  line-height: 19px;
}

.tenant-setting-body {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.tenant-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  flex: none;
}

.tenant-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tenant-switch-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--rule-2);
  position: relative;
  transition: background 120ms ease;
}

.tenant-switch-track span {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(17,17,16,0.18);
  transition: transform 120ms ease;
}

.tenant-switch input:checked + .tenant-switch-track {
  background: var(--ink-1);
}

.tenant-switch input:checked + .tenant-switch-track span {
  transform: translateX(14px);
}

.tenant-switch input:focus-visible + .tenant-switch-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.tenant-switch-label {
  min-width: 52px;
}

.tenant-settings-actions {
  display: flex;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--rule-1);
}

.tenant-setting-block {
  display: grid;
  gap: 10px;
  padding: 17px 18px;
  border-top: 1px solid var(--rule-1);
}

.tenant-setting-block textarea.field {
  height: auto;
  min-height: 260px;
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
  font-size: 12.5px;
}

@media (max-width: 840px) {
  .tenant-identity-card,
  .tenant-setting-card {
    align-items: stretch;
    flex-direction: column;
  }

  .tenant-identity-edit {
    min-width: 0;
  }

  .tenant-identity-input-row,
  .tenant-identity-meta {
    grid-template-columns: 1fr;
  }

  .tenant-identity-meta > div + div {
    border-left: 0;
    border-top: 1px solid var(--rule-1);
  }

  .tenant-assistant-state {
    justify-content: space-between;
  }
}

.tenant-instructions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 18px;
}

.point-group-list {
  display: grid;
  gap: 0;
}

.point-group-section {
  border-bottom: 1px solid var(--rule-1);
}

.point-group-section:last-child {
  border-bottom: 0;
}

.point-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 17px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule-1);
}

.point-group-title {
  font-size: 13.5px;
  font-weight: 600;
}

.point-group-rows {
  display: grid;
}

.point-row-card {
  display: grid;
  grid-template-columns: 34px minmax(170px, 1fr) minmax(150px, 0.75fr) minmax(170px, 0.8fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px 17px;
  border-bottom: 1px solid var(--rule-1);
}

.point-row-card:last-child {
  border-bottom: 0;
}

.point-position {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-1);
  border-radius: 50%;
  color: var(--ink-2);
  background: var(--surface);
  font-size: 11px;
}

.point-main {
  min-width: 0;
}

.group-manager-body {
  display: grid;
  gap: 0;
}

.group-manager-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule-1);
}

.group-manager-row:last-child {
  border-bottom: 0;
}

.group-manager-row.new {
  background: var(--surface-2);
}

.group-manager-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

@media (max-width: 1100px) {
  .tenant-order,
  .tenant-token-reveal {
    grid-template-columns: minmax(0, 1fr);
  }

  .tenant-order-item {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .tenant-order-item:last-child {
    border-bottom: 0;
  }

  .tenant-token-copy {
    border-right: 0;
    border-bottom: 1px solid var(--ok-border);
  }

  .analysis-setup-shell,
  .analysis-binding-row,
  .analysis-binding-toolbar,
  .tenant-login-form,
  .tenant-login-create,
  .point-row-card,
  .group-manager-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .analysis-save-cell,
  .tenant-login-actions,
  .tenant-login-state-form {
    justify-content: start;
  }

  .analysis-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .tenant-modal-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .tenant-admin-table {
    min-width: 780px;
  }

  .tenant-table-panel {
    overflow-x: auto;
  }
}

.group-tab-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-1);
  margin-bottom: 16px;
}

.group-tab {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  position: relative;
  transition: background 100ms, color 100ms;
}

.group-tab:hover {
  background: var(--surface-hover);
  color: var(--ink-2);
}

.group-tab.active {
  background: var(--surface);
  border-color: var(--rule-2);
  color: var(--ink-1);
  font-weight: 500;
}

.group-tab.active::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--ink-1);
  border-radius: 1px;
}

.tenant-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: start;
}

.tenant-decision-panel {
  padding: 18px 20px;
}

.tenant-next-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-1);
}

.tenant-info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  overflow: hidden;
}

.tenant-info-cell {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--rule-1);
}

.tenant-info-cell:last-child {
  border-right: 0;
}

.tenant-info-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  font-size: 16px;
  font-weight: 550;
  letter-spacing: -0.012em;
}

.tenant-info-note {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.tenant-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-1);
}

.tenant-empty {
  padding: 18px 16px;
  background: var(--surface);
}

.tenant-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.token-reveal {
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  border-color: var(--warn-border);
  background: var(--warn-soft);
}

.token-value {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-2);
  font-size: 12px;
  word-break: break-all;
}

/* toolbar */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  background: var(--surface);
}
.toolbar.inline {
  border: 0; border-radius: 0; background: transparent;
  padding: 0;
}

/* segmented */
.seg {
  display: inline-flex; border: 1px solid var(--rule-2);
  border-radius: var(--r-2); overflow: hidden; background: var(--surface);
}
.seg button {
  padding: 0 10px; height: 28px;
  background: transparent; border: 0;
  border-right: 1px solid var(--rule-1);
  font: inherit; font-size: 12px; color: var(--ink-2);
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink-1); color: #fff; }
.seg button:not(.on):hover { background: var(--surface-hover); color: var(--ink-1); }
.seg button:disabled {
  background: var(--surface-2);
  color: var(--ink-4);
  cursor: not-allowed;
}
.seg button:disabled:hover { background: var(--surface-2); color: var(--ink-4); }

.schedule-day-seg {
  display: none;
  width: fit-content;
  margin-top: 10px;
}

.schedule-day-seg button {
  padding: 0 14px;
  height: 30px;
  min-width: 0;
}

.schedule-compact-seg {
  max-width: 100%;
  flex-wrap: wrap;
}

.schedule-compact-seg button {
  min-width: 44px;
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 20px;
  align-items: start;
}

.schedule-main,
.schedule-form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.schedule-form {
  margin: 0;
}

.schedule-section {
  padding: 22px 24px;
}

.schedule-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.schedule-section-head.compact {
  margin-bottom: 12px;
}

.schedule-section-head.with-switch {
  align-items: center;
}

.schedule-section-head h2,
.schedule-rail-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.schedule-section-head p {
  margin: 4px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 620px;
}

.schedule-save-state {
  color: var(--ink-4);
  font-size: 11px;
  white-space: nowrap;
}

.schedule-save-state.failed {
  color: var(--alert-ink);
}

.schedule-cadence-grid {
  display: grid;
  grid-template-columns: repeat(var(--schedule-option-count), minmax(0, 1fr));
  gap: 8px;
}

.schedule-cadence-grid .btn {
  min-width: 0;
  height: 44px;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.schedule-window-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.schedule-window-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.schedule-window-row .field {
  width: 96px;
  height: 28px;
}

.schedule-day-mode {
  margin-left: 0;
}

.schedule-control-block {
  min-width: 0;
}

.local-signal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.schedule-field-hint {
  margin-top: 7px;
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 1.4;
}

.schedule-local-points {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.schedule-point-strip {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.schedule-local-note {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--rule-1);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.local-signal-panel.is-muted {
  background: var(--surface-2);
}

.local-signal-panel.is-muted .schedule-switch {
  cursor: not-allowed;
  opacity: 0.58;
}

.schedule-boost-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-1);
}

.schedule-confirm-modal {
  width: min(520px, 100%);
}

.schedule-confirm-modal-body {
  padding: 18px;
}

.schedule-confirm-cadence {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--rule-1);
}

.schedule-confirm-cadence strong {
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
}

.schedule-confirm-cadence span {
  color: var(--ink-3);
  font-size: 12px;
}

.schedule-confirm-modal-body p {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.schedule-confirm-actions {
  padding-top: 18px;
}

.schedule-watch-editor {
  border-top: 1px solid var(--rule-1);
  border-bottom: 1px solid var(--rule-1);
}

.schedule-watch-editor-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1fr) 64px;
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--rule-1);
}

.schedule-watch-editor-row:first-child {
  border-top: 0;
}

.schedule-watch-camera {
  min-width: 0;
}

.schedule-watch-camera span {
  display: block;
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.schedule-watch-camera small {
  display: block;
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 11.5px;
}

.schedule-watch-label-set {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.schedule-watch-option {
  position: relative;
  display: inline-flex;
}

.schedule-watch-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.schedule-watch-option .chip {
  min-height: 28px;
  padding: 0 11px;
  cursor: pointer;
  opacity: 0.46;
  filter: grayscale(0.25);
  transition: opacity 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.schedule-watch-option input:checked + .chip {
  opacity: 1;
  filter: none;
  box-shadow: inset 0 0 0 1px currentColor;
}

.schedule-watch-option input:focus-visible + .chip {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.schedule-watch-option .chip:hover {
  opacity: 0.82;
}

.schedule-watch-save-status {
  min-height: 18px;
  color: var(--ink-4);
  font-size: 11.5px;
  text-align: right;
}

.schedule-switch {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  background: var(--rule-2);
  position: relative;
  cursor: pointer;
  padding: 0;
  flex: none;
  transition: background 180ms ease;
}

.schedule-switch.on {
  background: var(--ink-1);
}

.schedule-switch span {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  top: 2px;
  left: 2px;
  transition: left 180ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  pointer-events: none;
}

.schedule-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 72px;
}

.schedule-rail-panel {
  padding: 16px;
}

.schedule-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.schedule-status-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
}

.schedule-status-note.compact {
  margin-top: 0;
}

.schedule-value {
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  text-align: right;
}

.workspace-scheduler-panel {
  padding: 16px;
}

.workspace-scheduler-head,
.workspace-scheduler-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workspace-panel-title {
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.workspace-panel-meta {
  margin-top: 2px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.4;
}

.workspace-scheduler-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.workspace-scheduler-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-1);
}

.schedule-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.schedule-mini-list span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r-2);
  color: var(--ink-2);
  background: var(--surface);
  font-size: 12px;
}

.schedule-watch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.schedule-watch-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: start;
  padding-top: 10px;
  border-top: 1px solid var(--rule-1);
}

.schedule-watch-row > span {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.schedule-watch-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schedule-watch-list.compact {
  gap: 8px;
  margin-top: 10px;
}

.schedule-watch-row.compact {
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding-top: 8px;
}

.schedule-watch-row.compact > div {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.schedule-watch-row.compact > div::-webkit-scrollbar {
  display: none;
}

.schedule-watch-row.compact .chip {
  flex: 0 0 auto;
}

.schedule-empty-line {
  margin-top: 10px;
  color: var(--ink-4);
  font-size: 12px;
}

.schedule-rail-action {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .schedule-layout {
    grid-template-columns: 1fr;
  }

  .schedule-rail {
    position: static;
  }

  #local-watch-fields {
    grid-template-columns: 1fr !important;
  }

  .schedule-watch-editor-row {
    grid-template-columns: minmax(140px, 0.45fr) minmax(0, 1fr);
  }

  .schedule-watch-save-status {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .schedule-section {
    padding: 18px;
  }

  .schedule-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .schedule-section-head.with-switch {
    flex-direction: row;
    align-items: center;
  }

  .schedule-cadence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-boost-fields,
  .local-signal-fields {
    grid-template-columns: 1fr;
  }

  .schedule-watch-editor-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .schedule-watch-save-status {
    grid-column: auto;
    text-align: left;
  }

  .schedule-window-row .field {
    width: 100%;
  }
}

/* Data row (list items) */
.drow {
  display: grid; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule-1);
  gap: 16px;
}
.drow:hover { background: var(--surface-hover); }
.drow:last-child { border-bottom: 0; }

/* tweak drawer */
.tweaks {
  position: fixed; bottom: 16px; right: 16px;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  z-index: 50;
  font-size: 12.5px;
}
.tweaks .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-1);
}
.tweaks .head h4 {
  margin: 0; font-size: 12px; font-weight: 550;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.tweaks .body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.tweaks .t-row .label { display: block; margin-bottom: 6px; }
.tweaks .camera-count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--rule-2);
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--surface);
}
.tweaks .camera-count-grid button {
  height: 28px;
  border: 0;
  border-right: 1px solid var(--rule-1);
  border-bottom: 1px solid var(--rule-1);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tweaks .camera-count-grid button:nth-child(4n) { border-right: 0; }
.tweaks .camera-count-grid button:nth-last-child(-n+4) { border-bottom: 0; }
.tweaks .camera-count-grid button.on { background: var(--ink-1); color: #fff; }
.tweaks .camera-count-grid button:not(.on):hover { background: var(--surface-hover); color: var(--ink-1); }
.tweaks .swatches { display: flex; gap: 6px; }
.tweaks .swatch {
  width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--rule-1);
}
.tweaks .swatch.on { outline: 2px solid var(--ink-1); outline-offset: 1px; }

/* slide-over drawer (chat) */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(17,17,16,0.18);
  z-index: 60; animation: fade 200ms ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--rule-1);
  border-radius: 0;                              /* flush edge — no rounding */
  box-shadow: -8px 0 32px rgba(17,17,16,0.10);
  z-index: 61;
  display: flex; flex-direction: column;
  animation: drawer-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Chat suggestion chips — pill style, lighter than a button */
.chat-chip {
  display: inline-flex; align-items: center;
  height: 28px; padding: 0 12px; flex: none;
  background: var(--surface-2); border: 1px solid var(--rule-1);
  border-radius: 14px;
  font-size: 11.5px; font-family: var(--font-sans);
  color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.chat-chip:hover {
  background: var(--surface);
  border-color: var(--rule-2);
  color: var(--ink-1);
}
.table tr[data-selected="true"] > td { background: var(--surface-raised); }

/* camera feed tile — responsive from 1 to 3 cameras wide */
.feed {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-3);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-width: 0;
}
.feed .feed-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px;
}
.feed .feed-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 550; min-width: 0;
}
.feed .feed-name { letter-spacing: -0.005em; }
.feed .feed-sub {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 10px;
  font-size: 11px;
  color: var(--ink-3);
  min-width: 0;
}
.feed .feed-sub .mono { font-size: 11px; letter-spacing: 0; color: var(--ink-3); }
.feed .feed-sub.hidden { display: none !important; }
.feed .feed-body { aspect-ratio: 16/9; position: relative; border-top: 1px solid var(--rule-1); border-bottom: 1px solid var(--rule-1); }
.feed .feed-foot {
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.feed .feed-foot-row {
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.feed .feed-result-meta {
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.feed .feed-signal-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.feed .feed-signal-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--ink-4);
  opacity: 0.7;
  flex: none;
}
.feed .feed-signal-label {
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.feed .feed-signal-value {
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.feed .feed-evidence-line {
  color: var(--ink-4);
  font-size: 10.5px;
  line-height: 1.35;
}
.feed .feed-evidence-line.hidden { display: none !important; }
.feed .v-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 12px; align-items: baseline;
}
.feed .v-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.feed .v-col.right { text-align: right; align-items: flex-end; }
.feed .v-label {
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; font-family: var(--font-mono);
}
.feed .v-value {
  font-size: 22px; letter-spacing: -0.012em; font-weight: 500;
  line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed.compact .v-value { font-size: 19px; }
.feed .v-conf { font-size: 13px; line-height: 1; }
.feed .v-actions { display: flex; gap: 6px; }
.feed .v-actions .btn.grow { flex: 1 1 auto; }

.feed.uncalibrated .feed-body {
  background: repeating-linear-gradient(135deg, #F6F5F0 0 14px, #EFEEE8 14px 28px);
}
.feed.uncalibrated .feed-body::after {
  content: "UNCALIBRATED — NO SCHEME";
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--ink-3);
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
.feed.offline .feed-body {
  filter: saturate(0.2) brightness(1.02);
}
.feed.offline .feed-body::after {
  content: "OFFLINE — SIGNAL UNAVAILABLE";
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--ink-3);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(250,250,247,0.18);
}

/* cam-toggle (dashboard chart legend / filter) */
.cam-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  background: var(--surface);
  font: inherit; font-size: 12px; color: var(--ink-2);
  cursor: pointer;
  transition: background 80ms, border-color 80ms, opacity 80ms;
}
.cam-toggle[data-on="false"] { opacity: 0.45; background: var(--surface-2); }
.cam-toggle:hover { background: var(--surface-hover); }
.cam-toggle:disabled,
.cam-toggle.is-disabled {
  cursor: default;
  opacity: 1;
  background: var(--surface);
  color: var(--ink-3);
}
.cam-toggle:disabled:hover,
.cam-toggle.is-disabled:hover { background: var(--surface); }
.cam-toggle .cam-sw { width: 8px; height: 8px; border-radius: 2px; }
.cam-toggle .cam-name { color: var(--ink-3); font-size: 11.5px; }
.cam-toggle .mono { font-size: 11px; letter-spacing: 0; }

/* Event / notice rows */
.notice {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-1);
}
.notice:last-child { border-bottom: 0; }
.notice .when { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.notice .what { font-size: 13px; }
.notice .what .src { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.notice { transition: background 80ms ease; }
.notice:hover { background: var(--surface-hover); cursor: pointer; }

/* Notification bell badge + dropdown */
.notif-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 15px; height: 15px;
  border-radius: 999px;
  background: var(--alert, #E53E3E);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--surface);
  pointer-events: none;
  line-height: 1;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 296px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(17,17,16,0.13), 0 2px 6px rgba(17,17,16,0.06);
  z-index: 75;
  overflow: hidden;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px 9px;
  border-bottom: 1px solid var(--rule-1);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-1);
}
.notif-item {
  display: block;
  padding: 9px 13px;
  border-bottom: 1px solid var(--rule-1);
  text-decoration: none;
  transition: background 70ms ease;
}
.notif-item:hover { background: var(--surface-hover); }
.notif-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.notif-src { font-size: 12px; font-weight: 500; color: var(--ink-1); }
.notif-time { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.notif-pills { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.notif-empty {
  padding: 20px 13px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}
.notif-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-top: 1px solid var(--rule-1);
  transition: background 70ms ease;
}
.notif-footer:hover { background: var(--surface-hover); color: var(--ink-1); }

/* Events feed cards */
.event-card {
  border-left: 3px solid var(--ink-6, #E5E4DE);
  border-radius: 0 6px 6px 0;
  background: var(--surface-1, #FAFAF7);
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
  transition: background 80ms ease;
}
.event-card:hover { background: var(--surface-2, #F2F1EB); }
.event-card[data-severity="alert"] { border-left-color: #E53E3E; }
.event-card[data-severity="warn"]  { border-left-color: #D97706; }
.event-card.kind-watch { background: color-mix(in srgb, var(--accent, #3B6EF8) 5%, var(--surface-1, #FAFAF7)); }
.event-card.kind-watch:hover { background: color-mix(in srgb, var(--accent, #3B6EF8) 9%, var(--surface-1, #FAFAF7)); }
.events-date-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--rule-1);
  margin-bottom: 8px;
}
.events-date-header:first-child { padding-top: 4px; }
.event-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.event-card-title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-1);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-card-time {
  font-size: 11px;
  color: var(--ink-4);
  white-space: nowrap;
  flex: none;
}
.event-card-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
/* Watch-label config (admin binding form) */
.analysis-watch-labels {
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Toggle-chip watch rule controls in modal */
.event-watch-toggle {
  display: inline-flex;
  cursor: pointer;
}
.event-watch-chip {
  transition: opacity 140ms ease, filter 140ms ease, outline-color 100ms ease;
  user-select: none;
  pointer-events: none;
}
/* Inactive: dimmed but colors visible */
.event-watch-toggle input:not(:checked) ~ .event-watch-chip {
  opacity: 0.32;
  filter: grayscale(15%);
}
/* Hover inactive: preview */
.event-watch-toggle:hover input:not(:checked) ~ .event-watch-chip {
  opacity: 0.68;
  filter: none;
}
/* Active: fully lit + ring */
.event-watch-toggle input:checked ~ .event-watch-chip {
  opacity: 1;
  filter: none;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
/* Hover active */
.event-watch-toggle:hover input:checked ~ .event-watch-chip {
  opacity: 0.84;
}
/* Camera row separator */
.event-watch-camera-row + .event-watch-camera-row {
  padding-top: 14px;
  border-top: 1px solid var(--rule-1);
}

/* spark bar/line — flat SVG, inherited stroke */
.spark path { stroke: var(--ink-1); stroke-width: 1.25; fill: none; }
.spark .area { fill: var(--surface-2); stroke: none; }
.spark .axis { stroke: var(--rule-1); stroke-width: 1; }

/* annotation workspace (legacy .studio rules removed — replaced by .studio-v2 system) */

/* login */
.login-shell {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.login-shell .info {
  background: var(--ink-1); color: #fff;
  padding: 40px 44px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden; position: relative;
}
.login-shell .info .grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.05));
}
.login-shell .form-col {
  display: grid; place-items: center;
  padding: 40px;
}

.login-shell.login-v2 {
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  background: #F7F6F1;
}
.login-v2 .login-hero {
  position: relative;
  overflow: hidden;
  padding: 52px 56px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(17,17,16,0.76), rgba(17,17,16,0.92)),
    linear-gradient(135deg, #22211E, #111110);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh;
}
.login-v2 .login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.72;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), rgba(0,0,0,0.16));
}
.login-v2 .login-brand,
.login-v2 .login-copy {
  position: relative;
  z-index: 1;
}
.login-v2 .login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-v2 .login-mark {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111110;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.login-v2 .login-brand-name {
  font-size: 14px;
  font-weight: 600;
}
.login-v2 .login-brand-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(255,255,255,0.52);
}
.login-v2 .login-copy {
  max-width: 520px;
  margin: auto 0;
  padding-bottom: 52px;
}
.login-v2 .login-copy .t-eyebrow {
  color: rgba(255,255,255,0.58);
}
.login-v2 .login-copy h1 {
  margin: 14px 0 0;
  max-width: 500px;
  font-size: 42px;
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: 0;
}
.login-v2 .login-copy p {
  margin: 18px 0 0;
  max-width: 420px;
  color: rgba(255,255,255,0.64);
  font-size: 14px;
  line-height: 1.55;
}
.login-v2 .login-form-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px;
}
.login-v2 .login-card {
  width: min(100%, 460px);
  padding: 30px;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 50px rgba(17,17,16,0.08);
}
.login-v2 .login-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}
.login-v2 .login-card h2 {
  margin: 7px 0 0;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 550;
  letter-spacing: 0;
}
.login-v2 .login-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
.login-v2 .login-field-label span {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 450;
  text-align: right;
}
.login-v2 .login-detection {
  margin: 12px 0 18px;
  padding: 12px 13px;
  border: 1px solid var(--rule-1);
  border-radius: 6px;
  background: var(--surface-2);
}
.login-v2 .login-detection.resolved {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.login-v2 .login-detection-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
}
.login-v2 .login-detection-text {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.login-v2 .login-submit {
  width: 100%;
  margin-top: 20px;
}

/* responsive: auto-collapse rail on narrow viewports */
@media (max-width: 980px) {
  .login-shell.login-v2 {
    grid-template-columns: 1fr;
  }
  .login-v2 .login-hero {
    min-height: auto;
    padding: 34px 24px;
    gap: 32px;
  }
  .login-v2 .login-copy {
    margin: 16px 0 0;
  }
  .login-v2 .login-copy h1 {
    font-size: 32px;
  }
  .login-v2 .login-form-panel {
    min-height: auto;
    padding: 28px 20px 40px;
  }
  .login-v2 .login-card {
    padding: 22px;
  }
  .login-v2 .login-feed-grid {
    grid-template-columns: 1fr;
  }
  .rail { width: 56px; }
  .rail .nav-label, .rail .section-title, .rail .rail-foot { display: none; }
  .rail a, .rail button.nav-item { justify-content: center; padding: 0; width: 36px; margin: 2px auto; height: 36px; }
  .studio {
    grid-template-columns: 220px 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(220px, auto) 140px;
  }
  .studio .pane.right {
    grid-column: 1 / -1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--rule-1);
  }
  .studio .filmstrip { grid-row: 3; }
}

@media (max-width: 1220px) {
  .situation-shell {
    grid-template-columns: 1fr;
  }
  .situation-side {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 980px) {
  .workspace-stage-shell.with-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .situation-side {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .situation-action {
    padding-left: 0;
    border-left: 0;
    align-items: flex-start;
    justify-self: start;
  }
  .situation-action-sub,
  .situation-action-note {
    text-align: left;
  }

  .tenant-flow-strip {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tenant-flow-step {
    padding-right: 0;
  }

  .tenant-flow-rule {
    display: none;
  }

  .point-card-list {
    grid-template-columns: 1fr;
  }

  .point-card-grid {
    grid-template-columns: 1fr;
  }

  .point-card-metric {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .point-card-metric:last-child {
    border-bottom: 0;
  }

  .point-card-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .tenant-page-grid {
    grid-template-columns: 1fr;
  }

  .tenant-index-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tenant-index-summary-cell {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .tenant-index-toolbar,
  .tenant-index-row {
    grid-template-columns: 1fr;
  }

  .tenant-index-header {
    display: none;
  }

  .tenant-index-signals {
    grid-template-columns: 1fr;
  }

  .pipeline-layout {
    grid-template-columns: 1fr;
  }

  .pipeline-list-panel {
    position: static;
  }

  .pipeline-form-grid,
  .pipeline-field-row,
  .pipeline-add-field {
    grid-template-columns: 1fr;
  }

  .pipeline-editor-head,
  .pipeline-editor-body {
    grid-template-columns: 1fr;
  }

  .tenant-info-strip {
    grid-template-columns: 1fr;
  }

  .tenant-info-cell {
    border-right: 0;
    border-bottom: 1px solid var(--rule-1);
  }

  .tenant-info-cell:last-child {
    border-bottom: 0;
  }

  .tenant-source-row {
    grid-template-columns: 1fr;
  }

  .tenant-next-action {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .situation-bar {
    padding: 16px 16px 18px;
  }
  .situation-headline {
    gap: 8px 12px;
  }
  .situation-context {
    font-size: 12.5px;
  }
  .situation-rail {
    grid-template-columns: 1fr;
  }
  .situation-metric-inline {
    border-left: 0;
    border-top: 1px solid var(--rule-1);
    padding: 10px 0 0;
  }
}

/* ============================================================
   App-shell bridge — extras on top of prototype tokens/shell
   ============================================================ */

body.app-body {
    color: var(--ink-1);
    background: var(--paper);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.45;
}

/* Mobile rail behaviour */
@media (max-width: 1023px) {
    .app .rail {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        z-index: 50;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
    }
    .app .rail.is-open { transform: translateX(0); }
    .app .right-col { width: 100%; }
}

/* Rail collapsed icon-only state */
.rail.collapsed .nav-label,
.rail.collapsed .section-title,
.rail.collapsed .badge,
.rail.collapsed .rail-foot .min-w-0,
.rail.collapsed .rail-foot form { display: none; }
.rail.collapsed .nav-item { justify-content: center; padding: 0; width: 36px; margin: 2px auto; height: 36px; }
.rail.collapsed .rail-foot { justify-content: center; padding: 12px 8px; }

/* Page-head actions wrap */
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Connect/online chip helpers (prototype variants) */
.chip.ok    .dot { background: var(--ok); }
.chip.warn  .dot { background: var(--warn); }
.chip.alert .dot { background: var(--alert); }
.chip.accent .dot { background: var(--accent); }
.chip.saa-pill-optimal .dot,
.chip.saa-pill-suboptimal .dot,
.chip.saa-pill-critical .dot,
.chip.saa-pill-unknown .dot { background: currentColor; }
.label-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex: none;
    background: var(--ink-4);
}
.label-dot.saa-pill-optimal { background: var(--ok); }
.label-dot.saa-pill-suboptimal { background: var(--warn); }
.label-dot.saa-pill-critical { background: var(--alert); }
.label-dot.saa-pill-unknown { background: var(--ink-4); }

.workspace-analysis-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 8px 12px;
    border: 1px solid var(--rule-1);
    border-radius: var(--r-2);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12.5px;
}
.workspace-analysis-status.hidden { display: none !important; }
.workspace-analysis-status[data-state="analyzing"] {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.workspace-analysis-status[data-state="error"] {
    border-color: var(--alert-border);
    background: var(--alert-soft);
    color: var(--alert-ink);
}
.workspace-analysis-status[data-state="complete"] {
    border-color: var(--ok-border);
    background: var(--ok-soft);
    color: var(--ok-ink);
}
.workspace-analysis-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex: none;
}
.feed-analysis-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(250, 250, 247, 0.72);
    color: var(--ink-1);
    font-size: 12.5px;
    font-weight: 550;
    backdrop-filter: blur(1px);
    pointer-events: none;
}
.feed-analysis-overlay.hidden { display: none !important; }
.feed.is-analyzing {
    border-color: var(--accent-border);
}
.feed.is-offline .feed-body {
    filter: saturate(0.45) brightness(1.03);
}

/* Workspace primary panel scroller for chat */
.workspace-stage-shell .panel { min-width: 0; }

/* Tighten Tailwind-injected utilities collisions for prototype primitives.
   Tailwind adds `border-style: solid` on every element at preflight. The
   prototype .panel/.feed/.btn/etc rely on having their own border colors,
   which still works because we set border explicitly. We force background +
   color on .btn so Tailwind cannot wash them out. */
.btn { background-clip: padding-box; }

/* Topbar trailing util container alignment */
.topbar .util .btn.icon { color: var(--ink-3); }
.topbar .util .btn.icon:hover { color: var(--ink-1); }

/* Prevent prototype .chip from being hidden by Tailwind 'hidden' */
.chip.hidden { display: none !important; }

/* Notice strip used on the workspace */
.workspace-notice {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    border-radius: var(--r-3);
    color: var(--accent-ink);
    font-size: 12.5px;
}
.workspace-notice.warn {
    border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn-ink);
}

/* Page-body section spacing aligned to prototype */
.page-body > * + * { margin-top: 16px; }

/* ── Data Engine: campaign detail ──────────────────────────────────────────── */

/* Track card */
.de-track-card { overflow: hidden; }

/* Review coverage bar */
.de-coverage-bar {
  height: 4px;
  background: var(--rule-1);
  border-radius: 2px;
  overflow: hidden;
}
.de-coverage-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 300ms ease;
}
.de-coverage-fill--enabled { background: var(--accent); }
.de-coverage-fill--browse  { background: var(--warn); }

/* Thumbnail strip */
.de-thumb-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.de-thumb-strip::-webkit-scrollbar { display: none; }

.de-thumb {
  flex: 0 0 80px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  display: block;
  text-decoration: none;
  border: 1px solid var(--rule-1);
  transition: border-color 100ms ease, opacity 100ms ease;
}
.de-thumb:hover { border-color: var(--rule-2); opacity: 0.88; }
.de-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.de-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--surface-sunken);
}

/* Schedule panel inline animation */
#de-schedule-panel { animation: deSlideDown 120ms ease; }
@keyframes deSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Annotation Studio V2 ──────────────────────────────────────────────────── */

/* Page shell: flex column filling the content area */
body:has(.studio-shell) .content {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
body:has(.studio-shell) .page-head { display: none; }
body:has(.studio-shell) .page-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
body:has(.studio-shell) .page-body > * + * { margin-top: 0; }

#annotation-page-root.studio-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--surface);
}

/* 1-line topbar */
.studio-topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
  min-height: 0;
}
.studio-topbar .grow { flex: 1 1 auto; min-width: 0; }
.studio-breadcrumb {
  display: flex; align-items: center; gap: 7px;
  min-width: 0; overflow: hidden;
}
.studio-breadcrumb-back {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 12.5px; font-weight: 500; color: var(--ink-4);
  text-decoration: none; padding: 2px 0;
  transition: color 80ms ease;
}
.studio-breadcrumb-back:hover { color: var(--ink-2); }
.studio-breadcrumb-sep { flex: none; font-size: 13px; color: var(--ink-5); }
.studio-topbar .dataset-name {
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink-1); min-width: 0;
}

/* Track pill tabs */
.studio-track-tabs {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 14px;
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface);
}
.studio-track-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer; background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
  transition: background 80ms ease, border-color 80ms ease;
}
.studio-track-tab:hover { background: var(--surface-hover); }
.studio-track-tab.active { background: var(--ink-1); color: #fff; border-color: var(--ink-1); }
.studio-track-tab .dot { background: var(--ink-3); }
.studio-track-tab.active .dot { background: #fff; }

/* Outer grid: center + sidebar */
/* Sidebar is always visible — no collapse state needed */
.studio-v2 {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) 290px;
  overflow: hidden;
}

/* Center column — scrolls to reveal filmstrip + annotations below the viewport */
.studio-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}

/* Viewport — capped at 65vh so the colorbar, filmstrip, and annotations are
   always visible without scrolling. JS sets max-width via clampViewportWidth()
   to prevent black pillarbox bars when max-height constrains the height. */
.studio-viewport {
  flex: none;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 65vh;
  position: relative;
  overflow: hidden;
  background: var(--surface-cinema);
}
/* Once JS has detected the image ratio, aspectRatio is updated via inline style */
/* Canvas fills the viewport; drawBitmap handles aspect-ratio scaling internally */
.studio-viewport canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Frame HUD overlay (must be above the absolute canvas) */
.studio-frame-hud {
  position: absolute; bottom: 10px; right: 12px; z-index: 2;
  display: flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,0.52); color: #fff;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-family: var(--font-mono);
  pointer-events: none; z-index: 2;
  backdrop-filter: blur(4px);
}
.studio-frame-hud .vr { background: rgba(255,255,255,0.25); width: 1px; height: 10px; }

/* Filmstrip + colorbar wrapper */
.studio-strip-wrap {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--rule-1);
  user-select: none;
}

/* Annotation color bar — 20px for clear visibility */
.studio-colorbar {
  position: relative;
  height: 20px;
  background: var(--surface-2);
  cursor: pointer;
  overflow: visible;
}
.studio-colorbar [data-annotation-spans] { position: absolute; inset: 0; }
.studio-colorbar .studio-playhead {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px; background: var(--ink-1); border-radius: 1px;
  pointer-events: none; z-index: 3;
}
.studio-colorbar .studio-sel-span {
  position: absolute; top: 0; bottom: 0;
  background: rgba(53,103,183,0.20);
  pointer-events: none; z-index: 2;
}
.studio-colorbar [data-annotation-selection-marker="start"] {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--accent); border-radius: 1px;
  pointer-events: none; z-index: 4;
}
.studio-colorbar [data-annotation-selection-marker="end"] {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--alert); border-radius: 1px;
  pointer-events: none; z-index: 4;
}

/* Filmstrip */
.studio-filmstrip {
  display: flex; gap: 3px; align-items: flex-start;
  padding: 5px 8px 6px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent;
}
.studio-filmstrip::-webkit-scrollbar { height: 4px; }
.studio-filmstrip::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 2px; }

/* Individual thumbnail */
.studio-thumb {
  flex: none; width: 100px; height: 56px;
  background: var(--surface-2);
  border: 1px solid var(--rule-1);
  border-radius: 3px;
  position: relative;
  cursor: pointer; overflow: hidden;
  transition: outline 60ms ease, opacity 60ms ease;
}
.studio-thumb canvas, .studio-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.studio-thumb:hover { opacity: 0.88; }
.studio-thumb.current { outline: 2px solid var(--ink-1); outline-offset: -2px; }
.studio-thumb.sel-start { outline: 2px solid var(--accent); outline-offset: -2px; }
.studio-thumb.sel-end   { outline: 2px solid var(--alert);  outline-offset: -2px; }

/* Filmstrip thumbnail image — fades in after load */
.studio-thumb img {
  opacity: 0;
  transition: opacity 180ms ease;
  user-select: none; -webkit-user-drag: none;
}
.studio-thumb img.is-loaded { opacity: 1; }

/* 3px color dot at thumb bottom */
.studio-thumb-dot {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; border-radius: 0 0 3px 3px;
  pointer-events: none;
}

/* .studio-actionbar removed — label buttons and range controls moved to right sidebar */
.studio-sel-readout { display: flex; align-items: center; gap: 5px; flex: none; flex-wrap: wrap; }

/* Label buttons dim until a range is active; full opacity when range set */
.studio-label-group .studio-label-btn { opacity: 0.72; transition: opacity 120ms ease, filter 80ms ease, transform 60ms ease, box-shadow 80ms ease; }
.studio-actionbar.has-selection .studio-label-group .studio-label-btn { opacity: 1; }
.studio-label-group .studio-label-btn:hover { opacity: 1; }

/* Success flash after annotation saved */
@keyframes studioFlashFade {
  0%   { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* Selection marker ping animation */
@keyframes studioMarkerPing {
  0%   { transform: scaleY(2.5) scaleX(1.5); }
  60%  { transform: scaleY(1.2) scaleX(1); }
  100% { transform: scaleY(1) scaleX(1); }
}
.studio-marker-ping { animation: studioMarkerPing 220ms ease; }

/* Label buttons — colored by token, slightly prominent */
.studio-label-btn {
  position: relative;
  height: 34px; padding: 0 16px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--r-2);
  transition: filter 80ms ease, transform 60ms ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.studio-label-btn:active:not(:disabled) { transform: scale(0.97); box-shadow: none; }
.studio-label-btn[data-label-token="critical"]            { background: var(--alert-soft);   color: var(--alert-ink);   border-color: var(--alert-border); }
.studio-label-btn[data-label-token="critical"]:hover      { filter: brightness(0.94); }
.studio-label-btn[data-label-token="warning"],
.studio-label-btn[data-label-token="suboptimal"]          { background: var(--warn-soft);    color: var(--warn-ink);    border-color: var(--warn-border); }
.studio-label-btn[data-label-token="warning"]:hover,
.studio-label-btn[data-label-token="suboptimal"]:hover    { filter: brightness(0.94); }
.studio-label-btn[data-label-token="positive"],
.studio-label-btn[data-label-token="optimal"]             { background: var(--ok-soft);      color: var(--ok-ink);      border-color: var(--ok-border); }
.studio-label-btn[data-label-token="positive"]:hover,
.studio-label-btn[data-label-token="optimal"]:hover       { filter: brightness(0.94); }
.studio-label-btn[data-label-token="info"]                { background: var(--accent-soft);  color: var(--accent-ink);  border-color: var(--accent-border); }
.studio-label-btn[data-label-token="info"]:hover          { filter: brightness(0.94); }
.studio-label-btn[data-label-token="neutral"],
.studio-label-btn[data-label-token=""]:not([data-label-token="critical"]) { background: var(--neutral-chip); color: var(--ink-2); border-color: var(--rule-1); }

/* Keyboard shortcut badge inside label button */
.studio-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 3px;
  background: rgba(0,0,0,0.14); border-radius: 3px;
  font-size: 10px; font-family: var(--font-mono);
  flex: none; margin-left: 4px;
}

/* Dot inside label button */
.studio-label-dot { flex: none; }
.studio-label-dot[data-token-dot="critical"]            { background: var(--alert); }
.studio-label-dot[data-token-dot="warning"],
.studio-label-dot[data-token-dot="suboptimal"]          { background: var(--warn); }
.studio-label-dot[data-token-dot="positive"],
.studio-label-dot[data-token-dot="optimal"]             { background: var(--ok); }
.studio-label-dot[data-token-dot="info"]                { background: var(--accent); }
.studio-label-dot[data-token-dot="neutral"]             { background: var(--ink-4); }

/* Right sidebar — annotation control panel */
.studio-sidebar {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--rule-1);
  background: var(--surface);
  overflow: hidden; min-height: 0;
}
.studio-sidebar-hd {
  flex: none; padding: 10px 14px;
  border-bottom: 1px solid var(--rule-1);
  display: flex; align-items: center; gap: 8px;
}
.studio-sidebar-hd .grow { flex: 1 1 auto; }

/* Section: label buttons — fills available space, scrolls if many labels */
.studio-sidebar-labels {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px;
  scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent;
}
/* Full-width label buttons in sidebar */
.studio-sidebar-labels .studio-label-btn {
  width: 100%; justify-content: flex-start; height: 40px;
  font-size: 13px; font-weight: 500;
}

/* Section: range controls — always visible */
.studio-sidebar-range {
  flex: none; padding: 10px 12px;
  border-top: 1px solid var(--rule-1);
  display: flex; flex-direction: column; gap: 7px;
}
.studio-range-display {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
}

/* Section: export */
.studio-sidebar-export {
  flex: none; padding: 8px 12px 10px;
  border-top: 1px solid var(--rule-1);
  display: flex; flex-direction: column; gap: 4px;
}
.studio-sidebar-export .btn {
  justify-content: flex-start; gap: 8px; font-size: 12px;
  color: var(--ink-2); font-weight: 500;
}

/* Eyebrow section label used inside sidebar sections */
.studio-sidebar-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-4); flex: none;
}

/* Annotation section — natural height, part of the scrollable center column */
.studio-anno-section {
  flex: none;
  overflow: visible;
  border-top: 1px solid var(--rule-1);
}
.studio-anno-section::-webkit-scrollbar { width: 4px; }
.studio-anno-section::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 2px; }
.studio-anno-section-hd {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); padding: 5px 14px;
  border-bottom: 1px solid var(--rule-1);
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-4);
}

/* Annotation row in sidebar — colored left border style */
.studio-anno-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 80ms ease;
}
.studio-anno-row + .studio-anno-row { border-top: 1px solid var(--rule-1); }
.studio-anno-row:hover { background: var(--surface-hover); }
.studio-anno-row-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.studio-anno-row-label { font-size: 12.5px; font-weight: 500; color: var(--ink-1); }
.studio-anno-row-meta  { font-size: 11px; color: var(--ink-4); font-family: var(--font-mono); }
/* Token-colored left border */
.studio-anno-row[data-token="critical"]                   { border-left-color: var(--alert); }
.studio-anno-row[data-token="warning"],
.studio-anno-row[data-token="suboptimal"]                 { border-left-color: var(--warn); }
.studio-anno-row[data-token="positive"],
.studio-anno-row[data-token="optimal"]                    { border-left-color: var(--ok); }
.studio-anno-row[data-token="info"]                       { border-left-color: var(--accent); }
.studio-anno-row[data-token="neutral"]                    { border-left-color: var(--ink-4); }

/* Token-keyed chip color classes (used in sidebar + annotation list) */
.chip-critical   { background: var(--alert-soft);   color: var(--alert-ink);   border-color: var(--alert-border); }
.chip-warning,
.chip-suboptimal { background: var(--warn-soft);    color: var(--warn-ink);    border-color: var(--warn-border); }
.chip-positive,
.chip-optimal    { background: var(--ok-soft);      color: var(--ok-ink);      border-color: var(--ok-border); }
.chip-info       { background: var(--accent-soft);  color: var(--accent-ink);  border-color: var(--accent-border); }
.chip-neutral    { background: var(--neutral-chip); color: var(--ink-2);       border-color: var(--rule-1); }

/* Keyboard shortcuts modal */
.studio-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.38);
  display: grid; place-items: center;
  z-index: 60;
}
.studio-modal-overlay[hidden] { display: none; }
.studio-modal-body { width: min(440px,92vw); }
.studio-modal-body .studio-sidebar-hd { border-radius: 6px 6px 0 0; }

/* Responsive: collapse sidebar to overlay below 1000px */
@media (max-width: 1000px) {
  .studio-v2 { grid-template-columns: minmax(0,1fr); }
  .studio-sidebar {
    position: fixed; right: 0; top: 0; bottom: 0; width: 280px;
    z-index: 50; box-shadow: -4px 0 24px rgba(0,0,0,0.16);
    transform: translateX(100%); transition: transform 200ms ease;
  }
  .studio-v2[data-sidebar-open="true"] .studio-sidebar { transform: translateX(0); }
}
