:root {
    --primary: #3d6bff;
    --primary-dark: #2f54d6;
    --sidebar: #ffffff;
    --sidebar-hover: #eef3ff;
    --accent: #6a5bff;
    --ink: #172033;
    --muted: #667085;
    --line: #e6ebf2;
    --bg: #f5f7fb;
}

@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Cairo-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/Cairo-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/Cairo-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/Cairo-800.woff2') format('woff2');
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.admin-sidebar {
    width: max-content;
    max-width: 14rem;
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    background: #fff;
    border-inline-end: 1px solid var(--line);
    padding: 1.1rem 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--ink);
    text-decoration: none;
    padding: 0 0.35rem;
}

.brand img {
    height: 2.4rem;
    width: auto;
    object-fit: contain;
}

.brand-name {
    display: block;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-sub {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.sidebar-logout {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.sidebar-logout .nav-link {
    width: auto;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: #9f2d2d;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 0.8rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3d4a5c;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: #f3f6fb;
    color: var(--ink);
}

.nav-link.active {
    background: #eef3ff;
    color: #315bff;
    box-shadow: none;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 1.25rem 2.5rem;
}

@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        max-width: none;
        height: auto;
        position: static;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
        padding: 0.85rem 0.75rem 0.7rem;
    }
    .admin-sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 0.75rem;
        gap: 0.35rem;
    }
    .sidebar-logout {
        margin-top: 0.75rem;
        padding-top: 0.65rem;
    }
    .admin-main { padding: 1.1rem 0.9rem 2rem; }
    .page-header { align-items: flex-start; }
    .page-title { font-size: 1.45rem; }
}

.nav-link svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.35rem 0.85rem 0.35rem 0.45rem;
    font-size: 0.875rem;
    color: #475569;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.user-badge-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #eef3ff;
    color: #315bff;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1.25rem;
    background:
        radial-gradient(900px 420px at 80% -10%, rgba(79, 125, 255, 0.16), transparent 60%),
        radial-gradient(700px 380px at 10% 110%, rgba(106, 91, 255, 0.12), transparent 55%),
        var(--bg);
}

.login-card {
    margin: auto 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.08);
    padding: 2.5rem 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.2;
}

.login-lead {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 1rem;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-inline-start: 0.35rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: #0f766e;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}
.live-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #14b8a6;
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
    animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(20, 184, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

.card-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    box-shadow: 0 10px 30px rgba(23, 32, 51, 0.05);
}

.dash-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.dash-stat {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    padding: 1.05rem 1.1rem;
    box-shadow: 0 10px 28px rgba(23, 32, 51, 0.04);
}

.dash-stat::before {
    content: "";
    position: absolute;
    inset-inline: 1rem;
    top: 0;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #4f7dff, #6a5bff);
}

.dash-stat-icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: none;
    border-radius: 0.8rem;
    background: #eef3ff;
    color: #315bff;
}

.dash-stat-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.dash-stat-copy { min-width: 0; }

.dash-stat-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #667085;
}

.dash-stat-value {
    margin-top: 0.1rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #172033;
}

.dash-stat-hint {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #98a2b3;
}

@media (max-width: 1100px) {
    .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .dash-stats { grid-template-columns: 1fr; }
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.1rem 1.15rem;
}

.stat-card::after {
    display: none;
}

