/* ==============================================
   Forge716 Sports — Base Styles (Sandbox)
   Fixed Bottom Drill-Down Layout
   ============================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-accent: #0f3460;
    --panel-bg: #1e2746;
    --panel-hover: #253255;
    --border-color: #2a3a5c;
    --text-primary: #f5f5f5;
    --text-secondary: #c0c7d4;
    --text-muted: #7a8599;
    --accent-color: #4a9eff;
    --accent: #4a9eff;
    --accent-hover: #6ab4ff;
    --accent-rgb: 74, 158, 255;
    --success-color: #4caf50;
    --success: #4caf50;
    --error-color: #ef4444;
    --error: #ef4444;
    --border-subtle: rgba(255, 255, 255, 0.12);
    --bg-tertiary: rgba(255, 255, 255, 0.06);
    --badge-bg: #ff9800;
    --badge-text: #1a1a2e;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --radius-sm: 6px;
    --radius-md: 10px;
    --transition-fast: 0.15s ease;
    --bottom-panel-height: 60px;
    --bottom-panel-expanded: 45vh;
    /* Entity Card Dimensions */
    --entity-card-width: 170px;
    --entity-card-height: 58px;
    --entity-card-icon-size: 24px;
    /* Entity Chat Drawer */
    --entity-chat-width: 380px;
    --entity-chat-handle-width: 52px;
    /* Selection Area Styling */
    --selection-area-bg: rgba(15, 52, 96, 0.25);
    --selection-area-border: rgba(74, 158, 255, 0.15);
    /* Progressive Blue Levels (darker to lighter) */
    --level-0-bg: #16213e;
    --level-1-bg: #1a2847;
    --level-2-bg: #1e2f50;
    --level-3-bg: #233659;
    --level-4-bg: #283d62;
    --level-5-bg: #2d446b;
    --level-6-bg: #324b74;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: 
        radial-gradient(circle, rgba(255, 255, 255, 0.087) 1.25px, transparent 1.25px),
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: 20px 20px, 100% 100%;
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    padding: 16px;
    padding-top: 136px; /* Extra top padding for fixed header */
    padding-bottom: calc(var(--bottom-panel-height) + 24px);
    margin-bottom: var(--bottom-panel-height);
    line-height: 1.5;
    transition: padding-top 0.3s ease, padding-right 0.3s ease;
}

/* Extra padding when offline banner is visible */
body.has-offline-banner {
    padding-top: 164px; /* 136px + 28px for offline banner */
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* --- App Container --- */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: calc(100vh - var(--bottom-panel-height) - 32px);
    display: flex;
    flex-direction: column;
}

.add-child-invite-landing-placeholder {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 14px;
    padding: 16px 18px;
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 12px;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 38%),
        linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.72));
    color: var(--text-primary, #e5e7eb);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.18);
}

.add-child-invite-landing-placeholder__eyebrow {
    font-size: 0.66rem;
    font-weight: 700;
    color: #7dd3fc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.add-child-invite-landing-placeholder__title {
    font-size: 1.14rem;
    font-weight: 700;
}

.add-child-invite-landing-placeholder__copy,
.add-child-invite-landing-placeholder__next {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary, #9ca3af);
}

.add-child-invite-landing-placeholder__status {
    padding: 9px 11px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.8rem;
    color: var(--text-secondary, #cbd5e1);
}

.add-child-invite-landing-placeholder__status[data-state="ready"],
.add-child-invite-landing-placeholder__status[data-state="success"] {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(20, 83, 45, 0.18);
    color: #d1fae5;
}

.add-child-invite-landing-placeholder__status[data-state="blocked"] {
    border-color: rgba(245, 158, 11, 0.26);
    background: rgba(120, 53, 15, 0.16);
    color: #fde68a;
}

.add-child-invite-landing-placeholder__status[data-state="error"] {
    border-color: rgba(248, 113, 113, 0.26);
    background: rgba(127, 29, 29, 0.16);
    color: #fecaca;
}

.add-child-invite-landing-placeholder__resolved {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-child-invite-landing-placeholder__resolved-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
}

.add-child-invite-landing-placeholder__resolved-copy {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary, #cbd5e1);
}

.add-child-invite-landing-placeholder__resolved-details {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.add-child-invite-landing-placeholder__resolved-details summary {
    cursor: pointer;
    padding: 9px 11px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
}

.add-child-invite-landing-placeholder__resolved-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0 11px 10px;
}

.add-child-invite-landing-placeholder__resolved-meta div {
    min-width: 0;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.46);
}

.add-child-invite-landing-placeholder__resolved-meta dt {
    font-size: 0.62rem;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.add-child-invite-landing-placeholder__resolved-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.77rem;
}

.add-child-invite-landing-placeholder__resolved-list {
    margin: 0;
    padding: 0 27px 12px;
    color: var(--text-secondary, #cbd5e1);
    font-size: 0.76rem;
    line-height: 1.45;
}

.add-child-invite-landing-placeholder__actor {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
}

.add-child-invite-landing-placeholder__actor span {
    color: var(--text-muted, #94a3b8);
}

.add-child-invite-landing-placeholder__actor strong {
    color: var(--text-primary, #e5e7eb);
}

.add-child-invite-landing-placeholder__choices-title {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.78rem;
    font-weight: 700;
}

.add-child-invite-landing-placeholder__choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.add-child-invite-landing-placeholder__choice {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
}

.add-child-invite-landing-placeholder__choice--available {
    border-color: rgba(34, 197, 94, 0.3);
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 32%),
        rgba(20, 83, 45, 0.14);
}

.add-child-invite-landing-placeholder__choice--disabled {
    opacity: 0.72;
}

.add-child-invite-landing-placeholder__choice-title {
    font-size: 0.8rem;
    font-weight: 700;
}

.add-child-invite-landing-placeholder__choice p {
    margin: 5px 0 7px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.75rem;
    line-height: 1.35;
}

.add-child-invite-landing-placeholder__accept-btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(34, 197, 94, 0.34);
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.18);
    color: #dcfce7;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.add-child-invite-landing-placeholder__accept-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.add-child-invite-landing-placeholder__choice span {
    display: inline-flex;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted, #6b7280);
    font-size: 0.66rem;
    font-weight: 700;
}

.add-child-invite-landing-placeholder__accepted {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: 8px;
    background: rgba(20, 83, 45, 0.16);
    color: #d1fae5;
    font-size: 0.8rem;
}

.add-child-invite-landing-placeholder__diagnostics {
    color: var(--text-secondary, #9ca3af);
    font-size: 0.76rem;
}

.add-child-invite-landing-placeholder__diagnostics summary {
    cursor: pointer;
    color: var(--text-primary, #e5e7eb);
    font-weight: 700;
}

.add-child-invite-landing-placeholder__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 0;
}

.add-child-invite-landing-placeholder__meta div {
    min-width: 120px;
    padding: 5px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.add-child-invite-landing-placeholder__meta dt {
    font-size: 0.62rem;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.add-child-invite-landing-placeholder__meta dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
}

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Header Account Proxy Selector (Fixed Header) */
.header-account-proxy {
    position: absolute;
    right: var(--account-proxy-right, 180px);
    top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--account-proxy-width, 130px);
    height: 50px; /* Fixed height to prevent shifting */
}

.header-proxy-icon-btn {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 35, 50, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.header-proxy-icon-btn:hover {
    background: rgba(50, 60, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-proxy-icon-btn.active {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 3px rgba(34, 197, 94, 0.15);
}

.header-proxy-icon {
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-proxy-greeting {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    text-align: center;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-proxy-greeting:empty {
    display: none;
}

.header-proxy-dropdown {
    position: fixed;
    top: 60px;
    right: var(--account-proxy-right, 180px);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.header-proxy-dropdown.open {
    display: flex;
}

.header-proxy-select {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.75rem;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-proxy-select:hover {
    border-color: var(--accent-blue);
}

.header-proxy-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.header-proxy-select option {
    background: #1e1e1e;
    color: var(--text-primary);
    padding: 4px 8px;
}

.header-proxy-status {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    text-align: center;
}

.header-proxy-status:empty {
    display: none;
}

.header-proxy-status.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.header-proxy-status.inactive {
    background: rgba(100, 100, 100, 0.2);
    color: #888;
}

/* === Header Utility Group (Account + Communications) === */
.header-utility-group {
    position: absolute;
    right: var(--account-proxy-right, 180px);
    top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    z-index: 10;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
    margin-left: 12px;
}

/* All utility group icon containers: fixed width for even spacing */
.header-utility-group > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 28px;
    position: relative;
}

/* Communications Trigger (Header) */
.header-communications {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header-comm-btn {
    position: relative;
    background: rgba(30, 35, 50, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.header-comm-btn:hover {
    background: rgba(50, 60, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-comm-btn:focus {
    outline: none;
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.header-comm-btn.active,
.header-comm-btn[aria-expanded="true"] {
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 0 3px rgba(74, 158, 255, 0.15);
}

.header-comm-icon {
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Unread Badge */
.header-comm-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #f85149;
    border-radius: 8px;
    font-size: 0.5625rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 0, 0, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    line-height: 1;
}

.header-comm-badge[data-count]:not([data-count="0"]) {
    opacity: 1;
    transform: scale(1);
}

.header-comm-badge[data-count]:not([data-count="0"])::before {
    content: attr(data-count);
}

/* High unread count: show 9+ */
.header-comm-badge.badge-overflow::before {
    content: '9+' !important;
}

/* Dot-only badge variant (for minimal indicator) */
.header-comm-badge.badge-dot {
    min-width: 8px;
    width: 8px;
    height: 8px;
    padding: 0;
    top: -2px;
    right: -2px;
}

.header-comm-badge.badge-dot::before {
    content: '' !important;
}

/* Notifications Trigger (Header) - mirrors communications styling */
.header-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header-notif-btn {
    position: relative;
    background: rgba(30, 35, 50, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.header-notif-btn:hover {
    background: rgba(50, 60, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-notif-btn:focus {
    outline: none;
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.header-notif-btn.active,
.header-notif-btn[aria-expanded="true"] {
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 0 3px rgba(74, 158, 255, 0.15);
}

.header-notif-icon {
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notifications Badge */
.header-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #f85149;
    border-radius: 8px;
    font-size: 0.5625rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 0, 0, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    line-height: 1;
}

.header-notif-badge[data-count]:not([data-count="0"]) {
    opacity: 1;
    transform: scale(1);
}

.header-notif-badge[data-count]:not([data-count="0"])::before {
    content: attr(data-count);
}

.header-notif-badge.badge-overflow::before {
    content: '9+' !important;
}

/* Account proxy now positioned within utility group */
.header-utility-group .header-account-proxy {
    position: relative;
    right: unset;
    top: unset;
    width: 28px;
    height: auto;
}

/* Greeting spans across the utility group, centered under icons */
.header-utility-group .header-proxy-greeting {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
}

/* Communications Panel (Placeholder Shell) */
.header-comm-panel {
    position: fixed;
    top: 60px;
    right: var(--account-proxy-right, 180px);
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.header-comm-panel.open {
    display: flex;
}

.header-comm-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(40, 40, 40, 0.6);
}

.header-comm-panel__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-comm-panel__close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.header-comm-panel__close:hover {
    color: var(--text-primary);
    background: rgba(100, 100, 100, 0.2);
}

.header-comm-panel__body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    min-height: 120px;
}

.header-comm-panel__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}

.header-comm-panel__placeholder svg {
    opacity: 0.4;
}

.header-comm-panel__placeholder-text {
    font-size: 0.8125rem;
    line-height: 1.5;
}

.header-comm-panel__placeholder-hint {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Admin Simulation Control (Task 11: Two-part scenario selector) */
.admin-simulation-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(100, 100, 100, 0.15);
    border: 1px solid #666;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #888;
    user-select: none;
    transition: all 0.2s ease;
}

.admin-sim-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.admin-sim-select {
    background: #1a1a2e;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.7rem;
    padding: 2px 6px;
    cursor: pointer;
}

.admin-sim-select option {
    background: #1a1a2e;
    color: #ccc;
}

.admin-sim-select option:hover,
.admin-sim-select option:checked {
    background: #58a6ff;
    color: #fff;
}

.admin-sim-type {
    min-width: 100px;
    max-width: 130px;
}

.admin-sim-source {
    min-width: 120px;
    max-width: 180px;
}

.admin-sim-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-sim-select:focus {
    outline: none;
    border-color: #58a6ff;
}

.admin-simulation-control:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.5);
}

/* When a non-"none" scenario is active - show active state */
.admin-simulation-control.scenario-active {
    background: rgba(88, 166, 255, 0.12);
    border-color: rgba(88, 166, 255, 0.6);
    color: #58a6ff;
}

.admin-simulation-control.scenario-active .admin-sim-label {
    color: #58a6ff;
}

.admin-simulation-control.scenario-active .admin-sim-select {
    border-color: #58a6ff;
    color: #58a6ff;
}

.admin-simulation-control.scenario-active .admin-sim-select:disabled {
    opacity: 0.7;
}

/* Legacy: Permission Scenario Control (Task 10) - superseded by Task 11 */
/* .permission-scenario-control { ... } */

/* Legacy: Admin Mode Active border - removed in Task 12 update */
/* Orange border was too distracting; admin state now shown via control highlight only */

/* DEV TOOL: Offline Toggle - REMOVE BEFORE PRODUCTION */
.dev-offline-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(88, 166, 255, 0.08);
    border: 1px dashed rgba(88, 166, 255, 0.4);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    color: #7ab3e0;
    user-select: none;
}

.dev-offline-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #58a6ff;
}

.dev-offline-toggle__label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dev-offline-toggle:hover {
    background: rgba(88, 166, 255, 0.15);
}

.dev-offline-toggle:has(input:checked) {
    background: rgba(244, 67, 54, 0.12);
    border-color: rgba(244, 67, 54, 0.5);
    color: #e57373;
}

.dev-offline-toggle:has(input:checked) input {
    accent-color: #e57373;
}

/* Dev Tools Section (in Admin Panel) */
.dev-tools-section.admin-config-collapsible {
    border-left-color: rgba(88, 166, 255, 0.5);
}

.dev-tools-body {
    padding: 12px;
}

.dev-tools-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dev-tool-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Collapsible Dev Tool Subsections */
.dev-tool-collapsible {
    background: rgba(100, 100, 100, 0.08);
    border: 1px solid rgba(100, 100, 100, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.dev-tool-collapsible[open] {
    background: rgba(100, 100, 100, 0.12);
}

.dev-tool-summary {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, background 0.2s;
}

.dev-tool-summary::-webkit-details-marker {
    display: none;
}

.dev-tool-summary::before {
    content: '▶';
    font-size: 0.6rem;
    transition: transform 0.2s;
    color: #666;
}

.dev-tool-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 18px;
    padding: 0 5px;
    border: 1px solid rgba(88, 166, 255, 0.32);
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.65rem;
    letter-spacing: 0;
    line-height: 1;
}

.dev-tool-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dev-tool-collapsible[open] > .dev-tool-summary::before {
    transform: rotate(90deg);
}

.dev-tool-summary:hover {
    color: #ccc;
    background: rgba(100, 100, 100, 0.1);
}

.dev-tool-content {
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(100, 100, 100, 0.15);
}

.dev-tool-desc {
    font-size: 0.7rem;
    color: #888;
    margin: 0 0 8px 0;
}

.dev-tool-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(88, 166, 255, 0.5);
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.dev-tool-btn:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.25);
}

.dev-tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dev-tool-btn--danger {
    border-color: rgba(248, 81, 73, 0.5);
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}

.dev-tool-btn--danger:hover {
    background: rgba(248, 81, 73, 0.25);
}

.dev-console-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
}

.dev-console-input {
    width: 100%;
    padding: 8px 10px;
    color: #e6edf3;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid rgba(88, 166, 255, 0.35);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
}

.dev-console-input:focus {
    outline: none;
    border-color: rgba(88, 166, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

.dev-console-status {
    margin-top: 8px;
    color: #9aa7b7;
    font-size: 0.72rem;
}

.dev-console-last-command {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 7px 8px;
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 8px;
    background: rgba(88, 166, 255, 0.07);
}

.dev-console-last-command[hidden] {
    display: none;
}

.dev-console-last-command-label {
    flex: 0 0 auto;
    color: #9fb3c8;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dev-console-last-command-btn {
    min-width: 0;
    flex: 1 1 auto;
    padding: 5px 7px;
    color: #dcecff;
    text-align: left;
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid rgba(125, 211, 252, 0.24);
    border-radius: 6px;
    cursor: pointer;
}

.dev-console-last-command-btn:hover,
.dev-console-last-command-btn:focus-visible {
    border-color: rgba(125, 211, 252, 0.62);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.16);
    outline: none;
}

.dev-console-last-command-btn code {
    display: block;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dev-console-command-card {
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.92);
}

.dev-console-command-card[hidden] {
    display: none;
}

.dev-console-command-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    color: #dbe7f7;
    background: rgba(88, 166, 255, 0.12);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dev-console-command-text {
    display: block;
    padding: 10px 12px;
    color: #eef6ff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
}

.dev-console-log {
    margin-top: 10px;
    max-height: 360px;
    overflow: auto;
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(7, 11, 20, 0.98), rgba(10, 15, 25, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.dev-console-empty {
    padding: 14px;
    color: #6e7681;
    font-size: 0.72rem;
    font-style: italic;
}

.dev-console-log-entry {
    padding: 10px 12px;
    border-top: 1px solid rgba(88, 166, 255, 0.12);
}

.dev-console-log-entry:first-child {
    border-top: 0;
}

.dev-console-log-entry--success {
    border-left: 3px solid #3fb950;
}

.dev-console-log-entry--warn {
    border-left: 3px solid #d29922;
}

.dev-console-log-entry--error {
    border-left: 3px solid #f85149;
}

.dev-console-log-entry--info {
    border-left: 3px solid #58a6ff;
}

.dev-console-log-head {
    display: flex;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
    color: #dbe7f7;
    font-size: 0.72rem;
    font-weight: 700;
}

.dev-console-log-time {
    color: #77839a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.66rem;
    font-weight: 500;
}

.dev-console-log-body {
    margin: 8px 0 0;
    padding: 9px 10px;
    color: #c9d1d9;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(88, 166, 255, 0.14);
    border-radius: 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
    line-height: 1.45;
}

@media (max-width: 780px) {
    .dev-console-form {
        grid-template-columns: 1fr;
    }
}

/* Account Proxy Control */
.account-proxy-control {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.account-proxy-control select {
    flex: 1;
    min-width: 150px;
}

.dev-proxy-status {
    font-size: 0.7rem;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    display: none;
}

.dev-proxy-status.active {
    display: block;
    background: rgba(56, 139, 253, 0.15);
    border: 1px solid rgba(56, 139, 253, 0.4);
    color: #58a6ff;
}

.dev-proxy-status.error {
    display: block;
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.4);
    color: #f85149;
}

.dev-tool-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
}

.dev-tool-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.5);
    border-radius: 4px;
    color: #58a6ff;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dev-tool-content .dev-tool-link + .dev-tool-link {
    margin-top: 4px;
}

.dev-tool-link:hover {
    background: rgba(88, 166, 255, 0.2);
    color: #79b8ff;
}

.dev-tool-go-live-readiness .glr-status-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(248, 81, 73, 0.28);
    border-radius: 6px;
    background: rgba(248, 81, 73, 0.08);
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-kicker {
    color: #8b949e;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.dev-tool-go-live-readiness .glr-title {
    color: #e6edf3;
    font-size: 0.9rem;
    font-weight: 700;
}

.dev-tool-go-live-readiness .glr-status-pill {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-status-pill--blocked {
    border: 1px solid rgba(248, 81, 73, 0.5);
    background: rgba(248, 81, 73, 0.16);
    color: #ff7b72;
}

.dev-tool-go-live-readiness .glr-live-panel {
    margin-bottom: 12px;
}

.dev-tool-go-live-readiness .glr-live-panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
}

.dev-tool-go-live-readiness .glr-live-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.dev-tool-go-live-readiness .glr-status-band--manual_review_pending,
.dev-tool-go-live-readiness .glr-status-band--unknown_evidence,
.dev-tool-go-live-readiness .glr-status-band--warnings_pending {
    border-color: rgba(210, 153, 34, 0.34);
    background: rgba(210, 153, 34, 0.08);
}

.dev-tool-go-live-readiness .glr-status-band--ready_candidate {
    border-color: rgba(63, 185, 80, 0.32);
    background: rgba(63, 185, 80, 0.08);
}

.dev-tool-go-live-readiness .glr-status-pill--manual_review_pending,
.dev-tool-go-live-readiness .glr-status-pill--unknown_evidence,
.dev-tool-go-live-readiness .glr-status-pill--warnings_pending {
    border: 1px solid rgba(210, 153, 34, 0.5);
    background: rgba(210, 153, 34, 0.16);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-status-pill--ready_candidate {
    border: 1px solid rgba(63, 185, 80, 0.45);
    background: rgba(63, 185, 80, 0.12);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-meta-grid > div {
    min-width: 0;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.55);
    padding: 7px 8px;
}

.dev-tool-go-live-readiness .glr-meta-grid span {
    display: block;
    color: #8b949e;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.dev-tool-go-live-readiness .glr-meta-grid strong {
    display: block;
    color: #c9d1d9;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-rollup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-rollup-grid > div {
    min-width: 0;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.45);
    padding: 7px 8px;
}

.dev-tool-go-live-readiness .glr-rollup-grid span {
    display: block;
    color: #8b949e;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.dev-tool-go-live-readiness .glr-rollup-grid strong {
    display: block;
    color: #e6edf3;
    font-size: 0.9rem;
}

.dev-tool-go-live-readiness .glr-check-groups {
    display: grid;
    gap: 10px;
}

.dev-tool-go-live-readiness .glr-check-group {
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-group-count {
    flex: 0 0 auto;
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.08);
    color: #79c0ff;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
}

.dev-tool-go-live-readiness .glr-check-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.dev-tool-go-live-readiness .glr-check-card {
    min-width: 0;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-left-width: 3px;
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.55);
    padding: 8px;
}

.dev-tool-go-live-readiness .glr-check-card--fail {
    border-left-color: #ff7b72;
}

.dev-tool-go-live-readiness .glr-check-card--warn,
.dev-tool-go-live-readiness .glr-check-card--manual_pending,
.dev-tool-go-live-readiness .glr-check-card--future_pending,
.dev-tool-go-live-readiness .glr-check-card--unknown {
    border-left-color: #d29922;
}

.dev-tool-go-live-readiness .glr-check-card--pass {
    border-left-color: #3fb950;
}

.dev-tool-go-live-readiness .glr-check-card--not_applicable {
    border-left-color: #8b949e;
}

.dev-tool-go-live-readiness .glr-check-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.dev-tool-go-live-readiness .glr-check-id,
.dev-tool-go-live-readiness .glr-check-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.66rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-check-id {
    border: 1px solid rgba(88, 166, 255, 0.26);
    background: rgba(88, 166, 255, 0.08);
    color: #79c0ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dev-tool-go-live-readiness .glr-check-status {
    border: 1px solid rgba(100, 100, 100, 0.22);
    background: rgba(100, 100, 100, 0.12);
    color: #c9d1d9;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-check-status--fail {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-check-status--warn,
.dev-tool-go-live-readiness .glr-check-status--manual_pending,
.dev-tool-go-live-readiness .glr-check-status--future_pending,
.dev-tool-go-live-readiness .glr-check-status--unknown {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-check-status--pass {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-check-card h5 {
    margin: 0 0 5px;
    color: #e6edf3;
    font-size: 0.78rem;
    line-height: 1.3;
}

.dev-tool-go-live-readiness .glr-check-card p {
    margin: 0 0 7px;
    color: #c9d1d9;
    font-size: 0.7rem;
    line-height: 1.4;
}

.dev-tool-go-live-readiness .glr-check-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 5px;
    margin: 0;
}

.dev-tool-go-live-readiness .glr-check-meta div {
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-check-meta dt {
    margin: 0 0 1px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-check-meta dd {
    margin: 0;
    color: #c9d1d9;
    font-size: 0.68rem;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-check-remediation {
    display: grid;
    gap: 2px;
    margin-top: 7px;
    border-top: 1px solid rgba(100, 100, 100, 0.18);
    padding-top: 7px;
}

.dev-tool-go-live-readiness .glr-check-remediation strong {
    color: #8b949e;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-check-remediation span {
    color: #c9d1d9;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-check-details {
    margin-top: 7px;
}

.dev-tool-go-live-readiness .glr-check-details summary {
    cursor: pointer;
    color: #79c0ff;
    font-size: 0.68rem;
    font-weight: 700;
}

.dev-tool-go-live-readiness .glr-check-details pre {
    max-height: 180px;
    overflow: auto;
    margin: 6px 0 0;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-radius: 6px;
    background: rgba(1, 4, 9, 0.45);
    color: #c9d1d9;
    padding: 7px;
    font-size: 0.66rem;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-empty-checks,
.dev-tool-go-live-readiness .glr-panel-message {
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.45);
    color: #8b949e;
    padding: 8px;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-panel-message {
    display: grid;
    gap: 2px;
}

.dev-tool-go-live-readiness .glr-panel-message strong {
    color: #e6edf3;
    font-size: 0.76rem;
}

.dev-tool-go-live-readiness .glr-panel-message--error {
    border-color: rgba(248, 81, 73, 0.35);
    background: rgba(248, 81, 73, 0.08);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-panel-message--loading {
    border-color: rgba(88, 166, 255, 0.26);
    background: rgba(88, 166, 255, 0.07);
    color: #c9d1d9;
}

.dev-tool-go-live-readiness .glr-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness h4 {
    margin: 0 0 6px;
    color: #c9d1d9;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dev-tool-go-live-readiness .glr-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dev-tool-go-live-readiness .glr-list li {
    position: relative;
    padding: 6px 8px 6px 22px;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.45);
    color: #c9d1d9;
    font-size: 0.72rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-list li::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0.82rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b949e;
}

.dev-tool-go-live-readiness .glr-list--blockers li::before {
    background: #ff7b72;
}

.dev-tool-go-live-readiness .glr-list--warnings li::before {
    background: #d29922;
}

.dev-tool-go-live-readiness .glr-list--evidence li::before {
    background: #3fb950;
}

.dev-tool-go-live-readiness .glr-evidence {
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-copy-tasks {
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-milestones,
.dev-tool-go-live-readiness .glr-program-dashboard,
.dev-tool-go-live-readiness .glr-priority-table,
.dev-tool-go-live-readiness .glr-readiness-tiers,
.dev-tool-go-live-readiness .glr-live-readiness-checks {
    margin-bottom: 12px;
}

.dev-tool-go-live-readiness .glr-pilot-summary {
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.1), rgba(13, 17, 23, 0.48));
    padding: 8px;
    margin-bottom: 8px;
}

.dev-tool-go-live-readiness .glr-pilot-summary h5 {
    margin: 0;
    color: #e6edf3;
    font-size: 0.82rem;
    line-height: 1.2;
}

.dev-tool-go-live-readiness .glr-status-pill--invite_friends_now {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-status-pill--invite_friends_after_listed_blockers {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-status-pill--do_not_invite_yet {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-rollup-grid--priority {
    margin-bottom: 8px;
}

.dev-tool-go-live-readiness .glr-priority-top-next {
    color: #c9d1d9;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-priority-top-next strong {
    display: block;
    margin-bottom: 4px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-priority-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.dev-tool-go-live-readiness .glr-priority-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dev-tool-go-live-readiness .glr-priority-filter {
    min-height: 26px;
    border-color: rgba(88, 166, 255, 0.22);
}

.dev-tool-go-live-readiness .glr-priority-filter span {
    color: #8b949e;
}

.dev-tool-go-live-readiness .glr-priority-filter--active {
    border-color: rgba(88, 166, 255, 0.55);
    background: rgba(88, 166, 255, 0.16);
    color: #dbeafe;
}

.dev-tool-go-live-readiness .glr-stage-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #8b949e;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-stage-select {
    min-height: 28px;
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.75);
    color: #e6edf3;
    padding: 4px 8px;
    font-size: 0.72rem;
}

.dev-tool-go-live-readiness .glr-priority-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(88, 166, 255, 0.16);
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.38);
}

.dev-tool-go-live-readiness .glr-priority-table-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

.dev-tool-go-live-readiness .glr-priority-table-grid th,
.dev-tool-go-live-readiness .glr-priority-table-grid td {
    padding: 8px 9px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.78);
    vertical-align: top;
    text-align: left;
}

.dev-tool-go-live-readiness .glr-priority-table-grid th {
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.dev-tool-go-live-readiness .glr-priority-row {
    cursor: pointer;
}

.dev-tool-go-live-readiness .glr-priority-row:hover,
.dev-tool-go-live-readiness .glr-priority-row:focus {
    background: rgba(88, 166, 255, 0.08);
    outline: none;
}

.dev-tool-go-live-readiness .glr-priority-row--open {
    background: rgba(88, 166, 255, 0.08);
}

.dev-tool-go-live-readiness .glr-priority-task {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 180px;
}

.dev-tool-go-live-readiness .glr-priority-task strong {
    color: #e6edf3;
    font-size: 0.76rem;
    line-height: 1.25;
}

.dev-tool-go-live-readiness .glr-priority-task span,
.dev-tool-go-live-readiness .glr-priority-next-action {
    color: #8b949e;
    font-size: 0.68rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-inline-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 999px;
    background: rgba(100, 100, 100, 0.12);
    color: #c9d1d9;
    padding: 2px 8px;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.dev-tool-go-live-readiness .glr-inline-badge--blocker,
.dev-tool-go-live-readiness .glr-inline-badge--pilot-blocks_pilot,
.dev-tool-go-live-readiness .glr-inline-badge--evidence-missing_review {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-inline-badge--should_fix,
.dev-tool-go-live-readiness .glr-inline-badge--pilot-unknown_review_needed,
.dev-tool-go-live-readiness .glr-inline-badge--evidence-partial {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-inline-badge--defer,
.dev-tool-go-live-readiness .glr-inline-badge--future,
.dev-tool-go-live-readiness .glr-inline-badge--evidence-future {
    border-color: rgba(110, 118, 129, 0.4);
    background: rgba(110, 118, 129, 0.12);
    color: #c9d1d9;
}

.dev-tool-go-live-readiness .glr-inline-badge--pilot-does_not_block_pilot,
.dev-tool-go-live-readiness .glr-inline-badge--evidence-passed {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-tag-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dev-tool-go-live-readiness .glr-tag-chip {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.08);
    color: #79c0ff;
    padding: 1px 7px;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dev-tool-go-live-readiness .glr-tag-chip--empty {
    color: #8b949e;
}

.dev-tool-go-live-readiness .glr-priority-detail-row td {
    padding: 0;
    border-bottom: 1px solid rgba(48, 54, 61, 0.78);
}

.dev-tool-go-live-readiness .glr-priority-detail-panel {
    padding: 10px;
    background: rgba(5, 8, 13, 0.8);
}

.dev-tool-go-live-readiness .glr-priority-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.dev-tool-go-live-readiness .glr-priority-detail-head div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-priority-detail-head strong {
    color: #e6edf3;
    font-size: 0.8rem;
    line-height: 1.2;
}

.dev-tool-go-live-readiness .glr-priority-detail-head span {
    color: #8b949e;
    font-size: 0.68rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-priority-copy-btn {
    flex: 0 0 auto;
}

.dev-tool-go-live-readiness .glr-priority-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin: 0;
}

.dev-tool-go-live-readiness .glr-priority-detail-grid div {
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-priority-detail-grid dt {
    margin: 0 0 3px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-priority-detail-grid dd {
    margin: 0;
    color: #c9d1d9;
    font-size: 0.68rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-priority-detail-list {
    margin: 0;
    padding-left: 16px;
    color: #c9d1d9;
}

.dev-tool-go-live-readiness .glr-priority-detail-list li + li {
    margin-top: 3px;
}

@media (max-width: 720px) {
    .dev-tool-go-live-readiness .glr-priority-controls {
        align-items: stretch;
    }

    .dev-tool-go-live-readiness .glr-stage-select-wrap {
        justify-content: space-between;
        width: 100%;
    }

    .dev-tool-go-live-readiness .glr-stage-select {
        flex: 1 1 auto;
    }

    .dev-tool-go-live-readiness .glr-priority-table-grid {
        min-width: 720px;
    }
}

.dev-tool-go-live-readiness .glr-program-summary {
    margin: 3px 0 0;
    color: #8b949e;
    font-size: 0.68rem;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: normal;
}

.dev-tool-go-live-readiness .glr-stage-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.dev-tool-go-live-readiness .glr-stage-filter {
    min-height: 26px;
    border-color: rgba(88, 166, 255, 0.22);
}

.dev-tool-go-live-readiness .glr-stage-filter span {
    color: #8b949e;
}

.dev-tool-go-live-readiness .glr-stage-filter--active {
    border-color: rgba(88, 166, 255, 0.55);
    background: rgba(88, 166, 255, 0.16);
    color: #dbeafe;
}

.dev-tool-go-live-readiness .glr-program-stage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.dev-tool-go-live-readiness .glr-program-stage {
    min-width: 0;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-left-width: 3px;
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.55);
    padding: 8px;
}

.dev-tool-go-live-readiness .glr-program-stage--primary {
    border-color: rgba(88, 166, 255, 0.36);
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.14), rgba(13, 17, 23, 0.58));
}

.dev-tool-go-live-readiness .glr-program-stage--blocked {
    border-left-color: #ff7b72;
}

.dev-tool-go-live-readiness .glr-program-stage--needs_evidence,
.dev-tool-go-live-readiness .glr-program-stage--watching {
    border-left-color: #d29922;
}

.dev-tool-go-live-readiness .glr-program-stage--active {
    border-left-color: #3fb950;
}

.dev-tool-go-live-readiness .glr-program-stage--planned {
    border-left-color: #8b949e;
}

.dev-tool-go-live-readiness .glr-program-stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.dev-tool-go-live-readiness .glr-program-stage-label,
.dev-tool-go-live-readiness .glr-program-stage-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-program-stage-label {
    border: 1px solid rgba(88, 166, 255, 0.28);
    background: rgba(88, 166, 255, 0.1);
    color: #79c0ff;
}

.dev-tool-go-live-readiness .glr-program-stage-status {
    border: 1px solid rgba(100, 100, 100, 0.22);
    background: rgba(100, 100, 100, 0.12);
    color: #c9d1d9;
    text-transform: uppercase;
}

.dev-tool-go-live-readiness .glr-program-stage-status--blocked {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-program-stage-status--needs_evidence,
.dev-tool-go-live-readiness .glr-program-stage-status--watching {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-program-stage-status--active {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-program-stage p {
    margin: 0 0 7px;
    color: #8b949e;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-program-stage-meta {
    display: grid;
    gap: 5px;
    margin: 0 0 8px;
}

.dev-tool-go-live-readiness .glr-program-stage-meta div {
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-program-stage-meta dt {
    margin: 0 0 1px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-program-stage-meta dd {
    margin: 0;
    color: #c9d1d9;
    font-size: 0.68rem;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-program-stage-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.dev-tool-go-live-readiness .glr-program-stage-counts span {
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 999px;
    background: rgba(100, 100, 100, 0.1);
    color: #c9d1d9;
    padding: 2px 6px;
    font-size: 0.62rem;
    font-weight: 700;
}

.dev-tool-go-live-readiness .glr-milestone-summary,
.dev-tool-go-live-readiness .glr-sync-note {
    min-width: 0;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.45);
    color: #c9d1d9;
    padding: 7px 8px;
    font-size: 0.7rem;
    line-height: 1.35;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-milestone-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dev-tool-go-live-readiness .glr-milestone-summary strong {
    flex: 0 0 auto;
    color: #9be9a8;
    font-size: 0.7rem;
}

.dev-tool-go-live-readiness .glr-sync-note {
    margin-top: 8px;
    margin-bottom: 0;
    color: #8b949e;
}

.dev-tool-go-live-readiness .glr-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.dev-tool-go-live-readiness .glr-section-head h4 {
    margin-bottom: 0;
}

.dev-tool-go-live-readiness .glr-copy-btn {
    min-height: 28px;
    white-space: nowrap;
}

.dev-tool-go-live-readiness .glr-task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
}

.dev-tool-go-live-readiness .glr-tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.dev-tool-go-live-readiness .glr-tier-card {
    min-width: 0;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-left-width: 3px;
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.55);
    padding: 8px;
}

.dev-tool-go-live-readiness .glr-tier-card--ready {
    border-left-color: #3fb950;
}

.dev-tool-go-live-readiness .glr-tier-card--candidate,
.dev-tool-go-live-readiness .glr-tier-card--manual_pending,
.dev-tool-go-live-readiness .glr-tier-card--unknown {
    border-left-color: #d29922;
}

.dev-tool-go-live-readiness .glr-tier-card--not_ready,
.dev-tool-go-live-readiness .glr-tier-card--blocked {
    border-left-color: #ff7b72;
}

.dev-tool-go-live-readiness .glr-tier-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.dev-tool-go-live-readiness .glr-tier-label,
.dev-tool-go-live-readiness .glr-tier-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-tier-label {
    border: 1px solid rgba(88, 166, 255, 0.28);
    background: rgba(88, 166, 255, 0.1);
    color: #79c0ff;
}

.dev-tool-go-live-readiness .glr-tier-status {
    border: 1px solid rgba(100, 100, 100, 0.22);
    background: rgba(100, 100, 100, 0.12);
    color: #c9d1d9;
    text-transform: uppercase;
}

.dev-tool-go-live-readiness .glr-tier-status--ready {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-tier-status--candidate,
.dev-tool-go-live-readiness .glr-tier-status--manual_pending,
.dev-tool-go-live-readiness .glr-tier-status--unknown {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-tier-status--not_ready,
.dev-tool-go-live-readiness .glr-tier-status--blocked {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-tier-card p {
    margin: 0 0 7px;
    color: #8b949e;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-tier-list-wrap {
    margin-top: 6px;
}

.dev-tool-go-live-readiness .glr-tier-list-wrap strong {
    display: block;
    margin-bottom: 3px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-tier-list {
    margin: 0;
    padding-left: 16px;
    color: #c9d1d9;
    font-size: 0.66rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-tier-list li + li {
    margin-top: 3px;
}

.dev-tool-go-live-readiness .glr-task-card {
    min-width: 0;
    border: 1px solid rgba(88, 166, 255, 0.18);
    border-left-width: 3px;
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.55);
    padding: 8px;
}

.dev-tool-go-live-readiness .glr-task-card--complete {
    border-left-color: #3fb950;
}

.dev-tool-go-live-readiness .glr-task-card--pending,
.dev-tool-go-live-readiness .glr-task-card--in_progress,
.dev-tool-go-live-readiness .glr-task-card--future,
.dev-tool-go-live-readiness .glr-task-card--unknown {
    border-left-color: #d29922;
}

.dev-tool-go-live-readiness .glr-task-card--blocked {
    border-left-color: #ff7b72;
}

.dev-tool-go-live-readiness .glr-task-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.dev-tool-go-live-readiness .glr-task-id {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border: 1px solid rgba(88, 166, 255, 0.28);
    border-radius: 4px;
    background: rgba(88, 166, 255, 0.1);
    color: #79c0ff;
    padding: 2px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
    font-weight: 700;
}

.dev-tool-go-live-readiness .glr-task-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 4px;
    background: rgba(100, 100, 100, 0.12);
    color: #c9d1d9;
    padding: 2px 6px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-task-status--complete {
    border-color: rgba(63, 185, 80, 0.38);
    background: rgba(63, 185, 80, 0.1);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-task-status--pending,
.dev-tool-go-live-readiness .glr-task-status--in_progress,
.dev-tool-go-live-readiness .glr-task-status--future,
.dev-tool-go-live-readiness .glr-task-status--unknown {
    border-color: rgba(210, 153, 34, 0.42);
    background: rgba(210, 153, 34, 0.12);
    color: #f0c36a;
}

.dev-tool-go-live-readiness .glr-task-status--blocked {
    border-color: rgba(248, 81, 73, 0.42);
    background: rgba(248, 81, 73, 0.12);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-task-card h5 {
    margin: 0 0 4px;
    color: #e6edf3;
    font-size: 0.78rem;
    line-height: 1.25;
}

.dev-tool-go-live-readiness .glr-task-card p {
    margin: 0 0 7px;
    color: #8b949e;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-task-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 5px;
    margin: 0 0 7px;
}

.dev-tool-go-live-readiness .glr-task-meta div {
    min-width: 0;
}

.dev-tool-go-live-readiness .glr-task-meta dt,
.dev-tool-go-live-readiness .glr-task-evidence span {
    margin: 0 0 1px;
    color: #8b949e;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dev-tool-go-live-readiness .glr-task-meta dd {
    margin: 0;
    color: #c9d1d9;
    font-size: 0.68rem;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-task-evidence {
    margin-bottom: 7px;
}

.dev-tool-go-live-readiness .glr-task-evidence ul {
    margin: 3px 0 0;
    padding-left: 16px;
    color: #c9d1d9;
    font-size: 0.66rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dev-tool-go-live-readiness .glr-task-evidence--empty {
    color: #8b949e;
    font-size: 0.68rem;
}

.dev-tool-go-live-readiness .glr-task-copy {
    margin-top: 2px;
}

.dev-tool-go-live-readiness .glr-copy-status {
    margin-top: 8px;
    border: 1px solid rgba(100, 100, 100, 0.22);
    border-radius: 6px;
    background: rgba(13, 17, 23, 0.45);
    color: #8b949e;
    padding: 7px 8px;
    font-size: 0.7rem;
    line-height: 1.35;
}

.dev-tool-go-live-readiness .glr-copy-status[data-state="success"] {
    border-color: rgba(63, 185, 80, 0.35);
    background: rgba(63, 185, 80, 0.08);
    color: #9be9a8;
}

.dev-tool-go-live-readiness .glr-copy-status[data-state="error"] {
    border-color: rgba(248, 81, 73, 0.35);
    background: rgba(248, 81, 73, 0.08);
    color: #ffb3ad;
}

.dev-tool-go-live-readiness .glr-next-step {
    border: 1px solid rgba(88, 166, 255, 0.26);
    border-radius: 6px;
    background: rgba(88, 166, 255, 0.08);
    color: #c9d1d9;
    padding: 8px 10px;
    font-size: 0.72rem;
    line-height: 1.45;
}

.dev-tool-go-live-readiness .glr-next-step code {
    color: #79c0ff;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .dev-tool-go-live-readiness .glr-status-band,
    .dev-tool-go-live-readiness .glr-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .dev-tool-go-live-readiness .glr-live-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .dev-tool-go-live-readiness .glr-live-actions .dev-tool-btn {
        flex: 1 1 128px;
    }
}

/* Admin Simulation Control in Panel */
.admin-simulation-control--panel {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    background: rgba(100, 100, 100, 0.1);
}

.admin-simulation-control--panel .admin-sim-select {
    width: 100%;
    max-width: none;
    padding: 6px 10px;
    font-size: 0.8rem;
}

/* Offline Toggle in Panel */
.dev-offline-toggle--panel {
    justify-content: flex-start;
    padding: 8px 12px;
}

.dev-offline-toggle--panel .dev-offline-toggle__label {
    font-size: 0.8rem;
}

/* Environment Info Badges */
.dev-env-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dev-env-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: monospace;
}

.dev-env-badge--db {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.5);
    color: #ff9800;
}

.dev-env-badge--cache {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #4caf50;
}

.dev-env-badge--cache.cache-invalid {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #f44336;
}
/* END DEV TOOL */

.app-title {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.app-title-logo {
    display: block;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    background-image:
        url('../logo/favicon-512.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.env-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

/* --- Mobile / Narrow App Header (≤700px) --- */
@media (max-width: 700px) {
    body {
        padding-top: 166px; /* 3-row header: scope/clock + progress + events */
    }

    body.has-offline-banner {
        padding-top: 194px;
    }

    .app-header {
        gap: 8px;
        padding: 8px 12px;
    }

    .app-title {
        font-size: 1.05rem;
    }

    .app-header-right {
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
    }

    .admin-simulation-control {
        gap: 4px;
        padding: 3px 6px;
        font-size: 0.625rem;
    }

    .admin-sim-type {
        min-width: 80px;
        max-width: 110px;
    }

    .admin-sim-source {
        min-width: 90px;
        max-width: 140px;
    }

    .admin-sim-select {
        font-size: 0.625rem;
        padding: 2px 4px;
    }

    .dev-offline-toggle {
        padding: 3px 6px;
        font-size: 0.625rem;
    }

    .env-badge {
        padding: 3px 8px;
        font-size: 0.625rem;
    }
}

@media (max-width: 480px) {
    .app-header {
        gap: 6px;
        padding: 6px 10px;
    }

    .app-title {
        font-size: 0.95rem;
        flex-basis: 100%;
    }

    .app-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-simulation-control {
        flex-wrap: wrap;
    }

    .admin-sim-label {
        flex-basis: 100%;
        font-size: 0.5625rem;
    }

    .admin-sim-type {
        min-width: 70px;
        max-width: 100px;
    }

    .admin-sim-source {
        min-width: 70px;
        max-width: 120px;
    }
}

/* --- Status Bar --- */
.status-bar {
    padding: 8px 12px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.status-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.status-text.success {
    color: var(--success-color);
}

/* --- Status Banner (top of fixed header - loading & success messages) --- */
#status-banner {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid rgba(100, 116, 139, 0.3);
}

#status-banner:not([data-state="hidden"]) {
    max-height: 28px;
    opacity: 1;
}

#status-banner[data-state="hidden"] {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

#status-banner .banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 16px;
    font-size: 0.7rem;
    color: #94a3b8;
}

#status-banner .banner-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-top-color: #94a3b8;
    border-radius: 50%;
    animation: status-spin 1s linear infinite;
}

#status-banner .banner-spinner[data-hidden] {
    display: none;
}

@keyframes status-spin {
    to { transform: rotate(360deg); }
}

#status-banner .banner-text {
    font-weight: 500;
}

/* --- Status Banner Mobile --- */
@media (max-width: 700px) {
    #status-banner:not([data-state="hidden"]) {
        max-height: 24px;
    }

    #status-banner .banner-content {
        padding: 3px 12px;
        font-size: 0.625rem;
        gap: 6px;
    }

    #status-banner .banner-spinner {
        width: 10px;
        height: 10px;
    }
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-container--visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toast-msg {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(-100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    opacity: 0.98;
}

.toast-msg--visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-msg--success {
    background: linear-gradient(135deg, rgba(21, 128, 61, 0.96) 0%, rgba(22, 163, 74, 0.92) 100%);
    border: 1px solid rgba(134, 239, 172, 0.45);
    color: #4ade80;
}

.toast-msg--error {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.98) 0%, rgba(153, 27, 27, 0.94) 100%);
    border: 1px solid rgba(252, 165, 165, 0.45);
    color: #fee2e2;
}

.toast-msg--loading {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.96) 0%, rgba(67, 56, 202, 0.92) 100%);
    border: 1px solid rgba(165, 180, 252, 0.4);
    color: #e0e7ff;
}

.toast-msg--interactive {
    width: 100%;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    appearance: none;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
}

.toast-msg--interactive:hover {
    transform: translateX(0) scale(1.01);
    filter: brightness(1.04);
}

.toast-msg--interactive:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 2px;
}

.toast-msg__summary {
    line-height: 1.4;
}

.toast-msg__hint {
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
}

/* ==============================================
   Main Layout - Single Column with Fixed Bottom
   ============================================== */

.two-panel-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
}

/* ==============================================
   Attributes Panel (Main Content Area)
   ============================================== */

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: visible;  /* Allow callouts to extend outside */
    display: flex;
    flex-direction: column;
}

.panel-attributes {
    flex: 1;
    margin-top: 8px;
    overflow: visible;  /* Allow vertical expansion, no scroll */
    min-height: 0;  /* Remove min-height to fit content */
    background: rgba(38, 43, 60, 0.215);
    display: flex;
    flex-direction: column;
}

/* --- Panel Tabs (Details / Admin) --- */
.panel-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 8px 0 8px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(38, 43, 60, 0.5);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    top: 1px;
    white-space: nowrap;
}

.panel-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05em;
    min-width: 1.05em;
    line-height: 1;
    font-size: 0.95em;
}

.panel-tab-label {
    line-height: 1.2;
}

.panel-tab:hover {
    color: var(--text-secondary);
    background: rgba(50, 56, 78, 0.7);
}

.panel-tab.active {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.panel-tab.display-layout-tab-hidden,
.panel-tab.display-layout-tab-hidden.tab-visible,
.panel-tab-content.display-layout-tab-content-hidden {
    display: none;
}

/* Admin tab - hidden by default, shown when in simulated source subtree (Task 12) */
.panel-tab--admin {
    display: none;
    color: rgba(249, 115, 22, 0.6);
}

.panel-tab--admin:hover {
    color: #f97316;
}

.panel-tab--admin.active {
    color: #f97316;
    border-bottom-color: #f97316;
}

/* Task 12: Show Entity Admin tab only when current entity is in simulated source subtree */
.panel-tab--admin.tab-visible {
    display: inline-flex;
}

/* Spacer pushes admin tabs to the right */
.panel-tabs-spacer {
    flex: 1;
    display: none;
}

/* Show spacer when either admin tab is visible */
.panel-tabs-spacer.spacer-visible {
    display: block;
}

/* --- Details Expand/Collapse Button --- */
.panel-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    top: 1px;
    flex-shrink: 0;
}

.panel-expand-btn:hover {
    color: var(--accent-color);
    background: rgba(50, 56, 78, 0.7);
    border-color: var(--accent-color);
}

.panel-expand-btn svg {
    width: 16px;
    height: 16px;
}

.panel-expand-btn .collapse-icon {
    display: none;
}

/* When expanded, swap icons and make exit button prominent */
.details-expanded .panel-expand-btn .expand-icon {
    display: none;
}

.details-expanded .panel-expand-btn .collapse-icon {
    display: block;
}

.details-expanded .panel-expand-btn {
    width: auto;
    height: 34px;
    padding: 0 12px;
    gap: 6px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-bottom: none;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 600;
}

.details-expanded .panel-expand-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.details-expanded .panel-expand-btn .exit-label {
    display: inline;
}

.panel-expand-btn .exit-label {
    display: none;
}

/* ==============================================
   Semi-Fullscreen Details Expanded State
   ============================================== */
.details-expanded #panel-attributes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;  /* Dynamic viewport height — respects mobile address bar */
    z-index: 2000;
    border-radius: 0;
    border: none;
    background: var(--bg-primary);
    max-height: none;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* iOS Safari: use -webkit-fill-available as fallback */
@supports (-webkit-touch-callout: none) {
    .details-expanded #panel-attributes {
        height: -webkit-fill-available;
    }
}

.details-expanded #panel-attributes .panel-tabs {
    padding: 12px 24px 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.details-expanded #panel-attributes .panel-tab-content {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overflow: visible;  /* Allow expansion, no scroll */
}

.details-expanded #panel-attributes .panel-tab-content.active {
    display: flex;
    flex-direction: column;
}

.details-expanded #panel-attributes .attributes-container,
.details-expanded #panel-attributes .admin-tab-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Hide everything else when expanded */
.details-expanded .fixed_header_banner,
.details-expanded .app-header,
.details-expanded .status-bar,
.details-expanded .app-footer,
.details-expanded #panel-drilldown {
    display: none !important;
}

/* Prevent body scroll when expanded */
body.details-expanded {
    overflow: hidden;
    /* iOS scroll-lock fix */
    position: fixed;
    width: 100%;
}

/* Tab content */
.panel-tab-content {
    display: none;
    flex: 1;
    overflow: visible;  /* Allow expansion, no scroll */
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 6px 6px 6px;
    margin: 0 8px 4px 8px;  /* Reduced bottom margin */
}

.panel-tab-content.active {
    display: block;
}

.panel-attributes--tabs-booting .panel-tab-content {
    display: none !important;
}

.admin-tab-container {
    padding: 16px;
    padding-bottom: 8px;  /* Reduce bottom padding to minimize scroll */
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(38, 43, 60, 0.511);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Panel title entity card */
.panel-title-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 18px 12px 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-sm);
    width: var(--entity-card-width);
    height: var(--entity-card-height);
    box-sizing: border-box;
    box-shadow: 
        0 0 0 2px rgba(74, 158, 255, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.panel-title-card[data-level="0"] { background: var(--level-0-bg); }
.panel-title-card[data-level="1"] { background: var(--level-1-bg); }
.panel-title-card[data-level="2"] { background: var(--level-2-bg); }
.panel-title-card[data-level="3"] { background: var(--level-3-bg); }
.panel-title-card[data-level="4"] { background: var(--level-4-bg); }
.panel-title-card[data-level="5"] { background: var(--level-5-bg); }
.panel-title-card[data-level="6"] { background: var(--level-6-bg); }

.panel-title-icon {
    width: var(--entity-card-icon-size);
    height: var(--entity-card-icon-size);
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--bg-primary);
    flex-shrink: 0;
}

.panel-title-label {
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.panel-title-separator {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.panel-title-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* --- Attributes Container --- */
.attributes-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-x: hidden;
    width: 100%;
    background: rgba(12, 12, 12, 0.081);
}

.attribute-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.attribute-group-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.attribute-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.attribute-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 10px 10px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    min-width: 80px;
    flex: 1 1 auto;
    max-width: 140px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.attribute-item:hover {
    background: var(--panel-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.15);
}

.attribute-item:active {
    transform: translateY(0);
}

.attribute-item-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bg-primary);
}

.attribute-item-label {
    font-size: 0.6875rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

.attribute-item-subtitle {
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-align: center;
}

.attribute-empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 12px 0;
}

/* ==============================================
   Fixed Bottom Drill-Down Panel
   ============================================== */

.panel-left {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 900px;
    max-height: var(--bottom-panel-height);
    z-index: var(--nav-z-index, 1000);
    background: var(--panel-bg);
    border: none;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s ease;
    overflow: visible;  /* Allow callouts to extend outside */
}

/* Responsive max-width for different screen sizes */
@media (min-width: 1400px) {
    .panel-left {
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .panel-left {
        max-width: 100%;
        left: 0;
        right: 0;
        transform: none;
        border-left: none;
        border-right: none;
    }
}

.panel-left:not(.collapsed) {
    max-height: none;  /* Allow vertical expansion */
    overflow: visible;  /* No scrolling - expand to fit content */
}

/* --- Toggle Button --- */
.panel-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    margin: 0;
    background: var(--bg-accent);
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-toggle-btn:hover {
    background: var(--accent-color);
}

.panel-toggle-btn:active {
    background: var(--accent-color);
    transform: scale(0.98);
}

.panel-toggle-btn svg {
    width: 18px;
    height: 18px;
    transform: rotate(90deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-left:not(.collapsed) .panel-toggle-btn svg {
    transform: rotate(-90deg);
}

/* --- Panel Sections (Legacy) --- */
.panel-section {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
    border-bottom: none;
    flex: 1;
}

.panel-section-title {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Collapse transitions */
.panel-left.collapsed .panel-section {
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* Keep hierarchy-nav visible but hide children when collapsed */
.panel-left.collapsed .hierarchy-nav {
    flex: 0;
    padding: 8px;
    gap: 0;
}

.panel-left.collapsed .hierarchy-nav .hierarchy-level-indicator,
.panel-left.collapsed .hierarchy-nav .hierarchy-children-section {
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.panel-section,
.hierarchy-nav {
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.hierarchy-level-indicator,
.hierarchy-children-section {
    transition: opacity 0.2s ease, visibility 0.2s ease, height 0.2s ease;
}

/* ==============================================
   Task 10: Hierarchy Navigation Refactor
   Compact, clear, and space-efficient design
   ============================================== */

/* Main container */
.hierarchy-nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

/* --- Current Path Breadcrumb Row --- */
.hierarchy-path-row {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    min-height: 28px;
}

.hierarchy-breadcrumb {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.hierarchy-breadcrumb::-webkit-scrollbar {
    height: 4px;
}

.hierarchy-breadcrumb::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Breadcrumb chip (compact pill) */
.breadcrumb-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    font-size: 0.6875rem;
    white-space: nowrap;
}

.breadcrumb-chip:hover {
    background: var(--panel-hover);
    border-color: var(--accent-color);
}

.breadcrumb-chip.current {
    background: var(--bg-accent);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.3);
}

.breadcrumb-chip.auto-skipped {
    opacity: 0.6;
    border-style: dashed;
}

.breadcrumb-chip-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.breadcrumb-chip-label {
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-chip.current .breadcrumb-chip-label {
    font-weight: 600;
}

/* Breadcrumb separator */
.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 0.625rem;
    flex-shrink: 0;
    opacity: 0.5;
}

/* Empty state for breadcrumb */
.breadcrumb-root {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-style: italic;
    padding: 2px 4px;
}

/* --- Current Level Indicator --- */
.hierarchy-level-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 0.6875rem;
}

.hierarchy-level-indicator .level-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}

.hierarchy-level-indicator .level-value {
    color: var(--accent-color);
    font-weight: 600;
}

/* --- Children Section --- */
.hierarchy-children-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.hierarchy-children-title {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 6px 0;
    padding: 0 4px;
}

.hierarchy-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    padding: 6px;
    background: var(--selection-area-bg);
    border: 1px solid var(--selection-area-border);
    border-radius: var(--radius-sm);
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

/* Empty state for children */
.hierarchy-children-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 12px 8px;
    text-align: center;
    grid-column: 1 / -1;
}

/* --- Compact Child Item Card --- */
.child-item-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 0;
}

.child-item-compact:hover {
    background: var(--panel-hover);
    border-color: var(--accent-color);
}

.child-item-compact:active {
    transform: scale(0.98);
}

.child-item-compact .child-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5625rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.child-item-compact .child-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.child-item-compact .child-name {
    font-size: 0.6875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.child-item-compact .child-subtitle {
    font-size: 0.5625rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.child-item-compact .child-arrow {
    color: var(--text-muted);
    font-size: 0.625rem;
    flex-shrink: 0;
    opacity: 0.5;
}

.child-item-compact:hover .child-arrow {
    opacity: 1;
    color: var(--accent-color);
}

/* Entity type stripe on compact child */
.child-item-compact .entity-type-stripe {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* Position relative for stripe */
.child-item-compact {
    position: relative;
}

/* --- Legacy Parent Stack (keep for compatibility) --- */
.parent-stack {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

/* Progressive background levels for parent-stack */
.parent-stack-item[data-level="0"] { background: var(--level-0-bg); }
.parent-stack-item[data-level="1"] { background: var(--level-1-bg); }
.parent-stack-item[data-level="2"] { background: var(--level-2-bg); }
.parent-stack-item[data-level="3"] { background: var(--level-3-bg); }
.parent-stack-item[data-level="4"] { background: var(--level-4-bg); }
.parent-stack-item[data-level="5"] { background: var(--level-5-bg); }
.parent-stack-item[data-level="6"] { background: var(--level-6-bg); }

/* Auto-skipped entity styling */
.parent-stack-item.auto-skipped {
    opacity: 0.7;
    border-style: dashed;
}

.parent-stack-item.auto-skipped:hover {
    opacity: 1;
}

/* Skip notice on parent (when child was auto-skipped) */
.parent-stack-item.has-skip-notice {
    position: relative;
}

.skip-notice-indicator {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
    opacity: 0.8;
    cursor: help;
}

.parent-stack-item.has-skip-notice:hover .skip-notice-indicator {
    opacity: 1;
    background: rgba(100, 100, 100, 0.5);
}

/* ==============================================
   Shared Entity Card Styles
   ============================================== */
.parent-stack-item,
.child-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 12px 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    width: var(--entity-card-width);
    height: var(--entity-card-height);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.parent-stack-item:hover,
.child-item:hover {
    background: var(--panel-hover);
    border-color: var(--accent-color);
}

.parent-stack-item:active,
.child-item:active {
    background: var(--panel-hover);
    border-color: var(--accent-color);
    transform: scale(0.96);
}

/* Selected state with pulse animation */
.parent-stack-item.current,
.parent-stack-item.selected,
.child-item.selected {
    background: var(--bg-accent);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
    animation: selectPulse 0.3s ease-out;
}

@keyframes selectPulse {
    0% {
        transform: scale(0.96);
        box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.5);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
    }
}

/* --- Shared Entity Card Icon --- */
.parent-stack-icon,
.child-item-icon {
    width: var(--entity-card-icon-size);
    height: var(--entity-card-icon-size);
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--bg-primary);
    flex-shrink: 0;
}

/* --- Shared Entity Card Label --- */
.parent-stack-label,
.child-item-content {
    flex: 1;
    min-width: 0;
}

.parent-stack-label,
.child-item-label {
    font-size: 0.75rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Child-specific: content wrapper for subtitle */
.child-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.child-item-subtitle {
    font-size: 0.5625rem;
    color: var(--text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.child-item-arrow {
    color: var(--text-muted);
    font-size: 0.625rem;
    flex-shrink: 0;
}

/* Entity Type Tag - full width striped header at top + left stripe */
.entity-type-tag {
    position: absolute;
    
    top: 0;
    left: 0;
    right: 0;
    height: 14px;
    border-radius: 3px 3px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.1) 3px,
        rgba(255, 255, 255, 0.1) 6px
    );
}

.entity-type-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: -200px;
    width: 4px;
    background-color: inherit;
    border-radius: 3px 0 0 3px;
    clip-path: inset(0);
}

.entity-type-tag::after {
    content: attr(data-label);
}

.child-item {
    position: relative;
}

/* Progressive background levels for child items */
.child-item[data-level="0"] { background: var(--level-0-bg); }
.child-item[data-level="1"] { background: var(--level-1-bg); }
.child-item[data-level="2"] { background: var(--level-2-bg); }
.child-item[data-level="3"] { background: var(--level-3-bg); }
.child-item[data-level="4"] { background: var(--level-4-bg); }
.child-item[data-level="5"] { background: var(--level-5-bg); }
.child-item[data-level="6"] { background: var(--level-6-bg); }

.parent-stack-type {
    display: none;
}

.parent-stack-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 4px 0;
}

/* --- Child List - Horizontal Scroll --- */
.child-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
    background: var(--selection-area-bg);
    border: 1px solid var(--selection-area-border);
    border-radius: var(--radius-sm);
}

.child-list-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 0;
    text-align: center;
    width: 100%;
}

/* ==============================================
   Legacy Support (for EntityGrid compatibility)
   ============================================== */

/* --- Cards --- */
.card {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--panel-hover);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* --- Entity Grid (Generic) --- */
.entity-grid {
    align-self: flex-start;
}

.entity-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

.entity-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    min-width: 70px;
}

.entity-item:hover {
    background: var(--panel-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.entity-item.clickable {
    cursor: pointer;
}

.entity-item.selected {
    background: var(--bg-accent);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.entity-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bg-primary);
}

.entity-label {
    font-size: 0.6875rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.entity-subtitle {
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-align: center;
}

/* --- Footer --- */
.app-footer {
    margin-top: 24px;
    padding: 12px;
    text-align: center;
    margin-bottom: calc(var(--bottom-panel-height) + 8px);
}

/* ==============================================
   Offline UI Additions
   ============================================== */

/* Action blocking styling for sports-specific elements */
.child-item[data-requires-online].offline-blocked,
.entity-item[data-requires-online].offline-blocked,
.parent-stack-item[data-requires-online].offline-blocked {
    opacity: 0.4;
    pointer-events: none;
}

.child-item[data-requires-online].offline-blocked::before,
.entity-item[data-requires-online].offline-blocked::before {
    content: '⚡';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    opacity: 0.7;
}

/* Data freshness indicator on section headers */
.panel-section-title[data-cache-key] {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Offline state color overrides for dark theme */
.cache-status-global--offline {
    background: #37474f;
    color: #b0bec5;
}

.cache-status-global--error {
    background: #4a1c1c;
    color: #ef9a9a;
}

.cache-status-global--hidden {
    display: none;
}

.cache-status-badge--offline {
    background: #37474f;
    color: #b0bec5;
}

.cache-status-badge--error {
    background: #4a1c1c;
    color: #ef9a9a;
}

/* Mobile-specific adjustments */
@media (max-width: 600px) {
    .app-header-right {
        gap: 6px;
    }
    
    .app-header-right .cache-status-global {
        position: static;
        padding: 4px 8px;
        font-size: 11px;
        transform: none;
        opacity: 1;
    }
    
    .app-header-right .cache-status-global--hidden {
        display: none;
    }
}

.footer-text {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
/* ==============================================
   Admin Console Section
   ============================================== */

.admin-console-section {
    display: none;
    flex-basis: 100%;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding: 1rem;
    background: rgba(249, 115, 22, 0.05);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 8px;
}

body.admin-mode-active .admin-console-section {
    display: block;
}

.admin-console-title {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Admin Console - Entity Config Subsection */
.admin-config-collapsible {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
}

.admin-config-collapsible:last-child {
    margin-bottom: 0;
}

.admin-config-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.admin-config-toggle::-webkit-details-marker {
    display: none;
}

.admin-config-toggle::before {
    content: '▶';
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.admin-config-collapsible[open] .admin-config-toggle::before {
    transform: rotate(90deg);
}

.admin-config-toggle .config-context {
    font-weight: 400;
    color: #a78bfa;
    font-size: 0.75rem;
    margin-left: auto;
}

/* Admin Tab Entity Header */
.admin-entity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border-left: 3px solid var(--admin-accent-color, var(--accent-color));
}

.admin-entity-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--admin-accent-color, var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: relative;
}

.admin-badge-gear {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.875rem;
    background: #1e293b;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.admin-entity-info {
    flex: 1;
    min-width: 0;
}

.admin-entity-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-entity-type {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--admin-accent-color, var(--accent-color));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-config-container {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* Task 13: Display Layout Section */
.layout-section-group {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(75, 85, 99, 0.4);
    border-radius: 6px;
    background: rgba(31, 41, 55, 0.3);
    overflow-x: auto;
}

.layout-section-group:last-of-type {
    margin-bottom: 8px;
}

.layout-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.layout-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.layout-group-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.layout-copy-config-btn {
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(107, 114, 128, 0.4);
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.2;
    padding: 3px 7px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.layout-copy-config-btn:hover {
    background: rgba(16, 185, 129, 0.14);
    border-color: #10b981;
    color: #6ee7b7;
}

.layout-copy-config-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.layout-refresh-btn {
    background: transparent;
    border: 1px solid rgba(107, 114, 128, 0.4);
    border-radius: 4px;
    color: #9ca3af;
    font-size: 0.85rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layout-refresh-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #60a5fa;
}

.layout-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.layout-refresh-btn--loading {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* All row in table header */
.layout-all-row {
    background: rgba(55, 65, 81, 0.5);
    border-bottom: 1px solid rgba(107, 114, 128, 0.4);
}

.layout-all-row td {
    padding: 6px 8px;
    font-size: 0.7rem;
}

.layout-all-label {
    font-weight: 500;
    color: #d1d5db;
    font-style: italic;
}

.layout-all-toggle {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
}

/* Tri-state toggle (All Sections) */
.layout-toggle-tri {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    position: relative;
}

.layout-toggle-tri-input {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 18px;
    background: rgba(100, 100, 100, 0.4);
    border-radius: 9px;
    outline: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

/* Left position (0 = Closed) - gray background */
.layout-toggle-tri-input[data-value="0"] {
    background: rgba(100, 100, 100, 0.4);
}

/* Middle position (1 = Mixed) - darker gray background */
.layout-toggle-tri-input[data-value="1"] {
    background: rgba(75, 85, 99, 0.5);
}

/* Right position (2 = Open) - green background */
.layout-toggle-tri-input[data-value="2"] {
    background: rgba(76, 175, 80, 0.4);
}

.layout-toggle-tri-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #888;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.layout-toggle-tri-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #888;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

/* Thumb color based on value */
.layout-toggle-tri-input[data-value="2"]::-webkit-slider-thumb {
    background: #4caf50;
}

.layout-toggle-tri-input[data-value="2"]::-moz-range-thumb {
    background: #4caf50;
}

.layout-toggle-tri-caption {
    display: block;
    font-size: 0.55rem;
    color: #6b7280;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.3;
}

.layout-inherit-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    vertical-align: middle;
}

/* Per-row tri-state toggle (Collapsed / Inherit / Expanded) */
.layout-toggle-tri-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    cursor: pointer;
    position: relative;
    width: min(100%, 250px);
    min-width: 0;
    margin-left: auto;
}

.layout-toggle-tri-row-input {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 18px;
    background: rgba(100, 100, 100, 0.4);
    border-radius: 9px;
    outline: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

/* Left position (0 = Collapsed) - gray background */
.layout-toggle-tri-row-input[data-value="0"] {
    background: rgba(100, 100, 100, 0.4);
}

/* Middle position (1 = Inherit) - color based on resolved value */
.layout-toggle-tri-row-input[data-value="1"][data-resolved="collapsed"] {
    background: rgba(100, 100, 100, 0.3);
}
.layout-toggle-tri-row-input[data-value="1"][data-resolved="expanded"] {
    background: rgba(76, 175, 80, 0.3);
}

/* Right position (2 = Expanded) - green background */
.layout-toggle-tri-row-input[data-value="2"] {
    background: rgba(76, 175, 80, 0.4);
}

.layout-toggle-tri-row-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #888;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.layout-toggle-tri-row-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #888;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

/* Thumb color based on value */
.layout-toggle-tri-row-input[data-value="2"]::-webkit-slider-thumb {
    background: #4caf50;
}
.layout-toggle-tri-row-input[data-value="2"]::-moz-range-thumb {
    background: #4caf50;
}

/* Middle position thumb matches resolved value */
.layout-toggle-tri-row-input[data-value="1"][data-resolved="expanded"]::-webkit-slider-thumb {
    background: #4caf50;
}
.layout-toggle-tri-row-input[data-value="1"][data-resolved="expanded"]::-moz-range-thumb {
    background: #4caf50;
}

/* Middle position (1 = Inherit) for visible - color based on resolved value */
.layout-toggle-tri-row-input[data-value="1"][data-resolved="visible"] {
    background: rgba(76, 175, 80, 0.3);
}
.layout-toggle-tri-row-input[data-value="1"][data-resolved="visible"]::-webkit-slider-thumb {
    background: #4caf50;
}
.layout-toggle-tri-row-input[data-value="1"][data-resolved="visible"]::-moz-range-thumb {
    background: #4caf50;
}

.layout-toggle-tri-row-caption {
    display: block;
    font-size: 0.55rem;
    color: #6b7280;
    margin-top: 2px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
    line-height: 1.3;
    max-width: 100%;
}

.layout-inherit-info-btn {
    background: none;
    border: none;
    padding: 0 3px;
    margin-top: 2px;
    margin-left: 0;
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.7rem;
    color: var(--text-muted, #9ca3af);
    vertical-align: middle;
    align-self: flex-end;
}
.layout-inherit-info-btn:hover {
    opacity: 1;
    color: var(--accent-color, #60a5fa);
}

/* Inheritance Info Popup */
.layout-inherit-popup {
    background: var(--card-bg, #1f2937);
    border: 1px solid var(--border-color, #374151);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    min-width: 280px;
    max-width: 560px;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}

.layout-inherit-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color, #374151);
    border-radius: 8px 8px 0 0;
}

.layout-inherit-popup-title {
    font-weight: 600;
    color: var(--text-color, #f3f4f6);
}

.layout-inherit-popup-close {
    background: none;
    border: none;
    color: var(--text-muted, #9ca3af);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.layout-inherit-popup-close:hover {
    color: var(--text-color, #f3f4f6);
}

.layout-inherit-popup-body {
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.layout-inherit-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.layout-inherit-popup-label {
    color: var(--text-muted, #9ca3af);
}

.layout-inherit-popup-value {
    font-weight: 500;
    color: var(--text-color, #f3f4f6);
}

.layout-inherit-popup-value--on {
    color: #4ade80;
}

.layout-inherit-popup-value--off {
    color: #f87171;
}

.layout-inherit-popup-desc {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #374151);
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    line-height: 1.5;
}

/* Phase 2 Resolution Details Styles */
.layout-inherit-popup-section {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.layout-inherit-popup-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.layout-inherit-popup-section-title {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 8px;
}

/* Inheritance info popup — debug section + JSON syntax highlighting */
.layout-inherit-popup-debug {
    background: rgba(255, 255, 0, 0.06);
    border: 1px dashed rgba(255, 255, 0, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 8px;
}
.layout-inherit-popup-debug .layout-inherit-popup-section-title {
    color: #facc15;
    margin-bottom: 6px;
}
.ljson-ctx {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 10px;
    row-gap: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    margin-bottom: 8px;
}
.ljson-ctx-row {
    display: contents;
}
.ljson-ctx-val {
    color: var(--text-color, #f3f4f6);
    word-break: break-word;
}
.ljson-lanes-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #facc15;
    opacity: 0.85;
    margin: 8px 0 4px;
}
.ljson-lane {
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    overflow: hidden;
}
.ljson-lane > summary {
    cursor: pointer;
    padding: 4px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    color: #93c5fd;
    list-style: none;
    user-select: none;
}
.ljson-lane > summary::-webkit-details-marker { display: none; }
.ljson-lane > summary::before {
    content: '▸';
    display: inline-block;
    width: 10px;
    color: var(--text-muted, #9ca3af);
    transition: transform 0.15s ease;
}
.ljson-lane[open] > summary::before { transform: rotate(90deg); }
.ljson-block {
    margin: 0;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-color, #f3f4f6);
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
}
.ljson-block code { font: inherit; color: inherit; background: none; padding: 0; }
.ljson-key    { color: #93c5fd; }   /* light blue */
.ljson-string { color: #86efac; }   /* green */
.ljson-number { color: #fbbf24; }   /* amber */
.ljson-bool   { color: #f0abfc; }   /* magenta */
.ljson-null   { color: #9ca3af; font-style: italic; }

.resolution-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resolution-toggle {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 8px 10px;
}

.resolution-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.resolution-toggle-name {
    font-weight: 600;
    color: var(--text-color, #f3f4f6);
}

.resolution-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.resolution-badge--hardset {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.resolution-badge--self {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.resolution-badge--softset {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.resolution-badge--default {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.resolution-toggle-value,
.resolution-toggle-source {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.resolution-label {
    color: var(--text-muted, #9ca3af);
    min-width: 40px;
}

.resolution-value {
    font-weight: 500;
}

.resolution-value--on {
    color: #4ade80;
}

.resolution-value--off {
    color: #f87171;
}

.resolution-source {
    color: var(--text-color, #f3f4f6);
}

.resolution-chain {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.resolution-chain-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 4px;
}

.chain-item {
    font-size: 0.7rem;
    padding: 2px 0;
    color: var(--text-muted, #9ca3af);
}

.chain-item--hardset {
    color: #f87171;
}

.chain-item--softset {
    color: #fbbf24;
}

.chain-item--self {
    color: #60a5fa;
}

.precedence-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.7rem;
}

.precedence-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted, #9ca3af);
}

.layout-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    table-layout: auto;
    min-width: 900px;
}

.layout-table th {
    text-align: left;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    vertical-align: bottom;
    white-space: nowrap;
}

.layout-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.layout-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.layout-col-order {
    width: 84px;
}

.layout-col-section {
    width: auto;
}

.layout-col-expanded,
.layout-col-visible {
    width: 1%;
}

.layout-table--tabs {
    min-width: 560px;
}

.layout-table--tabs .layout-col-visible {
    width: 280px;
}

.layout-label {
    color: var(--text-primary);
    white-space: normal;
    text-align: left;
    line-height: 1.35;
}

.layout-section-name {
    display: block;
    max-width: 100%;
}

.layout-row-nested .layout-label {
    padding-left: 22px;
    color: var(--text-secondary);
}

.layout-key-inline {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.625rem;
    padding: 1px 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    color: #888;
    display: inline-block;
    margin-top: 3px;
    margin-left: 0;
    white-space: nowrap;
}

.layout-visible {
    text-align: right;
}

.layout-visible-yes {
    color: #22c55e;
}

.layout-visible-no {
    color: var(--text-muted);
}

/* Layout Expanded/Collapsed Toggle */
.layout-expanded {
    text-align: right;
}

/* =============================================================================
   ADMIN TOGGLE - Canonical toggle switch style for all admin sections
   Use .admin-toggle or .layout-toggle interchangeably
   ============================================================================= */
.admin-toggle,
.layout-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.admin-toggle-input,
.layout-toggle-input {
    display: none;
}

.admin-toggle-slider,
.layout-toggle-slider {
    width: 32px;
    height: 18px;
    background: rgba(100, 100, 100, 0.4);
    border-radius: 9px;
    position: relative;
    transition: background 0.2s ease;
}

.admin-toggle-slider::after,
.layout-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.admin-toggle-input:checked + .admin-toggle-slider,
.layout-toggle-input:checked + .layout-toggle-slider {
    background: rgba(76, 175, 80, 0.4);
}

.admin-toggle-input:checked + .admin-toggle-slider::after,
.layout-toggle-input:checked + .layout-toggle-slider::after {
    transform: translateX(14px);
    background: #4caf50;
}

.admin-toggle-label,
.layout-toggle-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.admin-toggle-input:checked ~ .admin-toggle-label,
.layout-toggle-input:checked ~ .layout-toggle-label {
    color: #4caf50;
}

/* Per-toggle lock icons for Children scope */
.layout-table-with-locks .layout-expanded,
.layout-table-with-locks .layout-visible {
    position: relative;
    padding-top: 34px; /* Space for lock button above */
    vertical-align: top;
}

.layout-row-with-locks td {
    height: auto;
    min-height: 64px;
}

/* Position im-lock-btn inside layout cells */
.layout-table-with-locks .im-lock-btn {
    position: absolute;
    top: 4px;
    left: auto;
    right: calc(12px + ((44px - 24px) / 2));
    transform: none;
}

.layout-lock-branch {
    position: absolute;
    top: 2px;
    right: 44px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 116px;
    padding: 3px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 8px;
    background: rgba(22, 33, 62, 0.98);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px) scale(0.92);
    transform-origin: right center;
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.layout-lock-branch.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
}

.layout-lock-branch-option {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
}

.layout-lock-branch-option:hover,
.layout-lock-branch-option:focus-visible {
    border-color: rgba(125, 211, 252, 0.5);
    background: rgba(125, 211, 252, 0.14);
    color: var(--text-primary);
    outline: none;
}

.layout-lock-branch-option--reset {
    border-color: rgba(251, 191, 36, 0.28);
    color: #facc15;
}

/* Scope description in Display Layout tabs */
.layout-scope-description {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid #555;
    border-radius: 0 4px 4px 0;
}

/* Parent-locked indicator for Self scope */
.layout-parent-lock-indicator {
    position: absolute;
    top: 6px;
    left: auto;
    right: calc(12px + ((44px - 12px) / 2));
    transform: none;
    font-size: 0.75rem;
    color: #f44336;
    pointer-events: none;
}

/* Dim toggle when parent locked */
.layout-cell-parent-locked {
    position: relative;
}

.layout-cell-parent-locked .layout-toggle-tri-row-input,
.layout-cell-parent-locked .layout-toggle-tri-row-caption {
    opacity: 0.5;
    pointer-events: none;
}

.layout-cell-parent-locked .layout-toggle-input {
    pointer-events: none;
    opacity: 0.5;
}

.layout-cell-parent-locked .layout-toggle-slider {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Keep info button clickable and visible when locked */
.layout-cell-parent-locked .layout-inherit-info-btn {
    opacity: 1;
    pointer-events: auto;
}

.layout-th-order,
.layout-th-section {
    text-align: left;
}

.layout-th-expanded,
.layout-th-visible {
    text-align: right;
}

/* Task 16: Display Layout Self/Children Tabs */
.layout-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 6px;
}

.layout-tab {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layout-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.layout-tab-active {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.layout-tab-content {
    display: none;
}

.layout-tab-content-active {
    display: block;
}

.layout-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 12px !important;
}

.layout-note {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin: 8px 0 0 0;
    font-style: italic;
}

.layout-note-placeholder {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 4px;
    border-left: 3px solid #f97316;
}

/* Child type header for Descendants tab */
.layout-child-type-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 3px solid #3b82f6;
}

.layout-child-type-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.layout-child-type-value {
    font-size: 0.875rem;
    color: #60a5fa;
    font-weight: 600;
    text-transform: capitalize;
}

/* Leaf entity state (no children) */
.layout-leaf-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    background: rgba(107, 114, 128, 0.1);
    border-radius: 8px;
    text-align: center;
}

.layout-leaf-icon {
    font-size: 2rem;
    opacity: 0.7;
}

.layout-leaf-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.layout-leaf-message strong {
    color: #a78bfa;
}

.layout-leaf-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Task 11: Layout Reorder Controls */
.layout-order {
    width: 70px;
    text-align: left;
    color: var(--text-muted);
    white-space: nowrap;
}

.layout-th-order {
    width: 70px;
}

.layout-order-num {
    display: inline-block;
    min-width: 16px;
    text-align: left;
}

.layout-reorder-arrows {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    vertical-align: top;
    margin-left: 8px;
}

.layout-arrow {
    display: block;
    width: 18px;
    height: 14px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.5rem;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.12s ease;
}

.layout-arrow:hover:not(:disabled) {
    background: rgba(249, 115, 22, 0.3);
    color: #f97316;
}

.layout-arrow:active:not(:disabled) {
    background: rgba(249, 115, 22, 0.5);
    transform: scale(0.92);
}

.layout-arrow-disabled,
.layout-arrow:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Dirty state highlight on region group */
.layout-section-group--dirty {
    border-left: 3px solid #f97316;
    padding-left: 8px;
    transition: border-left 0.2s ease, padding-left 0.2s ease;
}

.layout-section-group--refreshed {
    animation: section-refresh-flash 1.2s ease-out;
}

@keyframes section-refresh-flash {
    0%   { border-color: #60a5fa; box-shadow: 0 0 8px rgba(96, 165, 250, 0.5); }
    40%  { border-color: #34d399; box-shadow: 0 0 12px rgba(52, 211, 153, 0.4); }
    100% { border-color: rgba(75, 85, 99, 0.4); box-shadow: none; }
}

/* Save / Cancel action bar */
.layout-reorder-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 0 4px 0;
    justify-content: flex-end;
}

.layout-save-btn,
.layout-cancel-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layout-save-btn {
    background: rgba(249, 115, 22, 0.85);
    color: #fff;
}

.layout-save-btn:hover:not(:disabled) {
    background: #f97316;
}

.layout-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.layout-cancel-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.layout-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Navigation info bar */
.config-nav-info {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.75rem;
}

.config-nav-info .nav-item {
    color: var(--text-muted);
}

.config-nav-info .nav-item strong {
    color: #60a5fa;
}

.config-nav-info .nav-item code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* Config Table */
.config-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.config-table th {
    text-align: left;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
}

.config-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.config-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.config-table tr.has-policy {
    background: rgba(139, 92, 246, 0.05);
}

.config-table tr.is-default {
    opacity: 0.7;
}

.config-table .config-key {
    font-family: monospace;
    color: #e0e0e0;
    white-space: nowrap;
}

.config-table .config-value {
    font-weight: 600;
}

.config-table .config-value.value-true {
    color: #22c55e;
}

.config-table .config-value.value-false {
    color: #64748b;
}

.config-table .config-source {
    white-space: nowrap;
}

.config-table .source-default {
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
}

.config-table .source-policy {
    background: rgba(139, 92, 246, 0.25);
    color: #a78bfa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
}

.config-table .source-role {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    margin-left: 4px;
}

.config-table .config-desc {
    color: var(--text-muted);
    font-size: 0.65rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.config-table .config-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

/* Policies detail section */
.config-policies-detail {
    margin-top: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.05);
}

.config-policies-detail summary {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
    cursor: pointer;
}

.config-policies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.config-policies-table th {
    text-align: left;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.6rem;
    text-transform: uppercase;
}

.config-policies-table td {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.config-policies-table tr.winner {
    background: rgba(34, 197, 94, 0.1);
}

.config-policies-table tr.winner td:first-child {
    border-left: 2px solid #22c55e;
}

.config-policies-table tr.overridden {
    opacity: 0.5;
}

.config-policies-table .policy-id {
    color: var(--text-muted);
    font-family: monospace;
}

/* ==============================================
   Add & Manage Events Section
   ============================================== */

.add-event-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.add-event-context {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.add-event-subsection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

#add-event-manage-content,
#add-facility-manage-content {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.add-event-subsection + .add-event-subsection {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.add-event-subsection-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 700;
}

.add-event-management-placeholder {
    margin: 0;
    padding: 9px 10px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.add-event-management-placeholder--error {
    border-color: rgba(248, 113, 113, 0.34);
    color: var(--error-color, #ef4444);
}

.add-event-existing-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.add-facility-existing-list {
    max-height: 132px;
}

.add-facility-existing-edit-forms {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.add-facility-existing-edit-forms:has(.add-facility-existing-edit-form:not([hidden])) {
    padding: 10px;
    border: 1px solid rgba(74, 158, 255, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(8, 13, 24, 0.32);
}

.add-facility-existing-edit-form {
    border-color: rgba(74, 158, 255, 0.34);
    background: rgba(15, 23, 42, 0.46);
}

.add-event-existing-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 5px 7px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.42);
}

.add-event-existing-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.add-event-existing-card--editing .add-event-existing-item {
    border-color: rgba(96, 165, 250, 0.46);
    background: rgba(30, 64, 175, 0.12);
}

.add-event-existing-main {
    min-width: 0;
}

.add-event-existing-title {
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
}

.add-event-existing-meta {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.62rem;
    line-height: 1.2;
}

.add-event-existing-status {
    flex-shrink: 0;
    padding: 2px 5px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.26);
    color: var(--accent-color, #60a5fa);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: capitalize;
}

.add-event-existing-side {
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-event-existing-actions {
    display: flex;
    gap: 3px;
}

.add-event-existing-btn {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 0.6rem;
    line-height: 1.25;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.add-event-existing-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
}

.add-event-existing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.add-event-existing-btn--save {
    color: #ffffff;
    background: var(--accent-color);
    border-color: transparent;
}

.add-event-existing-btn--save:hover:not(:disabled) {
    opacity: 0.85;
}

.add-event-existing-btn--delete {
    color: var(--error-color, #ef4444);
    border-color: rgba(248, 113, 113, 0.36);
}

.add-event-existing-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.26);
    overflow-x: hidden;
}

.add-event-existing-edit-form[hidden] {
    display: none !important;
}

.add-event-parent-edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(74, 158, 255, 0.26);
    border-radius: var(--radius-sm);
    background: rgba(74, 158, 255, 0.08);
}

.add-event-parent-edit-toolbar[hidden] {
    display: none !important;
}

.add-event-existing-edit-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.add-event-parent-edit-status {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
}

.add-event-existing-edit-status {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 1.05em;
    padding: 0;
}

.add-event-management-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

@media (max-width: 900px) {
    .add-event-existing-item {
        align-items: flex-start;
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .add-event-existing-side {
        width: 100%;
        justify-content: space-between;
    }
}

.add-event-ctx-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.6875rem;
}

.add-event-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-event-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
}

.add-event-row--split {
    flex-direction: row;
    gap: 10px;
    min-width: 0;
}

.add-event-field {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-event-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.add-event-opt {
    font-weight: 400;
    text-transform: none;
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.add-event-input,
.add-event-select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 7px 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.add-event-input:focus,
.add-event-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.add-event-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

/* Team selection grid */
.add-event-teams-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.add-event-team-group {
    margin-bottom: 4px;
}

.add-event-team-group-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 6px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
}

.add-event-team-group-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 4px;
}

.add-event-team-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.add-event-team-option:hover {
    background: rgba(0, 0, 0, 0.25);
}

.add-event-team-option input[type="checkbox"],
.add-event-team-option input[type="radio"] {
    accent-color: var(--accent-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.add-event-facility-grid {
    max-height: 190px;
}

.add-event-facility-option {
    min-height: 42px;
}

.add-event-facility-option:has(input[type="radio"]:checked) {
    border-color: var(--accent-color);
    background: rgba(74, 158, 255, 0.12);
}

.add-event-facility-badge {
    width: 34px;
}

.add-event-facility-location {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.add-event-team-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    flex-shrink: 0;
}

.add-event-team-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

/* Locked team (admin scope restricted) */
.add-event-team-locked {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.1);
    cursor: default;
}
.add-event-team-locked:hover {
    background: rgba(99, 102, 241, 0.1);
}
.add-event-team-locked input[type="checkbox"] {
    cursor: default;
}
.add-event-team-lock {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Scope indicator badge */
.add-event-scope-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-color, #6366f1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    margin-left: 8px;
    vertical-align: middle;
}

/* Side assignment */
.add-event-sides-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-event-side-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
}

.add-event-side-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.add-event-side-select {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: inherit;
}

/* Action buttons */
.add-event-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.add-event-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
    font-family: inherit;
}

.add-event-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-event-btn--submit {
    background: var(--accent-color);
    color: #fff;
    flex: 1;
}

.add-event-btn--submit:hover:not(:disabled) {
    opacity: 0.85;
}

.add-event-btn--reset {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.add-event-btn--reset:hover {
    background: rgba(255, 255, 255, 0.15);
}

.add-event-btn--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.add-event-btn--secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
}

.add-event-location-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-facility-map-picker-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
    min-width: 0;
}

.add-facility-map-picker-controls .facility-google-place-search {
    flex: 1 1 240px;
    min-width: 0;
}

.add-facility-map-picker-controls .facility-map-picker-btn {
    flex: 0 1 auto;
    white-space: nowrap;
}

.facility-location-map {
    width: 100%;
    min-height: 260px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.facility-location-map[hidden] {
    display: none;
}

.facility-map-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.facility-map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.facility-map-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
}

@media (max-width: 680px) {
    .add-facility-map-picker-controls {
        flex-direction: column;
    }
}

/* Status messages */
.add-event-status {
    font-size: 0.75rem;
    padding: 4px 0;
    min-height: 1.2em;
}

.add-event-status--pending {
    color: var(--text-muted);
}

.add-event-status--success {
    color: var(--success-color);
}

.add-event-status--error {
    color: var(--error-color);
}

/* ==============================================
   Add Child Entity (Task 13)
   ============================================== */

.add-child-section .admin-config-container {
    padding: 10px 12px;
}

.add-child-unavailable {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.add-child-unavailable-icon {
    font-size: 1rem;
    opacity: 0.6;
}

.add-child-unavailable-text {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    font-style: italic;
}

.add-child-section--unavailable .admin-config-toggle {
    opacity: 0.55;
}

.add-child-section--pending .admin-config-toggle {
    opacity: 0.7;
}

.add-child-context-debug {
    margin-top: 8px;
    padding: 5px 7px;
    border-radius: var(--radius-sm, 4px);
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--text-muted, #6b7280);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.6875rem;
    line-height: 1.35;
    word-break: break-word;
}

.add-child-ready {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.add-child-ready-icon {
    font-size: 1rem;
}

.add-child-ready-text {
    font-size: 0.8125rem;
    color: var(--text-secondary, #9ca3af);
}

.add-child-ready-text strong {
    color: var(--text-primary, #e5e7eb);
}

.add-child-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.add-child-meta-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-color, #6366f1);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Add Child Form */
.add-child-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-child-method {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-child-method + .add-child-method {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.add-child-method-heading {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.add-child-link-intro,
.add-child-link-created-copy {
    max-width: 56rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #9ca3af);
    line-height: 1.45;
}

.add-child-link-created-copy {
    margin-top: 3px;
    font-size: 0.76rem;
}

.add-child-link-options-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.add-child-link-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 560px;
}

.add-child-link-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.46);
}

.add-child-link-option--disabled {
    opacity: 0.8;
}

.add-child-link-option-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.add-child-link-option-label {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.82rem;
    font-weight: 700;
}

.add-child-link-option-help {
    color: var(--text-secondary, #9ca3af);
    font-size: 0.73rem;
    line-height: 1.35;
}

.add-child-link-option-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.add-child-link-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.add-child-link-option-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.24);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.add-child-link-option-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}

.add-child-link-option-input:checked + .add-child-link-option-toggle {
    background: rgba(34, 197, 94, 0.36);
    border-color: rgba(34, 197, 94, 0.44);
}

.add-child-link-option-input:checked + .add-child-link-option-toggle::after {
    transform: translateX(18px);
}

.add-child-link-option-input:disabled + .add-child-link-option-toggle {
    opacity: 0.65;
}

.add-child-link-option-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted, #94a3b8);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.add-child-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-child-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-child-input {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color, #2a3a5c);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary, #e5e7eb);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.add-child-input:focus {
    border-color: var(--accent-color, #6366f1);
}

.add-child-input::placeholder {
    color: var(--text-muted, #6b7280);
}

.add-child-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.add-child-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm, 4px);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
    font-family: inherit;
}

.add-child-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-child-input-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
    max-width: 320px;
}

.add-child-input-row .add-child-input {
    flex: 1;
}

.add-child-btn--generate {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #9ca3af);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.75rem;
    min-width: 40px;
}

.add-child-btn--generate:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary, #e5e7eb);
}

.add-child-btn--submit {
    background: var(--accent-color, #6366f1);
    color: #fff;
}

.add-child-btn--submit:hover:not(:disabled) {
    opacity: 0.85;
}

.add-child-btn--create-link {
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.add-child-btn--create-link:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.22);
}

.add-child-btn--copy-link {
    background: var(--accent-color, #6366f1);
    color: #fff;
}

.add-child-btn--refresh-link {
    background: rgba(14, 165, 233, 0.14);
    color: #bae6fd;
    border: 1px solid rgba(14, 165, 233, 0.26);
}

.add-child-btn--refresh-link:hover:not(:disabled) {
    background: rgba(14, 165, 233, 0.2);
}

.add-child-btn--deactivate-link {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.26);
}

.add-child-btn--deactivate-link:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.18);
}

.add-child-btn--uses-link {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted, #6b7280);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.add-child-btn--clear-link {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #9ca3af);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.add-child-btn--reset {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #9ca3af);
}

.add-child-btn--reset:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Status messages */
.add-child-status {
    font-size: 0.75rem;
    padding: 4px 0;
    min-height: 1.2em;
}

.add-child-status--pending {
    color: var(--text-muted, #6b7280);
}

.add-child-status--success {
    color: var(--success-color, #10b981);
}

.add-child-status--error {
    color: var(--error-color, #ef4444);
}

.add-child-link-status,
.add-child-link-copy-status {
    min-height: 1.2em;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.add-child-link-status--pending {
    color: var(--text-muted, #6b7280);
}

.add-child-link-status--success {
    color: var(--success-color, #10b981);
}

.add-child-link-status--error {
    color: var(--error-color, #ef4444);
}

.add-child-link-status {
    margin-top: 8px;
}

.add-child-link-result[hidden] {
    display: none;
}

.add-child-link-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(6px);
    animation: add-child-link-modal-fade-in 0.18s ease;
}

.add-child-link-modal {
    width: min(980px, 100%);
    max-height: min(88vh, 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(96, 165, 250, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.55);
    animation: add-child-link-modal-slide-up 0.22s ease;
}

.add-child-link-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.78);
}

.add-child-link-modal-title-wrap {
    min-width: 0;
}

.add-child-link-modal-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
}

.add-child-link-modal-title {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.add-child-link-modal-summary {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.add-child-link-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.add-child-link-modal-close:hover {
    background: rgba(30, 41, 59, 0.96);
    color: #fff;
}

.add-child-link-modal-body {
    padding: 18px 20px 20px;
    overflow: auto;
}

.add-child-link-modal-body .add-child-link-library {
    max-width: none;
}

.add-child-link-library {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 860px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.62);
}

.add-child-link-library-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-child-link-library-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
}

.add-child-link-library-note,
.add-child-link-library-error,
.add-child-link-empty-body,
.add-child-link-table-subtitle {
    color: var(--text-secondary, #9ca3af);
    font-size: 0.75rem;
    line-height: 1.4;
}

.add-child-link-library-error {
    color: var(--error-color, #ef4444);
}

.add-child-link-copy-toast {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10060;
    max-width: min(220px, calc(100vw - 24px));
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.32);
    color: #dbeafe;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
    animation: add-child-link-copy-toast-in 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.add-child-link-copy-toast--success {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.32);
}

.add-child-link-copy-toast--error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.34);
}

.add-child-link-copy-toast--pending {
    color: #e0f2fe;
    border-color: rgba(14, 165, 233, 0.34);
}

@keyframes add-child-link-copy-toast-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes add-child-link-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes add-child-link-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.add-child-link-empty {
    padding: 10px 12px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.add-child-link-empty-title {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.82rem;
    font-weight: 700;
}

.add-child-link-table-wrap {
    overflow-x: auto;
}

.add-child-link-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.add-child-link-table th,
.add-child-link-table td {
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}

.add-child-link-table th {
    color: var(--text-muted, #94a3b8);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(111, 145, 185, 0.18);
}

.add-child-link-table-row td {
    background: rgba(13, 23, 39, 0.92);
    border-bottom: 1px solid rgba(111, 145, 185, 0.12);
}

.add-child-link-table-label {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.79rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.add-child-link-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.add-child-link-table-meta-row td {
    padding: 0 0 10px;
    border: none;
    background: transparent;
}

.add-child-link-inline-cell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid rgba(120, 154, 195, 0.26);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(14, 24, 40, 0.92), rgba(21, 34, 57, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 18px rgba(5, 10, 20, 0.18);
    overflow: hidden;
}

.add-child-link-inline-cell::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 42%, rgba(149, 196, 255, 0.08) 100%);
    pointer-events: none;
}

.add-child-link-inline-cell--refresh,
.add-child-link-inline-cell--unavailable {
    border-color: rgba(111, 145, 185, 0.18);
    background: rgba(18, 29, 47, 0.86);
}

.add-child-link-inline-snippet {
    min-width: 0;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #b8cae2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.71rem;
}

.add-child-link-inline-snippet--copyable {
    color: #dbeafe;
}

.add-child-link-inline-snippet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: #b8cae2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.71rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.add-child-link-inline-snippet-btn:hover:not(:disabled) {
    color: #dbeafe;
    transform: translateY(-1px);
}

.add-child-link-inline-snippet-btn--copyable {
    color: #cfe3fb;
}

.add-child-link-inline-snippet-btn--unavailable {
    color: #a7bdd8;
}

.add-child-link-inline-preview-text {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-child-link-inline-preview-host {
    flex: 0 0 auto;
    min-width: 0;
    color: inherit;
}

.add-child-link-inline-preview-mask {
    flex: 0 0 auto;
    color: rgba(184, 202, 226, 0.72);
    opacity: 0.92;
    filter: blur(0.2px);
    background: linear-gradient(90deg, rgba(184, 202, 226, 0.86) 0%, rgba(184, 202, 226, 0.58) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.add-child-link-inline-affordance {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(145, 185, 232, 0.22);
    background: rgba(115, 165, 226, 0.12);
    color: rgba(221, 236, 255, 0.9);
}

.add-child-link-inline-affordance-icon {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.add-child-link-settings-trigger {
    min-width: 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(111, 145, 185, 0.2);
    background: rgba(23, 37, 61, 0.88);
    color: #c8dbf2;
    font-size: 0.95rem;
}

.add-child-link-settings-trigger:hover:not(:disabled) {
    background: rgba(31, 48, 77, 0.96);
}

.add-child-link-uses {
    color: #d7e5f7;
    font-size: 0.72rem;
    font-weight: 600;
}

.add-child-link-binary {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(111, 145, 185, 0.18);
    background: rgba(34, 48, 72, 0.75);
    color: #d9e7f8;
    font-size: 0.67rem;
    font-weight: 700;
}

.add-child-link-binary--on {
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(30, 64, 104, 0.54);
}

.add-child-link-binary--off {
    color: #bdcad9;
}

.add-child-link-flag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}

.add-child-link-flag--on {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
}

.add-child-link-flag--off {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
}

.add-child-link-manager {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 720px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.62);
}

.add-child-link-manager--active {
    border-color: rgba(34, 197, 94, 0.3);
}

.add-child-link-manager--disabled,
.add-child-link-manager--revoked,
.add-child-link-manager--expired,
.add-child-link-manager--unknown {
    border-color: rgba(148, 163, 184, 0.22);
}

.add-child-link-manager-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.add-child-link-manager-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
}

.add-child-link-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-child-link-status-text {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-child-link-status-pill {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
    border: 1px solid rgba(148, 163, 184, 0.26);
    background: rgba(148, 163, 184, 0.1);
}

.add-child-link-status-pill--active {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.34);
    background: rgba(34, 197, 94, 0.12);
}

.add-child-link-status-pill--disabled,
.add-child-link-status-pill--unknown {
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(148, 163, 184, 0.1);
}

.add-child-link-status-pill--revoked {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(248, 113, 113, 0.12);
}

.add-child-link-status-pill--expired {
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.32);
    background: rgba(245, 158, 11, 0.12);
}

.add-child-link-url-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
}

.add-child-link-url-unavailable {
    padding: 8px 10px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
}

.add-child-link-url-input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-sm, 4px);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary, #e5e7eb);
    font: 0.75rem ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.add-child-link-summary {
    color: var(--text-secondary, #cbd5e1);
    font-size: 0.77rem;
    line-height: 1.4;
}

.add-child-link-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    margin: 0;
}

.add-child-link-meta-row {
    min-width: 0;
    padding: 6px 8px;
    border-radius: var(--radius-sm, 4px);
    background: rgba(255, 255, 255, 0.05);
}

.add-child-link-meta-row dt {
    font-size: 0.625rem;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.add-child-link-meta-row dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.75rem;
    color: var(--text-primary, #e5e7eb);
}

.add-child-link-settings,
.add-child-link-advanced {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm, 4px);
    background: rgba(255, 255, 255, 0.035);
}

.add-child-link-settings-summary,
.add-child-link-advanced summary {
    cursor: pointer;
    padding: 8px 10px;
    color: var(--text-primary, #e5e7eb);
    font-size: 0.76rem;
    font-weight: 700;
}

.add-child-link-settings-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 10px;
}

.add-child-link-settings-note {
    color: var(--text-secondary, #9ca3af);
    font-size: 0.74rem;
    line-height: 1.4;
}

.add-child-link-settings-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    margin: 0;
}

.add-child-link-settings-row {
    min-width: 0;
    padding: 6px 8px;
    border-radius: var(--radius-sm, 4px);
    background: rgba(15, 23, 42, 0.46);
}

.add-child-link-settings-row dt {
    font-size: 0.62rem;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.add-child-link-settings-row dd {
    margin: 0;
    color: var(--text-primary, #e5e7eb);
    font-size: 0.75rem;
}

.add-child-link-advanced .add-child-link-meta {
    padding: 0 10px 10px;
}

.add-child-btn--manage-link {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.add-child-btn--manage-link:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.18);
}

.add-child-link-manage-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.add-child-link-manage-panel[hidden] {
    display: none;
}

.add-child-link-manage-heading {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary, #e5e7eb);
}

.add-child-link-manage-actions {
    margin-top: 0;
}

.add-child-link-result-actions {
    flex-wrap: wrap;
}

.add-child-link-library--inline {
    position: relative;
    margin-top: 8px;
    max-width: 100%;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.66);
}

.add-child-link-table {
    min-width: 760px;
}

.add-child-link-table-link {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.add-child-link-table-access,
.add-child-link-table-date {
    color: #d7e5f7;
    font-size: 0.73rem;
    font-weight: 600;
}

.add-child-link-table-empty-row td,
.add-child-link-table-add-row td {
    padding: 10px 0 0;
    border: none;
    background: transparent;
}

.add-child-link-add-row-btn {
    width: 100%;
    padding: 10px 12px;
    border: 1px dashed rgba(96, 165, 250, 0.3);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    color: #dbeafe;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.add-child-link-add-row-btn:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(96, 165, 250, 0.44);
    transform: translateY(-1px);
}

.add-child-link-manage-panel--compact {
    gap: 12px;
}

.add-child-link-manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.add-child-link-manage-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.54);
}

.add-child-link-manage-stat span {
    color: var(--text-muted, #94a3b8);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-child-link-manage-stat strong {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.3;
}

.add-child-link-create-popup-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    animation: add-child-link-modal-fade-in 0.18s ease;
}

.add-child-link-create-popup {
    width: min(420px, 100%);
    padding: 16px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.44);
    animation: add-child-link-modal-slide-up 0.22s ease;
}

.add-child-link-create-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.add-child-link-create-popup-kicker {
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.add-child-link-create-popup-title {
    margin-top: 4px;
    color: #f8fafc;
    font-size: 0.96rem;
    font-weight: 700;
}

.add-child-link-create-popup-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.add-child-link-create-popup-copy {
    margin-top: 10px;
    color: var(--text-secondary, #cbd5e1);
    font-size: 0.76rem;
    line-height: 1.45;
}

.add-child-link-create-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.add-child-link-option--compact {
    padding: 10px;
    border-radius: 10px;
}

.add-child-link-create-popup-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

@media (max-width: 760px) {
    .add-child-link-table,
    .add-child-link-table thead,
    .add-child-link-table tbody,
    .add-child-link-table th,
    .add-child-link-table td,
    .add-child-link-table tr {
        display: block;
        min-width: 0;
    }

    .add-child-link-table {
        min-width: 0;
    }

    .add-child-link-table thead {
        display: none;
    }

    .add-child-link-table-row,
    .add-child-link-table-meta-row td {
        border: 1px solid rgba(111, 145, 185, 0.16);
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.42);
    }

    .add-child-link-table-row {
        margin-bottom: 8px;
        padding: 4px 0;
    }

    .add-child-link-table-row td {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 10px;
        border: none;
        background: transparent;
    }

    .add-child-link-table-row td::before {
        content: attr(data-label);
        flex: 0 0 92px;
        color: var(--text-muted, #94a3b8);
        font-size: 0.66rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .add-child-link-table-meta-row {
        margin-top: -4px;
        margin-bottom: 8px;
    }

    .add-child-link-table-meta-row td {
        display: block;
        padding: 10px;
    }

    .add-child-link-inline-cell {
        flex: 1 1 auto;
        max-width: none;
    }

    .add-child-link-inline-snippet {
        max-width: none;
    }

    .add-child-link-inline-copy {
        min-width: 48px;
    }

    .add-child-link-settings-trigger {
        width: 34px;
        min-width: 34px;
    }
}

@media (max-width: 760px) {
    .add-child-link-table-link {
        width: 100%;
    }

    .add-child-link-table-add-row td,
    .add-child-link-table-empty-row td {
        padding: 8px 0 0;
    }

    .add-child-link-manage-grid {
        grid-template-columns: 1fr 1fr;
    }

    .add-child-link-create-popup-overlay {
        padding: 12px;
    }
}

.admin-tab-content--pending {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-tab-pending {
    position: relative;
    overflow: hidden;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.82), rgba(30, 41, 59, 0.7)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px);
}

.admin-tab-pending-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--admin-accent-color, #60a5fa);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-tab-pending-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in srgb, var(--admin-accent-color, #60a5fa) 26%, rgba(255, 255, 255, 0.14));
    border-top-color: var(--admin-accent-color, #60a5fa);
    border-radius: 999px;
    box-shadow: 0 0 12px color-mix(in srgb, var(--admin-accent-color, #60a5fa) 38%, transparent);
    animation: admin-tab-pending-spin 0.8s linear infinite;
}

.admin-tab-pending-title {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.86rem;
    font-weight: 700;
}

.admin-tab-pending-body {
    margin-top: 6px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.78rem;
    line-height: 1.45;
}

.admin-tab-pending-progress {
    position: relative;
    height: 3px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
}

.admin-tab-pending-progress span {
    position: absolute;
    inset-block: 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--admin-accent-color, #60a5fa) 82%, #ffffff),
        transparent
    );
    animation: admin-tab-pending-sweep 1.45s ease-in-out infinite;
}

@keyframes admin-tab-pending-spin {
    to { transform: rotate(360deg); }
}

@keyframes admin-tab-pending-sweep {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(280%); }
}

@media (prefers-reduced-motion: reduce) {
    .admin-tab-pending-spinner,
    .admin-tab-pending-progress span {
        animation: none;
    }

    .admin-tab-pending-progress span {
        transform: none;
        width: 100%;
    }
}

/* ==============================================
   Move Grandchild Section
   ============================================== */

.move-grandchild-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-grandchild-board--pending {
    cursor: wait;
}

.move-grandchild-intro {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 12px;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 42%),
        rgba(15, 23, 42, 0.72);
    color: var(--text-secondary, #9ca3af);
    font-size: 0.78rem;
    line-height: 1.45;
}

.move-grandchild-intro-kicker {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.move-grandchild-branch-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.move-grandchild-branch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.move-grandchild-branch:hover,
.move-grandchild-branch--active {
    border-color: rgba(56, 189, 248, 0.65);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(34, 197, 94, 0.08));
    color: var(--text-primary, #e5e7eb);
}

.move-grandchild-branch--active {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18), 0 10px 24px rgba(8, 47, 73, 0.22);
}

.move-grandchild-branch--drop-target {
    transform: translateY(-1px) scale(1.02);
    border-color: rgba(34, 197, 94, 0.86);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16), 0 12px 28px rgba(20, 83, 45, 0.28);
}

.move-grandchild-branch-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.move-grandchild-branch-count {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #dbeafe;
    font-size: 0.68rem;
    font-weight: 800;
    text-align: center;
}

.move-grandchild-panels {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.72), rgba(2, 6, 23, 0.5)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px);
    padding: 12px;
}

.move-grandchild-panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-primary, #e5e7eb);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.move-grandchild-panel-hint {
    color: var(--text-muted, #6b7280);
    font-size: 0.7rem;
    font-weight: 500;
}

.move-grandchild-pile {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 54px;
}

.move-grandchild-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 9px 8px 12px;
    border: 1px solid rgba(99, 102, 241, 0.42);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(20, 184, 166, 0.12));
    color: var(--text-primary, #e5e7eb);
    cursor: grab;
    font: inherit;
    font-size: 0.8rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
    transition: transform 0.16s ease, opacity 0.16s ease, border-color 0.16s ease;
}

.move-grandchild-pill:hover {
    border-color: rgba(125, 211, 252, 0.72);
    transform: translateY(-1px);
}

.move-grandchild-pill--dragging {
    opacity: 0.48;
    cursor: grabbing;
}

.move-grandchild-pill--moving {
    opacity: 0.62;
    pointer-events: none;
}

.move-grandchild-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.move-grandchild-pill-handle {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.34);
    color: #bae6fd;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.move-grandchild-empty {
    width: 100%;
    padding: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.26);
    border-radius: 12px;
    color: var(--text-muted, #6b7280);
    font-size: 0.78rem;
    font-style: italic;
    text-align: center;
}

.move-grandchild-empty--hidden {
    display: none;
}

.move-grandchild-status {
    min-height: 1.2em;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.move-grandchild-status--pending,
.move-grandchild-status--info {
    color: #7dd3fc;
}

.move-grandchild-status--success {
    color: var(--success-color, #10b981);
}

.move-grandchild-status--error {
    color: var(--error-color, #ef4444);
}

@media (max-width: 640px) {
    .move-grandchild-panel-heading,
    .move-grandchild-intro {
        flex-direction: column;
    }

    .move-grandchild-branch,
    .move-grandchild-pill {
        width: 100%;
        justify-content: space-between;
    }
}

/* ==============================================
   Delete Child Section
   ============================================== */

.delete-child-section {
    margin-top: 8px;
}

.delete-child-toggle {
    color: var(--error-color, #ef4444);
}

.delete-child-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm, 4px);
    margin-bottom: 10px;
}

.delete-child-warning-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.delete-child-warning-text {
    font-size: 0.75rem;
    color: var(--text-secondary, #9ca3af);
    line-height: 1.4;
}

.delete-child-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.delete-child-empty {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    font-style: italic;
    padding: 8px 0;
}

.delete-child-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm, 4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.delete-child-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.delete-child-item-name {
    font-size: 0.8125rem;
    color: var(--text-primary, #e5e7eb);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-child-item-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-sm, 4px);
    color: var(--error-color, #ef4444);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 28px;
}

.delete-child-item-btn:hover:not(:disabled) {
    background: var(--error-color, #ef4444);
    color: #fff;
}

.delete-child-item-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.delete-child-unavailable {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.delete-child-unavailable-icon {
    font-size: 1.25rem;
}

.delete-child-unavailable-text {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
}

/* Status messages */
.delete-child-status {
    font-size: 0.75rem;
    padding: 4px 0;
    min-height: 1.2em;
}

.delete-child-status--pending {
    color: var(--text-muted, #6b7280);
}

.delete-child-status--success {
    color: var(--success-color, #10b981);
}

.delete-child-status--error {
    color: var(--error-color, #ef4444);
}

/* Checkbox selection UI */
.delete-child-row-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-child-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--error-color, #ef4444);
    cursor: pointer;
    flex-shrink: 0;
}

.delete-child-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    margin-bottom: 8px;
}

.delete-child-select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--error-color, #ef4444);
    cursor: pointer;
}

.delete-child-select-all-label {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
}

.delete-child-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.delete-child-btn--danger {
    background: var(--error-color, #ef4444);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: opacity 0.15s;
}

.delete-child-btn--danger:hover:not(:disabled) {
    opacity: 0.85;
}

.delete-child-btn--danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==============================================
   Descendant Meter
   ============================================== */

.descendant-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 420px;
}

.descendant-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.descendant-label {
    width: 64px;
    font-size: 0.75rem;
    color: var(--text-secondary, #9ca3af);
    flex-shrink: 0;
}

.descendant-bar-container {
    width: 100px;
    flex-shrink: 0;
    height: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
}

.descendant-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color, #6366f1), var(--accent-color-light, #818cf8));
    border-radius: var(--radius-sm, 4px);
    transition: width 0.3s ease;
    min-width: 2px;
}

.descendant-count {
    width: 48px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #e5e7eb);
}

.descendant-capacity {
    font-weight: 400;
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
}

.descendant-row--total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.descendant-row--total .descendant-label {
    font-weight: 600;
    color: var(--text-primary, #e5e7eb);
}

.descendant-empty {
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
    font-style: italic;
}

.descendant-limit-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.descendant-limit-input {
    width: 48px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color, #2a3a5c);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary, #e5e7eb);
    font-size: 0.75rem;
    text-align: center;
    /* Hide default spinners */
    -moz-appearance: textfield;
}

.descendant-limit-input::-webkit-outer-spin-button,
.descendant-limit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.descendant-limit-input::placeholder {
    color: var(--text-muted, #6b7280);
    opacity: 0.7;
}

.descendant-limit-input:focus {
    border-color: var(--accent-color, #6366f1);
    outline: none;
    background: rgba(0, 0, 0, 0.45);
}

.descendant-limit-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.descendant-limit-input--invalid {
    border-color: var(--error-color, #ef4444) !important;
    background: rgba(239, 68, 68, 0.15);
}

.descendant-limit-max {
    font-size: 0.625rem;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
}

.descendant-limit-btn {
    padding: 4px 10px;
    background: var(--accent-color, #6366f1);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 4px);
    font-size: 0.75rem;
    cursor: pointer;
}

.descendant-limit-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.descendant-limit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.descendant-limit-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 8px;
}

.descendant-limit-status {
    font-size: 0.75rem;
}

.descendant-limit-status--success {
    color: var(--success-color, #10b981);
}

.descendant-limit-status--error {
    color: var(--error-color, #ef4444);
}

/* Tabs for Self / Children meters */
.descendant-meter-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.descendant-meter-tab {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.descendant-meter-tab:hover {
    color: var(--text-primary, #e5e7eb);
}

.descendant-meter-tab--active {
    color: var(--accent-color, #6366f1);
    border-bottom-color: var(--accent-color, #6366f1);
}

/* Panes */
.descendant-meter-pane {
    display: none;
}

.descendant-meter-pane--active {
    display: block;
}

.descendant-meter-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 8px 0;
    font-style: italic;
}

.descendant-meter-hint--empty {
    text-align: center;
    padding: 16px 0;
    color: var(--text-secondary, #9ca3af);
}

.descendant-meter-hint--error {
    color: var(--error-color, #ef4444);
}

.descendant-meter-hint strong {
    color: var(--text-primary, #e5e7eb);
    font-style: normal;
}

/* Child entity selector */
.descendant-child-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.descendant-child-selector label {
    font-size: 0.8125rem;
    color: var(--text-secondary, #9ca3af);
    white-space: nowrap;
}

.descendant-child-select {
    flex: 1;
    max-width: 240px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color, #2a3a5c);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary, #e5e7eb);
    font-size: 0.8125rem;
    cursor: pointer;
}

.descendant-child-select:focus {
    border-color: var(--accent-color, #6366f1);
    outline: none;
}

.descendant-child-meter-container {
    min-height: 60px;
}

/* ==============================================
   Calendar Picker (Date/Time)
   ============================================== */

.calendar-picker {
    display: flex;
    gap: 4px;
    align-items: center;
    position: relative;
    flex-wrap: wrap;
}

.calendar-picker .calendar-display {
    flex: 1 1 auto;
    min-width: 100px;
    max-width: 160px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--accent-color);
    font-size: 0.7rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: inherit;
}

.calendar-picker .calendar-display.calendar-display--am {
    color: var(--success-color, #22c55e);
    border-color: rgba(34, 197, 94, 0.55);
}

.calendar-picker .calendar-display.calendar-display--pm {
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.55);
}

.calendar-picker .calendar-display:hover {
    border-color: var(--success-color);
}

.calendar-picker .calendar-display::placeholder {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.calendar-now-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.625rem;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}

.calendar-now-btn:hover {
    opacity: 0.85;
}

.calendar-clear-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 5px 7px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.6875rem;
    transition: all 0.15s;
    flex-shrink: 0;
}

.calendar-clear-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/* Calendar Popup */
.calendar-popup {
    position: fixed;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    padding: 12px;
    min-width: 340px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 4px;
}

.calendar-header .cal-month-year {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
    font-size: 0.875rem;
}

.calendar-header .cal-nav {
    background: rgba(0, 0, 0, 0.25);
    border: none;
    color: var(--text-secondary);
    min-width: 54px;
    padding: 4px 7px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
    transition: all 0.15s;
}

.calendar-header .cal-nav:hover {
    background: var(--accent-color);
    color: white;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-days .cal-day {
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.calendar-days .cal-day:not(.empty):hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.calendar-days .cal-day.empty {
    cursor: default;
}

.calendar-days .cal-day.today {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.calendar-days .cal-day.selected {
    background: var(--accent-color);
    color: white;
    font-weight: 600;
}

.calendar-time {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.calendar-time label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 2px;
}

.cal-quarter-hint {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    position: absolute;
    left: calc(100% - 8px);
    bottom: 0;
    padding: 0 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-muted);
    font-size: 0.48rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(28%);
}

.cal-time-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cal-time-spinner input {
    width: 42px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 2px;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: default;
    margin: 1px 0;
}

.cal-spin-up,
.cal-spin-down {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    padding: 4px 12px;
    min-height: 24px;
    min-width: 32px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.cal-spin-up:hover,
.cal-spin-down:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.06);
}

.cal-spin-up-fast {
    position: relative;
    overflow: visible;
    font-size: 0.66rem;
    letter-spacing: -1px;
    opacity: 0.9;
}

.cal-spin-down-fast {
    position: relative;
    overflow: visible;
    font-size: 0.66rem;
    letter-spacing: -1px;
    opacity: 0.9;
}

.cal-spin-up-spacer {
    visibility: hidden;
    pointer-events: none;
}

.cal-spin-down-spacer {
    visibility: hidden;
    pointer-events: none;
}

.cal-colon {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    align-self: center;
    margin-top: 2px;
}

.cal-ampm-btn {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    align-self: center;
    margin-top: 2px;
}

.cal-ampm-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.cal-clock-switch {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    align-self: center;
    margin-top: 2px;
    margin-left: auto;
}

.cal-switch-opt {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 3px 7px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.cal-switch-opt + .cal-switch-opt {
    border-left: 1px solid var(--border-color);
}

.cal-switch-opt.active {
    background: var(--accent-color);
    color: #fff;
    cursor: default;
}

.cal-switch-opt:not(.active):hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.calendar-time input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.calendar-time span {
    color: var(--text-muted);
    font-weight: 600;
}

.calendar-time.calendar-time--am .cal-time-spinner input,
.calendar-time.calendar-time--am .cal-colon,
.calendar-time.calendar-time--am .cal-ampm-btn,
.calendar-time.calendar-time--am .cal-spin-up,
.calendar-time.calendar-time--am .cal-spin-down {
    color: var(--success-color, #22c55e);
}

.calendar-time.calendar-time--am .cal-time-spinner input,
.calendar-time.calendar-time--am .cal-ampm-btn {
    border-color: rgba(34, 197, 94, 0.45);
}

.calendar-time.calendar-time--pm .cal-time-spinner input,
.calendar-time.calendar-time--pm .cal-colon,
.calendar-time.calendar-time--pm .cal-ampm-btn,
.calendar-time.calendar-time--pm .cal-spin-up,
.calendar-time.calendar-time--pm .cal-spin-down {
    color: #a855f7;
}

.calendar-time.calendar-time--pm .cal-time-spinner input,
.calendar-time.calendar-time--pm .cal-ampm-btn {
    border-color: rgba(168, 85, 247, 0.45);
}

.calendar-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.calendar-actions button {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s;
    font-family: inherit;
}

.calendar-actions .cal-now-btn {
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
    margin-right: auto;
}

.calendar-actions .cal-now-btn:hover {
    background: var(--accent-color);
    color: white;
}

.calendar-actions .cal-ok-btn {
    background: var(--success-color);
    color: #fff;
}

.calendar-actions .cal-ok-btn:hover {
    filter: brightness(1.1);
}

.cal-preview {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 4px 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    font-style: italic;
    min-height: 1.2em;
}

.cal-preview.has-value {
    color: var(--accent-color);
    font-style: normal;
    font-weight: 500;
}

/* ==============================================
   Stat Query Context Container
   ============================================== */

/* Collapsible wrapper for Stat Query Context */
.stat-context-collapsible {
    margin-top: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
}

/* Remove top margin when inside admin console */
.admin-console-section .stat-context-collapsible {
    margin-top: 0;
}

.stat-context-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.stat-context-toggle::-webkit-details-marker {
    display: none;
}

.stat-context-toggle::before {
    content: '▶';
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.stat-context-collapsible[open] .stat-context-toggle::before {
    transform: rotate(90deg);
}

.stat-context-toggle .toggle-hint {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.7;
}

.stat-context-collapsible[open] .stat-context-toggle .toggle-hint {
    display: none;
}

.stat-context-collapsible .stat-context-container {
    margin-bottom: 0;
    border: none;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.stat-context-container {
    background: linear-gradient(135deg, var(--bg-accent) 0%, var(--panel-bg) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.stat-context-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-context-current {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-ctx-entity-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-ctx-entity-type {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(74, 158, 255, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: lowercase;
}

.stat-context-directive {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--text-muted);
}

.stat-context-directive.active {
    border-left-color: var(--success-color);
    background: rgba(166, 227, 161, 0.1);
}

.stat-context-directive.inactive {
    opacity: 0.6;
}

.stat-ctx-directive-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 60px;
}

.stat-ctx-directive-text {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-style: italic;
}

.stat-context-directive.active .stat-ctx-directive-text {
    color: var(--success-color);
    font-style: normal;
    font-weight: 500;
}

.stat-ctx-directive-note {
    width: 100%;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}

.stat-context-directive {
    flex-wrap: wrap;
}

.stat-context-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-context-field {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.stat-context-field.has-value {
    background: rgba(74, 158, 255, 0.1);
    border-left: 3px solid var(--accent-color);
}

/* Parent entities in path - more subdued */
.stat-context-field.is-parent {
    background: rgba(0, 0, 0, 0.15);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

/* Current entity - highlighted */
.stat-context-field.is-current {
    background: rgba(74, 158, 255, 0.15);
    border-left: 3px solid var(--accent-color);
}

.stat-context-field.is-current .stat-ctx-value {
    font-weight: 600;
    color: var(--accent-color);
}

.stat-ctx-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-ctx-subsection {
    margin-left: 8px;
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.15);
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-ctx-subsection:empty {
    display: none;
}

.stat-ctx-child-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-ctx-child-list {
    list-style: disc;
    margin: 0;
    padding-left: 16px;
}

.stat-ctx-child-item {
    padding: 3px 0;
    color: var(--text-primary);
    font-size: 0.75rem;
    display: list-item;
}

.stat-ctx-child-item > .stat-ctx-child-name {
    font-weight: 500;
}

.stat-ctx-child-item.selected {
    color: var(--accent-color);
    font-weight: 600;
}

.stat-ctx-child-item.selected::marker {
    color: var(--accent-color);
}

/* Level-specific styling for indentation */
.stat-ctx-level-0 {
    margin-left: 0;
}

.stat-ctx-level-1 {
    margin-left: 0;
}

.stat-ctx-level-1 .stat-ctx-child-item {
    font-size: 0.7rem;
}

.stat-ctx-level-2 {
    margin-left: 0;
}

.stat-ctx-level-2 .stat-ctx-child-item {
    font-size: 0.68rem;
}

.stat-ctx-level-3 {
    margin-left: 0;
}

.stat-ctx-level-3 .stat-ctx-child-item {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.stat-ctx-level-4 {
    margin-left: 0;
}

.stat-ctx-level-4 .stat-ctx-child-item {
    font-size: 0.62rem;
    color: var(--text-muted);
}

/* Entity type colors in tree - bullet markers */
.stat-ctx-child-item[data-type="season"]::marker {
    color: #4a9eff;
}

.stat-ctx-child-item[data-type="division"]::marker {
    color: #f9c74f;
}

.stat-ctx-child-item[data-type="team"]::marker {
    color: #90be6d;
}

.stat-ctx-child-item[data-type="player"]::marker {
    color: #f94144;
}

.stat-ctx-child-empty {
    font-size: 0.7rem;
    font-style: italic;
    color: var(--text-muted);
}

.stat-ctx-icon {
    font-size: 0.875rem;
    min-width: 20px;
    text-align: center;
}

.stat-ctx-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 60px;
}

.stat-ctx-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.stat-ctx-value:empty::after,
.stat-ctx-value:contains('—')::after {
    content: '—';
    color: var(--text-muted);
}

.stat-context-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-style: italic;
}

.stat-context-hint.ready {
    color: var(--success-color);
    font-style: normal;
}

.stat-context-hint.full {
    color: var(--accent-color);
    font-weight: 500;
}

/* --- Stat Table Draft Section --- */
.stat-table-draft-container {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.stat-table-draft-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

/* --- Details Section Container (unified style for Players, Events, Facilities) --- */
.details-section-container {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.details-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-section-title .section-title-icon {
    font-size: 1rem;
}

.details-section-title .section-count {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--bg-accent);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Remove margin from nested containers inside details-section */
.details-section-container .data-table-container,
.details-section-container .compact-card-list {
    margin-bottom: 0;
}

.stat-group {
    margin-bottom: 16px;
}

.stat-group:last-child {
    margin-bottom: 0;
}

.stat-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-empty {
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 0.9rem;
    margin: 0;
    padding: 8px 0;
}

/* ==============================================
   Skeleton Loading Placeholders
   ============================================== */

@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

.skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}

.skeleton-line--full { width: 100%; }
.skeleton-line--long { width: 80%; }
.skeleton-line--medium { width: 55%; margin-top: 8px; }
.skeleton-line--short { width: 35%; margin-top: 8px; }

/* Left panel: child list skeleton items */
.skeleton-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
}

.skeleton-icon {
    width: var(--entity-card-icon-size, 24px);
    height: var(--entity-card-icon-size, 24px);
    border-radius: 6px;
    flex-shrink: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}

.skeleton-item .skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-item .skeleton-line--long { width: 70%; }
.skeleton-item .skeleton-line--short { width: 40%; margin-top: 0; }

/* Right panel: details body skeleton */
.skeleton-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-details-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}

.skeleton-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 8px;
    animation: skeleton-shimmer 1.4s ease infinite;
    background: linear-gradient(90deg, var(--text-muted) 25%, rgba(255,255,255,0.3) 50%, var(--text-muted) 75%);
    background-size: 400px 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Panel inline loading card (used when fetching details/attributes).
   Mirrors the Entity Admin loading card (.admin-tab-pending) so the two panels feel consistent. */
.panel-loading {
    position: relative;
    overflow: hidden;
    margin: 14px 0;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.82), rgba(30, 41, 59, 0.7)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px);
}

.panel-loading-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--accent-color, #60a5fa);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in srgb, var(--accent-color, #60a5fa) 26%, rgba(255, 255, 255, 0.14));
    border-top-color: var(--accent-color, #60a5fa);
    border-radius: 999px;
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent-color, #60a5fa) 38%, transparent);
    animation: skeleton-shimmer-spin 0.8s linear infinite;
}

.panel-loading-title {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.86rem;
    font-weight: 700;
}

.panel-loading-text,
.panel-loading-body {
    margin-top: 6px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.78rem;
    line-height: 1.45;
    font-style: normal;
}

.panel-loading-progress {
    position: relative;
    height: 3px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
}

.panel-loading-progress span {
    position: absolute;
    inset-block: 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--accent-color, #60a5fa) 82%, #ffffff),
        transparent
    );
    animation: panel-loading-sweep 1.45s ease-in-out infinite;
}

@keyframes skeleton-shimmer-spin {
    to { transform: rotate(360deg); }
}

@keyframes panel-loading-sweep {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(280%); }
}

@media (prefers-reduced-motion: reduce) {
    .panel-loading-spinner,
    .panel-loading-progress span {
        animation: none;
    }

    .panel-loading-progress span {
        transform: none;
        width: 100%;
    }
}

/* Panel fatal-error card — shown in place of a stuck/infinite loading spinner. */
.panel-error {
    position: relative;
    overflow: hidden;
    margin: 14px 0;
    padding: 14px 16px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(40, 14, 18, 0.82), rgba(60, 20, 26, 0.7)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px);
}

.panel-error-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #f87171;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.82rem;
}

.panel-error-title {
    color: var(--text-primary, #e5e7eb);
    font-size: 0.86rem;
    font-weight: 700;
}

.panel-error-body {
    margin-top: 6px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.78rem;
    line-height: 1.45;
    word-break: break-word;
}

.panel-error-retry {
    margin-top: 14px;
    padding: 7px 14px;
    border: 1px solid rgba(248, 113, 113, 0.5);
    border-radius: 8px;
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.panel-error-retry:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.7);
}

/* ==============================================
   View Mode Toggle (Global View checkbox) — above scope tabs
   ============================================== */

.admin-view-mode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.admin-view-mode-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
}

.admin-view-mode-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #818cf8;
    cursor: pointer;
}

.admin-view-mode-checkbox-text {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.admin-view-mode-checkbox-label:hover .admin-view-mode-checkbox-text {
    opacity: 1;
}

.admin-layout-debug-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}

.admin-layout-debug-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #38bdf8;
    cursor: pointer;
}

.admin-layout-debug-checkbox-text {
    opacity: 0.82;
    transition: opacity 0.15s ease;
}

.admin-layout-debug-checkbox-label:hover .admin-layout-debug-checkbox-text {
    opacity: 1;
}

.admin-section-preview-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

.admin-section-preview-switch-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 4px;
}

.admin-section-preview-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.admin-section-preview-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.admin-section-preview-btn--active {
    background: rgba(74, 158, 255, 0.18);
    color: #9ed0ff;
    box-shadow: inset 0 0 0 1px rgba(74, 158, 255, 0.28);
}

/* Local View RSP: preserve tri-toggle visual language while staying read-only */
.admin-view-perspective--rsp .admin-scope-pane .layout-toggle-tri-row-input.layout-toggle-rsp-target-policy-mode {
    pointer-events: none;
    opacity: 0.85;
}

.admin-view-perspective--rsp .admin-scope-pane .layout-toggle-tri-row-input.layout-toggle-rsp-target-policy-mode.layout-toggle-rsp-target-policy-inherited {
    opacity: 0.55;
}

.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .im-lock-btn,
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .im-lock-btn {
    pointer-events: none;
    opacity: 0.4;
}

.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .dlv1-slot-module-shell .im-lock-btn:not(:disabled),
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .dlv1-slot-module-shell .im-lock-btn:not(:disabled) {
    pointer-events: auto;
    opacity: 1;
}

.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .layout-reorder-arrows,
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .layout-reorder-arrows {
    pointer-events: none;
    opacity: 0.3;
}

.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .layout-reset-btn,
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .layout-reset-btn {
    display: none;
}

/* Local View: make chat visible toggle read-only in descendant panes */
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .chat-visible-checkbox,
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .chat-visible-checkbox {
    pointer-events: none;
    opacity: 0.5;
}

/* Local View: hide resolution badges showing descendant custom/local overrides */
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="children"] .resolution-badge--self,
.admin-view-perspective--rsp .admin-scope-pane[data-scope-pane="descendants"] .resolution-badge--self {
    display: none;
}

.admin-local-view-hint {
    font-size: 0.75rem;
    color: #818cf8;
    font-style: italic;
    margin: 0 0 8px 0;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid rgba(99, 102, 241, 0.3);
    display: none;
}

.admin-view-mode--local .admin-scope-pane[data-scope-pane="children"] .admin-local-view-hint,
.admin-view-mode--local .admin-scope-pane[data-scope-pane="descendants"] .admin-local-view-hint {
    display: block;
}

/* RSP ACTIVE banner (shown in Local View when entity !== sim account) */
.admin-local-view-banner {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-left: 4px solid #818cf8;
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-local-view-banner-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-local-view-banner-data {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-local-view-banner-raw-row {
    display: flex;
    gap: 8px;
}

.admin-local-view-banner-raw {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.625rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    word-break: break-all;
    padding: 5px 8px;
    border-radius: 4px;
}

.admin-local-view-banner-raw--entity {
    color: #67e8f9;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.admin-local-view-banner-raw--account {
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.admin-local-view-banner-logic {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid;
}

.admin-local-view-banner-logic--match {
    color: #86efac;
    background: rgba(34, 197, 94, 0.1);
    border-left-color: #22c55e;
}

.admin-local-view-banner-logic--mismatch {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.admin-local-view-banner-icon {
    font-size: 1.1rem;
}

.admin-local-view-banner-sub {
    font-weight: 400;
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0.7;
    margin-left: auto;
}

.admin-local-view-banner-entity,
.admin-local-view-banner-account {
    font-weight: 400;
    font-size: 0.6875rem;
    text-transform: none;
    letter-spacing: normal;
    color: #c4b5fd;
    background: rgba(99, 102, 241, 0.12);
    padding: 1px 8px;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Wrapper border accent when Local View is active */
.admin-view-mode--local {
    border-left: 3px solid #818cf8 !important;
}

/* Local View debug resolution text (next to tri-toggles) */
.local-view-debug {
    display: none;
    font-size: 0.625rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: #c4b5fd;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 3px;
    padding: 2px 6px;
    margin-top: 3px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.admin-view-mode--local .local-view-debug {
    display: block;
}

.layout-toggle-debug {
    display: none;
    margin-top: 4px;
    font-size: 0.61rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.12);
    border: 1px dashed rgba(56, 189, 248, 0.45);
    border-radius: 4px;
    padding: 3px 6px;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    max-width: 240px;
}

.admin-layout-toggle-debug--on .layout-toggle-debug {
    display: block;
}

.admin-layout-toggle-debug--on .layout-toggle-tri-row {
    outline: 1px dashed rgba(56, 189, 248, 0.4);
    outline-offset: 3px;
    border-radius: 6px;
}

.admin-layout-toggle-debug--on .im-lock-btn {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.admin-layout-toggle-debug--on .rsp-target-policy-caption-grid {
    outline: 1px dashed rgba(245, 158, 11, 0.35);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ──────────────────────────────────────────────────────────────
   Display Layout v1 — Admin tab section
   ────────────────────────────────────────────────────────────── */
.display-layout-v1-section > .admin-config-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 12px 16px;
}

.dlv1-empty {
    color: #64748b;
    font-style: italic;
    font-size: 0.68rem;
}

/* Group — mirrors .layout-section-group */
.dlv1-group {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(75, 85, 99, 0.4);
    border-radius: 6px;
    background: rgba(31, 41, 55, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* Override .layout-section-group's overflow so info popovers in the
   group header are not clipped. Horizontal scrolling for the wide
   table happens on the inner .dlv1-table-scroll wrapper instead. */
.dlv1-group.layout-section-group {
    overflow: visible;
}

.dlv1-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Info popovers in the group header sit at the left side of the group;
   open them to the right so they don't overflow into prior content. */
.dlv1-group-header .dlv1-inline-info-panel,
.layout-group-header .dlv1-inline-info-panel {
    left: 0;
    right: auto;
}

/* Last row's cell info popup would be clipped by the table scroll
   wrapper; open it upward so it stays visible. */
.dlv1-table tbody tr:last-child .dlv1-inline-info-panel {
    top: auto;
    bottom: calc(100% + 6px);
}

.dlv1-group:last-of-type {
    margin-bottom: 8px;
}

.dlv1-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.dlv1-group-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.dlv1-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.dlv1-group-scope {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.36);
    font-size: 0.6rem;
    color: #94a3b8;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.inline-info-popover {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.inline-info-popover--floating {
    z-index: 10000;
}

.catalog-pane-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 8px;
}

.catalog-pane-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.02em;
}

.catalog-inline-info-btn,
.dlv1-inline-info-btn,
.admin-toggle-inline-info-btn {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.35);
    background: rgba(147, 197, 253, 0.12);
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.catalog-inline-info-btn::-webkit-details-marker,
.dlv1-inline-info-btn::-webkit-details-marker,
.admin-toggle-inline-info-btn::-webkit-details-marker {
    display: none;
}

.catalog-inline-info-btn:hover,
.dlv1-inline-info-btn:hover,
.admin-toggle-inline-info-btn:hover {
    background: rgba(147, 197, 253, 0.2);
    border-color: rgba(147, 197, 253, 0.5);
}

.catalog-inline-info-panel,
.dlv1-inline-info-panel,
.admin-toggle-inline-info-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 6;
    min-width: 240px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(147, 197, 253, 0.18);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.inline-info-popover--floating .catalog-inline-info-panel,
.inline-info-popover--floating .dlv1-inline-info-panel,
.inline-info-popover--floating .admin-toggle-inline-info-panel {
    z-index: 10000;
}

.inline-info-popover--syntax .dlv1-inline-info-panel {
    width: max-content;
    min-width: 360px;
    max-width: min(620px, calc(100vw - 32px));
}

.inline-info-popover--compact .dlv1-inline-info-panel {
    min-width: 220px;
    max-width: min(300px, calc(100vw - 32px));
    padding: 8px 10px;
}

.inline-info-popover--compact .dlv1-inline-info-panel-title {
    margin-bottom: 4px;
    font-size: 0.68rem;
}

.inline-info-popover--compact .dlv1-inline-info-panel-copy {
    display: none;
}

.catalog-inline-info-panel-title,
.dlv1-inline-info-panel-title,
.admin-toggle-inline-info-panel-title {
    margin-bottom: 8px;
    color: #dbeafe;
    font-weight: 700;
}

.catalog-inline-info-panel-copy,
.dlv1-inline-info-panel-copy,
.admin-toggle-inline-info-panel-copy {
    margin-bottom: 8px;
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.72);
}

.catalog-inline-info-panel-meta,
.dlv1-inline-info-panel-meta,
.admin-toggle-inline-info-panel-meta {
    margin-top: 4px;
    font-size: 0.66rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.6);
}

.inline-info-meta--syntax {
    padding: 6px 0;
    border-top: 1px solid rgba(147, 197, 253, 0.10);
}

.inline-info-popover--compact .inline-info-meta--syntax {
    padding: 3px 0;
}

.inline-info-meta--syntax:first-of-type {
    border-top: 0;
}

.inline-info-meta--syntax > strong {
    display: block;
    margin-bottom: 4px;
    color: rgba(219, 234, 254, 0.88);
    font-size: 0.64rem;
    letter-spacing: 0.02em;
}

.inline-info-popover--compact .inline-info-meta--syntax > strong {
    margin-bottom: 2px;
    font-size: 0.58rem;
}

.inline-info-meta-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-weight: 600;
    opacity: 0.85;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.inline-info-meta-heading-label {
    flex: 0 0 auto;
}

.inline-info-meta-heading--hoverable {
    cursor: help;
    border-bottom: 1px dotted rgba(147, 197, 253, 0.45);
    align-self: flex-start;
    padding-bottom: 1px;
}

.inline-info-meta-heading--hoverable:hover .inline-info-meta-heading-label {
    color: #dbeafe;
}

.inline-info-meta--hoverable {
    cursor: help;
}

.inline-info-meta--hoverable > strong {
    border-bottom: 1px dotted rgba(147, 197, 253, 0.45);
}

.inline-info-meta--hoverable:hover > strong {
    color: #dbeafe;
}

.inline-info-popover-more {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(147, 197, 253, 0.10);
}

.inline-info-popover-more > summary {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border: 1px solid rgba(147, 197, 253, 0.22);
    border-radius: 4px;
    background: rgba(147, 197, 253, 0.10);
    color: #bfdbfe;
    font-size: 0.62rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.inline-info-popover-more > summary::-webkit-details-marker {
    display: none;
}

.inline-info-popover-more > summary:hover {
    border-color: rgba(147, 197, 253, 0.42);
    background: rgba(147, 197, 253, 0.18);
}

.inline-info-popover-more-body {
    max-height: min(220px, 45vh);
    margin-top: 6px;
    overflow-y: auto;
    padding-right: 3px;
}

.inline-info-syntax {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.66rem;
    line-height: 1.35;
}

.inline-info-syntax-token {
    display: inline-flex;
    align-items: baseline;
    max-width: 100%;
    min-width: 0;
    padding: 2px 5px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.62);
    color: rgba(226, 232, 240, 0.86);
    overflow-wrap: anywhere;
}

.inline-info-syntax-token--pair {
    gap: 2px;
}

.inline-info-syntax-key {
    color: #93c5fd;
    font-weight: 700;
}

.inline-info-syntax-sep {
    color: rgba(148, 163, 184, 0.75);
}

.inline-info-syntax-value {
    color: rgba(226, 232, 240, 0.88);
    min-width: 0;
    overflow-wrap: anywhere;
}

.inline-info-syntax-value--number { color: #fbbf24; }
.inline-info-syntax-value--bool { color: #f0abfc; }
.inline-info-syntax-value--write,
.inline-info-syntax-value--ok { color: #86efac; }
.inline-info-syntax-value--read { color: #bfdbfe; }
.inline-info-syntax-value--warn { color: #fca5a5; }
.inline-info-syntax-value--muted { color: #94a3b8; font-style: italic; }
.inline-info-syntax-token--empty { color: #94a3b8; font-style: italic; }

/* Table — mirrors .layout-table */
.dlv1-table.layout-table,
.dlv1-table {
    --dlv1-slot-width: 220px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 0.72rem;
    border-radius: 0;
    overflow: visible;
}

.dlv1-table th {
    text-align: left;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted, #9ca3af);
    font-weight: 600;
    font-size: 0.66rem;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color, #2a3a5c);
    vertical-align: bottom;
    white-space: nowrap;
}

.dlv1-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.dlv1-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Column widths */
.dlv1-th-order { width: 52px; }
.dlv1-th-label { width: 340px; min-width: 340px; white-space: nowrap; }
.dlv1-th-expanded { width: 50%; }
.dlv1-th-visible  { width: 50%; }
.dlv1-th-toggles { width: auto; }

.dlv1-th-order,
.dlv1-th-label {
    text-align: left;
}

.dlv1-th-expanded,
.dlv1-th-visible,
.dlv1-th-toggles {
    text-align: right;
}

.dlv1-toggles-head {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, var(--dlv1-slot-width)));
    justify-content: end;
    column-gap: 24px;
}

.dlv1-toggles-head-label {
    text-align: center;
    min-width: 0;
}

.dlv1-toggles-cell {
    text-align: right;
    vertical-align: middle;
    padding-left: 12px;
    padding-right: 12px;
}

.dlv1-toggles-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, var(--dlv1-slot-width)));
    justify-content: end;
    align-items: flex-start;
    column-gap: 24px;
}

.dlv1-toggles-row .dlv1-module-cell {
    padding-left: 0;
    padding-right: 0;
    min-width: 0;
}

/* Inline order number now lives inside the section label cell */
.dlv1-order-inline {
    display: inline-block;
    width: 28px;
    margin-right: 0;
    color: var(--text-muted, #9ca3af);
    text-align: left;
    font-variant-numeric: tabular-nums;
    flex: 0 0 28px;
}

/* # column — mirrors .layout-order */
.dlv1-order {
    text-align: left;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 12px;
}

/* Section label — mirrors .layout-label */
.dlv1-label {
    color: var(--text-primary, #e2e8f0);
    line-height: 1.32;
    text-align: left !important;
    padding-left: 12px;
    padding-right: 12px;
    vertical-align: top;
}

.dlv1-label > .dlv1-order-inline {
    vertical-align: top;
    margin-right: 8px;
}

.dlv1-label > .dlv1-section-name,
.dlv1-label > .dlv1-key-inline {
    vertical-align: top;
}

.dlv1-section-name {
    display: inline-block;
    width: auto;
    font-weight: 500;
    color: var(--text-primary, #e2e8f0);
    text-align: left;
}

.dlv1-key-inline {
    display: inline-block;
    font-size: 0.58rem;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 2px;
    margin-left: 0;
}

.dlv1-scope-description {
    margin-bottom: 10px;
}

.dlv1-module-cell {
    vertical-align: top;
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
}

.dlv1-module-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 46px;
    justify-content: flex-start;
    align-items: center;
    width: min(100%, 260px);
    margin-left: auto;
    margin-right: auto;
    padding: 1px 0 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dlv1-module-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-height: 16px;
    width: 100%;
}

.dlv1-module-card-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.dlv1-module-card-info {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0;
    width: 100%;
}

.dlv1-module-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(30, 41, 59, 0.72);
    color: #cbd5e1;
}

.dlv1-module-empty {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 42px;
    padding: 4px 6px;
    border: 1px dashed rgba(71, 85, 105, 0.28);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.24);
    font-size: 0.58rem;
    color: #94a3b8;
    font-style: italic;
}

/* Slot cell — empty widget placeholder */
.dlv1-slot-cell {
    text-align: center;
    vertical-align: top;
    padding-left: 6px;
    padding-right: 6px;
}

.dlv1-slot-box {
    border: 1px solid rgba(71, 85, 105, 0.42);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(20, 29, 46, 0.88) 0%, rgba(15, 23, 42, 0.78) 100%);
    min-height: 52px;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.dlv1-slot-scope {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px 5px;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    line-height: 1.2;
    width: 100%;
}

.dlv1-slot-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(30, 41, 59, 0.9);
    white-space: nowrap;
}

.dlv1-slot-type {
    font-size: 0.56rem;
    color: #94a3b8;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    line-height: 1.2;
    text-align: left;
}

.dlv1-slot-box--module {
    max-width: 100%;
    width: 100%;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
}

.dlv1-slot-stage {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 6px;
}

.dlv1-slot-stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.dlv1-slot-stage-label {
    font-size: 0.54rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.dlv1-slot-mask-unavailable {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.18);
    color: #cbd5e1;
}

.dlv1-slot-mask-unavailable-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dlv1-slot-mask-unavailable-label {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #e2e8f0;
}

.dlv1-slot-mask-unavailable-copy {
    font-size: 0.62rem;
    line-height: 1.45;
    color: #94a3b8;
}

.dlv1-slot-lock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #fecaca;
    font-size: 0.46rem;
    line-height: 1;
    white-space: nowrap;
}

.dlv1-slot-lock-indicator-icon {
    font-size: 0.54rem;
}

.dlv1-slot-lock-indicator-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dlv1-slot-module-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ----------------------------------------------------------------------
 * Ratio-locked slot rendering
 * --------------------------------------------------------------------
 * When data-scale-locked="1" is set, the module is rendered at its
 * declared designed pixel size inside a .dlv1-slot-module-scaler. The
 * slot itself adopts the module's aspect-ratio (so vertical space is
 * reserved correctly) and uses JS-authored CSS variables to derive a
 * uniform scale that fits the available width but never exceeds 1.
 *
 * The module is the source of truth for its proportions (designedWidth /
 * designedHeight set in its config). The mount path can refine those
 * dimensions after render so late font/layout drift still preserves the
 * proportional fit contract.
 * --------------------------------------------------------------------*/
.dlv1-slot-module-shell[data-scale-locked="1"] {
    aspect-ratio: var(--dlv1-designed-width) / var(--dlv1-designed-height);
    overflow: hidden;
    /* The scaler is a fixed-size layout box (designedWidth × designedHeight)
       that we shrink visually with transform: scale(). transform does NOT
       resize the layout box, so the shell's flex centering would push the
       oversized box outside the shell and overflow:hidden would clip both
       sides — the exact symptom of captions being sliced. Anchor the
       scaler to the shell's top-left so the scale origin lines up with
       the visible box. */
    justify-content: flex-start;
    align-items: flex-start;
}

.dlv1-slot-module-shell[data-scale-locked="1"]:not([data-scale-ready="1"]) {
    visibility: hidden;
}

.dlv1-slot-module-scaler {
    width: calc(var(--dlv1-designed-width) * 1px);
    height: calc(var(--dlv1-designed-height) * 1px);
    transform-origin: top left;
    transform: translateX(var(--dlv1-scale-offset-x, 0px)) scale(var(--dlv1-scale-factor, 1));
    flex: 0 0 auto;
}

.dlv1-slot-module-shell[data-scale-locked="1"] .input-module-widget {
    margin: 0;
}

.dlv1-slot-module-shell .im-c-module-embedded {
    width: auto;
    margin: 0 auto;
}

.dlv1-slot-module-shell[data-dlv1-secmask-loading="true"] {
    opacity: 0.66;
    pointer-events: none;
    cursor: progress;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded-body {
    gap: 3px;
    padding: 0;
    width: auto;
    align-items: center;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-inner-slot {
    width: auto;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-tri-row {
    gap: 2px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-tri-row-input {
    width: 44px;
    height: 16px;
    border-radius: 8px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-tri-row-input::-webkit-slider-thumb {
    width: 14px;
    height: 12px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-tri-row-input::-moz-range-thumb {
    width: 14px;
    height: 12px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-tri-row-caption {
    margin-top: 0;
    font-size: 0.55rem;
    line-height: 1.3;
    text-align: center;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-widget {
    width: auto;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-dot {
    width: 6px;
    height: 6px;
    top: 5px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-dot--left {
    left: calc(50% - 18px);
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-dot--right {
    left: calc(50% + 12px);
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-caption-col {
    gap: 2px;
    padding: 0 5px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-caption-label,
.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-caption-banner {
    font-size: 0.55rem;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-rsp-radio {
    width: 5px;
    height: 5px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-c-module-embedded .im-lock-row {
    gap: 1px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-lock-btn {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border-width: 1px;
}

.dlv1-slot-module-shell:not([data-scale-locked="1"]) .im-lock-btn .im-lock-icon {
    font-size: 0.68rem;
}

.dlv1-slot-module-shell .im-lock-choice-popover {
    top: 50%;
    width: 86px;
    min-width: 0;
    justify-content: space-between;
    gap: 0;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
    transform-origin: 50% 50%;
    transform: translate(-50%, -50%) scale(0.96);
}

.dlv1-slot-module-shell .im-lock-choice-popover::before {
    content: '';
    position: absolute;
    left: 19px;
    right: 19px;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.18), rgba(251, 191, 36, 0.2));
    opacity: 0;
    transform: translateY(-50%) scaleX(0.7);
    transform-origin: 50% 50%;
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.dlv1-slot-module-shell .im-lock-choice-popover.is-open {
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1);
}

.dlv1-slot-module-shell .im-lock-choice-popover.is-open::before {
    opacity: 1;
    transform: translateY(-50%) scaleX(1);
}

.dlv1-slot-module-shell .im-lock-choice-option {
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    gap: 0;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
}

.dlv1-slot-module-shell .im-lock-choice-option:first-child {
    min-width: 25px;
    transform: translateX(-2px);
}

.dlv1-slot-module-shell .im-lock-choice-option--reset {
    min-width: 25px;
    transform: translateX(2px);
}

.dlv1-slot-module-shell .im-lock-choice-icon {
    font-size: 0.66rem;
}

.dlv1-slot-module-shell .im-lock-choice-label {
    display: none;
}

.dlv1-slot-module-shell--table {
    width: 100%;
    max-width: 100%;
}

.dlv1-slot-module-shell--table .im-c-module-embedded,
.dlv1-slot-module-shell--table .im-c-module-embedded-body,
.dlv1-slot-module-shell--table .im-inner-slot,
.dlv1-slot-module-shell--table .im-rsp-widget {
    max-width: 100%;
}

.dlv1-module-card .dlv1-slot-lock-indicator {
    margin-left: auto;
}

.dlv1-module-card-info .dlv1-inline-info-btn {
    width: 13px;
    height: 13px;
    font-size: 0.54rem;
}

.dlv1-slot-harness {
    margin-top: 2px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 6px;
    text-align: left;
}

.dlv1-slot-harness-title {
    font-size: 0.54rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #cbd5e1;
}

.dlv1-slot-harness-subtitle {
    margin-top: 2px;
    font-size: 0.54rem;
    color: #64748b;
}

.dlv1-slot-harness-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}

.dlv1-slot-harness-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.52);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.dlv1-slot-harness-path-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.dlv1-slot-harness-path {
    font-size: 0.54rem;
    color: #bfdbfe;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dlv1-slot-harness-value {
    flex-shrink: 0;
    font-size: 0.54rem;
    color: #94a3b8;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    white-space: nowrap;
}

/* Individual field — block, one per line */
.dlv1-field {
    display: grid;
    grid-template-columns: 56px max-content minmax(40px, 1fr);
    align-items: start;
    gap: 4px 8px;
    line-height: 1.32;
    margin-bottom: 4px;
    padding: 1px 0;
}

.dlv1-field-key {
    color: #94a3b8;
    white-space: nowrap;
    width: fit-content;
    font-size: 0.56rem;
}

.dlv1-field-key::after {
    content: ':';
}

.dlv1-field-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 8ch;
    width: 100%;
    justify-self: end;
}

.dlv1-field-origin {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.dlv1-field-origin > .dlv1-origin-popover {
    width: 100%;
}

.dlv1-field-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.44rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: relative;
}

.dlv1-field-badge--db-ref {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.28);
}

.dlv1-field-badge--db-in {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.28);
}

.dlv1-field-badge--staged-in {
    background: rgba(190, 24, 93, 0.14);
    color: #f9a8d4;
    border: 1px solid rgba(244, 114, 182, 0.26);
}

.dlv1-field-badge--db-out {
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
    border: 1px solid rgba(52, 211, 153, 0.24);
}

.dlv1-field-badge--calculated {
    background: rgba(245, 158, 11, 0.14);
    color: #fdba74;
    border: 1px solid rgba(251, 191, 36, 0.24);
}

.dlv1-field-badge--ui,
.dlv1-field-badge--ui-in {
    background: rgba(14, 165, 233, 0.12);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.24);
}

.dlv1-field-badge--ui-out {
    background: rgba(8, 145, 178, 0.14);
    color: #a5f3fc;
    border: 1px solid rgba(34, 211, 238, 0.24);
}

.dlv1-field-badge--step {
    background: rgba(71, 85, 105, 0.28);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.dlv1-field-badge--outline-1 {
    box-shadow:
        0 0 0 1px var(--dlv1-child-outline-1);
}

.dlv1-field-badge--outline-2 {
    box-shadow:
        0 0 0 1px var(--dlv1-child-outline-1),
        0 0 0 2px var(--panel-bg, #0f172a),
        0 0 0 3px var(--dlv1-child-outline-2);
}

.dlv1-field-badge--outline-3 {
    box-shadow:
        0 0 0 1px var(--dlv1-child-outline-1),
        0 0 0 2px var(--panel-bg, #0f172a),
        0 0 0 3px var(--dlv1-child-outline-2),
        0 0 0 4px var(--panel-bg, #0f172a),
        0 0 0 5px var(--dlv1-child-outline-3);
}

.dlv1-field-badge--outline-4 {
    box-shadow:
        0 0 0 1px var(--dlv1-child-outline-1),
        0 0 0 2px var(--panel-bg, #0f172a),
        0 0 0 3px var(--dlv1-child-outline-2),
        0 0 0 4px var(--panel-bg, #0f172a),
        0 0 0 5px var(--dlv1-child-outline-3),
        0 0 0 6px var(--panel-bg, #0f172a),
        0 0 0 7px var(--dlv1-child-outline-4);
}

.dlv1-field-source {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.56rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dlv1-field--db-ref .dlv1-field-source {
    border-color: rgba(96, 165, 250, 0.24);
    color: #bfdbfe;
}

.dlv1-field--db-in .dlv1-field-source {
    border-color: rgba(96, 165, 250, 0.24);
    color: #bfdbfe;
}

.dlv1-field--staged-in .dlv1-field-source {
    border-color: rgba(244, 114, 182, 0.24);
    color: #fbcfe8;
}

.dlv1-field--db-out .dlv1-field-source {
    border-color: rgba(52, 211, 153, 0.22);
    color: #bbf7d0;
}

.dlv1-field--calculated .dlv1-field-source {
    border-color: rgba(251, 191, 36, 0.2);
    color: #fde68a;
}

.dlv1-field--ui .dlv1-field-source,
.dlv1-field--ui-in .dlv1-field-source {
    border-color: rgba(56, 189, 248, 0.22);
    color: #bae6fd;
}

.dlv1-field--ui-out .dlv1-field-source {
    border-color: rgba(34, 211, 238, 0.22);
    color: #cffafe;
}

.dlv1-field-val {
    display: inline-flex;
    color: inherit;
    font-weight: 500;
    padding-left: 2px;
    min-width: 100%;
    white-space: nowrap;
    text-align: right;
    justify-content: flex-end;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-size: 0.58rem;
}

.dlv1-field--db-ref .dlv1-field-val {
    color: #dbeafe;
}

.dlv1-field--db-in .dlv1-field-val {
    color: #dbeafe;
}

.dlv1-field--staged-in .dlv1-field-val {
    color: #fce7f3;
}

.dlv1-field--db-out .dlv1-field-val {
    color: #dcfce7;
}

.dlv1-field--calculated .dlv1-field-val {
    color: #fed7aa;
}

.dlv1-field--ui .dlv1-field-val,
.dlv1-field--ui-in .dlv1-field-val {
    color: #cffafe;
}

.dlv1-field--ui-out .dlv1-field-val {
    color: #ecfeff;
}

.dlv1-toggle-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 3px;
    margin-bottom: 2px;
    padding-bottom: 1px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}

/* Toggle sub-header (expanded / visible) when both in one row */
.dlv1-toggle-label {
    font-size: 0.56rem;
    font-weight: 600;
    color: #7dd3fc;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dlv1-toggle-label-row:first-child {
    margin-top: 0;
}

.dlv1-supporting-fields {
    margin-top: 4px;
    padding-top: 3px;
    border-top: 1px dashed rgba(148, 163, 184, 0.14);
}

.dlv1-supporting-fields-summary {
    cursor: pointer;
    list-style: none;
    color: #94a3b8;
    font-size: 0.48rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    user-select: none;
}

.dlv1-supporting-fields-summary::-webkit-details-marker {
    display: none;
}

.dlv1-supporting-fields-summary::before {
    content: '+';
    display: inline-block;
    margin-right: 6px;
    color: #64748b;
}

.dlv1-supporting-fields[open] > .dlv1-supporting-fields-summary::before {
    content: '-';
}

.dlv1-supporting-fields-body {
    margin-top: 4px;
}

.dlv1-origin-popover {
    position: relative;
    flex-shrink: 0;
}

.dlv1-origin-tag {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.dlv1-origin-tag::-webkit-details-marker {
    display: none;
}

.dlv1-origin-popover--stack {
    width: 100%;
}

.dlv1-origin-popover--stack > .dlv1-origin-tag {
    display: block;
    width: 100%;
}

.dlv1-origin-popover--stack > .dlv1-origin-tag > .dlv1-field-badge {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding: 1px 4px;
}

.dlv1-origin-popover--chip {
    align-self: flex-start;
}

.dlv1-origin-tag--step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(30, 41, 59, 0.7);
    color: #e2e8f0;
    font-size: 0.54rem;
    line-height: 1;
}

.dlv1-origin-tag-label {
    color: inherit;
}

.dlv1-origin-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 10;
    min-width: 240px;
    max-width: 340px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(96, 165, 250, 0.2);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.52);
}

.dlv1-origin-popover[open] > .dlv1-origin-tag > .dlv1-field-badge {
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.16);
}

.dlv1-origin-popover[open] > .dlv1-origin-tag--step {
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.16);
}

.dlv1-info-title {
    margin-bottom: 8px;
    font-size: 0.58rem;
    font-weight: 700;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dlv1-info-group + .dlv1-info-group {
    margin-top: 8px;
}

.dlv1-info-group-title {
    margin-bottom: 5px;
    font-size: 0.54rem;
    font-weight: 700;
    color: #7dd3fc;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dlv1-info-chip-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dlv1-calc-summary {
    margin-bottom: 8px;
    color: #cbd5e1;
    font-size: 0.58rem;
    line-height: 1.5;
}

.dlv1-calc-summary--detail {
    color: #94a3b8;
}

.dlv1-calc-block {
    margin-top: 10px;
}

.dlv1-dep-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.dlv1-dep-note {
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.54rem;
}

.dlv1-dep-note--algorithm {
    margin-top: 0;
}

.dlv1-algorithm-details {
    margin-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 8px;
}

.dlv1-algorithm-summary {
    cursor: pointer;
    list-style: none;
    color: #93c5fd;
    font-size: 0.54rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    user-select: none;
}

.dlv1-algorithm-summary::-webkit-details-marker {
    display: none;
}

.dlv1-algorithm-summary::before {
    content: '+';
    display: inline-block;
    margin-right: 6px;
    color: #64748b;
}

.dlv1-algorithm-details[open] > .dlv1-algorithm-summary::before {
    content: '-';
}

.dlv1-algorithm-body {
    margin-top: 8px;
}

.dlv1-ref-chip {
    display: inline-flex;
    align-items: flex-start;
}

.dlv1-ref-chip--dependency {
    display: inline-flex;
}

.dlv1-ref-chip--db-ref {
    color: inherit;
}

.dlv1-ref-chip--db-in {
    color: inherit;
}

.dlv1-ref-chip--staged-in {
    color: inherit;
}

.dlv1-ref-chip--db-out {
    color: inherit;
}

.dlv1-ref-chip--calculated {
    color: inherit;
}

.dlv1-ref-chip--ui,
.dlv1-ref-chip--ui-in {
    color: inherit;
}

.dlv1-ref-chip--ui-out {
    color: inherit;
}

.dlv1-ref-chip--static {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.dlv1-ref-chip--static.dlv1-ref-chip--db-ref {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(30, 58, 138, 0.14);
}

.dlv1-ref-chip--static.dlv1-ref-chip--db-in {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(30, 58, 138, 0.14);
}

.dlv1-ref-chip--static.dlv1-ref-chip--staged-in {
    border-color: rgba(244, 114, 182, 0.24);
    background: rgba(131, 24, 67, 0.16);
}

.dlv1-ref-chip--static.dlv1-ref-chip--db-out {
    border-color: rgba(52, 211, 153, 0.22);
    background: rgba(20, 83, 45, 0.16);
}

.dlv1-ref-chip--static.dlv1-ref-chip--calculated {
    border-color: rgba(251, 191, 36, 0.18);
    background: rgba(120, 53, 15, 0.16);
}

.dlv1-ref-chip--static.dlv1-ref-chip--ui,
.dlv1-ref-chip--static.dlv1-ref-chip--ui-in {
    border-color: rgba(56, 189, 248, 0.2);
    background: rgba(8, 47, 73, 0.18);
}

.dlv1-ref-chip--static.dlv1-ref-chip--ui-out {
    border-color: rgba(34, 211, 238, 0.2);
    background: rgba(8, 51, 68, 0.2);
}

.dlv1-ref-chip--static .dlv1-field-source {
    flex: 1;
}

.dlv1-ref-chip-info {
    position: relative;
    flex-shrink: 0;
}

.dlv1-ref-chip-info-btn {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.68);
    color: #93c5fd;
    font-size: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

.dlv1-ref-chip-info-btn::-webkit-details-marker {
    display: none;
}

.dlv1-ref-chip-info-btn:hover {
    border-color: rgba(147, 197, 253, 0.36);
    background: rgba(30, 64, 175, 0.18);
}

.dlv1-ref-chip-info[open] .dlv1-ref-chip-info-btn {
    border-color: rgba(147, 197, 253, 0.42);
    background: rgba(30, 64, 175, 0.22);
}

.dlv1-ref-chip-info-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 11;
    min-width: 210px;
    max-width: 280px;
    padding: 8px 9px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.5);
}

.dlv1-ref-chip-info-panel .dlv1-calc-summary:last-child {
    margin-bottom: 0;
}

/* ──────────────────────────────────────────────────────────────
   RSP Inherited-Side Dot
   Indicates the inheritedSide (the side currently in effect via
   inheritance) inside the bi-toggle when the admin has an explicit
   authored selection (targetPolicySelection).
   Blue (#3b82f6) = informational / reference / secondary metadata.
   Must not compete with the primary authored selection.
   ────────────────────────────────────────────────────────────── */
.rsp-inherited-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    opacity: 0.6;
    pointer-events: none;
    z-index: 2;
    /* Vertically centered within the 18px tall input track: (18 - 6) / 2 = 6 */
    top: 6px;
    transition: opacity 0.2s ease;
}

/* Left side = inheritedSide is left (collapsed / hidden)
   Input is 44px wide, centered in flex parent. Left edge of input = 50% - 22px.
   Dot inset 4px from input's left edge: 50% - 22px + 4px = 50% - 18px */
.rsp-inherited-dot--left {
    left: calc(50% - 18px);
}

/* Right side = inheritedSide is right (expanded / visible)
   Right edge of input = 50% + 22px. Dot 6px wide, inset 4px: 50% + 22px - 6px - 4px = 50% + 12px */
.rsp-inherited-dot--right {
    left: calc(50% + 12px);
}

/* Local View RSP: 3-column caption grid with radio beneath each label.
   Replaces the plain-text caption; each column centers label + radio. */
.rsp-target-policy-caption-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
    margin-top: 2px;
}

.rsp-target-policy-context-note {
    grid-column: 1 / -1;
    margin-top: 3px;
    text-align: center;
    font-size: 0.54rem;
    color: #93c5fd;
    opacity: 0.85;
}

.rsp-target-policy-caption-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

.rsp-target-policy-caption-label {
    font-size: 0.55rem;
    color: #6b7280;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0;
    pointer-events: none;
}

/* Reset the row-level info button styling when we clone it inline into the
   RSP inherit label; otherwise the base flex-end alignment can pull it down. */
.rsp-target-policy-caption-label .layout-inherit-info-btn {
    display: inline-flex !important;
    align-self: center;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    padding: 0;
    margin: 0;
    font-size: inherit;
    line-height: 1;
    vertical-align: middle;
}

.rsp-target-policy-radio {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    border: 1px solid rgba(125, 211, 252, 0.5);
    background: transparent;
    flex-shrink: 0;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rsp-target-policy-caption-col:hover .rsp-target-policy-radio,
.rsp-target-policy-radio:hover {
    transform: scale(2);
    box-shadow: 0 0 3px rgba(125, 211, 252, 0.4);
}

.rsp-target-policy-radio--active {
    background: #7dd3fc;
    border-color: #7dd3fc;
}

.rsp-target-policy-radio--staged {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
    border-color: #f59e0b;
}

.rsp-target-policy-radio--error {
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
    border-color: #ef4444;
    background: #ef4444;
}

/* ==============================================
   Task 10: Admin Scope Sub-Tabs (Self / Children)
   ============================================== */

.admin-scope-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.admin-scope-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    letter-spacing: 0.02em;
}

.admin-scope-tab-label {
    display: block;
    line-height: 1.15;
}

.admin-scope-tab-coord {
    display: block;
    max-width: 100%;
    color: rgba(203, 213, 225, 0.58);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-scope-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.admin-scope-tab--active {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.admin-scope-tab--active .admin-scope-tab-coord {
    color: rgba(253, 186, 116, 0.92);
}

.admin-scope-pane {
    display: none;
}

.admin-scope-pane--active {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;  /* Reduced gap */
    animation: admin-scope-fadein 0.15s ease;
}

/* Normalize child collapsible margins inside scope panes */
.admin-scope-pane > .admin-config-collapsible,
.admin-scope-pane > .stat-context-collapsible,
.admin-scope-pane > .admin-section-wrapper {
    margin-top: 0;
    margin-bottom: 0;
}

@keyframes admin-scope-fadein {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-scope-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 12px 0 0 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-color);
}

/* ==============================================
   Target Policy Tab Styling
   ============================================== */

.admin-scope-tab--target-policy {
    color: #f59e0b;
    font-size: 0.75rem;
}

.admin-scope-tab--target-policy.admin-scope-tab--active {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.target-policy-container {
    padding: 4px 0;
}

.target-policy-no-descendants {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 12px 0;
}

.target-policy-section {
    margin-bottom: 12px;
}

.target-policy-form {
    padding: 4px 0;
}

.target-policy-form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.target-policy-inline-select {
    padding: 3px 6px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 3px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.6875rem;
    cursor: pointer;
    transition: border-color 0.15s;
    flex: 1 1 0;
    min-width: 70px;
    max-width: 160px;
}

.target-policy-inline-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.target-policy-inline-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.target-policy-inline-select option {
    background: var(--surface-bg, #1e1e2e);
    color: var(--text-primary, #e2e8f0);
}

.target-policy-author-field {
    padding: 3px 6px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    color: var(--text-muted, #64748b);
    font-size: 0.6875rem;
    cursor: default;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.target-policy-rule-author {
    color: var(--text-muted, #64748b);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.target-policy-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.target-policy-add-btn {
    flex: 0 0 auto;
    padding: 3px 10px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.3;
}

.target-policy-add-btn:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
}

.target-policy-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.target-policy-save-status {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.target-policy-save-status--ok {
    color: #4ade80;
}

.target-policy-save-status--err {
    color: #f87171;
}

.target-policy-save-status--warn {
    color: #fbbf24;
}

.target-policy-rule-override,
.target-policy-rule-scope {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.target-policy-rule-override--on {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.target-policy-rule-override--off {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.target-policy-rule-override--inherit {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.target-policy-rule-scope--self {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.target-policy-rule-scope--children {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.target-policy-rule-scope--all-descendants {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

/* ── Target Policy: Applied Target Policies ── */

.target-policy-applied-section {
    border-left: 3px solid rgba(96, 165, 250, 0.3);
}

.target-policy-applied-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: normal;
}

.target-policy-refresh-btn {
    display: inline-block;
    background: none;
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
    transition: all 0.15s;
}

.target-policy-refresh-btn:hover:not(:disabled) {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.5);
}

.target-policy-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.target-policy-applied-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr auto auto auto 1fr;
    gap: 8px;
    padding: 4px 10px 6px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
    margin-bottom: 4px;
}

.target-policy-applied-col-head {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.target-policy-applied-row {
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr auto auto auto 1fr;
    gap: 8px;
    align-items: center;
    padding: 5px 10px;
    background: rgba(96, 165, 250, 0.03);
    border: 1px solid rgba(96, 165, 250, 0.10);
    border-radius: var(--radius-sm, 4px);
    font-size: 0.78rem;
    margin-bottom: 3px;
}

.target-policy-applied-row:hover {
    background: rgba(96, 165, 250, 0.07);
}

.target-policy-applied-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-policy-applied-source {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.76rem;
}

.target-policy-applied-source-icon {
    color: #60a5fa;
    font-weight: 700;
    margin-right: 2px;
}

.target-policy-applied-config {
    color: var(--text-primary, #e2e8f0);
    font-weight: 500;
}

.target-policy-applied-dimension {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.74rem;
}

.target-policy-authored-target {
    color: #60a5fa;
    font-size: 0.76rem;
    font-weight: 500;
}

.target-policy-authored-author {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-style: italic;
}

.target-policy-applied-source,
.target-policy-authored-target {
    display: flex;
    align-items: center;
}

.target-policy-entity-chip {
    max-width: 100%;
    cursor: default;
}

.target-policy-entity-chip:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.target-policy-entity-chip-icon {
    width: 16px;
    height: 16px;
    font-size: 0.5rem;
}

.target-policy-entity-chip-label {
    max-width: 180px;
}

.target-policy-applied-lane {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.target-policy-applied-toggle code {
    font-size: 0.68rem;
    background: rgba(148, 163, 184, 0.1);
    padding: 1px 5px;
    border-radius: 2px;
    color: var(--text-secondary, #94a3b8);
}

.target-policy-applied-empty {
    padding: 12px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
    text-align: center;
}

.target-policy-applied-footer {
    padding: 6px 10px 2px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    font-style: italic;
}

/* ==============================================
   Target Policy: Descendant Config Matrix
   ============================================== */

.tp-matrix-container {
    margin-bottom: 10px;
}

.tp-matrix-placeholder,
.tp-matrix-loading,
.tp-matrix-error,
.tp-matrix-empty {
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-sm, 4px);
    background: rgba(148, 163, 184, 0.03);
}

.tp-matrix-error {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

.tp-matrix {
    border: 1px solid rgba(96, 165, 250, 0.12);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
}

.tp-matrix-header {
    padding: 6px 10px;
    background: rgba(96, 165, 250, 0.06);
    border-bottom: 1px solid rgba(96, 165, 250, 0.10);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tp-matrix-header-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

/* Per-cell info button */
.tp-matrix-cell-info-btn {
    background: none;
    border: none;
    padding: 0 1px;
    cursor: pointer;
    opacity: 0;
    font-size: 0.58rem;
    color: var(--text-muted, #9ca3af);
    flex-shrink: 0;
    transition: opacity 0.15s;
    margin-left: 2px;
    vertical-align: middle;
}
.tp-matrix-cell--scope:hover .tp-matrix-cell-info-btn {
    opacity: 0.5;
}
.tp-matrix-cell-info-btn:hover {
    opacity: 1 !important;
    color: var(--accent-color, #60a5fa);
}

/* Raw data popup */
.tp-matrix-raw-popup {
    position: absolute;
    z-index: 10000;
    background: var(--card-bg, #1f2937);
    border: 1px solid var(--border-color, #374151);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-width: 320px;
    max-width: 420px;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
}
.tp-matrix-raw-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color, #374151);
    border-radius: 8px 8px 0 0;
}
.tp-matrix-raw-popup-title {
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-color, #f3f4f6);
}
.tp-matrix-raw-popup-close {
    background: none;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 4px;
    opacity: 0.7;
}
.tp-matrix-raw-popup-close:hover {
    opacity: 1;
    color: #ef4444;
}
.tp-matrix-raw-popup-body {
    padding: 8px 10px;
    overflow: auto;
    flex: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--text-secondary, #94a3b8);
    white-space: pre;
    margin: 0;
    tab-size: 2;
}

.tp-matrix-count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.tp-matrix-table {
    max-height: 400px;
    overflow-y: auto;
}

.tp-matrix-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px 80px;
    gap: 6px;
    align-items: center;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.tp-matrix-row:last-child {
    border-bottom: none;
}

.tp-matrix-row--head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(30, 30, 46, 0.95);
    border-bottom: 1px solid rgba(96, 165, 250, 0.10);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 10px;
}

/* SP row — current entity, pinned style */
.tp-matrix-row--sp {
    position: sticky;
    top: 28px;
    z-index: 1;
    background: rgba(96, 165, 250, 0.08);
    border-left: 3px solid rgba(96, 165, 250, 0.5);
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
}

/* RSP rows — descendant entities */

.tp-matrix-row:hover:not(.tp-matrix-row--head) {
    background: rgba(96, 165, 250, 0.04);
}

.tp-matrix-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-matrix-cell--entity {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.tp-matrix-cell--scope {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Text label scope cells */
.tp-scope-label {
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.tp-tri-on {
    color: rgba(74, 222, 128, 0.9);
}

.tp-tri-off {
    color: rgba(248, 113, 113, 0.85);
}

.tp-tri-inherit {
    color: var(--text-muted, #94a3b8);
    opacity: 0.75;
}

.tp-tri-na {
    color: var(--text-muted);
    opacity: 0.4;
}

.tp-matrix-entity-icon {
    flex-shrink: 0;
    font-size: 0.65rem;
    width: 16px;
    text-align: center;
}

.tp-matrix-entity-label {
    font-size: 0.76rem;
    color: var(--text-secondary, #94a3b8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-matrix-entity-id {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Merged row — multiple entities with identical config values */
.tp-matrix-row--merged .tp-matrix-entity-label {
    font-style: italic;
}

.tp-matrix-entity-count {
    flex-shrink: 0;
    font-size: 0.62rem;
    color: rgba(96, 165, 250, 0.7);
    font-weight: 600;
    margin-left: 2px;
}

.tp-matrix-cell-na {
    color: var(--text-muted);
    font-size: 0.72rem;
    opacity: 0.5;
}

/* Section header rows */
.tp-matrix-section {
    margin-bottom: 8px;
}

.tp-matrix-section-header {
    font-size: 0.74rem;
    font-weight: 700;
    color: rgba(96, 165, 250, 0.85);
    padding: 6px 10px 4px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(96, 165, 250, 0.04);
}

/* Group headers */
.tp-matrix-group-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(96, 165, 250, 0.04);
    border-bottom: 1px solid rgba(96, 165, 250, 0.08);
    cursor: pointer;
    user-select: none;
}

.tp-matrix-group-header:hover {
    background: rgba(96, 165, 250, 0.08);
}

.tp-matrix-group-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 12px;
    text-align: center;
    transition: transform 0.15s;
}

.tp-matrix-group-icon {
    font-size: 0.7rem;
    width: 16px;
    text-align: center;
}

.tp-matrix-group-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.tp-matrix-group-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.tp-matrix-group--collapsed .tp-matrix-group-body {
    display: none;
}

/* ==============================================
   Task 10: Inheritance Indicator
   ============================================== */

.inheritance-indicator {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.inheritance-indicator.inheritance-enabled {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.25);
}

.inheritance-indicator.inheritance-disabled {
    background: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.2);
}

.inheritance-indicator-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.inheritance-indicator-icon {
    font-size: 0.875rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.inheritance-enabled .inheritance-indicator-icon {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.inheritance-disabled .inheritance-indicator-icon {
    color: var(--text-muted);
    background: rgba(100, 116, 139, 0.15);
}

.inheritance-indicator-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.inheritance-indicator-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.inheritance-enabled .inheritance-indicator-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.inheritance-disabled .inheritance-indicator-badge {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.inheritance-indicator-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.inheritance-indicator-note {
    font-size: 0.6875rem;
    color: #a78bfa;
    margin: 6px 0 0 0;
    font-style: italic;
}

/* ==============================================
   Disabled Section Placeholders (Children scope)
   ============================================== */

.admin-config-collapsible--disabled {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

.admin-config-toggle--disabled {
    cursor: default;
}

.admin-config-toggle--disabled::before {
    content: '▶';
    opacity: 0.4;
}

.config-context--disabled {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.6875rem;
    margin-left: auto;
    font-style: italic;
}

/* Disabled hierarchy path in Children scope */
.hierarchy-path--disabled {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

/* ==============================================
   TODO Section Placeholders (Planned features)
   ============================================== */

.admin-config-collapsible--todo {
    border-left-color: rgba(234, 179, 8, 0.5);  /* amber accent */
    background: rgba(234, 179, 8, 0.03);
}

.admin-config-toggle--todo {
    color: var(--text-secondary);
}

.admin-todo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(234, 179, 8, 0.15);
    color: #b7930a;
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 4px;
    margin-left: auto;
}

.admin-todo-container {
    padding: 12px 16px;
    background: rgba(234, 179, 8, 0.05);
}

.admin-todo-message {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.admin-change-log-container {
    padding: 12px 16px 16px;
}

.admin-change-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.admin-change-log-toolbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-change-log-scope,
.admin-change-log-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
}

.admin-change-log-refresh {
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 4px;
    background: rgba(125, 211, 252, 0.12);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.admin-change-log-refresh:hover:not(:disabled) {
    background: rgba(125, 211, 252, 0.18);
    border-color: rgba(125, 211, 252, 0.45);
}

.admin-change-log-refresh:disabled {
    cursor: wait;
    opacity: 0.72;
}

.admin-change-log-table-wrap {
    overflow-x: auto;
}

.admin-change-log-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.admin-change-log-table th,
.admin-change-log-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.admin-change-log-table th {
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-change-log-table strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.78rem;
}

.admin-change-log-summary {
    display: block;
    margin-top: 3px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.admin-change-log-details summary {
    cursor: pointer;
    color: var(--accent-color);
}

.admin-change-log-detail-card {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.38);
    overflow: hidden;
}

.admin-change-log-detail-card-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 8px 0;
}

.admin-change-log-copy-btn {
    appearance: none;
    border: 1px solid rgba(125, 211, 252, 0.22);
    background: rgba(59, 130, 246, 0.12);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.admin-change-log-copy-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(125, 211, 252, 0.34);
}

.admin-change-log-copy-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.admin-change-log-detail-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    color: var(--text-secondary);
}

.admin-change-log-transaction {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-change-log-command-card {
    overflow: hidden;
    border: 1px solid rgba(125, 211, 252, 0.25);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.72);
}

.admin-change-log-command-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.13);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.admin-change-log-command-text {
    display: block;
    padding: 9px 10px;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
    line-height: 1.45;
}

.admin-change-log-detail-card-body pre {
    max-width: 100%;
    max-height: 220px;
    overflow: auto;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-change-log-request-line {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.admin-write-outcome-card {
    margin-bottom: 10px;
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(69, 10, 10, 0.18), rgba(15, 23, 42, 0.52));
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.18);
    overflow: hidden;
}

.admin-write-outcome-card--denied {
    border-color: rgba(248, 113, 113, 0.34);
}

.admin-write-outcome-card--rejected {
    border-color: rgba(251, 191, 36, 0.34);
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.16), rgba(15, 23, 42, 0.52));
}

.admin-write-outcome-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 0;
}

.admin-write-outcome-card-copy {
    min-width: 0;
}

.admin-write-outcome-card-title {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.admin-write-outcome-card-summary {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.admin-write-outcome-dismiss {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.42);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.admin-write-outcome-dismiss:hover {
    background: rgba(30, 41, 59, 0.56);
    color: var(--text-primary);
}

.admin-write-outcome-card .admin-change-log-detail-card {
    margin: 8px 12px 12px;
}

.admin-write-pending-card {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 12;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #e0e7ff;
    box-shadow: none;
    cursor: help;
}

.admin-write-pending {
    position: relative;
}

.admin-write-pending-card-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(224, 231, 255, 0.28);
    border-top-color: #c4b5fd;
    border-radius: 999px;
    animation: spin 0.85s linear infinite;
    flex: 0 0 auto;
}

.im-tri-row.admin-write-pending .admin-write-pending-card {
    top: 2px;
    right: auto;
    left: calc(50% + var(--admin-write-pending-toggle-offset, 0px));
    width: 14px;
    height: 14px;
    transform: translateX(-50%);
}

.im-tri-row.admin-write-pending .admin-write-pending-card-spinner {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
}

.im-rsp-radio.admin-write-pending .admin-write-pending-card,
.im-lock-btn.admin-write-pending .admin-write-pending-card {
    top: 50%;
    right: auto;
    left: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
}

.im-rsp-radio.admin-write-pending .admin-write-pending-card {
    width: 10px;
    height: 10px;
}

.im-rsp-radio.admin-write-pending .admin-write-pending-card-spinner {
    width: 8px;
    height: 8px;
    border-width: 1.5px;
}

.im-lock-btn.admin-write-pending .im-lock-icon {
    opacity: 0.28;
}

.admin-write-pending .dlv1-slot-module-shell,
.admin-write-pending .dlv1-module-card {
    opacity: 0.72;
}

.admin-write-outcome-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10020;
    padding: 20px;
}

.admin-write-outcome-modal {
    width: min(900px, 100%);
    max-height: min(88vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid rgba(248, 113, 113, 0.24);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.55);
}

.admin-write-outcome-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.78);
}

.admin-write-outcome-modal-title-wrap {
    min-width: 0;
}

.admin-write-outcome-modal-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fca5a5;
}

.admin-write-outcome-modal-title {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.admin-write-outcome-modal-summary {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.admin-write-outcome-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.admin-write-outcome-modal-close:hover {
    background: rgba(127, 29, 29, 0.72);
    color: #fff;
}

.admin-write-outcome-modal-body {
    padding: 18px 20px 20px;
    overflow: auto;
}

.admin-write-outcome-modal-body .admin-change-log-detail-card {
    margin: 0;
}

.admin-change-log-empty {
    padding: 12px;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.admin-change-log-empty--error {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.35);
}

/* ==============================================
   Section Inheritance (Phase 1 — read-only trace)
   ============================================== */

.admin-section-inheritance-section .admin-config-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-section-inheritance-container {
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(20, 26, 48, 0.7), rgba(20, 26, 48, 0.45));
    border: 1px solid rgba(125, 211, 252, 0.14);
    border-radius: 10px;
}

.admin-section-inheritance-intro {
    margin: 0 0 4px 0;
    font-size: 0.78rem;
    color: var(--text-secondary, #cbd5e1);
    line-height: 1.4;
}

.admin-section-inheritance-intro em {
    color: #bae6fd;
    font-style: normal;
}

.admin-section-inheritance-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 8px 0 4px 0;
    border-bottom: 1px dashed rgba(125, 211, 252, 0.14);
    margin-bottom: 6px;
}

.admin-section-inheritance-picker-label,
.admin-section-inheritance-rowcap-label,
.admin-section-inheritance-zlimit-label {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.admin-section-inheritance-picker,
.admin-section-inheritance-rowcap,
.admin-section-inheritance-zlimit {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(125, 211, 252, 0.3);
    background: rgba(2, 6, 23, 0.6);
    color: #e0f2fe;
    font-size: 0.82rem;
}

.admin-section-inheritance-picker {
    min-width: 220px;
}

.admin-section-inheritance-rowcap {
    min-width: 90px;
    border-color: rgba(125, 211, 252, 0.22);
}

.admin-section-inheritance-zlimit {
    width: 88px;
    border-color: rgba(125, 211, 252, 0.22);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.admin-section-inheritance-table {
    min-height: 60px;
}

.admin-section-inheritance-empty {
    margin: 0;
    padding: 14px 0;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
    font-style: italic;
}

.admin-si-example-grid-wrap {
    overflow: auto;
    border: 1px solid rgba(125, 211, 252, 0.16);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.36);
}

.admin-si-example-grid {
    width: 100%;
    min-width: max(100%, calc(72px + (var(--admin-si-example-target-count, 1) * 276px)));
    border-collapse: separate;
    border-spacing: 0;
    color: #e2e8f0;
    font-size: 0.72rem;
}

.admin-si-example-grid th,
.admin-si-example-grid td {
    border-right: 1px solid rgba(125, 211, 252, 0.12);
    border-bottom: 1px solid rgba(125, 211, 252, 0.12);
    padding: 7px 8px;
    vertical-align: top;
}

.admin-si-example-grid thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(15, 23, 42, 0.96);
    color: #93c5fd;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-si-example-grid thead tr:nth-child(2) th {
    top: 30px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.92);
    color: #bfdbfe;
    font-size: 0.62rem;
}

.admin-si-example-corner,
.admin-si-example-y {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 72px;
    background: rgba(15, 23, 42, 0.96);
    color: #bae6fd;
    text-align: left;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.admin-si-example-y {
    z-index: 1;
    font-weight: 700;
}

.admin-si-example-y span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 0.56rem;
}

.admin-si-example-targethead {
    min-width: 240px;
    border-left: 1px solid rgba(125, 211, 252, 0.18);
}

.admin-si-example-x {
    min-width: 92px;
}

.admin-si-example-cell {
    min-width: 92px;
    background: rgba(15, 23, 42, 0.36);
    text-align: center;
    vertical-align: middle;
}

.admin-si-example-row--z-source .admin-si-example-y,
.admin-si-example-row--z-source .admin-si-example-cell {
    background: rgba(14, 116, 144, 0.18);
}

.admin-si-example-row--z-source .admin-si-example-y {
    color: #67e8f9;
}

.admin-si-example-coordinate {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    line-height: 1.35;
    white-space: nowrap;
}

.admin-si-example-coordinate-part {
    color: var(--si-coordinate-color, #cbd5e1);
    font-weight: 700;
}

.admin-si-example-coordinate-separator {
    color: #64748b;
}

.admin-si-example-target {
    display: block;
    margin-top: 3px;
    color: #e2e8f0;
    font-size: 0.64rem;
    line-height: 1.3;
}

.admin-si-example-transform {
    display: block;
    margin-top: 3px;
    color: #bfdbfe;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.63rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.admin-si-example-secmask {
    display: block;
    margin-top: 3px;
    color: #93c5fd;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.64rem;
    line-height: 1.3;
    white-space: nowrap;
}

.admin-si-example-secmask {
    color: #a7f3d0;
}

.admin-si-summary-counts--wide {
    flex-basis: 100%;
    color: var(--text-muted, #94a3b8);
    font-size: 0.72rem;
}

/* ==============================================
   Mask Matrix
   ============================================== */

.admin-mask-matrix-section .admin-config-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-mask-matrix-container {
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(20, 26, 48, 0.7), rgba(20, 26, 48, 0.45));
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-mask-matrix-section {
    --admin-mask-surface-deep: rgba(15, 23, 42, 0.82);
    --admin-mask-surface-panel: rgba(30, 41, 59, 0.76);
    --admin-mask-surface-soft: rgba(30, 41, 59, 0.58);
    --admin-mask-surface-muted: rgba(51, 65, 85, 0.44);
    --admin-mask-border-soft: rgba(148, 163, 184, 0.16);
    --admin-mask-border-mid: rgba(148, 163, 184, 0.22);
    --admin-mask-inner-grid-shell-bg: rgba(49, 46, 129, 0.16);
    --admin-mask-inner-grid-shell-border: rgba(129, 140, 248, 0.18);
    --admin-mask-inner-grid-shell-shadow: none;
    --admin-mask-inner-grid-panel-bg: rgba(49, 46, 129, 0.12);
    --admin-mask-inner-grid-panel-bg-active: rgba(49, 46, 129, 0.12);
    --admin-mask-inner-grid-panel-border: rgba(129, 140, 248, 0.18);
    --admin-mask-inner-grid-panel-shadow: none;
    --admin-mask-inner-grid-label: #e5e7eb;
    --admin-mask-inner-grid-meta: #cbd5e1;
    --admin-mask-outer-l-row-bg: rgba(59, 130, 246, 0.12);
    --admin-mask-outer-l-col-bg: rgba(59, 130, 246, 0.10);
    --admin-mask-outer-l-focus-bg: rgba(191, 219, 254, 0.12);
    --admin-mask-outer-l-border: rgba(125, 211, 252, 0.30);
    --admin-mask-outer-l-focus-border: rgba(191, 219, 254, 0.44);
    --admin-mask-inner-l-row-bg: rgba(129, 140, 248, 0.18);
    --admin-mask-inner-l-col-bg: rgba(129, 140, 248, 0.13);
    --admin-mask-inner-l-focus-bg: rgba(129, 140, 248, 0.24);
    --admin-mask-inner-l-border: rgba(196, 181, 253, 0.36);
    --admin-mask-inner-l-focus-border: rgba(224, 231, 255, 0.52);
}

.admin-mask-matrix-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.admin-mask-matrix-intro {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary, #cbd5e1);
    line-height: 1.45;
    flex: 1;
}

.admin-mask-matrix-intro code {
    color: #e0f2fe;
}

.admin-mask-matrix-debug {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(248, 250, 252, 0.14);
    background: rgba(15, 23, 42, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.admin-mask-matrix-debug-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-mask-matrix-debug-title {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #dbeafe;
}

.admin-mask-matrix-debug-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    background: rgba(20, 83, 45, 0.2);
    color: #dcfce7;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.4;
}

.admin-mask-matrix-debug-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    background: rgba(30, 41, 59, 0.92);
    color: #e0f2fe;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease, opacity 120ms ease;
}

.admin-mask-matrix-debug-copy:hover:not(:disabled) {
    border-color: rgba(125, 211, 252, 0.5);
    background: rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
}

.admin-mask-matrix-debug-copy:disabled {
    opacity: 0.82;
    cursor: default;
}

.admin-mask-matrix-debug-body {
    margin: 0;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.58);
    color: #bfdbfe;
    font-size: 0.74rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.admin-mask-matrix-bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.72);
    color: #dbeafe;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.admin-mask-matrix-bulk-btn:hover {
    border-color: rgba(125, 211, 252, 0.42);
    background: rgba(30, 41, 59, 0.94);
    transform: translateY(-1px);
}

.admin-mask-matrix-bulk-btn-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.admin-mask-matrix-bulk-btn-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.admin-mask-matrix-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-mask-matrix-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--admin-mask-border-soft);
    background: var(--admin-mask-surface-soft);
}

.admin-mask-matrix-chip-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #93c5fd;
}

.admin-mask-matrix-chip-value {
    font-size: 0.76rem;
    color: #f8fafc;
    word-break: break-word;
}

.admin-mask-table-wrap {
    overflow-x: auto;
}

.admin-mask-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 900px;
}

.admin-mask-table th,
.admin-mask-table td {
    padding: 10px 10px;
    border: 1px solid var(--admin-mask-border-soft);
    vertical-align: top;
    transition: none;
}

.admin-mask-table thead th {
    background: var(--admin-mask-surface-deep);
    color: #e2e8f0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
}

.admin-mask-table--boolean thead tr:first-child th:last-child {
    text-align: center;
}

.admin-mask-table--boolean thead tr:nth-child(2) th {
    background: rgba(30, 41, 59, 0.92);
    text-align: center;
}

.admin-mask-table tbody th {
    width: 180px;
    background: var(--admin-mask-surface-panel);
}

.admin-mask-table-host {
    width: 150px;
    font-size: 0.82rem;
    color: #f8fafc;
    vertical-align: middle;
    background: var(--admin-mask-surface-panel);
}

.admin-mask-table-space {
    width: 180px;
    font-size: 0.78rem;
    color: #cbd5e1;
    background: var(--admin-mask-surface-soft);
}

.admin-mask-table-host--aggregate {
    background: var(--admin-mask-surface-panel);
}

.admin-mask-table-space--aggregate {
    background: var(--admin-mask-surface-soft);
}

.admin-mask-table-divider-row th {
    padding: 0;
    border-left-color: var(--admin-mask-border-soft);
    border-right-color: var(--admin-mask-border-soft);
    border-top-color: var(--admin-mask-border-mid);
    border-bottom-color: var(--admin-mask-border-mid);
    background: var(--admin-mask-surface-muted);
}

.admin-mask-table-divider-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    text-align: left;
}

.admin-mask-table-divider-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: #f8fafc;
}

.admin-mask-table-divider-copy {
    font-size: 0.69rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.admin-mask-table-rowhead {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-mask-table-rowtitle {
    font-size: 0.84rem;
    color: #f8fafc;
}

.admin-mask-table-rownote {
    font-size: 0.68rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.admin-mask-table-cell-lead {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    text-align: center;
}

.admin-mask-table-cell-lead--rowhead {
    flex-direction: column;
    gap: 6px;
}

.admin-mask-table-cell-lead--host {
    color: #f8fafc;
}

.admin-mask-table-rownote--drilldown {
    display: block;
    margin-top: 8px;
}

.admin-mask-table-rowperspective {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.36);
    color: #dbe4ee;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.admin-mask-table-coordinate-pattern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 2px 6px;
    border: 1px solid rgba(147, 197, 253, 0.20);
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.42);
    color: #bfdbfe;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.62rem;
    font-weight: 700;
}

.admin-mask-table-scope-constraint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: center;
    gap: 2px;
    padding: 3px 7px;
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: 4px;
    background: rgba(20, 83, 45, 0.22);
    color: #bbf7d0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.62rem;
    font-weight: 700;
}

.admin-mask-table-scope-label {
    color: #86efac;
    font-size: 0.55rem;
    line-height: 1;
    text-transform: lowercase;
}

.admin-mask-table-scope-value {
    color: #bbf7d0;
    line-height: 1.15;
}

.admin-mask-table-coordinate-fact {
    display: block;
    max-width: 28ch;
    color: #cbd5e1;
    font-size: 0.63rem;
    line-height: 1.35;
}

.admin-mask-table-coordinate-fact strong {
    color: #93c5fd;
    font-weight: 700;
}

.admin-mask-table-rownote--perspective {
    max-width: 24ch;
}

.admin-mask-table-rownote--host {
    margin-top: 10px;
    color: #cbd5e1;
}

.admin-mask-inline-subrow-headers {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 8px;
    border-top: 1px dashed var(--admin-mask-inner-grid-panel-border);
    border-radius: 14px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    background: var(--admin-mask-inner-grid-panel-bg);
    box-shadow: var(--admin-mask-inner-grid-panel-shadow);
}

.admin-mask-table tbody tr.admin-mask-table-row--drilldown-open [data-mask-inline-subrow-headers] {
    display: flex;
}

.admin-mask-inline-subrow-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    position: relative;
    min-height: 108px;
    height: 108px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 0;
    background: var(--admin-mask-surface-soft);
    box-shadow: none;
    text-align: center;
    overflow: visible;
}

.admin-mask-inline-subrow-label {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--admin-mask-inner-grid-label);
}

.admin-mask-inline-subrow-meta {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    z-index: 12;
    display: block;
    width: min(220px, calc(100vw - 48px));
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.34);
    font-size: 0.64rem;
    line-height: 1.35;
    color: var(--admin-mask-inner-grid-meta);
    text-align: center;
    transform: translateX(-50%) translateY(-4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.admin-mask-inline-subrow-item:hover .admin-mask-inline-subrow-meta,
.admin-mask-inline-subrow-item:focus-within .admin-mask-inline-subrow-meta {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.admin-mask-table td.admin-mask-table-cell--drilldown {
    cursor: pointer;
    transition: none;
}

.admin-mask-table td.admin-mask-table-cell--drilldown:focus-visible {
    outline: none;
    box-shadow:
        inset 0 0 0 1px rgba(191, 219, 254, 0.52),
        0 0 0 2px rgba(59, 130, 246, 0.14);
}

.admin-mask-table td.admin-mask-table-cell--drilldown-active {
    background-color: transparent;
    box-shadow: none;
    border-color: rgba(148, 163, 184, 0.14);
}

.admin-mask-table td.admin-mask-table-cell--drilldown-active .admin-mask-matrix-cell-number {
    background: rgba(51, 65, 85, 0.42);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

.admin-mask-table td.admin-mask-table-cell--drilldown-row-trail,
.admin-mask-table th.admin-mask-table-cell--drilldown-row-trail,
.admin-mask-table td.admin-mask-table-cell--drilldown-col-trail,
.admin-mask-table th.admin-mask-table-cell--drilldown-col-trail {
    box-shadow: none;
    border-color: rgba(148, 163, 184, 0.14);
}

.admin-mask-table tbody tr.admin-mask-table-row--drilldown-open > th,
.admin-mask-table tbody tr.admin-mask-table-row--drilldown-open > td {
    vertical-align: top;
}

.admin-mask-table tbody tr.admin-mask-table-row--drilldown-open > th.admin-mask-table-space,
.admin-mask-table tbody tr.admin-mask-table-row--drilldown-open > td.admin-mask-table-cell--drilldown {
    padding-left: 4px;
    padding-right: 4px;
}

.admin-mask-matrix-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 72px;
    padding-top: 10px;
    text-align: center;
}

.admin-mask-matrix-cell--drilldown-host {
    align-items: stretch;
    justify-content: flex-start;
}

.admin-mask-matrix-cell-bulk-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.82);
    color: #dbeafe;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.admin-mask-matrix-cell-bulk-btn:hover {
    border-color: rgba(125, 211, 252, 0.42);
    background: rgba(30, 41, 59, 0.96);
    transform: translateY(-1px);
}

.admin-mask-inline-drilldown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 8px;
    border-top: 1px dashed var(--admin-mask-inner-grid-panel-border);
    border-radius: 14px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    background: var(--admin-mask-inner-grid-panel-bg);
    box-shadow: none;
    text-align: left;
    cursor: default;
}

.admin-mask-inline-drilldown[hidden] {
    display: none;
}

.admin-mask-inline-drilldown--active {
    border-top-color: var(--admin-mask-inner-grid-panel-border);
    background: var(--admin-mask-inner-grid-panel-bg);
}

.admin-mask-inline-slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 108px;
    padding: 4px;
    border-radius: 12px;
    border: 0;
    background: var(--admin-mask-surface-panel);
    box-shadow: none;
    cursor: default;
}

.admin-mask-inline-slot--editable {
    cursor: pointer;
}

.admin-mask-inline-slot--editable:focus-visible {
    outline: 2px solid rgba(191, 219, 254, 0.78);
    outline-offset: 2px;
}

.admin-mask-inline-slot-body {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell,
.admin-mask-inline-slot .admin-mask-matrix-read-summary {
    border-width: 0;
    min-height: 100%;
    width: 100%;
    background: transparent;
    box-shadow: none;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-0 {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-1 {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-2 {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-matrix-read-summary--visible {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-matrix-read-summary--hidden {
    border-color: transparent;
    background: transparent;
}

.admin-mask-inline-slot .admin-mask-matrix-cell-number {
    background: rgba(51, 65, 85, 0.42);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    opacity: 0.72;
}

.admin-mask-inline-slot .admin-mask-aggregate-level {
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    font-size: 1.18rem;
    font-weight: 800;
    box-shadow: none;
}

.admin-mask-inline-slot .admin-mask-aggregate-label,
.admin-mask-inline-slot .admin-mask-matrix-read-summary-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.20);
    background: rgba(30, 41, 59, 0.46);
    color: #dbe4ee;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-shadow: none;
    white-space: nowrap;
}

.admin-mask-inline-slot .admin-mask-aggregate-label {
    position: absolute;
    left: 50%;
    bottom: 10px;
    opacity: 0.9;
    transform: translateX(-50%);
}

.admin-mask-inline-slot .admin-mask-matrix-read-summary-label {
    align-self: center;
    opacity: 0.92;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-0 .admin-mask-aggregate-label,
.admin-mask-inline-slot .admin-mask-matrix-read-summary--hidden .admin-mask-matrix-read-summary-label {
    border-color: rgba(148, 163, 184, 0.26);
    background: rgba(71, 85, 105, 0.46);
    color: #e2e8f0;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-1 .admin-mask-aggregate-label {
    border-color: rgba(134, 239, 172, 0.34);
    background: rgba(21, 128, 61, 0.34);
    color: #ecfdf5;
}

.admin-mask-inline-slot .admin-mask-aggregate-cell--level-2 .admin-mask-aggregate-label,
.admin-mask-inline-slot .admin-mask-matrix-read-summary--visible .admin-mask-matrix-read-summary-label {
    border-color: rgba(125, 211, 252, 0.34);
    background: rgba(8, 145, 178, 0.28);
    color: #ecfeff;
}

.admin-mask-inline-subrow-item,
.admin-mask-inline-drilldown .admin-mask-aggregate-cell,
.admin-mask-inline-drilldown .admin-mask-matrix-read-summary {
    transition: none;
}

.admin-mask-inline-drilldown-empty {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.26);
    font-size: 0.72rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.admin-mask-inline-subrow-item.admin-mask-inline-cell--hover-row {
    border-color: var(--admin-mask-inner-l-border);
    box-shadow: inset 0 0 0 999px var(--admin-mask-inner-l-row-bg);
}

.admin-mask-inline-subrow-item.admin-mask-inline-cell--hover-col {
    box-shadow: inset 0 0 0 999px var(--admin-mask-inner-l-col-bg);
    border-color: var(--admin-mask-inner-l-border);
}

.admin-mask-inline-subrow-item.admin-mask-inline-cell--hover-focus {
    box-shadow:
        inset 0 0 0 999px var(--admin-mask-inner-l-focus-bg),
        inset 0 0 0 2px var(--admin-mask-inner-l-focus-border);
    border-color: var(--admin-mask-inner-l-focus-border);
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-row,
.admin-mask-inline-slot.admin-mask-inline-cell--hover-col,
.admin-mask-inline-slot.admin-mask-inline-cell--hover-focus {
    border-radius: 12px;
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-row {
    border-color: var(--admin-mask-inner-l-border);
    box-shadow: inset 0 0 0 999px var(--admin-mask-inner-l-row-bg);
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-col {
    border-color: var(--admin-mask-inner-l-border);
    box-shadow: inset 0 0 0 999px var(--admin-mask-inner-l-col-bg);
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-focus {
    border-color: var(--admin-mask-inner-l-focus-border);
    box-shadow:
        inset 0 0 0 999px var(--admin-mask-inner-l-focus-bg),
        inset 0 0 0 2px var(--admin-mask-inner-l-focus-border);
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-row .admin-mask-aggregate-cell,
.admin-mask-inline-slot.admin-mask-inline-cell--hover-row .admin-mask-matrix-read-summary {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-col .admin-mask-aggregate-cell,
.admin-mask-inline-slot.admin-mask-inline-cell--hover-col .admin-mask-matrix-read-summary {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.admin-mask-inline-slot.admin-mask-inline-cell--hover-focus .admin-mask-aggregate-cell,
.admin-mask-inline-slot.admin-mask-inline-cell--hover-focus .admin-mask-matrix-read-summary {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.admin-mask-inline-slot--editable:hover {
    box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.30);
}

.mask-matrix-editor-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.74);
    backdrop-filter: blur(4px);
}

.mask-matrix-editor-modal {
    width: min(420px, 100%);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.96) 100%);
    box-shadow: 0 26px 60px rgba(2, 6, 23, 0.42);
    color: #e2e8f0;
}

.mask-matrix-editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.mask-matrix-editor-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
}

.mask-matrix-editor-modal-icon {
    font-size: 1.1rem;
}

.mask-matrix-editor-modal-close {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.mask-matrix-editor-modal-close:hover {
    color: #ffffff;
}

.mask-matrix-editor-modal-body {
    padding: 18px 20px;
}

.mask-matrix-editor-modal-copy {
    margin: 0 0 10px;
    color: #dbe4ee;
    font-size: 0.95rem;
    line-height: 1.5;
}

.mask-matrix-editor-modal-note {
    margin: 0 0 14px;
    color: #93c5fd;
    font-size: 0.82rem;
    line-height: 1.45;
}

.mask-matrix-editor-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mask-matrix-bulk-editor-modal {
    width: min(720px, 100%);
}

.mask-matrix-bulk-lane-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mask-matrix-bulk-lane {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.42);
}

.mask-matrix-bulk-lane-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.mask-matrix-bulk-lane-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f8fafc;
}

.mask-matrix-bulk-lane-meta {
    font-size: 0.74rem;
    color: #93c5fd;
}

.mask-matrix-bulk-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 8px;
}

.mask-matrix-bulk-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 82px;
    padding: 10px 8px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.54);
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.mask-matrix-bulk-choice:hover {
    border-color: rgba(125, 211, 252, 0.46);
    background: rgba(30, 41, 59, 0.88);
    transform: translateY(-1px);
}

.mask-matrix-bulk-choice--active {
    border-color: rgba(125, 211, 252, 0.72);
    background: rgba(30, 64, 175, 0.24);
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.38);
}

.mask-matrix-bulk-choice--keep {
    align-items: flex-start;
    text-align: left;
}

.mask-matrix-bulk-choice-value {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
}

.mask-matrix-bulk-choice-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #cbd5e1;
}

.mask-matrix-editor-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    padding: 12px 10px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.54);
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.mask-matrix-editor-choice:hover {
    border-color: rgba(125, 211, 252, 0.46);
    background: rgba(30, 41, 59, 0.88);
    transform: translateY(-1px);
}

.mask-matrix-editor-choice--active {
    border-color: rgba(125, 211, 252, 0.72);
    background: rgba(30, 64, 175, 0.24);
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.38);
}

.mask-matrix-editor-choice-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
}

.mask-matrix-editor-choice-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: #cbd5e1;
}

.mask-matrix-editor-error {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, 0.32);
    background: rgba(127, 29, 29, 0.28);
    color: #fecaca;
    font-size: 0.82rem;
    line-height: 1.4;
}

.mask-matrix-editor-modal-footer {
    padding: 0 20px 20px;
}

.mask-matrix-editor-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.mask-matrix-editor-btn {
    min-width: 96px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.88);
    color: #e2e8f0;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.mask-matrix-editor-btn:hover:not(:disabled) {
    border-color: rgba(125, 211, 252, 0.46);
}

.mask-matrix-editor-btn:disabled {
    opacity: 0.56;
    cursor: wait;
}

.mask-matrix-editor-btn--save {
    border-color: rgba(134, 239, 172, 0.34);
    background: rgba(21, 128, 61, 0.30);
    color: #ecfdf5;
}

.admin-mask-table td.admin-mask-table-cell--hover-row,
.admin-mask-table th.admin-mask-table-cell--hover-row {
    background-color: var(--admin-mask-outer-l-row-bg);
}

.admin-mask-table td.admin-mask-table-cell--hover-col,
.admin-mask-table th.admin-mask-table-cell--hover-col {
    box-shadow: inset 0 0 0 999px var(--admin-mask-outer-l-col-bg);
    border-color: var(--admin-mask-outer-l-border);
}

.admin-mask-table td.admin-mask-table-cell--hover-focus,
.admin-mask-table th.admin-mask-table-cell--hover-focus {
    box-shadow:
        inset 0 0 0 999px var(--admin-mask-outer-l-focus-bg),
        inset 0 0 0 1px var(--admin-mask-outer-l-focus-border);
    border-color: var(--admin-mask-outer-l-focus-border);
}

.admin-mask-matrix-cell-number {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(51, 65, 85, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    font-size: 0.61rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    opacity: 0.82;
}

@media (hover: hover) {
    .admin-mask-inline-slot .admin-mask-aggregate-label {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
        pointer-events: none;
        transition: opacity 0.14s ease, transform 0.14s ease;
    }

    .admin-mask-inline-slot:hover .admin-mask-aggregate-label {
        opacity: 0.9;
        transform: translateX(-50%) translateY(0);
    }
}

.admin-mask-matrix-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.admin-mask-matrix-state--read-write {
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(74, 222, 128, 0.32);
    color: #dcfce7;
}

.admin-mask-matrix-state--read-only {
    background: rgba(59, 130, 246, 0.16);
    border: 1px solid rgba(147, 197, 253, 0.28);
    color: #dbeafe;
}

.admin-mask-matrix-state--hidden {
    background: rgba(51, 65, 85, 0.44);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

.admin-mask-aggregate-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.admin-mask-aggregate-summary--empty {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.24);
}

.admin-mask-aggregate-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-mask-aggregate-title {
    margin: 0;
    font-size: 0.82rem;
    color: #f8fafc;
}

.admin-mask-aggregate-copy {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.admin-mask-table--aggregate {
    min-width: 620px;
}

.admin-mask-table--aggregate thead th {
    text-align: center;
}

.admin-mask-table--aggregate thead th:first-child {
    text-align: left;
}

.admin-mask-aggregate-rowhead {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    color: #f8fafc;
}

.admin-mask-aggregate-header-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.3;
}

.admin-mask-aggregate-header-meta {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.01em;
    color: #bfdbfe;
    line-height: 1.35;
}

.admin-mask-aggregate-syntax {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.44);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    vertical-align: baseline;
}

.admin-mask-aggregate-syntax--slot {
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.26);
    background: rgba(30, 64, 175, 0.22);
}

.admin-mask-aggregate-syntax--scope-type {
    color: #fde68a;
    border-color: rgba(250, 204, 21, 0.28);
    background: rgba(146, 64, 14, 0.22);
}

.admin-mask-aggregate-syntax--toggle {
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.26);
    background: rgba(21, 128, 61, 0.2);
}

.admin-mask-aggregate-syntax--mask {
    color: #f9a8d4;
    border-color: rgba(244, 114, 182, 0.26);
    background: rgba(157, 23, 77, 0.2);
}

.admin-mask-aggregate-header-sep {
    display: inline-block;
    margin: 0 3px;
    color: rgba(191, 219, 254, 0.7);
}

.admin-mask-aggregate-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 68px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.4);
}

.admin-mask-matrix-read-summary {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 68px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.22);
}

.admin-mask-matrix-read-summary--visible {
    border-color: rgba(96, 165, 250, 0.28);
    background: rgba(14, 165, 233, 0.14);
}

.admin-mask-matrix-read-summary--hidden {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(51, 65, 85, 0.2);
}

.admin-mask-matrix-read-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #e2e8f0;
}

.admin-mask-aggregate-cell[data-aggregate-tooltip]::after,
.admin-mask-matrix-read-summary[data-aggregate-tooltip]::after {
    content: attr(data-aggregate-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(6px);
    width: max-content;
    max-width: min(280px, 80vw);
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.96);
    border: 1px solid rgba(125, 211, 252, 0.24);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.44);
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 12;
}

.admin-mask-aggregate-cell[data-aggregate-tooltip]::before,
.admin-mask-matrix-read-summary[data-aggregate-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(6px);
    width: 10px;
    height: 10px;
    background: rgba(2, 6, 23, 0.96);
    border-left: 1px solid rgba(125, 211, 252, 0.24);
    border-top: 1px solid rgba(125, 211, 252, 0.24);
    rotate: 225deg;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 11;
}

.admin-mask-aggregate-cell[data-aggregate-tooltip]:hover::after,
.admin-mask-aggregate-cell[data-aggregate-tooltip]:hover::before,
.admin-mask-matrix-read-summary[data-aggregate-tooltip]:hover::after,
.admin-mask-matrix-read-summary[data-aggregate-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.admin-mask-aggregate-cell--level-0 {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(51, 65, 85, 0.28);
}

.admin-mask-aggregate-cell--level-1 {
    border-color: rgba(74, 222, 128, 0.28);
    background: rgba(22, 101, 52, 0.22);
}

.admin-mask-aggregate-cell--level-2 {
    border-color: rgba(125, 211, 252, 0.28);
    background: rgba(3, 105, 161, 0.22);
}

.admin-mask-aggregate-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 1.02rem;
    font-weight: 800;
}

.admin-mask-aggregate-label {
    font-size: 0.66rem;
    font-weight: 600;
    color: #cbd5e1;
    line-height: 1.3;
}

.admin-mask-access-legend {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-mask-access-legend-title {
    margin: 0;
    font-size: 0.82rem;
    color: #f8fafc;
}

.admin-mask-access-legend-copy {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.admin-mask-matrix-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.admin-mask-matrix-legend-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.34);
    color: #cbd5e1;
    font-size: 0.72rem;
    line-height: 1.4;
}

.admin-mask-matrix-legend-item strong {
    color: #f8fafc;
    font-size: 0.74rem;
}

.admin-mask-matrix-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-mask-matrix-group {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.34);
}

.admin-mask-matrix-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.admin-mask-matrix-group-head h4 {
    margin: 0;
    font-size: 0.88rem;
    color: #f8fafc;
}

.admin-mask-matrix-group-head span {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #93c5fd;
}

.admin-mask-matrix-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}

.admin-mask-card {
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.55);
    overflow: hidden;
}

.admin-mask-card-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}

.admin-mask-card-summary::-webkit-details-marker {
    display: none;
}

.admin-mask-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
}

.admin-mask-card-slot,
.admin-mask-card-mask {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.68rem;
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.admin-mask-card-mask {
    margin-left: auto;
    color: #e0f2fe;
}

.admin-mask-card-body {
    padding: 0 12px 12px 12px;
}

.admin-mask-card-copy {
    margin: 0 0 8px 0;
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.4;
}

.admin-mask-bit-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-mask-bit-table th,
.admin-mask-bit-table td {
    padding: 8px 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: top;
    text-align: left;
}

.admin-mask-bit-table th {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #93c5fd;
}

.admin-mask-bit-table td {
    font-size: 0.72rem;
    color: #e2e8f0;
}

.admin-mask-bit-access {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.admin-mask-bit-access--write {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.22);
    color: #86efac;
}

.admin-mask-bit-access--readonly {
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.22);
    color: #7dd3fc;
}

.admin-mask-bit-access--hidden {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #94a3b8;
}

.admin-mask-bit-rule {
    color: #f8fafc;
    line-height: 1.4;
}

.admin-mask-bit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.admin-mask-bit-meta code {
    font-size: 0.64rem;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    padding: 2px 7px;
}

.admin-mask-bit-note {
    margin-top: 6px;
    color: #94a3b8;
    line-height: 1.35;
}

.admin-si-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    color: #cbd5e1;
    margin: 4px 0 6px 0;
}

.admin-si-summary strong {
    color: #bae6fd;
}

.admin-si-trace-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
    color: #e2e8f0;
}

.admin-si-trace-table th,
.admin-si-trace-table td {
    padding: 4px 6px;
    border: 1px solid rgba(125, 211, 252, 0.12);
    text-align: center;
    vertical-align: middle;
}

.admin-si-trace-table thead th {
    background: rgba(15, 23, 42, 0.7);
    color: #93c5fd;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
}

.admin-si-trace-table th.admin-si-th-entity {
    text-align: left;
    min-width: 160px;
}

.admin-si-row--self {
    background: rgba(59, 130, 246, 0.08);
}

.admin-si-row--overflow td {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    background: rgba(15, 23, 42, 0.4);
}

.admin-si-entity {
    text-align: left !important;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.admin-si-entity-type {
    font-size: 0.6rem;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.8;
}

.admin-si-entity-name {
    color: #f1f5f9;
}

.admin-si-entity-id {
    color: #94a3b8;
    font-size: 0.66rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.admin-si-entity-badge {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-si-cell {
    display: inline-block;
    min-width: 1.2em;
    text-align: center;
    font-weight: 700;
}

.admin-si-cell--on {
    color: #4ade80;
}

.admin-si-cell--off {
    color: #f87171;
}

.admin-si-cell--inherit {
    color: #93c5fd;
}

.admin-si-cell--na {
    color: #475569;
}

.admin-si-module-td {
    min-width: 220px;
    padding: 8px 10px !important;
}

.admin-si-module-card {
    min-height: 0;
}

.admin-si-module-shell {
    width: min(100%, 240px);
    margin: 0 auto;
}

.admin-si-legend {
    margin: 6px 0 0 0;
    font-size: 0.66rem;
    color: #94a3b8;
    text-align: right;
}

.admin-si-legend .admin-si-cell {
    margin: 0 2px 0 6px;
}

/* ==============================================
   Chat Service Config Section (legacy)
   ============================================== */

.chat-config-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-config-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Toggle switch */
.chat-config-switch {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.chat-config-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chat-config-switch__track {
    width: 40px;
    height: 22px;
    background: rgba(107, 114, 128, 0.5);
    border-radius: 11px;
    transition: background 0.2s ease;
    position: relative;
}

.chat-config-switch input:checked + .chat-config-switch__track {
    background: #22c55e;
}

.chat-config-switch__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.chat-config-switch input:checked + .chat-config-switch__track .chat-config-switch__knob {
    transform: translateX(18px);
}

/* Select dropdown */
.chat-config-select {
    padding: 6px 10px;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(31, 41, 55, 0.6);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 140px;
}

.chat-config-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Permission radio fieldset */
.chat-config-fieldset {
    border: 1px solid rgba(75, 85, 99, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-config-legend {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 6px;
}

.chat-config-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-primary);
    cursor: pointer;
}

.chat-config-radio input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chat-config-radio__indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(107, 114, 128, 0.6);
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s ease;
}

.chat-config-radio input:checked + .chat-config-radio__indicator {
    border-color: var(--accent-color);
}

.chat-config-radio input:checked + .chat-config-radio__indicator::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
}

/* Save button & status */
.chat-config-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.chat-config-save-btn {
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-color);
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-config-save-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

.chat-config-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-config-status--ok {
    color: #22c55e;
}

.chat-config-status--err {
    color: #ef4444;
}

/* ==============================================
   Chat Permission Policies (cpp-) Section
   ============================================== */

.cpp-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cpp-banner {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    padding: 8px 12px;
    line-height: 1.4;
}

/* Policy table */
.cpp-table-wrap {
    overflow-x: auto;
}

.cpp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cpp-table th {
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(75, 85, 99, 0.35);
    white-space: nowrap;
}

.cpp-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.15);
    vertical-align: middle;
}

.cpp-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.cpp-id-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.cpp-ts {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cpp-loading, .cpp-error {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
}

.cpp-error {
    color: #ef4444;
}

/* Privilege badges */
.cpp-privilege-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.cpp-privilege-badge--read {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.cpp-privilege-badge--read_write {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.cpp-privilege-badge--moderate {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

/* Toggle button */
.cpp-toggle-btn {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.cpp-toggle-btn--active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.cpp-toggle-btn--inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.cpp-toggle-btn:hover {
    filter: brightness(1.2);
}

/* Actions cell */
.cpp-actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.cpp-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 5px;
    border: 1px solid rgba(75, 85, 99, 0.3);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.cpp-btn:hover {
    background: rgba(99, 102, 241, 0.12);
}

.cpp-btn--primary {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-color);
    font-weight: 600;
}

.cpp-btn--primary:hover {
    background: rgba(99, 102, 241, 0.25);
}

.cpp-btn--cancel {
    color: var(--text-muted);
}

.cpp-btn--delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Empty state */
.cpp-empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Form */
.cpp-form-details {
    border: 1px solid rgba(75, 85, 99, 0.25);
    border-radius: 8px;
    overflow: hidden;
}

.cpp-form-toggle {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    cursor: pointer;
    list-style: none;
}

.cpp-form-toggle::-webkit-details-marker {
    display: none;
}

.cpp-form-toggle::before {
    content: '▸ ';
}

.cpp-form-details[open] .cpp-form-toggle::before {
    content: '▾ ';
}

.cpp-form {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid rgba(75, 85, 99, 0.2);
}

.cpp-form-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cpp-form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cpp-form-select {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(31, 41, 55, 0.6);
    color: var(--text-primary);
    cursor: pointer;
}

.cpp-form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cpp-form-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.cpp-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.cpp-form-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cpp-form-status--ok {
    color: #22c55e;
}

.cpp-form-status--err {
    color: #ef4444;
}

.cpp-form-validation {
    font-size: 0.78rem;
    color: #f87171;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 4px;
}

/* ==============================================
   Chat Enabled Toggle (Feature Flag)
   Main policy toggle that controls whether chat
   is available at all for a given scope.
   ============================================== */

.chat-enabled-toggle-wrapper {
    padding: 12px 16px;
    background: var(--surface-color, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
}

.chat-enabled-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-enabled-toggle-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chat-enabled-toggle-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.chat-enabled-toggle-label {
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.95rem;
    white-space: nowrap;
}

.chat-enabled-toggle-hint {
    color: var(--text-secondary, #999);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-enabled-default-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 6px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-radius: 4px;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* iOS-style toggle switch */
.chat-enabled-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.chat-enabled-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.chat-enabled-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444;
    border-radius: 24px;
    transition: background-color 0.3s;
}

.chat-enabled-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.chat-enabled-switch input:checked + .chat-enabled-slider {
    background-color: #22c55e;
}

.chat-enabled-switch input:checked + .chat-enabled-slider::before {
    transform: translateX(20px);
}

.chat-enabled-switch input:focus-visible + .chat-enabled-slider {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* Also apply toggle wrapper styles to Phase 1 renamed class */
.chat-visible-toggle-wrapper {
    padding: 12px 16px;
    background: var(--surface-color, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
}

/* ==============================================
   REMOVED in Phase 1 (Chat Permission Reset):
     - .comm-policy-placeholder* styles
     - .comm-access-* styles (scope-integrated policy editor)
   Will be re-introduced cleanly in Phase 2.
   ============================================== */

/* ==============================================
   Donor Recognition Section
   ============================================== */

.admin-donor-recognition-container {
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(234, 179, 8, 0.03) 100%);
}

/* Section Headings */
.donor-section-heading {
    margin: 0 0 4px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.donor-section-heading--special {
    color: #a78bfa;
    font-size: 0.9rem;
}

.donor-section-description {
    margin: 0 0 12px 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==== Special Recognition - Founder Supporter ==== */
.donor-special-recognition {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

/* Founder row - centered premium spotlight container */
.donor-founder-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    padding: 0 8px;
}

.donor-founder-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    min-width: 280px;
    max-width: 380px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.08) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    position: relative;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.donor-founder-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.5));
    animation: founderGlow 3s ease-in-out infinite;
}

@keyframes founderGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.7)); }
}

.donor-founder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.donor-founder-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #d8b4fe;
    letter-spacing: 0.02em;
}

.donor-founder-tagline {
    font-size: 0.7rem;
    color: rgba(216, 180, 254, 0.7);
    font-style: italic;
}

.donor-founder-badge {
    padding: 4px 10px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.35);
}

/* ==== Donor Tiers Ladder ==== */
.donor-tiers-section {
    margin-bottom: 8px;
}

.donor-tier-ladder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.donor-tier {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
}

.donor-tier-rank {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.donor-tier-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.donor-tier-name {
    font-weight: 600;
    font-size: 0.8rem;
}

.donor-tier-description {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.donor-tier-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Champion Tier - Gold/Highest */
.donor-tier--champion {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-left: 3px solid #eab308;
}

.donor-tier--champion .donor-tier-rank {
    background: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
    color: #1a1a2e;
}

.donor-tier--champion .donor-tier-name {
    color: #fcd34d;
}

/* Prominent Advocate Tier - Silver/Mid */
.donor-tier--advocate {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.12) 0%, rgba(107, 114, 128, 0.06) 100%);
    border: 1px solid rgba(156, 163, 175, 0.25);
    border-left: 3px solid #9ca3af;
}

.donor-tier--advocate .donor-tier-rank {
    background: linear-gradient(135deg, #9ca3af 0%, #d1d5db 100%);
    color: #1a1a2e;
}

.donor-tier--advocate .donor-tier-name {
    color: #d1d5db;
}

/* Generous Supporter Tier - Bronze/Base */
.donor-tier--supporter {
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.12) 0%, rgba(217, 119, 6, 0.06) 100%);
    border: 1px solid rgba(180, 83, 9, 0.2);
    border-left: 3px solid #b45309;
}

.donor-tier--supporter .donor-tier-rank {
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    color: #fff;
}

.donor-tier--supporter .donor-tier-name {
    color: #fbbf24;
}

/* Hover effects */
.donor-tier:hover {
    transform: translateX(3px);
}

.donor-founder-card:hover {
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ==============================================
   Support Pillars Section (Index Page)
   ============================================== */

.support-pillars-section {
    padding: 20px;
    padding-bottom: calc(var(--bottom-panel-height, 60px) + 36px); /* Extra breathing room above dock */
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: calc(var(--bottom-panel-height, 60px) + 8px);
}

.support-brand-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 6px 0 22px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.support-brand-intro__logo {
    width: 100px;
    height: 100px;
}

.support-brand-intro .support-brand-intro__title {
    font-size: 1.45rem;
}

/* Header */
.support-pillars-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.support-pillars-title {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.support-pillars-title::before {
    content: '🏆';
}

.support-pillars-subtitle {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 600px) {
    .support-brand-intro {
        gap: 12px;
        justify-content: flex-start;
        padding-bottom: 18px;
    }

    .support-brand-intro__logo {
        width: 78px;
        height: 78px;
    }

    .support-brand-intro .support-brand-intro__title {
        font-size: 1.2rem;
    }
}

/* Base Pillar Card */
.support-pillar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.support-pillar:hover {
    transform: translateX(2px);
}

/* Image Container (with actual logo) */
.support-pillar-image {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.support-pillar-image--large {
    width: auto;
    height: 100%;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    overflow: hidden;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-pillar-logo {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* Image Placeholder Container */
.support-pillar-image-placeholder {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.support-pillar:hover .support-pillar-image-placeholder {
    border-color: rgba(255, 255, 255, 0.25);
}

.support-pillar-image-placeholder--large {
    width: 60px;
    height: 60px;
}

.support-pillar-image-placeholder .placeholder-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.support-pillar-image-placeholder--large .placeholder-icon {
    font-size: 1.6rem;
}

.support-pillar-image-placeholder .placeholder-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* Pillar Content */
.support-pillar-content {
    flex: 1;
    min-width: 0;
}

.support-pillar-name {
    margin: 0 0 2px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.support-pillar-description {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Pillar Badge (Founder only) */
.support-pillar-badge {
    padding: 4px 10px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #d4af37 0%, #c9a227 50%, #b8860b 100%);
    color: #1a1305;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(201, 162, 39, 0.4);
    flex-shrink: 0;
}

/* ==== Tier Row Layout ==== */
.support-tier-row {
    margin-bottom: 24px;
}

.support-tier-row:last-child {
    margin-bottom: 0;
}

.support-tier-label {
    margin: 0 0 10px 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* Tier heading block (founder uses this structured heading) */
.support-tier-heading {
    margin-bottom: 16px;
}

.support-tier-eyebrow {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #d4af37;
    margin-bottom: 4px;
}

.support-tier-headline {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.support-tier-description {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.support-tier-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Compact pillar cards for inline display */
.support-tier-row .support-pillar {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 14px;
    padding-top: 18px;
    gap: 12px;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 90px;
}

/* Image stays fixed height */
.support-tier-row .support-pillar .support-pillar-image {
    height: 65px;
    flex-shrink: 0;
}

.support-tier-row .support-pillar-badge {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 10px;
    font-size: 0.5rem;
    white-space: nowrap;
    border-radius: 3px;
    letter-spacing: 0.06em;
}

/* ==== Founder Supporter - Premium Hero Tier ==== */
.support-tier-row--founder {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    padding-top: 16px;
    margin-bottom: 28px;
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.04) 0%, transparent 100%);
    border: 1px solid rgba(201, 162, 39, 0.12);
    border-radius: 10px;
}

.support-tier-row--founder .support-tier-heading {
    align-self: flex-start;
}

.support-tier-row--founder .support-tier-label {
    color: #d4af37;
}

.support-tier-row--founder .support-tier-items {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
    align-self: center;
    width: 100%;
    max-width: 780px;
    margin-top: 20px;
}

.support-tier-row--founder .support-pillar {
    display: grid;
    grid-template-columns: minmax(92px, 118px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 14px;
    row-gap: 10px;
    width: min(100%, 360px);
    min-height: 110px;
    height: auto;
    flex: 0 1 360px;
    align-items: center;
    padding: 18px;
    padding-top: 22px;
}

.support-pillar--founder {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.06) 0%, rgba(180, 140, 20, 0.10) 50%, rgba(139, 92, 30, 0.05) 100%);
    border: 1px solid rgba(201, 162, 39, 0.25);
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.08);
    position: relative;
    overflow: visible;
    scroll-margin-bottom: calc(var(--bottom-panel-expanded, 45vh) + 24px);
}

.support-pillar--founder:hover {
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.18);
}

.support-pillar--founder .support-pillar-name {
    font-size: 0.9rem;
    color: #fef3c7;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.2;
    white-space: normal;
}

.support-pillar--founder .support-pillar-image {
    background: rgba(201, 162, 39, 0.06);
    border: 1px solid rgba(201, 162, 39, 0.25);
}

/* Star icon on card bottom-right — flatter, integrated */
.support-pillar-icon {
    font-size: 14px;
    background: rgba(30, 30, 40, 0.9);
    border: 1.5px solid rgba(201, 162, 39, 0.4);
    border-radius: 6px;
    padding: 3px 7px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: absolute;
    bottom: -4px;
    right: -4px;
    z-index: 2;
    cursor: help;
    line-height: 1;
}

/* Tooltip on hover */
.support-pillar-icon::after {
    content: attr(data-tooltip);
    /* Fallback shown if JS fails to set data-tooltip — indicates config load error */
    position: absolute;
    bottom: calc(100% + 12px);
    right: -8px;
    background: rgba(20, 20, 30, 0.95);
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
    border: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    transform: translateY(4px);
    pointer-events: none;
    z-index: 100;
}

/* Tooltip arrow */
.support-pillar-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    right: 8px;
    border: 6px solid transparent;
    border-top-color: rgba(20, 20, 30, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 101;
}

.support-pillar-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.support-pillar-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Image container */
.support-pillar--founder .support-pillar-image {
    flex-shrink: 0;
    width: 100%;
    max-width: 118px;
    justify-self: start;
}

.support-pillar-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    height: 65px;
    align-self: flex-start;
    gap: 3px;
}

.support-pillar--founder .support-pillar-info {
    align-self: center;
    height: auto;
    min-height: 65px;
}

.support-pillar-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

a.support-pillar-name {
    cursor: pointer;
    transition: color 0.2s;
}

a.support-pillar-name:hover,
a.support-pillar-name:focus-visible {
    color: var(--accent-color);
    text-decoration: underline;
}

a.support-pillar-name:focus-visible {
    outline: 2px solid rgba(74, 158, 255, 0.45);
    outline-offset: 2px;
    border-radius: 3px;
}

.sponsor-external-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease;
}

.sponsor-external-modal-overlay[hidden] {
    display: none;
}

.sponsor-external-modal {
    width: min(100%, 420px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: #1e1e2e;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: slideUp 0.2s ease;
}

.sponsor-external-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px 12px 0 0;
}

.sponsor-external-modal__logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.28);
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.24),
        0 6px 18px rgba(0, 0, 0, 0.24);
}

.sponsor-external-modal__title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0;
}

.sponsor-external-modal__body {
    padding: 20px;
}

.sponsor-external-modal__message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.data-load-error-modal__body {
    display: grid;
    gap: 12px;
}

.data-load-error-modal__meta {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    line-height: 1.45;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.data-load-error-modal__details {
    width: 100%;
    min-height: 240px;
    max-height: min(52vh, 420px);
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(6, 10, 20, 0.92);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre;
    overflow: auto;
    resize: vertical;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.data-load-error-modal__details:focus-visible {
    outline: 2px solid rgba(74, 158, 255, 0.5);
    outline-offset: 2px;
}

.sponsor-external-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 12px 12px;
}

.sponsor-external-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 10px 18px;
    border-radius: 8px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sponsor-external-modal__btn:focus-visible {
    outline: 2px solid rgba(74, 158, 255, 0.5);
    outline-offset: 2px;
}

.sponsor-external-modal__btn--primary {
    border: 1px solid rgba(234, 179, 8, 0.4);
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(234, 179, 8, 0.15));
    color: #eab308;
}

.sponsor-external-modal__btn--primary:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(234, 179, 8, 0.25));
    border-color: rgba(234, 179, 8, 0.6);
}

.sponsor-external-modal__btn--secondary {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.sponsor-external-modal__btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .sponsor-external-modal__actions {
        flex-direction: column;
    }

    .sponsor-external-modal__btn {
        width: 100%;
    }
}

/* Founder description with see more */
.support-pillar-description {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 2px;
    text-align: left;
    max-height: 1.3em; /* 1 line */
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.support-pillar-description.expanded {
    max-height: 200px;
}

.support-pillar-see-more {
    font-size: 0.625rem;
    color: rgba(148, 163, 184, 0.7);
    cursor: pointer;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}

.support-pillar-see-more:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Expandable description block - inline expand */
.support-pillar-expanded {
    display: none;
    width: 100%;
    padding: 10px 12px;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.support-pillar--founder .support-pillar-expanded {
    grid-column: 1 / -1;
    margin-top: 0;
}

.support-pillar-expanded p {
    margin: 0;
}

.support-pillar.expanded .support-pillar-expanded {
    display: block;
}

/* ==== Champion Tier ==== */
.support-tier-row--champion {
    padding: 16px;
    background: linear-gradient(180deg, rgba(234, 179, 8, 0.06) 0%, transparent 100%);
    border: 1px solid rgba(234, 179, 8, 0.18);
    border-radius: 10px;
}

.support-tier-row--champion .support-tier-label {
    color: #fcd34d;
}

.support-pillar--champion {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.08) 0%, rgba(245, 158, 11, 0.05) 50%, rgba(180, 140, 20, 0.04) 100%);
    border: 1px solid rgba(234, 179, 8, 0.22);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.06);
    position: relative;
    overflow: visible;
}

.support-pillar--champion:hover {
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.14);
}

/* Champion badge */
.support-pillar-badge--champion {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 50%, #d97706 100%);
    color: #1a1305;
}

/* Champion star icon */
.support-pillar-icon--champion {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(252, 211, 77, 0.4);
}

.support-pillar-icon--champion::after {
    content: attr(data-tooltip);
}

.support-pillar-icon--champion::before {
    border-top-color: rgba(20, 20, 30, 0.95);
}

/* Placeholder image styling */
.support-pillar-image--placeholder {
    background: rgba(234, 179, 8, 0.08);
    border: 2px dashed rgba(234, 179, 8, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-pillar-image--placeholder .placeholder-icon {
    font-size: 32px;
    opacity: 0.6;
}

/* Placeholder name styling */
.support-pillar-name--placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
}

.support-pillar-see-more--disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.support-pillar--champion .support-pillar-image-placeholder {
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.06);
}

/* ==== Prominent Advocate Tier ==== */
.support-tier-row--advocate {
    padding: 16px;
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.04) 0%, transparent 100%);
    border: 1px solid rgba(201, 162, 39, 0.14);
    border-radius: 10px;
}

.support-tier-row--advocate .support-tier-label {
    color: #d1d5db;
}

.support-pillar--advocate {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.08) 0%, rgba(107, 114, 128, 0.05) 50%, rgba(75, 85, 99, 0.04) 100%);
    border: 1px solid rgba(156, 163, 175, 0.20);
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.06);
    position: relative;
    overflow: visible;
}

.support-pillar--advocate:hover {
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.14);
}

/* Advocate badge */
.support-pillar-badge--advocate {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    color: #1f2937;
}

/* Advocate icon */
.support-pillar-icon--advocate {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(156, 163, 175, 0.4);
}

.support-pillar-icon--advocate::after {
    content: attr(data-tooltip);
}

.support-pillar-icon--advocate::before {
    border-top-color: rgba(20, 20, 30, 0.95);
}

/* Advocate placeholder image */
.support-pillar-image--advocate {
    background: rgba(156, 163, 175, 0.08);
    border: 2px dashed rgba(156, 163, 175, 0.4);
}

.support-pillar--advocate .support-pillar-image-placeholder {
    border-color: rgba(156, 163, 175, 0.25);
    background: rgba(156, 163, 175, 0.05);
}

/* ==== Generous Supporter Tier ==== */
.support-tier-row--supporter {
    padding: 16px;
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.04) 0%, transparent 100%);
    border: 1px solid rgba(201, 162, 39, 0.14);
    border-radius: 10px;
}

.support-tier-row--supporter .support-tier-label {
    color: #fb923c;
}

.support-pillar--supporter {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.08) 0%, rgba(234, 88, 12, 0.05) 50%, rgba(180, 83, 9, 0.04) 100%);
    border: 1px solid rgba(251, 146, 60, 0.20);
    box-shadow: 0 2px 8px rgba(251, 146, 60, 0.06);
    position: relative;
    overflow: visible;
}

.support-pillar--supporter:hover {
    box-shadow: 0 4px 12px rgba(251, 146, 60, 0.14);
}

/* Supporter badge */
.support-pillar-badge--supporter {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 50%, #c2410c 100%);
    color: #1c1917;
}

/* Supporter icon */
.support-pillar-icon--supporter {
    background: rgba(30, 30, 40, 0.9);
    border-color: rgba(251, 146, 60, 0.4);
}

.support-pillar-icon--supporter::after {
    content: attr(data-tooltip);
}

.support-pillar-icon--supporter::before {
    border-top-color: rgba(20, 20, 30, 0.95);
}

/* Supporter placeholder image */
.support-pillar-image--supporter {
    background: rgba(251, 146, 60, 0.08);
    border: 2px dashed rgba(251, 146, 60, 0.4);
}

.support-pillar--supporter .support-pillar-image-placeholder {
    border-color: rgba(180, 83, 9, 0.25);
    background: rgba(180, 83, 9, 0.05);
}

/* ==== Tablet Responsive ==== */
@media (max-width: 768px) {
    .support-tier-row--founder .support-tier-items {
        max-width: 620px;
        gap: 18px;
    }

    .support-tier-row--founder .support-pillar {
        flex: 0 1 320px;
        width: min(100%, 320px);
    }
    
    .support-pillar-name {
        font-size: 0.8rem;
    }
}

/* ==== Mobile Responsive ==== */
@media (max-width: 600px) {
    .support-pillars-section {
        padding: 14px;
        padding-bottom: calc(var(--bottom-panel-height, 60px) + 28px);
    }
    
    .support-pillars-header {
        margin-bottom: 18px;
        padding-bottom: 12px;
    }
    
    /* All tier rows: stack cards vertically on mobile */
    .support-tier-items {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Founder hero section — mobile */
    .support-tier-row--founder {
        padding: 14px;
        padding-top: 12px;
        margin-bottom: 22px;
    }

    .support-tier-row--founder .support-tier-items {
        flex-direction: column;
        align-items: center;
        max-width: none;
        margin-top: 16px;
        gap: 14px;
    }
    
    .support-tier-row--founder .support-pillar {
        flex: none;
        width: min(100%, 320px);
        grid-template-columns: minmax(72px, 96px) minmax(0, 1fr);
        column-gap: 12px;
        padding: 14px;
        padding-top: 18px;
        min-height: auto;
    }
    
    .support-tier-heading {
        margin-bottom: 12px;
    }
    
    .support-tier-headline {
        font-size: 0.85rem;
    }
    
    .support-tier-row .support-pillar {
        padding: 12px;
        padding-top: 16px;
        min-height: auto;
        gap: 10px;
        width: 100%;
    }
    
    .support-tier-row .support-pillar .support-pillar-image {
        height: 55px;
    }
    
    .support-pillar-image--large {
        width: auto;
    }
    
    .support-pillar-info {
        flex: 1;
        min-width: 100px;
        height: 55px;
    }

    .support-pillar--founder .support-pillar-info {
        min-height: 55px;
    }
    
    .support-pillar--founder .support-pillar-name {
        font-size: 0.8rem;
    }
    
    .support-pillar-name {
        font-size: 0.75rem;
    }
    
    .support-pillar-icon {
        font-size: 12px;
        padding: 2px 6px;
        bottom: -3px;
        right: -3px;
    }
    
    .support-pillar-icon::after {
        white-space: normal;
        width: 180px;
        right: -10px;
    }
    
    .support-pillar-description {
        font-size: 0.65rem;
    }
    
    .support-pillar-see-more {
        font-size: 0.58rem;
    }
    
    .support-pillar-expanded {
        padding: 8px 10px;
        font-size: 0.68rem;
    }
    
    .support-pillar-image-placeholder {
        width: 40px;
        height: 40px;
    }
    
    .support-tier-label {
        font-size: 0.6rem;
    }
    
    .support-pillars-title {
        font-size: 0.95rem;
    }
    
    .support-pillars-subtitle {
        font-size: 0.7rem;
    }
}

/* ==============================================
   Admin Section Cards (Floating Popup Callouts)
   ============================================== */

/* Wrapper: positions the floating popup relative to the card */
.admin-section-wrapper {
    position: relative;
    display: block;
    margin-bottom: 8px;
    overflow: visible;  /* Allow callouts to extend into page margin */
}

.admin-section-wrapper:last-child {
    margin-bottom: 0;
}

/* Normalize details elements inside wrapper */
.admin-section-wrapper > details {
    margin: 0;
    padding: 0;
}

.admin-section-wrapper > details.admin-config-collapsible {
    margin-bottom: 0;  /* Wrapper handles spacing */
}

.admin-section-wrapper > details > summary {
    list-style: none;
    cursor: pointer;
}

.admin-section-wrapper > details > summary::-webkit-details-marker {
    display: none;
}

/* The compact section card */
.admin-section-card {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    appearance: none;
    text-align: left;
    color: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--section-accent);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.admin-section-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.admin-section-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-section-card-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.admin-section-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-section-card-hint {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.admin-section-card--disabled {
    opacity: 0.76;
    border-style: dashed;
}

.admin-section-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.admin-section-title {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Note indicator (shows if notes exist) */
.admin-note-indicator {
    font-size: 0.875rem;
    margin-left: auto;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.admin-note-indicator--has-notes {
    opacity: 1;
}

.admin-note-indicator--empty {
    opacity: 0.3;
    font-size: 0.75rem;
}

.admin-section-wrapper:hover .admin-note-indicator {
    opacity: 1;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-scope-pane--active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: start;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-scope-pane > :not(.admin-section-wrapper) {
    grid-column: 1 / -1;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-section-wrapper {
    margin: 0;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-section-card {
    display: flex;
    min-height: 82px;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-section-wrapper > details {
    display: none;
}

.admin-tab-content.admin-section-preview-mode--cards .admin-margin-indicator {
    display: none;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-scope-pane--active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper {
    display: none;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused {
    display: block;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused > details {
    display: block;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused .admin-section-card {
    display: none;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused .admin-margin-indicator {
    display: flex;
}

/* In cards focus mode, treat the section header like a back control. */
.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused .admin-config-toggle::before {
    content: '←';
    font-size: 0.8rem;
    transform: none;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused.admin-config-collapsible[open] .admin-config-toggle::before {
    transform: none;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused .admin-config-toggle .toggle-hint {
    font-size: 0;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper.admin-section-wrapper--focused .admin-config-toggle .toggle-hint::after {
    content: '(back to cards)';
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* ==============================================
   Margin Indicator (section documentation shortcut)
   ============================================== */

.admin-margin-indicator {
    position: absolute;
    right: -50px;  /* Position in right margin */
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.admin-margin-indicator:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--section-accent);
    transform: translateY(-50%) scale(1.1);
}

.admin-margin-indicator--empty {
    opacity: 0.5;
}

.admin-margin-indicator--empty:hover {
    opacity: 1;
}

.admin-margin-icon {
    font-size: 1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.admin-margin-indicator--docs {
    border-color: color-mix(in srgb, var(--section-accent) 65%, rgba(255, 255, 255, 0.12));
}

.admin-margin-icon--has-notes {
    color: var(--section-accent);
    font-weight: 700;
}

.admin-margin-icon--empty {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Status badges */
.admin-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

.admin-status-badge--todo {
    background: rgba(234, 179, 8, 0.15);
    color: #b7930a;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.admin-status-badge--progress {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.admin-status-badge--complete {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.admin-status-badge--reference {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* ==============================================
   Table Chips (Schema Preview in Section Headers)
   ============================================== */

.admin-section-title-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.admin-table-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;  /* Force onto new row */
    padding-left: 1.2em; /* Indent to align with title (after expand arrow) */
    margin-top: 4px;
}

.admin-table-chips-loading,
.admin-table-chips-empty {
    font-size: 0.625rem;
    color: var(--muted-color, #888);
    font-style: italic;
}

.admin-table-chips-error {
    font-size: 0.625rem;
    color: #e57373;
    font-style: italic;
}

/* Tables section in documentation popup */
.admin-callout-tables-section {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.admin-callout-tables-section .admin-table-chips {
    margin-top: 6px;
    padding-left: 0;
}

/* Summary needs to wrap when it has table chips */
.admin-config-collapsible[data-has-tables] > .admin-config-toggle {
    flex-wrap: wrap;
}

.admin-table-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(100, 100, 140, 0.15);
    border: 1px solid rgba(100, 100, 140, 0.3);
    border-radius: 4px;
    font-size: 0.5625rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #a5a5c0;
    cursor: default;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-table-chip:hover {
    background: rgba(100, 100, 140, 0.25);
    border-color: rgba(100, 100, 140, 0.5);
}

.admin-table-chip--planned {
    background: rgba(234, 179, 8, 0.1);
    border: 1px dashed rgba(234, 179, 8, 0.4);
    color: #b7930a;
}

.admin-table-chip--planned:hover {
    background: rgba(234, 179, 8, 0.2);
    border-color: rgba(234, 179, 8, 0.6);
}

/* Proposed tables - orange tint */
.admin-table-chip--proposed {
    background: rgba(249, 115, 22, 0.15);
    border: 1px dashed rgba(249, 115, 22, 0.5);
    color: #ea580c;
}

.admin-table-chip--proposed:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: rgba(249, 115, 22, 0.7);
}

.admin-table-chip-db {
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 3px;
    border-radius: 2px;
    background: rgba(60, 60, 80, 0.4);
    color: #8888aa;
}

.admin-table-chip-name {
    font-weight: 500;
}

/* ==============================================
   Floating Section Documentation Popup
   ============================================== */

.admin-callout-popup {
    position: fixed;
    top: 50%;
    right: 20px;  /* Fixed in right margin of viewport */
    transform: translateY(-50%);
    width: 280px;
    max-height: 80vh;
    overflow: visible;  /* Allow arrow to extend outside */
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Show popup on click (via JS-added class) */
.admin-callout-popup--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Connecting line from margin indicator to popup */
.admin-callout-arrow {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    transform-origin: 0 50%;
    width: 100px;
    height: 3px;
    background: var(--callout-accent);
    pointer-events: none;
    z-index: -1;  /* Behind the popup content */
}

/* Animate line drawing when popup visible */
.admin-callout-popup--visible .admin-callout-arrow {
    /* JS dynamically sets width, rotation, position */
}

/* Small dot at indicator end of line */
.admin-callout-arrow::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--callout-accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--callout-accent);
}

/* Remove arrow tip - line goes behind popup */
.admin-callout-arrow::after {
    display: none;
}

/* Popup content container */
.admin-callout-content {
    position: relative;
    z-index: 1;  /* Above the arrow line */
    background: linear-gradient(135deg, 
        rgba(20, 20, 25, 0.45),
        rgba(15, 15, 20, 0.45)
    );
    border: 2px solid var(--callout-accent);
    border-radius: 10px;
    padding: 14px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    max-height: 80vh;
    overflow-y: auto;
}

/* Callout header */
.admin-callout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-callout-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

/* Select toggle switch for AI editing consent */
.admin-callout-select-toggle {
    position: relative;
    width: 28px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.admin-callout-select-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-select-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.admin-select-slider::before {
    content: '';
    position: absolute;
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.admin-callout-select-toggle input:checked + .admin-select-slider {
    background: var(--callout-accent);
}

.admin-callout-select-toggle input:checked + .admin-select-slider::before {
    transform: translateX(12px);
    background: white;
}

.admin-callout-select-toggle:hover .admin-select-slider {
    background: rgba(255, 255, 255, 0.25);
}

.admin-callout-select-toggle input:checked:hover + .admin-select-slider {
    filter: brightness(1.1);
}

/* Refresh button */
.admin-callout-refresh-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.admin-callout-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--callout-accent);
    border-color: var(--callout-accent);
}

.admin-callout-refresh-btn--spinning {
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* AI-added content appears in blue */
.admin-callout-text .ai-added,
.admin-section-notes .ai-added,
.admin-section-next-steps .ai-added {
    color: #60a5fa;  /* Blue-400 */
}

/* Marker for AI additions with timestamp */
.ai-added::before {
    content: '⟨AI⟩ ';
    font-size: 0.65rem;
    opacity: 0.7;
    vertical-align: super;
}

/* ── Catalog reference section: collapsible <details> inside notes ── */
.catalog-ref details {
    margin: 6px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}
.catalog-ref details[open] {
    border-color: rgba(96, 165, 250, 0.25);
}
.catalog-ref summary {
    padding: 6px 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    user-select: none;
    font-size: 0.82rem;
    list-style: none;
}
.catalog-ref summary::-webkit-details-marker { display: none; }
.catalog-ref summary::before {
    content: '▸ ';
    font-size: 0.75rem;
    color: #60a5fa;
    margin-right: 4px;
}
.catalog-ref details[open] > summary::before {
    content: '▾ ';
}
.catalog-ref summary:hover {
    background: rgba(255, 255, 255, 0.07);
}
.catalog-ref details > :not(summary) {
    padding: 4px 10px 8px;
}
.catalog-ref p {
    margin: 4px 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
}
.catalog-ref code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    color: #93c5fd;
}
.catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    margin: 4px 0;
}
.catalog-table th {
    text-align: left;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.catalog-table td {
    padding: 3px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
}
.catalog-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}
.catalog-rendered {
    max-height: 60vh;
    overflow-y: auto;
    cursor: default;
}
.catalog-loading {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    font-size: 0.78rem;
}
.catalog-count {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}
.catalog-hierarchy {
    margin: 4px 0 8px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ── Catalog Tabs ── */
.catalog-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.catalog-tab {
    flex: 1;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    letter-spacing: 0.02em;
}

.catalog-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.catalog-tab--active {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.catalog-tab-pane {
    display: none;
}

.catalog-tab-pane--active {
    display: block;
    animation: admin-scope-fadein 0.15s ease;
}

/* ── Data Model table ── */
.data-model-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin: 4px 0;
}

.data-model-table th {
    text-align: left;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-model-table td {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
    vertical-align: top;
}

.data-model-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.data-model-table .dm-datasource {
    font-weight: 600;
    color: #93c5fd;
    background: rgba(255, 255, 255, 0.02);
    border-right: 2px solid rgba(96, 165, 250, 0.2);
}

.data-model-table .dm-datasource-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.data-model-table .dm-datasource-copy {
    min-width: 0;
}

.data-model-table .dm-field code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    color: #e2e8f0;
}

.catalog-cardinality {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.catalog-cardinality--single {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.catalog-cardinality--multi {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.dm-field-kind {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-left: 4px;
}

.dm-field-note {
    margin-top: 3px;
    font-size: 0.66rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.5);
}

.dm-datasource-info,
.dm-datasource-info-panel-wrap {
    position: relative;
    flex-shrink: 0;
}

.dm-datasource-info-btn {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.35);
    background: rgba(147, 197, 253, 0.12);
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.dm-datasource-info-btn::-webkit-details-marker {
    display: none;
}

.dm-datasource-info-btn:hover {
    background: rgba(147, 197, 253, 0.2);
    border-color: rgba(147, 197, 253, 0.5);
}

.dm-datasource-info-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 6;
    min-width: 240px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(147, 197, 253, 0.18);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.dm-datasource-info-title {
    margin-bottom: 8px;
    color: #dbeafe;
    font-weight: 700;
}

.dm-datasource-info-copy {
    margin-bottom: 8px;
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.72);
}

.dm-datasource-info-meta {
    margin-top: 4px;
    font-size: 0.66rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.6);
}

.dm-datasource-info-meta code {
    font-size: 0.64rem;
}

.admin-config-toggle .inline-info-popover {
    margin-left: 6px;
}

.dm-section-header td {
    padding: 8px 10px 5px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.03);
    border-top: 2px solid rgba(96, 165, 250, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-rel-detail {
    font-size: 0.63rem;
    color: rgba(255, 255, 255, 0.3);
    margin-left: 4px;
    font-style: italic;
}

.dm-permission-placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.72rem;
}

.dm-exceptions-row td {
    padding: 6px 10px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-exceptions {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 0.7rem;
}

.dm-exceptions-label {
    font-weight: 600;
    color: #f59e0b;
    font-size: 0.7rem;
}

.dm-exceptions-list {
    margin: 4px 0 0 16px;
    padding: 0;
    list-style: disc;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
}

.dm-exceptions-list code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.68rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    color: #93c5fd;
}

/* Edit button in popup */
.admin-note-edit-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-note-edit-btn:hover {
    background: color-mix(in srgb, var(--callout-accent) 25%, transparent);
    border-color: var(--callout-accent);
    transform: scale(1.1);
}

/* Callout sections */
.admin-callout-section {
    margin-bottom: 10px;
}

.admin-callout-section:last-of-type {
    margin-bottom: 8px;
}

.admin-callout-doc-intro {
    padding: 8px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 6px;
    background: rgba(96, 165, 250, 0.08);
}

.admin-callout-doc-summary {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.45;
}

/* Data table section */
.admin-data-table-section {
    margin-bottom: 10px;
}

.admin-data-table-details {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
}

.admin-data-table-summary {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.admin-data-table-summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.admin-data-table-summary .admin-callout-label,
.admin-data-table-summary .admin-data-table-label {
    margin-bottom: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-data-table-count {
    font-size: 0.625rem;
    color: var(--text-muted);
    font-style: italic;
}

.admin-data-table-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 4px 4px 4px;
}

.admin-data-table-loading,
.admin-data-table-empty,
.admin-data-table-error {
    padding: 12px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.admin-data-table-error {
    color: #ef4444;
}

.admin-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.6875rem;
}

.admin-data-table th,
.admin-data-table td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-data-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-data-table td {
    color: var(--text-secondary);
}

.admin-data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Role select dropdown */
.admin-role-select {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.75rem;
    min-width: 100px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.admin-role-select:hover {
    border-color: var(--accent);
}

.admin-role-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.admin-role-select.updating {
    opacity: 0.6;
    pointer-events: none;
}

.admin-role-select.updated {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.admin-role-select.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Cascading Entity Picker (Type → Entity) */
.admin-entity-picker {
    display: flex;
    gap: 4px;
    align-items: center;
}

.admin-entity-picker select {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.75rem;
    min-width: 80px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.admin-entity-picker .admin-type-select {
    min-width: 70px;
    font-weight: 500;
}

.admin-entity-picker .admin-entity-select {
    flex: 1;
    min-width: 100px;
}

.admin-entity-picker select:hover {
    border-color: var(--accent);
}

.admin-entity-picker select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.admin-entity-picker.updating {
    opacity: 0.6;
    pointer-events: none;
}

.admin-entity-picker.updated select {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.admin-entity-picker.error select {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Table footnote */
.admin-data-table-footnote {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin: 8px 0 0;
    font-style: italic;
}

/* Add User button */
.admin-add-user-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-add-user-btn:hover {
    background: var(--accent-hover);
}

/* Add user row */
.admin-add-user-row {
    background: rgba(var(--accent-rgb), 0.05);
}

.admin-add-user-row td {
    padding: 6px 8px;
}

/* Input fields in table */
.admin-input {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

.admin-input:focus {
    outline: none;
    border-color: var(--accent);
}

.admin-input-half {
    width: 48%;
    display: inline-block;
}

.admin-input-half:first-of-type {
    margin-right: 4%;
}

/* Save/Cancel buttons */
.admin-save-user-btn,
.admin-cancel-user-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 3px;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-save-user-btn {
    background: var(--success);
    color: white;
    margin-right: 4px;
}

.admin-save-user-btn:hover {
    background: #16a34a;
}

.admin-save-user-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-cancel-user-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.admin-cancel-user-btn:hover {
    background: var(--error);
    color: white;
}

.admin-callout-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--callout-accent);
    margin-bottom: 4px;
}

.admin-callout-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.admin-callout-toolbar {
    display: flex;
    gap: 2px;
}

.admin-toolbar-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.admin-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--callout-accent);
    border-color: var(--callout-accent);
}

.admin-callout-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
    min-height: 1.5em;
}

/* List styling in callout text */
.admin-callout-text ul,
.admin-callout-text ol {
    margin: 0.25em 0;
    padding-left: 1.25em;
    list-style-position: outside;
}

.admin-callout-text ul {
    list-style-type: disc;
}

.admin-callout-text ol {
    list-style-type: decimal;
}

.admin-callout-text li {
    margin: 0.15em 0;
}

.admin-callout-text ul ul,
.admin-callout-text ol ul {
    list-style-type: circle;
    margin: 0.1em 0;
}

.admin-callout-text b,
.admin-callout-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Contenteditable styling */
.admin-callout-text[contenteditable="true"] {
    cursor: text;
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: 4px;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.admin-callout-text[contenteditable="true"]:hover {
    background: rgba(255, 255, 255, 0.05);
}

.admin-callout-text[contenteditable="true"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px var(--callout-accent);
}

/* Placeholder for empty contenteditable */
.admin-callout-text[data-empty="true"]::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    font-style: italic;
    pointer-events: none;
    position: absolute;
    top: 4px;
    left: 6px;
}

/* Hide placeholder when focused or has content */
.admin-callout-text[data-empty="true"]:focus::before {
    display: none;
}

.admin-callout-footer {
    font-size: 0.5625rem;
    color: var(--text-muted);
    font-style: italic;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Mobile documentation toggle and container - hidden on desktop */
.admin-mobile-notes-toggle {
    display: none;
}

.admin-mobile-notes-container {
    display: none;
}

/* Content container is transparent wrapper on desktop */
.admin-mobile-content-container {
    display: contents;
}

/* Mobile: content/documentation toggle */
@media (max-width: 600px) {
    .admin-section-wrapper {
        display: flex;
        flex-direction: column;
    }

    .admin-tab-content.admin-section-preview-mode--cards .admin-scope-pane--active {
        display: flex;
        flex-direction: column;
    }

    .admin-tab-content.admin-section-preview-mode--cards .admin-section-card {
        display: none;
    }

    .admin-tab-content.admin-section-preview-mode--cards .admin-section-wrapper > details {
        display: block;
    }

    .admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus .admin-section-wrapper {
        display: flex;
    }
    
    /* Show mobile toggle in summary header */
    .admin-mobile-notes-toggle {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 6px;
        margin-left: auto;
        cursor: pointer;
        user-select: none;
        background: rgba(30, 30, 45, 0.6);
        border-radius: 4px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .admin-mobile-notes-label {
        font-size: 0.5rem;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    
    .admin-mobile-notes-checkbox {
        display: none;
    }
    
    .admin-mobile-notes-slider {
        position: relative;
        width: 22px;
        height: 12px;
        background: rgba(100, 100, 120, 0.4);
        border-radius: 6px;
        transition: background 0.2s ease;
    }
    
    .admin-mobile-notes-slider::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 8px;
        height: 8px;
        background: #888;
        border-radius: 50%;
        transition: transform 0.2s ease, background 0.2s ease;
    }
    
    .admin-mobile-notes-checkbox:checked + .admin-mobile-notes-slider {
        background: rgba(59, 130, 246, 0.5);
    }
    
    .admin-mobile-notes-checkbox:checked + .admin-mobile-notes-slider::after {
        transform: translateX(10px);
        background: #60a5fa;
    }
    
    /* Content container visible by default */
    .admin-mobile-content-container {
        display: block;
    }
    
    /* Documentation container hidden by default */
    .admin-mobile-notes-container {
        display: none;
        padding: 12px;
        background: rgba(20, 20, 30, 0.6);
        border-radius: 8px;
        margin-top: 8px;
    }
    
    /* Notes view - toggle containers */
    details.admin-section--notes-view .admin-mobile-content-container {
        display: none;
    }
    
    details.admin-section--notes-view .admin-mobile-notes-container {
        display: block;
    }
    
    /* Hide desktop popup and indicator on mobile */
    .admin-callout-popup {
        display: none !important;
    }
    
    .admin-margin-indicator {
        display: none;
    }
    
    .admin-callout-arrow {
        display: none;
    }
}

/* Allow callouts to overflow into page margin */
.admin-scope-pane--active,
.admin-config-collapsible--todo {
    overflow: visible;
}

/* Ensure callouts don't get cut off when active */
.admin-section-wrapper:has(.admin-callout-popup--visible) {
    z-index: 1001;
}

/* Legacy classes kept for compatibility */
.admin-section-edit-controls {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-section-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(234, 179, 8, 0.05));
    border: 1px solid rgba(234, 179, 8, 0.25);
    border-radius: 6px;
    color: #d4a20a;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-edit-icon {
    font-size: 0.9rem;
}

.admin-edit-label {
    /* Hidden on very small screens */
}

.admin-section-edit-btn:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.1));
    border-color: rgba(234, 179, 8, 0.4);
    color: #eab308;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

/* Edit form */
.admin-section-edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-section-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8125rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    resize: vertical;
}

.admin-section-input:focus {
    outline: none;
    border-color: rgba(234, 179, 8, 0.5);
}

.admin-section-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.admin-section-save-btn,
.admin-section-cancel-btn {
    padding: 6px 14px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-section-save-btn {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.admin-section-save-btn:hover {
    background: rgba(34, 197, 94, 0.3);
}

.admin-section-cancel-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.admin-section-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==============================================
   Admin Notes Modal (Word-style popup)
   ============================================== */

.admin-notes-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.admin-notes-modal {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.admin-notes-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px 12px 0 0;
}

.admin-notes-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-notes-modal-icon {
    font-size: 1.25rem;
}

.admin-notes-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.admin-notes-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.admin-notes-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.admin-notes-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-notes-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-notes-label-icon {
    font-size: 1rem;
}

.admin-notes-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-notes-textarea:focus {
    outline: none;
    border-color: rgba(234, 179, 8, 0.5);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

.admin-notes-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.admin-notes-textarea--small {
    min-height: 60px;
}

.admin-notes-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 12px 12px;
}

.admin-notes-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.admin-notes-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.admin-notes-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-notes-btn-icon {
    font-size: 1rem;
}

.admin-notes-btn--cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.admin-notes-btn--cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.admin-notes-btn--save {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(234, 179, 8, 0.15));
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #eab308;
}

.admin-notes-btn--save:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(234, 179, 8, 0.25));
    border-color: rgba(234, 179, 8, 0.6);
}

.admin-notes-btn--save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-notes-btn--success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(34, 197, 94, 0.15)) !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
    color: #22c55e !important;
}

.admin-notes-error {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 0.8125rem;
}

/* ==============================================
   Mobile Responsive Fixes
   ============================================== */
@media (max-width: 600px) {
    /* Allow content to expand on small screens */
    .panel-attributes {
        max-height: none;
        overflow: visible;
    }
    body.panel-expanded .panel-attributes {
        max-height: none;
        overflow: visible;
    }

    /* Admin entity header compact on mobile */
    .admin-entity-header {
        padding: 8px 12px;
        gap: 8px;
    }

    .admin-entity-badge {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .admin-entity-name {
        font-size: 0.875rem;
    }

    .admin-entity-type {
        font-size: 0.6875rem;
    }

    /* Admin scope tabs: larger tap targets */
    .admin-scope-tab {
        padding: 10px 8px;
        font-size: 0.75rem;
    }

    /* Config tables: scrollable + smaller text */
    .admin-config-container {
        padding: 8px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .config-table {
        font-size: 0.6875rem;
        min-width: 400px;
    }

    .config-table th,
    .config-table td {
        padding: 6px 8px;
    }

    /* Layout tables: scrollable + smaller text */
    .layout-table {
        font-size: 0.6875rem;
        min-width: 350px;
    }

    .layout-table th,
    .layout-table td {
        padding: 4px 6px;
    }

    .layout-group-title {
        font-size: 0.6875rem;
    }

    .layout-all-row td {
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    .layout-toggle-tri-input {
        width: 40px;
        height: 16px;
    }

    .layout-toggle-tri-label {
        font-size: 0.55rem;
        min-width: 45px;
    }

    /* Collapsible toggle text */
    .admin-config-toggle {
        font-size: 0.75rem;
        padding: 8px 12px;
    }

    .config-context {
        font-size: 0.625rem;
    }

    /* Layout reorder actions */
    .layout-reorder-actions {
        gap: 6px;
    }

    .layout-save-btn,
    .layout-cancel-btn {
        padding: 6px 10px;
        font-size: 0.6875rem;
    }

    /* Hierarchy path compact */
    .hierarchy-path {
        padding: 6px 8px;
        gap: 4px;
    }

    .hierarchy-item-icon {
        width: 18px;
        height: 18px;
        font-size: 0.5rem;
    }

    .hierarchy-item-name {
        font-size: 0.625rem;
    }

    .hierarchy-separator {
        font-size: 0.5rem;
    }

    /* Inheritance badge compact */
    .layout-inherit-badge {
        font-size: 0.5625rem;
        padding: 1px 4px;
    }

    /* App title smaller */
    .app-title {
        font-size: 1rem;
    }

    .support-brand-intro .support-brand-intro__title {
        font-size: 1.2rem;
    }
}

/* ==============================================
   Layout Propagation Modal
   ============================================== */
.layout-propagation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.layout-propagation-modal {
    background: linear-gradient(135deg, #1e2230 0%, #171a24 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 1px rgba(255, 255, 255, 0.1) inset;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

.layout-propagation-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.layout-propagation-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.layout-propagation-modal-icon {
    font-size: 1.25rem;
}

.layout-propagation-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.layout-propagation-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.layout-propagation-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.layout-propagation-entity-context {
    margin: 0 0 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.propagation-entity-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: #93c5fd;
}

.layout-propagation-description {
    margin: 0 0 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.layout-propagation-question {
    margin: 0 0 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.layout-propagation-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layout-propagation-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layout-propagation-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.layout-propagation-option:has(input:checked) {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
}

.layout-propagation-option input[type="radio"] {
    margin: 2px 0 0 0;
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.layout-propagation-option-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.layout-propagation-option-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.layout-propagation-option-icon {
    font-size: 1rem;
}

.layout-propagation-option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Entity Preview Table */
.propagation-entity-preview {
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.propagation-preview-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.propagation-preview-table-wrapper {
    max-height: 200px;
    overflow-y: auto;
}

.propagation-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.propagation-preview-table th {
    position: sticky;
    top: 0;
    background: rgba(30, 30, 40, 0.98);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.propagation-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.propagation-preview-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.propagation-entity-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.propagation-entity-type {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.propagation-entity-name {
    color: var(--text-primary);
    font-weight: 500;
}

.propagation-value-cell {
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.7rem;
}

.propagation-current-value {
    color: var(--text-muted);
}

.propagation-expected-value {
    color: #60a5fa;
}

.propagation-change-cell {
    text-align: center;
    width: 30px;
    font-size: 0.9rem;
}

.propagation-row--will-change .propagation-change-cell {
    color: #fbbf24;
}

.propagation-row--unchanged .propagation-change-cell {
    color: #4ade80;
    opacity: 0.6;
}

.propagation-row--will-change {
    background: rgba(251, 191, 36, 0.05);
}

.propagation-row--more .propagation-more-cell {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px;
}

.propagation-custom-badge {
    display: inline-block;
    font-size: 0.55rem;
    padding: 1px 4px;
    margin-left: 4px;
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 3px;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    vertical-align: middle;
}

/* Specific change display */
.propagation-changes-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px !important;
}

.propagation-change-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.propagation-row--will-change .propagation-change-icon {
    color: #fbbf24;
}

.propagation-row--unchanged .propagation-change-icon {
    color: #4ade80;
    opacity: 0.6;
}

.propagation-changes-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.propagation-change-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-family: 'SF Mono', Monaco, monospace;
}

.change-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.change-from {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7rem;
}

.change-from--positive {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.change-from--negative {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.change-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.change-to {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7rem;
}

.change-to--positive {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #4ade80;
}

.change-to--negative {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #f87171;
}

.propagation-more-changes {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 4px;
}

.propagation-no-change {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Propagation preview header buttons */
.propagation-copy-btn,
.propagation-expand-btn {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 8px;
}

.propagation-copy-btn:hover,
.propagation-expand-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

/* Debug details accordion */
.propagation-debug-details {
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
}

.propagation-debug-details summary {
    padding: 8px 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    outline: none;
    transition: all 0.15s ease;
}

.propagation-debug-details summary:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.propagation-debug-details[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.propagation-debug-pre {
    margin: 0;
    padding: 12px;
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    font-size: 0.68rem;
    line-height: 1.5;
    color: #a0a0a0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
}

/* Code blocks in debug pre */
.propagation-debug-pre code {
    color: #93c5fd;
}

/* Make header flex properly with buttons */
.propagation-preview-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.propagation-preview-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: auto;
}

.layout-propagation-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.layout-propagation-modal-actions {
    display: flex;
    gap: 10px;
}

.layout-propagation-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.layout-propagation-btn-icon {
    font-size: 1rem;
}

.layout-propagation-btn--cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.layout-propagation-btn--cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.layout-propagation-btn--save {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

.layout-propagation-btn--save:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(59, 130, 246, 0.3));
    border-color: rgba(59, 130, 246, 0.7);
}

.layout-propagation-btn--copy {
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.2), rgba(147, 197, 253, 0.1));
    border: 1px solid rgba(147, 197, 253, 0.3);
    color: #93c5fd;
}

.layout-propagation-btn--copy:hover {
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.3), rgba(147, 197, 253, 0.2));
    border-color: rgba(147, 197, 253, 0.5);
}

/* Propagation Analysis Sections */
.propagation-analysis {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.propagation-analysis--empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.propagation-debug-info {
    font-size: 0.625rem;
    color: var(--text-muted);
    opacity: 0.7;
    font-style: normal;
    word-break: break-all;
}

.analysis-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.analysis-row + .analysis-row {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
    margin-top: 4px;
}

.analysis-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}

.analysis-text {
    line-height: 1.4;
}

.analysis-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.analysis-row--unchanged .analysis-text {
    color: #93c5fd;
}

.analysis-row--warning .analysis-text {
    color: #fbbf24;
}

.analysis-row--locked .analysis-text {
    color: #f87171;
}

/* Propagation Error Modal Variations */
.layout-propagation-modal--error {
    border-color: rgba(239, 68, 68, 0.5);
}

.layout-propagation-modal-header--error {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-bottom-color: rgba(239, 68, 68, 0.3);
}

.layout-propagation-description--error {
    color: #f87171;
}

.propagation-error-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.propagation-error-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
}

.propagation-error-type {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #f87171;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.propagation-error-message {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.propagation-error-entities {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.propagation-error-entities strong {
    color: var(--text-muted);
}

.propagation-error-details {
    margin-top: 16px;
}

.propagation-error-details summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 0;
}

.propagation-error-details summary:hover {
    color: var(--text-secondary);
}

.propagation-error-json {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    font-size: 0.6875rem;
    color: #a5f3fc;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Verification loading state */
.layout-propagation-verification {
    padding: 40px 20px;
    text-align: center;
}

.verification-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.verification-icon {
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.verification-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =============================================
   Propagation Verification Modal - Tabbed Layout
   ============================================= */
.propagation-modal-body--tabs {
    display: flex;
    flex-direction: column;
    max-height: 60vh;
}

.propagation-tabs {
    display: flex;
    gap: 2px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-primary);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.propagation-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

.propagation-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.propagation-tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.propagation-tab-content {
    display: none;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.propagation-tab-content--active {
    display: block;
}

/* Summary Tab */
.propagation-summary {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.propagation-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.propagation-summary-row:last-child {
    border-bottom: none;
}

.propagation-summary-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.propagation-summary-value {
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.propagation-mode-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    text-transform: uppercase;
}

.propagation-mode-badge--cascade {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.propagation-mode-badge--preserve {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.propagation-mode-badge--reset {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Errors & Warnings Sections */
.propagation-errors-section,
.propagation-warnings-section {
    margin-top: 16px;
}

.propagation-section-title {
    font-size: 0.8125rem;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.propagation-section-title--error {
    color: #f87171;
}

.propagation-section-title--warning {
    color: #fbbf24;
}

.propagation-warning-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.propagation-warning-item {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    padding: 10px;
}

.propagation-warning-type {
    font-size: 0.625rem;
    font-weight: 600;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.propagation-warning-message {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.propagation-warning-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

.propagation-error-entities-detail {
    margin-top: 8px;
}

.propagation-error-entities-detail summary {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.propagation-affected-list {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.propagation-more {
    color: var(--text-muted);
    font-style: italic;
}

/* Changes Tab */
.propagation-changes-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.propagation-change-stat {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.propagation-change-stat--changed {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.propagation-change-stat--unchanged {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.propagation-changes-group {
    margin-bottom: 12px;
}

.propagation-changes-group summary {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 0;
}

.propagation-changes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.propagation-change-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
}

.propagation-change-entity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.propagation-entity-icon {
    font-size: 1rem;
}

.propagation-entity-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.propagation-entity-type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
}

.propagation-change-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.propagation-before {
    color: var(--text-muted);
    text-decoration: line-through;
}

.propagation-arrow {
    color: var(--accent);
}

.propagation-after {
    color: #4ade80;
}

/* Hierarchy Tab */
.propagation-hierarchy-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.propagation-type-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.propagation-type-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
}

.propagation-type-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.propagation-type-icon {
    font-size: 1rem;
}

.propagation-type-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.propagation-type-count {
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.propagation-custom-badge {
    font-size: 0.625rem;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.propagation-entity-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.propagation-entity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.propagation-entity-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.propagation-entity-item--custom {
    background: rgba(251, 191, 36, 0.08);
}

.propagation-entity-id {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.propagation-custom-indicator,
.propagation-inherited-indicator {
    margin-left: auto;
    font-size: 0.875rem;
}

/* Expected Values Tab */
.propagation-expected-values {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
}

.propagation-expected-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.propagation-expected-stat:last-of-type {
    border-bottom: none;
}

.propagation-expected-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.propagation-expected-value {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.propagation-expected-detail {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}

.propagation-expected-detail summary {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.propagation-expected-json {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    font-size: 0.6875rem;
    color: #a5f3fc;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.propagation-no-data {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Modal variant for verification */
.layout-propagation-modal--verification {
    max-width: 650px;
    min-height: 400px;
}

.layout-propagation-modal-header--success {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-bottom-color: rgba(34, 197, 94, 0.3);
}

/* ==============================================
   Layout Row State Indicators
   ============================================== */
/* Row state badge for inherited/custom/locked status */
.layout-row-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.layout-row-state--inherited {
    background: rgba(147, 197, 253, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(147, 197, 253, 0.3);
}

.layout-row-state--custom {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.layout-row-state--locked {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.layout-row-state--default {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Reset to Default button */
.layout-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 8px;
}

.layout-reset-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.layout-reset-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================================
   Google Auth Panel (within Auth section)
   Compartmentalized OAuth UI
   ============================================== */

.google-auth-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.admin-subsection-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    user-select: none;
}

.admin-subsection-toggle::-webkit-details-marker {
    display: none;
}

.google-auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.google-auth-title {
    flex: 1;
}

.google-auth-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.google-auth-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.google-auth-status--checking .google-auth-status-dot,
.google-auth-status--unknown {
    background: var(--badge-bg);
    animation: pulse 1.5s ease-in-out infinite;
}

.google-auth-status--authenticated {
    background: var(--success-color);
    box-shadow: 0 0 6px var(--success-color);
}

.google-auth-status--unauthenticated {
    background: var(--text-muted);
}

.google-auth-status--error {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.google-auth-content {
    padding: 0 14px 14px 14px;
}

.google-auth-user-info {
    margin-bottom: 12px;
}

.google-auth-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-accent);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.google-auth-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.google-auth-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.google-auth-user-initials {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.google-auth-user-details {
    flex: 1;
    min-width: 0;
}

.google-auth-user-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.google-auth-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.google-auth-user-tier {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.google-auth-user-tier code {
    background: var(--bg-secondary);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
}

.google-auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.google-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.google-auth-btn svg {
    flex-shrink: 0;
}

.google-auth-btn--primary {
    background: #4285F4;
    color: white;
}

.google-auth-btn--primary:hover {
    background: #3367d6;
}

.google-auth-btn--primary:disabled {
    background: #6b7280;
    cursor: wait;
}

.google-auth-btn--secondary {
    background: var(--bg-accent);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.google-auth-btn--secondary:hover {
    background: var(--panel-hover);
}

.google-auth-btn--tertiary {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.75rem;
}

.google-auth-btn--tertiary:hover {
    color: var(--text-primary);
    background: var(--bg-accent);
}

.google-auth-debug {
    margin-top: 4px;
}

.google-auth-debug-details {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.google-auth-debug-details > summary {
    padding: 6px 10px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.google-auth-debug-content {
    padding: 8px 10px;
    font-size: 0.75rem;
}

.google-auth-debug-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.google-auth-debug-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.google-auth-debug-value {
    color: var(--accent-color);
    font-family: 'Consolas', monospace;
    font-size: 0.6875rem;
}

.google-auth-debug-json {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.625rem;
    color: #0f0;
    max-height: 150px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==============================================
   Entity Chat Drawer (Right Side Panel)
   ============================================== */
.entity-chat-drawer {
    position: fixed;
    top: 80px; /* Below fixed header */
    right: 0;
    bottom: 0;
    width: var(--entity-chat-width);
    background: rgba(22, 24, 32, 0.98);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: var(--chat-z-index, 900);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.entity-chat-drawer[aria-hidden="false"] {
    transform: translateX(0);
}

/* Adjust for offline banner */
body.has-offline-banner .entity-chat-drawer {
    top: 108px;
}

/* Header */
.entity-chat-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(30, 32, 42, 0.9);
    flex-shrink: 0;
}

.entity-chat-drawer__entity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.entity-chat-drawer__badge {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.entity-chat-drawer__info {
    min-width: 0;
    flex: 1;
}

.entity-chat-drawer__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-chat-drawer__type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entity-chat-drawer__close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.entity-chat-drawer__close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.entity-chat-drawer__header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.entity-chat-drawer__refresh {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, transform 0.3s;
    flex-shrink: 0;
}
.entity-chat-drawer__refresh:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}
.entity-chat-drawer__refresh--spinning svg {
    animation: chat-refresh-spin 0.6s linear;
}
@keyframes chat-refresh-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.entity-chat-drawer__status {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2px 12px;
    min-height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Messages area */
.entity-chat-drawer__messages {
    flex: 1;
    overflow-y: auto;
    padding: 50px 40px 16px 16px; /* Top padding for first-message popup clearance, extra right for scrollbar */
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-left: 10px solid rgba(153, 161, 212, 0.2);
    border-right: 20px solid rgba(153, 161, 212, 0.2);
    background:
        radial-gradient(circle, var(--chat-dot-color, rgba(255, 255, 255, 0.06)) 1px, transparent 1px);
    background-size: 18px 18px;
}

/* Empty state */
.entity-chat-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    flex: 1;
}

.entity-chat-drawer__empty-text {
    font-size: 0.875rem;
    margin: 12px 0 4px;
    color: var(--text-secondary);
}

.entity-chat-drawer__empty-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Hide empty when messages exist */
.entity-chat-drawer__messages:has(.entity-chat-message) .entity-chat-drawer__empty {
    display: none;
}

/* Message bubbles */
.entity-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.entity-chat-message--outgoing {
    align-self: flex-end;
}

.entity-chat-message--incoming {
    align-self: flex-start;
}

.entity-chat-message__sender {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 0 4px;
}

.entity-chat-message--outgoing .entity-chat-message__sender {
    text-align: right;
}

.entity-chat-message__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.8125rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.entity-chat-message--outgoing .entity-chat-message__bubble {
    background: var(--accent-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.entity-chat-message--incoming .entity-chat-message__bubble {
    background: rgba(60, 65, 80, 0.8);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.entity-chat-message__time {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.entity-chat-message--outgoing .entity-chat-message__time {
    text-align: right;
}

.entity-chat-message__edited {
    font-style: italic;
    opacity: 0.7;
}

/* Meta row (time + reply count) */
.entity-chat-message__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
}

.entity-chat-message__meta .entity-chat-message__time {
    margin-top: 0;
    padding: 0;
}

.entity-chat-message--outgoing .entity-chat-message__meta {
    justify-content: flex-end;
}

/* Reply count badge */
.entity-chat-message__reply-count {
    font-size: 0.625rem;
    color: var(--accent-blue, #4ea4f6);
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.entity-chat-message__reply-count:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Reply thread panel */
.entity-chat-reply-thread {
    margin-top: 6px;
    padding: 6px 10px;
    border-left: 2px solid var(--accent-blue, #4ea4f6);
    border-radius: 0 6px 6px 0;
    background: rgba(78, 164, 246, 0.06);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.entity-chat-reply-thread__item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.entity-chat-reply-thread__item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.entity-chat-reply-thread__sender {
    font-weight: 600;
    color: var(--accent-blue, #4ea4f6);
    flex-shrink: 0;
}

.entity-chat-reply-thread__text {
    color: var(--text-primary, #e0e0e0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.entity-chat-reply-thread__time {
    font-size: 0.6rem;
    color: var(--text-muted, #888);
    flex-shrink: 0;
    margin-left: auto;
}

/* Deleted message styling */
.entity-chat-message--deleted .entity-chat-message__bubble--deleted {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.85em;
    padding: 8px 12px;
}

.entity-chat-message--deleted .entity-chat-message__bubble--deleted svg {
    opacity: 0.5;
}

/* Message actions popup */
.entity-chat-message__actions {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(30, 32, 42, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3px 5px;
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

/* Show actions on hover (trigger is the bubble, not the full row) */
.entity-chat-message__bubble:hover > .entity-chat-message__actions,
.entity-chat-message--actions-open .entity-chat-message__actions {
    display: flex;
}

.entity-chat-message__action {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.15s;
    color: var(--text-secondary);
}

.entity-chat-message__action:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.15);
}

.entity-chat-message__action--edit,
.entity-chat-message__action--delete {
    font-size: 0.7rem;
}

.entity-chat-message__action--delete:hover {
    background: rgba(248, 81, 73, 0.2);
    color: #f85149;
}

.entity-chat-message {
    position: relative;
}

.entity-chat-message__bubble {
    position: relative;
    cursor: pointer;
}

.entity-chat-message--outgoing .entity-chat-message__actions {
    right: 0;
}

.entity-chat-message--incoming .entity-chat-message__actions {
    right: 0;
}

/* Selected message visual state (mobile) */
.entity-chat-message--selected .entity-chat-message__bubble {
    outline: 2px solid var(--accent-blue, #4a9eff);
    outline-offset: 2px;
    background: rgba(74, 158, 255, 0.08);
}

/* Mobile top action bar */
.entity-chat-mobile-action-bar {
    display: none; /* shown dynamically via JS hidden attribute + mobile CSS */
}

/* Ensure last message has room for actions popup below */
.entity-chat-message:last-child {
    margin-bottom: 40px;
}

/* Reply quote inside message bubble */
.entity-chat-message__reply-quote {
    background: rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
    padding: 5px 8px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    line-height: 1.35;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 100%;
    overflow: hidden;
}

.entity-chat-message--outgoing .entity-chat-message__reply-quote {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.6);
}

.entity-chat-message__reply-sender {
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--accent-blue);
}

.entity-chat-message--outgoing .entity-chat-message__reply-sender {
    color: rgba(255, 255, 255, 0.85);
}

.entity-chat-message__reply-text {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-chat-message--outgoing .entity-chat-message__reply-text {
    color: rgba(255, 255, 255, 0.65);
}

/* Reply action button */
.entity-chat-message__action--reply {
    font-size: 0.7rem;
}

/* Highlight flash when scrolling to a replied-to message */
.entity-chat-message--highlighted .entity-chat-message__bubble {
    animation: chatReplyHighlight 1.5s ease;
}

@keyframes chatReplyHighlight {
    0%, 20% { box-shadow: 0 0 0 2px var(--accent-blue); }
    100% { box-shadow: none; }
}

/* Reply preview banner above composer */
.entity-chat-reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(30, 32, 42, 0.95);
    border-left: 3px solid var(--accent-blue);
    flex-shrink: 0;
}

.entity-chat-reply-preview__content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.entity-chat-reply-preview__icon {
    color: var(--accent-blue);
    flex-shrink: 0;
}

.entity-chat-reply-preview__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.entity-chat-reply-preview__sender {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.entity-chat-reply-preview__msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-chat-reply-preview__cancel {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.entity-chat-reply-preview__cancel:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Composer area */
.entity-chat-drawer__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(30, 32, 42, 0.9);
    flex-shrink: 0;
}

.entity-chat-drawer__input {
    flex: 1;
    background: rgba(50, 55, 70, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.8125rem;
    color: var(--text-primary);
    resize: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color 0.2s;
}

.entity-chat-drawer__input::placeholder {
    color: var(--text-muted);
}

.entity-chat-drawer__input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.entity-chat-drawer__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, opacity 0.2s, transform 0.15s;
}

.entity-chat-drawer__send:hover:not(:disabled) {
    background: #5ba3ff;
    transform: scale(1.05);
}

.entity-chat-drawer__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chat trigger button (appears in entity context) */
.entity-chat-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 6px;
    color: var(--accent-blue);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.entity-chat-trigger:hover {
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.5);
}

.entity-chat-trigger svg {
    flex-shrink: 0;
}

.entity-chat-trigger__label {
    white-space: nowrap;
}

/* ==============================================
   Entity Chat Handle (Right Edge Tab)
   ============================================== */
.entity-chat-handle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--entity-chat-handle-width);
    height: 120px;
    background: rgba(30, 32, 42, 0.95);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 12px 0 0 12px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 901;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.25);
    transition: right 0.3s ease, transform 0.2s, opacity 0.2s, background 0.2s;
}

.entity-chat-handle__icon {
    opacity: 0.9;
}

.entity-chat-handle__badge {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.entity-chat-handle__label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.entity-chat-handle:hover {
    background: rgba(40, 44, 58, 0.98);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35);
}

.entity-chat-handle:hover .entity-chat-handle__icon {
    filter: drop-shadow(0 0 4px rgba(74, 158, 255, 0.5));
}

.entity-chat-handle:active {
    transform: translateY(-50%) scale(0.98);
}

/* Hide handle when no entity selected (root level) */
.entity-chat-handle--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(100%);
}

/* Move handle to drawer edge when open */
body.entity-chat-open .entity-chat-handle {
    right: var(--entity-chat-width);
}

/* Unread count badge on handle */
.entity-chat-handle__unread {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #f85149;
    border-radius: 9px;
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.entity-chat-handle__unread:not(:empty) {
    display: flex;
}

/* ==============================================
   Desktop Content Reflow When Chat Open
   ============================================== */
/* Desktop reflow — excluded for compact landscape (phone in landscape = touch + short viewport) */
@media (min-width: 701px) and (not ((pointer: coarse) and (max-height: 500px) and (orientation: landscape))) {
    body.entity-chat-open {
        padding-right: calc(var(--entity-chat-width) + 16px);
    }
    
    body.entity-chat-open .panel-left {
        /* Shift bottom panel left to account for drawer */
        left: calc(50% - var(--entity-chat-width) / 2);
    }
}

/* ==============================================
   Mobile Chat Handle
   Also applies in compact landscape: phone rotated (coarse pointer + short height)
   ============================================== */
@media (max-width: 700px), ((pointer: coarse) and (max-height: 500px) and (orientation: landscape)) {
    .entity-chat-handle {
        width: 40px;
        height: 100px;
        gap: 6px;
    }

    .entity-chat-handle__icon svg {
        width: 20px;
        height: 20px;
    }

    .entity-chat-handle__badge {
        font-size: 0.625rem;
        padding: 2px 4px;
    }

    .entity-chat-handle__label {
        font-size: 0.5625rem;
    }
}

/* ==============================================
   Entity Chat Drawer — Compact Mode
   Portrait mobile (≤700px) OR phone landscape (coarse pointer + short height)
   ============================================== */
@media (max-width: 700px), ((pointer: coarse) and (max-height: 500px) and (orientation: landscape)) {
    .entity-chat-drawer {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        border-left: none;
        border-radius: 0;
        transform: translateY(100%);
        z-index: 9999; /* Above everything on mobile */
    }

    .entity-chat-drawer[aria-hidden="false"] {
        transform: translateY(0);
    }
    
    body.has-offline-banner .entity-chat-drawer {
        top: 0; /* Full screen on mobile */
    }

    .entity-chat-drawer__header {
        padding: 14px 16px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }

    .entity-chat-drawer__close {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    .entity-chat-drawer__messages {
        padding: 16px 12px;
        border-left: none;
        border-right: none;
        overscroll-behavior: contain;
    }

    .entity-chat-message {
        max-width: 90%;
    }

    .entity-chat-drawer__composer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        overflow: hidden; /* Prevent horizontal overflow on narrow viewports */
    }

    .entity-chat-drawer__input {
        font-size: 16px; /* ≥16px prevents iOS Safari auto-zoom on focus */
        min-width: 0;    /* Allow flex shrink below intrinsic width */
    }

    /* Disable hover-triggered actions on mobile — use explicit tap only */
    .entity-chat-message__bubble:hover > .entity-chat-message__actions {
        display: none;
    }
    /* Suppress near-message action popup entirely on mobile — use top action bar instead */
    .entity-chat-message--actions-open .entity-chat-message__actions {
        display: none;
    }

    /* Mobile top action bar — shown between header and messages */
    .entity-chat-mobile-action-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: rgba(74, 158, 255, 0.12);
        border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
        flex-shrink: 0;
    }

    .entity-chat-mobile-action-bar[hidden] {
        display: none;
    }

    .entity-chat-mobile-action-bar__cancel {
        width: 36px;
        height: 36px;
        border: none;
        background: transparent;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary, #aaa);
        flex-shrink: 0;
    }

    .entity-chat-mobile-action-bar__cancel:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .entity-chat-mobile-action-bar__label {
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--text-primary, #fff);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        flex: 1;
    }

    .entity-chat-mobile-action-bar__actions {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .entity-chat-mobile-action-bar__btn {
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        color: var(--text-secondary, #aaa);
        transition: background 0.15s;
    }

    .entity-chat-mobile-action-bar__btn--labeled {
        width: auto;
        height: auto;
        border-radius: 8px;
        flex-direction: column;
        gap: 2px;
        padding: 4px 8px;
    }

    .entity-chat-mobile-action-bar__btn-label {
        font-size: 0.6rem;
        line-height: 1;
        color: var(--text-secondary, #aaa);
        font-weight: 500;
    }

    .entity-chat-mobile-action-bar__btn:active {
        background: rgba(255, 255, 255, 0.12);
    }

    .entity-chat-mobile-action-bar__btn--delete:active {
        background: rgba(248, 81, 73, 0.2);
        color: #f85149;
    }
}

/* ==============================================
   Mobile Virtual Keyboard Compensation
   ============================================== */
@media (max-width: 700px), ((pointer: coarse) and (max-height: 500px) and (orientation: landscape)) {
    body.entity-chat-keyboard-open .entity-chat-drawer {
        height: var(--chat-viewport-height, 100dvh);
        top: var(--chat-viewport-offset, 0px);
        transition: height 0.1s ease-out, top 0.1s ease-out, transform 0.3s ease;
    }

    body.entity-chat-keyboard-open .entity-chat-drawer__messages {
        /* Ensure messages area shrinks so composer stays visible */
        min-height: 0;
    }
}

/* ==============================================
   Entity Chat — Permission States
   ============================================== */
.entity-chat-denied {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    flex: 1;
    min-height: 0;
}

.entity-chat-denied__icon {
    font-size: 2.5rem;
    opacity: 0.6;
}

.entity-chat-denied__text {
    font-size: 0.875rem;
    color: var(--text-muted, #888);
    line-height: 1.5;
    max-width: 260px;
}

.entity-chat-readonly-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    color: var(--text-secondary, #ccc);
    background: rgba(74, 158, 255, 0.08);
    border-bottom: 1px solid rgba(74, 158, 255, 0.15);
    flex-shrink: 0;
}

/* ============================================================================
   Input Modules — Component Showcase
   ============================================================================
   CONTAINERIZATION CONTRACT (virtual encapsulation)
   ----------------------------------------------------------------------------
   Input modules are TREATED AS SELF-CONTAINED COMPONENTS even though they share
   global CSS. The container is "virtual": enforced by convention, not by Shadow
   DOM. Every rule below is part of the module's own surface — nothing outside
   this section may style module internals, and module rules may not depend on
   anything painted by hosts (details panel, slot shell, showcase page).

   ALLOWED in this section:
     • Selectors prefixed `.input-module-`, `.im-c-module-`, `.im-`,
       `.im-outer-`, `.im-inner-`, `.im-tri-`, `.im-rsp-`, `.im-lock-`.
     • Container queries against `container-name: im-inner` / `im-outer`.
     • Tokens consumed from the `:root` block immediately below.

   FORBIDDEN — adding any of these is "drift" and breaks containerization:
     ✗ Selectors that combine a host class with a module class, e.g.
         `.dlv1-slot-module-shell .im-c-module-embedded { … }`
         `.details-panel .input-module-input-json { … }`
       If a module needs to look different in a host, expose a
       data-attribute on the module root (e.g. `data-im-density="embedded"`)
       and style THAT here. Hosts must never reach in.
     ✗ Module styles outside this section (anywhere else in sports.css, or in
       details-panel.css, or inline in HTML/JS). If you find one, move it here.
     ✗ Hard-coded literals already covered by an `--im-*` token. Use the token
       so a single skin change propagates everywhere.
     ✗ New container variants without a token entry. If you add a variant that
       needs a new border/radius/padding, add the token first, then reference it.
     ✗ Inline `style=""` on rendered module elements (input-modules.js). The
       styles live HERE so they cache once and lint cleanly. The HTML carries
       only class names and `data-im-*` state attributes.
     ✗ `!important` to win over a host. If you need it, the host is reaching in
       — fix the host instead.

   When Copilot is asked to "make this module look different in <host>" or
   "tweak the embedded variant from the slot shell" — STOP. The correct answer
   is almost always: add a `data-im-*` modifier on the module and a rule HERE.

   See: 0-Notes/Apps/Sports/Active/MODULE_CONTAINERIZATION_AUDIT_2026-04-22.md
   ============================================================================ */

/* ---- Input-module design tokens ----
   Single source of truth for module framing. Values preserve current visuals;
   downstream rules reference these so future skin changes are a one-line edit.
   DO NOT add new container variants without first adding their tokens here.
   DO NOT duplicate these tokens in JS or other CSS files — reference them. */
:root {
    --im-widget-width: 200px;
    --im-frame-radius: 8px;
    --im-frame-radius-sm: 6px;
    --im-frame-padding: 10px 12px;
    --im-frame-padding-sm: 8px 10px;
    --im-frame-border: 1px solid rgba(125, 211, 252, 0.14);
    --im-frame-border-emph: 1px solid rgba(125, 211, 252, 0.25);
    --im-frame-border-child: 1px solid rgba(125, 211, 252, 0.15);
    --im-frame-border-dashed: 1px dashed rgba(148, 163, 184, 0.35);
    --im-frame-bg: rgba(15, 23, 42, 0.38);
    --im-frame-bg-subtle: rgba(15, 23, 42, 0.25);
    --im-frame-bg-child: rgba(30, 41, 59, 0.35);
    --im-label-color: #93c5fd;
    --im-label-size: 0.58rem;
    --im-label-size-sm: 0.5rem;
}

.input-module-panel {
    display: grid;
    grid-template-columns: 1fr var(--im-widget-width) 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    width: 100%;
    min-width: 0;
}

.input-module-input-desc {
    justify-self: end;
    max-width: 280px;
    min-width: 0;
}

.input-module-input-json {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: #f97316;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(249, 115, 22, 0.12);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
    text-align: left;
}

/* Editable JSON input (contenteditable) */
.im-input-editable {
    outline: none;
    cursor: text;
    transition: border-color 0.15s ease;
}

.im-input-editable:focus {
    border-color: rgba(249, 115, 22, 0.45);
}

.im-input-editable--error {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.15);
}

/* Outer input editable */
.im-outer-input-json.im-input-editable:focus {
    border-color: rgba(251, 191, 36, 0.45);
}

.im-input-btn-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.im-input-apply-btn {
    padding: 2px 10px;
    font-size: 0.575rem;
    font-weight: 600;
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.08);
    border: 1px solid rgba(147, 197, 253, 0.25);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.im-input-apply-btn:hover {
    background: rgba(147, 197, 253, 0.16);
    border-color: rgba(147, 197, 253, 0.4);
}

.im-input-reset-btn {
    padding: 2px 10px;
    font-size: 0.575rem;
    font-weight: 600;
    color: #f87171;
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.im-input-reset-btn:hover {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.4);
}

.input-module-widget {
    width: 100%;
}

.input-module-widget-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--im-widget-width);
    min-width: var(--im-widget-width);
    max-width: var(--im-widget-width);
    box-sizing: border-box;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--im-frame-radius);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

/* Flow arrows: input desc --> [box] --> output */
.input-module-widget-area::before,
.input-module-widget-area::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 12px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.input-module-widget-area::before {
    right: 100%;
}

.input-module-widget-area::after {
    left: 100%;
}

.input-module-output {
    justify-self: start;
    max-width: 280px;
    min-width: 0;
    box-sizing: border-box;
    display: none;
    margin: 0;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: #a5f3fc;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(165, 243, 252, 0.12);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
    text-align: left;
}

.input-module-output--visible {
    display: block;
    animation: imFadeIn 0.25s ease;
}

@keyframes imFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Locked state — post-transaction (interaction disabled, no visual change) */
.input-module--locked {
    pointer-events: none;
}

.dlv1-slot-module-shell .input-module--readonly-surface {
    opacity: 0.72;
}

.input-module-refresh-btn {
    margin: 8px 0 4px;
    padding: 5px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.input-module-refresh-btn:hover {
    background: rgba(249, 115, 22, 0.2);
    border-color: rgba(249, 115, 22, 0.5);
}

/* Inner tabs scoping — prevent bubble to parent layout-tabs */
.im-tabs {
    margin-bottom: 12px;
}

/* Collapsible module sub-sections */
.im-module-block {
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.im-module-block[open] {
    border-color: rgba(249, 115, 22, 0.2);
}

.im-module-summary {
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #d1d5db);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    transition: background 0.15s ease;
}

.im-module-summary-text {
    flex: 1 1 auto;
    min-width: 0;
}

.im-module-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    background: rgba(14, 116, 144, 0.16);
    color: #7dd3fc;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.im-module-id-badge--c {
    border-color: rgba(249, 115, 22, 0.28);
    background: rgba(154, 52, 18, 0.18);
    color: #fdba74;
}

.im-module-summary::-webkit-details-marker {
    display: none;
}

.im-module-summary::before {
    content: '▸';
    font-size: 0.625rem;
    color: var(--text-muted, #6b7280);
    transition: transform 0.15s ease;
}

.im-module-block[open] > .im-module-summary::before {
    transform: rotate(90deg);
}

.im-module-summary:hover {
    background: rgba(255, 255, 255, 0.03);
}

.im-module-block[open] > .im-module-summary {
    color: #f97316;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.im-module-body {
    padding: 10px 12px;
}

/* =============================================
   Input Modules — SP Tri-Toggle (independent)
   ============================================= */

.im-tri-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    position: relative;
}

.im-tri-row-input {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 18px;
    background: rgba(100, 100, 100, 0.4);
    border-radius: 9px;
    outline: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.im-tri-row-input[data-value="0"] {
    background: rgba(100, 100, 100, 0.4);
}

.im-tri-row-input[data-value="1"][data-inherit="false"] {
    background: rgba(100, 100, 100, 0.3);
}

.im-tri-row-input[data-value="1"][data-inherit="true"] {
    background: rgba(76, 175, 80, 0.3);
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="false"] {
    background: rgba(100, 100, 100, 0.3);
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="true"] {
    background: rgba(76, 175, 80, 0.3);
}

.im-tri-row-input[data-value="2"] {
    background: rgba(76, 175, 80, 0.4);
}

.im-tri-row-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #888;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.im-tri-row-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #888;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.im-tri-row-input[data-value="2"]::-webkit-slider-thumb {
    background: #4caf50;
}

.im-tri-row-input[data-value="2"]::-moz-range-thumb {
    background: #4caf50;
}

.im-tri-row-input[data-value="1"][data-inherit="true"]::-webkit-slider-thumb {
    background: #4caf50;
}

.im-tri-row-input[data-value="1"][data-inherit="true"]::-moz-range-thumb {
    background: #4caf50;
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="false"]::-webkit-slider-thumb {
    background: #888;
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="false"]::-moz-range-thumb {
    background: #888;
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="true"]::-webkit-slider-thumb {
    background: #4caf50;
}

.im-tri-row-input[data-value="1"][data-resolved-value-state="true"]::-moz-range-thumb {
    background: #4caf50;
}

.im-tri-row-caption {
    display: block;
    font-size: 0.55rem;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
}

/* =============================================
   Input Modules — RSP Tri-Toggle (independent)
   ============================================= */

.im-rsp-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    opacity: 0.6;
    pointer-events: none;
    z-index: 2;
    top: 6px;
    transition: opacity 0.2s ease;
}

.im-rsp-dot--left {
    left: calc(50% - 18px);
}

.im-rsp-dot--right {
    left: calc(50% + 12px);
}

.im-rsp-widget {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.im-rsp-caption-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.im-rsp-context-note {
    grid-column: 1 / -1;
    margin-top: 3px;
    text-align: center;
    font-size: 0.54rem;
    color: #93c5fd;
    opacity: 0.85;
}

.im-rsp-caption-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    padding: 0 8px;
    position: relative;
    cursor: pointer;
}

.im-rsp-caption-col + .im-rsp-caption-col::before {
    content: '|';
    position: absolute;
    left: 0;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: #6b7280;
    pointer-events: none;
}

.im-rsp-caption-label {
    font-size: 0.55rem;
    color: #6b7280;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0;
    pointer-events: none;
}

.input-policy-radio-caption-col--selected .im-rsp-caption-label {
    font-weight: 700;
}

.im-rsp-caption-banner {
    display: block;
    text-align: center;
    font-size: 0.55rem;
    color: #6b7280;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 3px;
}

.im-rsp-radio {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    border: 1px solid rgba(125, 211, 252, 0.5);
    background: transparent;
    flex-shrink: 0;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.im-rsp-caption-col:hover .im-rsp-radio,
.im-rsp-radio:hover {
    transform: scale(2);
    box-shadow: 0 0 3px rgba(125, 211, 252, 0.4);
}

.im-rsp-radio--active {
    background: #7dd3fc;
    border-color: #7dd3fc;
}

/* =============================================
   Input Modules — Lock/Unlock Toggle
   ============================================= */

.im-lock-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.im-lock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    padding: 0;
}

.im-lock-btn:hover {
    border-color: rgba(125, 211, 252, 0.25);
    transform: scale(1.05);
}

.im-lock-btn--locked {
    border-color: rgba(251, 191, 36, 0.4);
}

.im-lock-btn--locked:hover {
    border-color: rgba(251, 191, 36, 0.6);
}

.im-lock-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.im-lock-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.input-module--locked .im-lock-btn {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.im-lock-choice-popover {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 132px;
    padding: 4px;
    border: 1px solid rgba(125, 211, 252, 0.26);
    border-radius: 8px;
    background: rgba(22, 33, 62, 0.98);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -3px) scale(0.96);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.im-lock-choice-popover.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
}

.im-lock-choice-option {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
}

.im-lock-choice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 0.75rem;
    line-height: 1;
}

.im-lock-choice-label {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.im-lock-choice-option:hover,
.im-lock-choice-option:focus-visible {
    border-color: rgba(125, 211, 252, 0.5);
    background: rgba(125, 211, 252, 0.14);
    color: var(--text-primary);
    outline: none;
}

.im-lock-choice-option--reset {
    border-color: rgba(251, 191, 36, 0.28);
    color: #facc15;
}

/* — Small variant (for inline / table-cell contexts) */
.im-lock-btn--sm {
    width: 24px;
    height: 24px;
    border-width: 1.5px;
    border-radius: 6px;
}

.im-lock-btn--sm .im-lock-icon {
    font-size: 0.8rem;
}

/* — Ancestor-locked state (red, disabled by inherited policy) */
.im-lock-btn--ancestor-locked {
    border-color: rgba(244, 67, 54, 0.5);
    cursor: not-allowed;
    opacity: 0.7;
}

.im-lock-btn--ancestor-locked:hover {
    border-color: rgba(244, 67, 54, 0.5);
    background: none;
    transform: none;
}

/* — Pending state (optimistic UI: server response in flight) */
/* Button itself looks fully settled (locked/unlocked already shows the new state). */
/* A small spinner appears next to it until the server confirms. */
.im-lock-btn--pending {
    position: relative;
}

.im-lock-btn--pending::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(125, 211, 252, 0.25);
    border-top-color: rgba(125, 211, 252, 0.95);
    transform: translate(-50%, -50%);
    animation: im-lock-btn-pending-spin 0.7s linear infinite;
    pointer-events: none;
}

.im-lock-btn--pending .im-lock-icon {
    opacity: 0.28;
}

@keyframes im-lock-btn-pending-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* =============================================
   Input Modules — C Module Shell
   ============================================= */

.im-c-module {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.im-c-module-section-label {
    display: block;
    font-size: var(--im-label-size);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--im-label-color);
}

.im-c-module-outer-section,
.im-c-module-inner-section {
    min-width: 0;
    border-radius: var(--im-frame-radius);
    border: var(--im-frame-border);
    background: var(--im-frame-bg);
}

.im-c-module-outer-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.im-c-module-outer-section .im-outer-input-desc,
.im-c-module-outer-section .im-outer-output {
    flex: 1;
    display: flex;
    align-items: center;
}

.im-c-module-outer-section .im-outer-input-json,
.im-c-module-outer-section .im-outer-output {
    margin: auto 0;
}

.im-c-module-inner-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    container-type: inline-size;
    container-name: im-inner;
}

/* Constraint section between sibling inner children inside a c-module */
.im-c-module-constraint-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
    padding: var(--im-frame-padding-sm);
    border-radius: var(--im-frame-radius-sm);
    border: var(--im-frame-border-dashed);
    background: var(--im-frame-bg-subtle);
}

.im-c-module-constraint-label {
    color: #fbbf24;
}

.im-c-module-constraint-error {
    font-size: 11px;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.35);
    border: 1px solid rgba(248, 113, 113, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.im-c-module-constraint-section .im-outer-input-desc {
    width: 100%;
    min-width: 0;
}

.im-c-module-constraint-json {
    min-height: 36px;
}

.im-c-module-constraint-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.im-c-module-bind-wizard-btn {
    margin-left: auto;
}

.im-c-module-bind-wizard-btn--active,
.im-c-module-expression-wizard-btn--active {
    background: rgba(96, 165, 250, 0.25);
    border-color: rgba(96, 165, 250, 0.6);
    color: #93c5fd;
}

.im-c-module-constraint-clear-btn {
    background: rgba(127, 29, 29, 0.25);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fca5a5;
}

.im-c-module-constraint-clear-btn:hover {
    background: rgba(127, 29, 29, 0.45);
}

.input-module-input-json.im-bind-overlay-active {
    outline: 2px dashed rgba(96, 165, 250, 0.6);
    outline-offset: 2px;
    cursor: default;
}

.im-bind-pick {
    color: inherit;
}

.im-bind-pick--leaf {
    cursor: pointer;
    border-radius: 3px;
    padding: 0 2px;
    transition: background-color 80ms;
}

.im-bind-pick--leaf:hover {
    background: rgba(96, 165, 250, 0.35);
    color: #f0f9ff;
}

.im-bind-pick-input {
    background: rgba(15, 23, 42, 0.95);
    color: #f0f9ff;
    border: 1px solid rgba(96, 165, 250, 0.7);
    border-radius: 3px;
    padding: 0 4px;
}

.im-bind-pick-input.im-input-editable--error {
    border-color: #f87171;
    background: rgba(127, 29, 29, 0.5);
}

.im-c-module-constraint-json--bind-focus {
    border-color: rgba(250, 204, 21, 0.9);
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.45);
}

.im-bind-picker-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    margin-bottom: 4px;
    padding: 2px 4px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.7);
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
}

.im-bind-picker-inline-json {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.im-bind-picker-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.im-bind-picker-inline .im-bind-picker-input {
    width: 110px;
    min-width: 70px;
    background: rgba(2, 6, 23, 0.85);
    border-color: rgba(148, 163, 184, 0.6);
}

.im-bind-picker-inline .im-bind-picker-path {
    flex: 1 1 220px;
    min-width: 120px;
}

.im-bind-picker-inline .im-bind-picker-punc {
    color: #cbd5e1;
}

.im-bind-picker-inline .im-bind-picker-error {
    margin-left: 2px;
}

.im-bind-picker,
.im-expression-builder {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 4px 6px;
    margin-bottom: 4px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.7);
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
}

.im-bind-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.im-bind-picker-row--tokens,
.im-bind-picker-row--presets {
    align-items: flex-start;
}

.im-bind-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.im-bind-picker-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.im-bind-picker-field--stack {
    width: 100%;
}

.im-bind-picker-label {
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.im-bind-picker-path {
    color: #93c5fd;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.im-bind-picker-sep {
    color: #94a3b8;
}

.im-bind-picker-input {
    flex: 1 1 120px;
    min-width: 80px;
    background: rgba(15, 23, 42, 0.95);
    color: #f0f9ff;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 3px;
    padding: 2px 4px;
    font: inherit;
}

.im-bind-picker-select,
.im-bind-picker-expression {
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    color: #f0f9ff;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 3px;
    padding: 2px 4px;
    font: inherit;
}

.im-bind-picker-expression {
    min-height: 52px;
    resize: vertical;
}

.im-bind-picker-input.im-input-editable--error {
    border-color: #f87171;
    background: rgba(127, 29, 29, 0.5);
}

.im-bind-picker-select.im-input-editable--error,
.im-bind-picker-expression.im-input-editable--error {
    border-color: #f87171;
    background: rgba(127, 29, 29, 0.5);
}

.im-bind-picker-tokens,
.im-bind-picker-presets,
.im-bind-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.im-bind-picker-token,
.im-bind-picker-preset {
    padding-inline: 8px;
}

.im-bind-picker-empty {
    color: #94a3b8;
    font-size: 11px;
}

.im-bind-picker-error {
    color: #fca5a5;
    font-size: 11px;
}

/* Auto-scale inner modules proportionally based on available width */
@container im-inner (max-width: 700px) {
    .im-inner-children { zoom: 0.95; }
}
@container im-inner (max-width: 550px) {
    .im-inner-children { zoom: 0.85; }
}
@container im-inner (max-width: 450px) {
    .im-inner-children { zoom: 0.75; }
}
@container im-inner (max-width: 350px) {
    .im-inner-children { zoom: 0.65; }
}

/* Outer input (composite-level, far left) */
.im-outer-input-desc {
    width: 100%;
    min-width: 0;
}

.im-outer-input-json {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 8px 10px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.525rem;
    line-height: 1.45;
    color: #fbbf24;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
    text-align: left;
}

/* Inner children column (center) — stacked inner module panels */
.im-inner-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.im-inner-child {
    padding: 6px 8px;
    border: var(--im-frame-border-child);
    border-radius: var(--im-frame-radius-sm);
    background: var(--im-frame-bg-child);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.im-inner-child-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #93c5fd;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.im-inner-child-label-text {
    line-height: 1.2;
}

/* Each inner child reuses .input-module-panel grid (input | widget | output) */

/* Outer output (composite-level, far right) */
.im-outer-output {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: block;
    visibility: hidden;
    margin: 0;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.575rem;
    line-height: 1.5;
    color: #fbbf24;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
    text-align: left;
}

.im-outer-output--visible {
    visibility: visible;
    animation: imFadeIn 0.25s ease;
}

.im-json-line--resolved {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.im-json-line--resolved::after {
    content: attr(data-im-json-tag);
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(30, 41, 59, 0.9);
    color: #93c5fd;
    font-size: 0.55rem;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
}

.im-json-string--collapsed {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    vertical-align: bottom;
    text-decoration: none;
    border-bottom: 1px dotted rgba(251, 191, 36, 0.35);
}

/* View toggle (Exploded / Composed) */
.im-c-module-view-toggle {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.im-c-module-view-btn {
    padding: 3px 10px;
    font-size: 0.625rem;
    font-weight: 600;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.im-c-module-view-btn:hover {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.3);
}

.im-c-module-view-btn--active {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.1);
    border-color: rgba(147, 197, 253, 0.35);
}

.im-c-module-detail {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 8px;
    align-items: stretch;
    max-width: 100%;
    min-width: 0;
}

/* ── Scoped overrides: c-module output stability ── */
.im-c-module .input-module-input-json,
.im-c-module .input-module-output {
    font-size: 0.5rem;
    padding: 6px 8px;
}

.im-c-module .input-module-output {
    display: block;
    visibility: hidden;
}

.im-c-module .input-module-output--visible {
    visibility: visible;
}

.im-c-module-compact {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 8px;
    align-items: stretch;
    max-width: 100%;
    min-width: 0;
}

.im-c-module-compact-widget-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
}

.im-c-module-compact-frame {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    min-width: var(--im-widget-width);
    max-width: var(--im-widget-width);
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid rgba(125, 211, 252, 0.18);
    border-radius: var(--im-frame-radius);
    background: transparent;
}

.im-c-module-compact-frame .im-lock-label,
.im-c-module-embedded .im-lock-label {
    display: none;
}

.im-c-module-compact-frame .im-lock-row,
.im-c-module-embedded .im-lock-row {
    gap: 0;
}

.im-c-module-compact-frame .im-tri-row,
.im-c-module-embedded .im-tri-row {
    gap: 4px;
}

.im-c-module-compact-label {
    display: block;
    font-size: var(--im-label-size-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--im-label-color);
    opacity: 0.7;
    margin-bottom: 4px;
}

.im-inner-slot {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Embedded c-modules should collapse to the control's intrinsic width
   instead of inheriting the standalone full-width module sizing. */
.im-c-module-embedded {
    width: auto;
    max-width: 100%;
}

.im-c-module-embedded-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: 100%;
    position: relative;
}

.im-c-module-embedded-body > .im-inner-slot {
    position: relative;
    z-index: 2;
}

.im-c-module-selected-label-connector {
    position: absolute;
    display: block;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.im-c-module-selected-label-connector line {
    stroke: rgba(125, 211, 252, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px rgba(125, 211, 252, 0.35));
}

.im-c-module-embedded .input-module-widget,
.im-c-module-embedded .im-inner-slot,
.im-c-module-embedded .im-rsp-widget,
.im-c-module-embedded .im-rsp-caption-grid {
    width: auto;
    max-width: 100%;
}

/* Embedded c1 policy captions should use a stable shared geometry so the
   selected-policy connector and radio row line up consistently across
   expansion/visibility variants. */
.im-c-module-embedded .im-rsp-widget {
    width: min(100%, 204px);
}

.im-c-module-embedded .im-rsp-caption-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
    justify-content: center;
    align-items: start;
    justify-items: stretch;
    width: 100%;
}

.im-c-module-embedded .im-rsp-caption-col {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
    padding: 0 4px;
}

.im-c-module-embedded .im-rsp-caption-label {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.im-c-module-control-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.im-c-module-control-summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #93c5fd;
    user-select: none;
    margin-bottom: 8px;
}

.im-c-module-control-summary::-webkit-details-marker {
    display: none;
}

.im-c-module-control-summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    color: rgba(147, 197, 253, 0.7);
    transition: transform 0.15s ease;
}

.im-c-module-control-section[open] > .im-c-module-control-summary::before {
    transform: rotate(90deg);
}