.stat-card.teal::after { background: #14b8a6; }
.stat-card.indigo::after { background: #6366f1; }
.stat-card.amber::after { background: #f59e0b; }
.stat-card.rose::after { background: #f43f5e; }
.stat-card.sky::after { background: #0ea5e9; }
.stat-card.emerald::after { background: #10b981; }

.stat-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    margin-bottom: 0.75rem;
}

.stat-icon,
.stat-icon.teal,
.stat-icon.indigo,
.stat-icon.amber,
.stat-icon.rose,
.stat-icon.sky,
.stat-icon.emerald { background: #eef3ff; color: #315bff; }
.stat-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.user-badge-icon svg {
    width: 1rem;
    height: 1rem;
}

.alert svg {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 0.8rem;
    padding: 0.65rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn-primary,
.btn-dark,
.btn-success {
    background: linear-gradient(90deg, #4f7dff 0%, #6a5bff 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(79, 125, 255, 0.28);
}

.btn-primary:hover,
.btn-dark:hover,
.btn-success:hover {
    filter: brightness(1.06);
    color: #fff;
}

.btn.btn-ghost,
.btn-ghost,
.btn-outline {
    background: #fff;
    color: #3d4a5c;
    border: 1px solid #e6ebf2;
    border-radius: 0.8rem;
    box-shadow: none;
}

.btn.btn-ghost:hover,
.btn-ghost:hover,
.btn-outline:hover {
    background: #f5f7fb;
    color: #172033;
    border-color: #d5dce8;
}

.btn-warning {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.btn-warning:hover { background: #fef3c7; }

.btn-danger {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}

.btn-danger:hover { background: #ffe4e6; }



.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    border-radius: 0.6rem;
}

.btn-sm svg {
    width: 0.9rem;
    height: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4f7dff;
    box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.16);
}

.login-card .relative > span {
    pointer-events: none;
}

.login-card .relative .form-input {
    padding-inline-start: 2.7rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #334155;
}

.table-modern {
    width: 100%;
    font-size: 0.875rem;
}

.table-modern thead {
    background: #f8fafc;
}

.table-modern th {
    padding: 0.85rem 1rem;
    text-align: right;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.table-modern td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background: #f8fafc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-draft { background: #f1f5f9; color: #475569; }
.status-published { background: #d1fae5; color: #047857; }
.status-stopped { background: #fef3c7; color: #b45309; }
.status-ended { background: #fee2e2; color: #b91c1c; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.925rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #64748b;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.filter-panel {
    padding: 1rem;
    margin-bottom: 1rem;
}

.flatpickr-input.form-input,
.form-input.flatpickr-input,
.flatpickr-input.alt {
    width: 100%;
    cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat left 0.85rem center;
    padding-left: 2.4rem;
}

.flatpickr-calendar {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    border-radius: 0.85rem;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #0f766e;
    border-color: #0f766e;
}

.flatpickr-day:hover {
    background: #ccfbf1;
    border-color: #99f6e4;
}

.kpi-hint {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.chart-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.chart-card-head h2,
.chart-card-head h3 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.chart-card-sub {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}

.chart-shell {
    position: relative;
    height: 280px;
}

.chart-shell.lg { height: 320px; }

.chart-empty {
    height: 100%;
    min-height: 180px;
    display: grid;
    place-items: center;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 0.85rem;
    padding: 1.5rem;
}

.chart-empty p { margin: 0; font-size: 0.875rem; font-weight: 600; }

.chart-empty-icon {
    display: block;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 0.65rem;
    border-radius: 0.75rem;
    background: #e2e8f0;
}

.chart-legend {
    margin-top: 1rem;
    display: grid;
    gap: 0.45rem;
    list-style: none;
    padding: 0;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f8fafc;
    border-radius: 0.7rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
}

.chart-legend-swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.chart-legend-label {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: #334155;
}

.chart-legend-value {
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.funnel {
    display: grid;
    gap: 0.65rem;
}

.funnel-row { display: grid; gap: 0.3rem; }

.funnel-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
}

.funnel-track {
    height: 0.7rem;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.funnel-fill {
    height: 100%;
    border-radius: 999px;
    background: #0f766e;
}

.q-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.55rem;
}

.viz-row {
    display: grid;
    gap: 0.35rem;
}

.viz-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8125rem;
}

.viz-label { font-weight: 700; color: #334155; min-width: 0; }
.viz-meta { font-weight: 800; color: #0f172a; white-space: nowrap; }

.viz-track {
    height: 0.7rem;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.viz-fill {
    height: 100%;
    border-radius: 999px;
    background: #0f766e;
}

.viz-fill.warn { background: #d97706; }
.viz-fill.danger { background: #e11d48; }
.viz-fill.neutral { background: #94a3b8; }

.rating-avg {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.rating-avg strong {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
}

.stack-bar {
    display: flex;
    height: 1.35rem;
    border-radius: 999px;
    overflow: hidden;
    background: #f1f5f9;
}

.stack-seg { height: 100%; min-width: 0; }

.note-muted {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 0.5rem;
}

.insight-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: end;
}
.insight-picker-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    min-width: min(100%, 28rem);
}
.insight-picker-form .form-select { min-width: min(100%, 22rem); }

.insight-cover {
    background: linear-gradient(100deg, #315bff 0%, #6a5bff 100%);
    color: #fff;
    border-radius: 1.25rem;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 16px 40px rgba(49, 91, 255, 0.18);
}
.insight-cover-mark {
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    margin-bottom: 0.75rem;
}
.insight-title { font-size: 1.75rem; font-weight: 800; line-height: 1.4; margin: 0 0 0.4rem; }
.insight-meta { opacity: 0.85; font-size: 0.9rem; margin: 0 0 1rem; }
.insight-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.insight-kpi {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.insight-kpi span { display: block; font-size: 0.75rem; font-weight: 800; color: #64748b; }
.insight-kpi strong { display: block; font-size: 1.6rem; font-weight: 800; color: #0f172a; margin: 0.15rem 0; }
.insight-kpi em { font-style: normal; font-size: 0.75rem; color: #94a3b8; font-weight: 600; }
.insight-kpi.accent { background: #ecfdf5; border-color: #99f6e4; }
.insight-kpi.accent strong { color: #047857; }

.insight-section-head { margin: 0 0 1rem; }
.insight-section-head h2 { font-size: 1.15rem; font-weight: 800; }
.insight-section-head p { color: #64748b; font-size: 0.9rem; margin-top: 0.2rem; }

.q-insight-head { display: flex; gap: 1rem; align-items: flex-start; }
.q-num {
    width: 2.1rem; height: 2.1rem; flex: none;
    display: grid; place-items: center;
    border-radius: 0.75rem;
    background: #0f766e; color: #fff;
    font-weight: 800; font-size: 0.9rem;
}
.q-insight-text { font-size: 1.05rem; font-weight: 800; color: #0f172a; line-height: 1.6; }
.q-metric {
    font-size: 0.75rem; font-weight: 800;
    background: #f0fdfa; color: #0f766e;
    border-radius: 999px; padding: 0.15rem 0.6rem;
}
.q-metric.quiet { background: #f8fafc; color: #64748b; }
.q-avg {
    text-align: center; background: #fffbeb; border: 1px solid #fde68a;
    border-radius: 1rem; padding: 0.5rem 0.85rem; min-width: 5rem;
}
.q-avg strong { display: block; font-size: 1.4rem; color: #b45309; }
.q-avg span { font-size: 0.7rem; font-weight: 800; color: #92400e; }
.q-avg-likert strong { color: #0f766e; }
.q-avg-likert span { color: #115e59; }
.q-chip-likert { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }

.q-dist { display: grid; gap: 0.7rem; margin-top: 1.1rem; }
.q-dist-row {
    display: grid;
    grid-template-columns: minmax(7rem, 1.2fr) minmax(8rem, 2fr) auto;
    gap: 0.75rem;
    align-items: center;
}
.q-dist-label { font-weight: 700; color: #334155; font-size: 0.875rem; display: flex; align-items: center; gap: 0.45rem; }
.q-dist-swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.q-dist-track {
    height: 0.85rem; background: #f1f5f9; border-radius: 999px; overflow: hidden;
}
.q-dist-fill { height: 100%; background: #0f766e; border-radius: 999px; }
.q-dist-stats { display: flex; gap: 0.55rem; align-items: baseline; white-space: nowrap; }
.q-dist-stats b { font-size: 0.95rem; color: #0f172a; }
.q-dist-stats span { font-size: 0.8rem; font-weight: 800; color: #0f766e; }

.q-texts { margin-top: 1.1rem; }
.q-texts-head { font-size: 0.75rem; font-weight: 800; color: #64748b; margin-bottom: 0.5rem; }
.q-texts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: #1e293b;
}
.q-texts-table th,
.q-texts-table td {
    border: 1px solid #e2e8f0;
    padding: 0.35rem 0.65rem;
    vertical-align: middle;
}
.q-texts-table th {
    background: #ccfbf1;
    font-size: 0.75rem;
    font-weight: 800;
    color: #134e4a;
}
.q-texts-table td.q-texts-num,
.q-texts-table th.q-texts-num {
    width: 2.5rem;
    text-align: center;
    color: #64748b;
    white-space: nowrap;
}
.q-texts-table tbody tr:nth-child(even) { background: #f0fdfa; }
.q-texts-table tbody tr:nth-child(odd) { background: #fff; }

@media (max-width: 768px) {
    .chart-shell,
    .chart-shell.lg { height: 240px; }
    .chart-legend-item { font-size: 0.75rem; }
    .q-dist-row { grid-template-columns: 1fr; gap: 0.25rem; }
}

.export-table-host.is-updating,
#likert-table-host.is-updating,
#axis-table-host.is-updating {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.likert-matrix-wrap { overflow: hidden; }

.likert-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: center;
}
.likert-matrix th,
.likert-matrix td {
    border: 1px solid #cbd5e1;
    padding: 0.55rem 0.65rem;
}
.likert-matrix thead th {
    background: #f8fafc;
    font-weight: 800;
    color: #334155;
    white-space: nowrap;
}
.likert-matrix tbody td {
    background: #fff;
    color: #0f172a;
    font-weight: 600;
}
.likert-scale {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}
.likert-col-num { width: 2.5rem; }
.likert-col-axis {
    text-align: right;
    min-width: 10rem;
    font-weight: 700;
}
.likert-col-index {
    font-weight: 800;
    min-width: 6.5rem;
}
.likert-idx-high {
    background: #86efac !important;
    color: #14532d !important;
}
.likert-idx-low {
    background: #fca5a5 !important;
    color: #7f1d1d !important;
}
.likert-idx-total {
    background: #fde047 !important;
    color: #713f12 !important;
    font-size: 1rem;
}
.likert-matrix-foot td {
    border-top: 2px solid #94a3b8;
}

.category-axis-matrix {
    border: 1.5px solid #94a3b8;
    table-layout: auto;
}
.category-axis-matrix thead th {
    background: #134e4a;
    color: #fff;
    white-space: nowrap;
}
.category-axis-matrix .axis-col {
    width: 9.5rem;
}
.category-axis-matrix .question-col {
    text-align: right;
    width: auto;
}
.category-axis-matrix .axis-cell {
    background: #f8fafc;
    font-weight: 800;
    color: #134e4a;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    width: 9.5rem;
}
.category-axis-matrix .direction-cell {
    white-space: nowrap;
    color: #0f766e;
    font-weight: 700;
    width: 8rem;
}

.likert-summary-table .likert-pct {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f766e;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    border-radius: 0.65rem;
    padding: 0.2rem 0.75rem;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-inline-start: 0.35rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: #0f766e;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}
.live-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #14b8a6;
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
    animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(20, 184, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}
.org-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.org-node + .org-node {
    margin-top: 0.45rem;
}

.org-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.9rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.org-row:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.org-row-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.org-icon {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.75rem;
    background: #fff;
    color: #0f766e;
    border: 1px solid #ccfbf1;
    flex-shrink: 0;
}

.org-icon-branch {
    background: #ccfbf1;
    color: #0f766e;
}

.org-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.org-name {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.org-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.org-meta span {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0f766e;
    background: #fff;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
}

.org-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.org-edit {
    margin: 0.45rem 0 0.65rem;
    padding: 0.9rem;
    border-radius: 0.9rem;
    border: 1px dashed #cbd5e1;
    background: #fff;
}

.org-children {
    margin: 0.15rem 1.15rem 0.15rem 0;
    padding: 0.35rem 0.9rem 0 0;
    border-right: 2px solid #99f6e4;
}

.org-children .org-row {
    background: #fff;
}

.publish-dialog,
.app-dialog {
    border: 0;
    border-radius: 1.25rem;
    padding: 1.5rem 1.55rem 1.35rem;
    width: min(26rem, calc(100vw - 2rem));
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    background: #fff;
    color: #0f172a;
}
.publish-dialog::backdrop,
.app-dialog::backdrop {
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
}
.app-dialog {
    text-align: center;
    overflow: hidden;
    margin: auto;
    max-height: none;
}
.app-dialog[open] {
    animation: app-dialog-in 0.18s ease-out;
}
.app-dialog-icon {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 0.9rem;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    background: #fff1f2;
    color: #e11d48;
    box-shadow: inset 0 0 0 1px #fecdd3;
}
.app-dialog[data-tone="warn"] .app-dialog-icon {
    background: #fffbeb;
    color: #b45309;
    box-shadow: inset 0 0 0 1px #fde68a;
}
.app-dialog[data-tone="success"] .app-dialog-icon {
    background: #ecfdf5;
    color: #047857;
    box-shadow: inset 0 0 0 1px #a7f3d0;
}
.app-dialog-icon svg {
    width: 1.4rem;
    height: 1.4rem;
}
.app-dialog-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 0.45rem;
}
.app-dialog-name {
    display: inline-block;
    margin: 0 0 0.65rem;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f766e;
    font-weight: 700;
    font-size: 0.875rem;
}
.app-dialog-name[hidden] { display: none; }
.app-dialog-text {
    margin: 0;
    color: #64748b;
    font-size: 0.925rem;
    line-height: 1.7;
}
.app-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
}
.app-dialog-actions .btn {
    min-width: 7.5rem;
    justify-content: center;
}
.btn-danger,
.btn-danger-solid,
.btn-warning {
    border-radius: 0.8rem;
}

.btn-danger-solid {
    background: linear-gradient(90deg, #f43f5e 0%, #e11d48 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.24);
}
.btn-danger-solid:hover {
    filter: brightness(1.05);
    color: #fff;
}
@keyframes app-dialog-in {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.people-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}
.people-kicker {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #0f766e;
}
.people-sub {
    margin: 0.15rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}
.people-intro-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.people-count-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.8125rem;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.people-count-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f766e;
}
.people-filters {
    display: grid;
    grid-template-columns: minmax(12rem, 1.5fr) minmax(10rem, 1fr) 9rem auto;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}
.search-field {
    position: relative;
}
.search-field > svg,
.search-field > i {
    position: absolute;
    top: 50%;
    right: 0.85rem;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #94a3b8;
    pointer-events: none;
}
.search-field .form-input {
    padding-right: 2.4rem;
}
.people-board {
    overflow-x: auto;
    padding: 0;
}
.people-head,
.people-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) 8.6rem minmax(0, 1fr) 5.6rem 6.8rem 9.4rem;
    gap: 0.65rem 0.75rem;
    align-items: center;
    padding: 0.9rem 1.1rem;
}
.people-head {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}
.people-head span:last-child {
    text-align: left;
}
.people-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.people-row {
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.people-row:last-child {
    border-bottom: 0;
}
.people-row:hover {
    background: #f8fffd;
}
.people-row.is-inactive {
    background: #fffbfb;
}
.people-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.people-avatar {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.people-avatar.teal { background: #ccfbf1; color: #0f766e; }
.people-avatar.indigo { background: #e0e7ff; color: #4338ca; }
.people-avatar.sky { background: #e0f2fe; color: #0369a1; }
.people-avatar.amber { background: #fef3c7; color: #b45309; }
.people-avatar.rose { background: #ffe4e6; color: #be123c; }
.people-avatar.emerald { background: #d1fae5; color: #047857; }
.people-id-text { min-width: 0; }
.people-head span { white-space: nowrap; }
.people-name {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.people-email {
    font-size: 0.78rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.people-chip {
    display: inline-flex;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #334155;
    padding: 0.22rem 0.55rem;
    border-radius: 0.5rem;
    font-variant-numeric: tabular-nums;
}
.people-dept {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #475569;
    font-size: 0.875rem;
    min-width: 0;
}
.people-dept svg {
    width: 0.95rem;
    height: 0.95rem;
    color: #94a3b8;
    flex-shrink: 0;
}
.people-dept span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.people-meta {
    display: contents;
}
.people-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #64748b;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.people-date svg {
    width: 0.9rem;
    height: 0.9rem;
    color: #94a3b8;
}
.status-badge .status-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.75;
}
.icon-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    justify-content: flex-end;
    min-width: 9.2rem;
}
.icon-actions form {
    margin: 0;
    display: inline-flex;
}
.icon-btn {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.7rem;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}
.icon-btn.view:hover { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }
.icon-btn.edit:hover { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.icon-btn.warn:hover { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.icon-btn.ok:hover { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.icon-btn.danger:hover { background: #fff1f2; color: #e11d48; border-color: #fecdd3; }
.people-empty {
    padding: 3.5rem 1.5rem;
    text-align: center;
}
.people-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 0.9rem;
    display: grid;
    place-items: center;
    border-radius: 1.1rem;
    background: #f0fdfa;
    color: #0f766e;
}
.people-empty-icon svg {
    width: 1.6rem;
    height: 1.6rem;
}
.people-empty h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}
.people-empty p {
    margin: 0 0 1.1rem;
    color: #64748b;
}
.people-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8125rem;
}
.people-pager {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.people-page-label {
    font-weight: 700;
    color: #334155;
    min-width: 3.5rem;
    text-align: center;
}
.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 0.55rem;
    border-radius: 0.6rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-weight: 700;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: all 0.15s ease;
}
.pg-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-active) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}
.pg-active {
    background: linear-gradient(135deg, #0d9488, #0f766e) !important;
    color: #fff !important;
    border-color: #0d9488 !important;
}
.pg-disabled {
    color: #cbd5e1 !important;
    pointer-events: none;
    border-color: #f1f5f9;
    background: #f8fafc;
}

.form-shell {
    overflow: hidden;
    max-width: 46rem;
}
.form-shell-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    padding: 1.15rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc, #f0fdfa);
    border-bottom: 1px solid #e2e8f0;
}
.form-shell-head.compact {
    background: linear-gradient(135deg, #fffbeb, #fff);
}
.form-shell-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}
.form-shell-head > div {
    min-width: 0;
    flex: 1 1 14rem;
}
.form-shell-head p {
    margin: 0.15rem 0 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.6;
}
.form-shell-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    background: #ccfbf1;
    color: #0f766e;
    flex-shrink: 0;
}
.form-shell-icon.warn {
    background: #fef3c7;
    color: #b45309;
}
.form-shell-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}
.form-shell-tools,
.form-shell-back {
    margin-inline-start: auto;
}
.form-shell-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.form-shell-body {
    padding: 1.25rem;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-grid-full {
    grid-column: 1 / -1;
}
.form-shell-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}
.form-shell-actions.between {
    justify-content: space-between;
}
.people-profile-bar {
    max-width: none;
    margin-bottom: 1.25rem;
}
.people-profile-bar .form-shell-head {
    border-bottom: 0;
}

@media (max-width: 1280px) {
    .people-head { display: none; }
    .people-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem 0.75rem;
    }
    .people-identity { grid-column: 1; }
    .icon-actions { grid-column: 2; grid-row: 1; min-width: 0; }
    .people-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.45rem 0.75rem;
        grid-column: 1 / -1;
    }
    .people-cell::before { display: none; }
}

@media (max-width: 960px) {
    .people-filters {
        grid-template-columns: 1fr 1fr;
    }
    .people-filter-btn {
        grid-column: 1 / -1;
    }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .people-filters { grid-template-columns: 1fr; }
}
.publish-choice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
    cursor: pointer;
}
.publish-choice:has(input:checked) {
    border-color: #14b8a6;
    background: #f0fdfa;
}
.publish-choice input {
    margin-top: 0.3rem;
}

@media print {
    @page { size: A4 landscape; margin: 12mm; }

    body { background: #fff !important; color: #000 !important; font-size: 11pt; }
    .admin-sidebar,
    .no-print,
    .flash-banner,
    .insight-picker,
    .chart-shell canvas { display: none !important; }

    .md\\:flex { display: block !important; }
    main, .admin-main { padding: 0 !important; margin: 0 !important; width: 100% !important; }

    .card-panel, .insight-cover, .likert-summary, .q-insight {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .insight-actions .btn { display: none !important; }
    .likert-summary { background: #f0fdfa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .likert-matrix-wrap,
    .likert-idx-high,
    .likert-idx-low,
    .likert-idx-total,
    .category-axis-matrix thead th,
    .category-axis-matrix .axis-cell {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .q-avg-likert strong, .likert-pct { color: #0f766e !important; }
}

.section-fold {
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: #fff;
    margin-bottom: 0.65rem;
}
.section-fold > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    font-weight: 800;
    color: #1e1b4b;
}
.section-fold > summary::-webkit-details-marker { display: none; }
.section-fold > summary::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-inline-start: auto;
    border-left: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(-45deg);
    flex: none;
}
.section-fold[open] > summary { border-bottom: 1px solid var(--line); }
.section-fold[open] > summary::after { transform: rotate(135deg); margin-top: 0.2rem; }
.section-count { font-size: 0.75rem; font-weight: 700; color: #64748b; }
.section-fold .qsection { padding: 0.65rem; }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }
.q-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: #f8fafc;
    padding: 0.55rem 0.75rem;
}
.q-row-branched { background: #f0fdfa; border-color: #99f6e4; }
.q-row-title { font-weight: 700; font-size: 0.92rem; color: #172033; }
.q-row-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; margin-top: 0.15rem; font-size: 0.75rem; color: #64748b; }
.q-row-rule { color: #0f766e; font-weight: 800; }
.branch-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}
@media (max-width: 700px) {
    .branch-row { grid-template-columns: 1fr; }
    .q-row { flex-direction: column; }
}

/* Scan alerts */
.table-modern tbody tr.audit-scan,
.table-modern tbody tr.audit-scan:hover {
    background: #fef2f2;
}
.table-modern tbody tr.audit-scan td {
    color: #991b1b;
    border-bottom-color: #fecaca;
}
.table-modern tbody tr.audit-scan td:first-child {
    box-shadow: inset -4px 0 0 #dc2626;
}
.scan-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.scan-tag svg {
    width: 0.9rem;
    height: 0.9rem;
}
.scan-ip {
    color: #b91c1c;
    font-weight: 700;
}
.scan-badge {
    margin-inline-start: auto;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.35rem;
    text-align: center;
    animation: scan-pulse 1.6s infinite;
}
.scan-badge[hidden] {
    display: none;
}
@keyframes scan-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
    70% { box-shadow: 0 0 0 0.45rem rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}
.scan-alerts {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: min(22rem, calc(100vw - 2rem));
}
.scan-alert {
    background: #fff;
    border: 1px solid #fecaca;
    border-top: 4px solid #dc2626;
    border-radius: 0.8rem;
    padding: 0.75rem 0.9rem;
    box-shadow: 0 12px 30px rgba(220, 38, 38, 0.25);
    color: #7f1d1d;
    animation: scan-in 0.25s ease-out;
}
.scan-alert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #b91c1c;
    font-size: 0.9rem;
}
.scan-alert-close {
    border: 0;
    background: transparent;
    color: #b91c1c;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.scan-alert-body {
    margin-top: 0.4rem;
    display: grid;
    gap: 0.15rem;
    font-size: 0.8rem;
}
.scan-alert-body > div {
    display: flex;
    gap: 0.35rem;
}
.scan-alert-key {
    font-weight: 700;
    min-width: 3.5rem;
}
.scan-alert-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 700;
}
@keyframes scan-in {
    from { opacity: 0; transform: translateY(-0.5rem); }
    to { opacity: 1; transform: none; }
}
a.scan-tag {
    text-decoration: none;
}
.audit-scan-link {
    cursor: pointer;
}
.scan-open {
    display: inline-block;
    margin-inline-start: 0.4rem;
    color: #dc2626;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.scan-open:hover {
    text-decoration: underline;
}

/* Scan detail page */
.sx { display: grid; gap: 1.25rem; }
.sx-back {
    display: inline-flex; align-items: center; gap: .4rem; width: fit-content;
    padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: #fff;
    color: #475569; font-size: .8rem; font-weight: 700; text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}
.sx-back:hover { border-color: #cbd5e1; color: var(--ink); }
.sx-back svg { width: .95rem; height: .95rem; }

/* Hero */
.sx-hero {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1.25rem;
    padding: 1.5rem 1.75rem; border-radius: 1.25rem; color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #ef4444 0%, #b91c1c 45%, #7f1d1d 100%);
    box-shadow: 0 18px 40px -18px rgba(185, 28, 28, .6);
}
.sx-hero::after {
    content: ""; position: absolute; inset: auto -4rem -6rem auto; width: 16rem; height: 16rem;
    border-radius: 50%; background: rgba(255, 255, 255, .06); pointer-events: none;
}
.sx-hero-badge {
    display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 1.1rem;
    background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
.sx-hero-badge svg { width: 2rem; height: 2rem; }
.sx-hero-kicker {
    display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; border-radius: 999px;
    background: rgba(255, 255, 255, .16); font-size: .72rem; font-weight: 800; letter-spacing: .02em;
}
.sx-hero-kicker::before {
    content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: #fecaca;
    box-shadow: 0 0 0 0 rgba(254, 202, 202, .8); animation: scan-pulse 1.6s infinite;
}
.sx-hero-ip {
    display: flex; align-items: center; gap: .6rem; margin-top: .45rem;
    font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: .01em;
}
.sx-hero-ip bdi { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.sx-hero-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.sx-hero-meta span {
    display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: .6rem;
    background: rgba(0, 0, 0, .16); font-size: .78rem; font-weight: 600;
}
.sx-hero-meta svg { width: .85rem; height: .85rem; opacity: .85; }
.sx-hero-stats { display: flex; gap: .75rem; }
.sx-stat {
    display: grid; justify-items: center; gap: .15rem; min-width: 7.5rem; padding: .85rem 1rem;
    border-radius: 1rem; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.sx-stat strong { font-size: 1.75rem; line-height: 1; font-weight: 800; }
.sx-stat span { font-size: .72rem; opacity: .9; text-align: center; }
.sx-copy {
    display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: .6rem;
    background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; transition: background .15s ease;
}
.sx-copy:hover { background: rgba(255, 255, 255, .28); }
.sx-copy.copied { background: #16a34a; }
.sx-copy svg { width: 1rem; height: 1rem; }

.sx-notice {
    display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1rem; border-radius: .9rem;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: .85rem;
}
.sx-notice svg { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .1rem; }

/* Cards */
.sx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.sx-card {
    display: flex; flex-direction: column; min-width: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 1.15rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -20px rgba(16, 24, 40, .18);
    overflow: hidden;
}
.sx-card-head {
    display: flex; align-items: center; gap: .85rem; padding: 1.1rem 1.35rem;
    border-bottom: 1px solid #eef2f7; background: linear-gradient(180deg, #fbfcfe, #fff);
}
.sx-card-head h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--ink); }
.sx-card-head p { margin: .1rem 0 0; font-size: .75rem; color: var(--muted); }
.sx-card-head .sx-count {
    margin-inline-start: auto; padding: .2rem .65rem; border-radius: 999px;
    background: #f1f5f9; color: #475569; font-size: .75rem; font-weight: 800;
}
.sx-ico {
    flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .8rem;
}
.sx-ico svg { width: 1.2rem; height: 1.2rem; }
.sx-ico-blue { background: #eef3ff; color: #3d6bff; }
.sx-ico-violet { background: #f3efff; color: #6a5bff; }
.sx-ico-red { background: #fef2f2; color: #dc2626; }
.sx-ico-teal { background: #ecfdf5; color: #0d9488; }
.sx-ico-amber { background: #fffbeb; color: #d97706; }
.sx-ico-slate { background: #f1f5f9; color: #475569; }
.sx-card-body { flex: 1; padding: .5rem 1.35rem 1.1rem; }
.sx-card-foot {
    display: flex; flex-wrap: wrap; gap: .5rem; padding: .9rem 1.35rem;
    border-top: 1px solid #eef2f7; background: #fbfcfe;
}

.sx-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 0; border-bottom: 1px dashed #e8edf4; font-size: .875rem;
}
.sx-row:last-child { border-bottom: 0; }
.sx-k { flex: none; display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-weight: 600; }
.sx-k svg { width: .95rem; height: .95rem; color: #94a3b8; }
.sx-v { min-width: 0; color: var(--ink); font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.sx-empty { color: #b6c0cf; font-weight: 500; font-size: .8rem; }
.sx-mono {
    display: inline-block; max-width: 100%; padding: .15rem .5rem; border-radius: .45rem;
    background: #f5f7fb; border: 1px solid #edf1f6; color: #1e293b;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; font-weight: 600;
    overflow-wrap: anywhere; direction: ltr; unicode-bidi: isolate;
}

.sx-pill {
    display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px;
    font-size: .75rem; font-weight: 800; white-space: nowrap;
}
.sx-pill::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.sx-pill-danger { background: #fef2f2; color: #dc2626; }
.sx-pill-ok { background: #ecfdf5; color: #059669; }
.sx-pill-muted { background: #f1f5f9; color: #64748b; }
.sx-pill-warn { background: #fffbeb; color: #d97706; }

.sx-method {
    display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: .45rem;
    background: #1e293b; color: #fff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .72rem; font-weight: 800; letter-spacing: .04em;
}

.sx-place {
    display: flex; align-items: center; gap: .85rem; margin: .65rem 0 .35rem; padding: .85rem 1rem;
    border-radius: .9rem; background: linear-gradient(135deg, #f4f7ff, #fbfcff); border: 1px solid #e6edff;
}
.sx-cc {
    flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .85rem;
    background: linear-gradient(135deg, #3d6bff, #6a5bff); color: #fff;
    font-size: 1.05rem; font-weight: 800; letter-spacing: .06em; box-shadow: 0 8px 18px -10px rgba(61, 107, 255, .8);
}
.sx-cc svg { width: 1.4rem; height: 1.4rem; }
.sx-place strong { display: block; font-size: 1rem; color: var(--ink); }
.sx-place span { font-size: .8rem; color: var(--muted); }

.sx-threat {
    display: flex; align-items: center; gap: .85rem; margin: .65rem 0 .35rem; padding: .85rem 1rem;
    border-radius: .9rem; background: linear-gradient(135deg, #fef2f2, #fff7f7); border: 1px solid #fde2e2;
}
.sx-threat.is-neutral { background: #f8fafc; border-color: #edf1f6; }
.sx-threat-ico {
    flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: .75rem;
    background: #dc2626; color: #fff;
}
.sx-threat.is-neutral .sx-threat-ico { background: #94a3b8; }
.sx-threat-ico svg { width: 1.15rem; height: 1.15rem; }
.sx-threat small { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }
.sx-threat strong { font-size: 1rem; color: #b91c1c; }
.sx-threat.is-neutral strong { color: var(--ink); }

.sx-request {
    display: flex; align-items: center; gap: .6rem; margin: .65rem 0 .35rem; padding: .75rem .9rem;
    border-radius: .9rem; background: #0f172a; color: #e2e8f0; direction: ltr;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem;
}
.sx-request .sx-method { background: #dc2626; }
.sx-request code { min-width: 0; overflow-wrap: anywhere; }
.sx-request .sx-q { color: #fbbf24; }
.sx-request .sx-status {
    margin-left: auto; padding: .15rem .5rem; border-radius: .4rem;
    background: rgba(255, 255, 255, .1); color: #cbd5e1; font-size: .72rem; font-weight: 700;
}

.sx-code {
    margin-top: .35rem; padding: .75rem .9rem; border-radius: .8rem; direction: ltr; text-align: left;
    background: #f8fafc; border: 1px solid #edf1f6; color: #334155;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; line-height: 1.6;
    overflow-wrap: anywhere;
}
.sx-label { display: block; margin-top: .85rem; font-size: .75rem; font-weight: 700; color: var(--muted); }

.sx-empty-state {
    display: grid; place-items: center; gap: .6rem; height: 100%; min-height: 11rem; padding: 1.5rem 1rem;
    text-align: center; color: var(--muted); font-size: .85rem;
}
.sx-empty-state .sx-ico { width: 3.25rem; height: 3.25rem; border-radius: 1rem; }
.sx-empty-state .sx-ico svg { width: 1.5rem; height: 1.5rem; }
.sx-empty-state strong { display: block; color: var(--ink); font-size: .9rem; }

.sx-hint {
    display: flex; align-items: flex-start; gap: .4rem; margin: .75rem 0 0;
    color: #94a3b8; font-size: .72rem; line-height: 1.6;
}
.sx-hint svg { flex: none; width: .85rem; height: .85rem; margin-top: .15rem; }

.sx-link {
    display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: .65rem;
    border: 1px solid var(--line); background: #fff; color: #334155; font-size: .78rem; font-weight: 700;
    text-decoration: none; transition: all .15s ease;
}
.sx-link:hover { border-color: #fca5a5; color: #b91c1c; background: #fff7f7; }
.sx-link svg { width: .85rem; height: .85rem; }

.sx-paths {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .5rem;
    margin: .75rem 0 0; padding: 0; list-style: none; direction: ltr; counter-reset: sx-path;
}
.sx-paths li {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: .7rem;
    background: #fbfcfe; border: 1px solid #edf1f6; color: #1e293b;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; overflow-wrap: anywhere;
    counter-increment: sx-path;
}
.sx-paths li::before {
    content: counter(sx-path); flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem;
    border-radius: .45rem; background: #fee2e2; color: #b91c1c; font-size: .7rem; font-weight: 800;
}

.sx-kv { width: 100%; margin-top: .5rem; border-collapse: separate; border-spacing: 0; direction: ltr; }
.sx-kv th, .sx-kv td {
    padding: .6rem .75rem; border-bottom: 1px solid #f1f4f8; text-align: left; vertical-align: top;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem;
}
.sx-kv tr:last-child th, .sx-kv tr:last-child td { border-bottom: 0; }
.sx-kv th { width: 13rem; color: #64748b; font-weight: 700; white-space: nowrap; }
.sx-kv td { color: #1e293b; overflow-wrap: anywhere; }
.sx-kv tr:nth-child(even) { background: #fbfcfe; }

.sx-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: .5rem; font-size: .84rem; }
.sx-table th {
    padding: .6rem .75rem; text-align: right; font-size: .75rem; font-weight: 700; color: var(--muted);
    background: #f8fafc; border-bottom: 1px solid #eef2f7;
}
.sx-table td { padding: .7rem .75rem; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.sx-table tr:last-child td { border-bottom: 0; }
.sx-table tr.is-current td { background: #fff7f7; }
.sx-table tr.is-current td:first-child { box-shadow: inset -3px 0 0 #dc2626; }
.sx-table .sx-hits { font-weight: 800; color: var(--ink); }

@media (max-width: 1100px) {
    .sx-grid { grid-template-columns: minmax(0, 1fr); }
    .sx-hero { grid-template-columns: auto minmax(0, 1fr); }
    .sx-hero-stats { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .sx-hero { grid-template-columns: minmax(0, 1fr); padding: 1.25rem; }
    .sx-hero-ip { font-size: 1.5rem; }
    .sx-hero-stats { flex-wrap: wrap; }
    .sx-row { flex-direction: column; align-items: flex-start; gap: .3rem; }
    .sx-v { text-align: right; }
}

