:root {
    --bg: #12141f;
    --bg-elevated: #1a1c2c;
    --sidebar: #161824;
    --border: #2a2d3e;
    --text: #e8eaf0;
    --text-muted: #9aa0b5;
    --accent: #52E5FF;
    --accent-hover: #3AD8F5;
    --accent-ink: #0b1a20;
    --success: #3ecf8e;
    --warning: #f0b429;
    --danger: #ef5b5b;
    --info: #5b8def;
    --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Trebuchet MS", "Segoe UI", sans-serif;
    --radius: 10px;
    --sidebar-width: 240px;
}

/* Scrollbars: sin flechas, thumb en color de resalte */
* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
    background-clip: padding-box;
}

*::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    z-index: 40;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.sidebar__brand {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    padding: 0 1.25rem 1.5rem;
    color: var(--text);
    letter-spacing: 0.02em;
}

.sidebar__brand span { color: var(--accent); }

.sidebar__section {
    padding: 0.5rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar__nav a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--text-muted);
    border-left: 3px solid transparent;
}

.sidebar__nav a.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.sidebar__link-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

.sidebar__nav a:hover,
.sidebar__nav a.is-active {
    color: var(--text);
    background: rgba(82, 229, 255, 0.08);
    border-left-color: var(--accent);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(8, 10, 18, 0.55);
}

.sidebar-backdrop[hidden] {
    display: none !important;
}

.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem 2rem 2.5rem;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.22s ease, width 0.22s ease;
}

.app.is-sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.app.is-sidebar-collapsed .main {
    margin-left: 0;
    width: 100%;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 auto;
}

.topbar__left h1 {
    margin: 0 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
}

.topbar h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
}

.topbar__menu-btn,
.topbar__home-btn {
    flex-shrink: 0;
}

.topbar__home-btn {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--text);
    border-color: var(--border);
}

.topbar__home-btn svg {
    width: 1.2rem;
    height: 1.2rem;
}

.topbar__home-btn.is-active,
.topbar__home-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(82, 229, 255, 0.12);
}

.topbar__user {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.home-hub {
    padding: 1.25rem 1.35rem 1.5rem;
}

.home-hub__header {
    margin-bottom: 1.15rem;
}

.home-hub__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
}

.home-hub__hint {
    margin: 0;
    font-size: 0.9rem;
}

.home-hub__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 8.5rem));
    gap: 0.85rem;
}

.home-hub__card {
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    padding: 0.75rem 0.55rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    color: var(--text-muted);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.home-hub__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
}

.home-hub__icon svg {
    width: 100%;
    height: 100%;
}

.home-hub__label {
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
}

.home-hub__card:hover {
    color: var(--text);
    border-color: rgba(82, 229, 255, 0.55);
    background: rgba(82, 229, 255, 0.08);
    transform: translateY(-1px);
}

.home-hub__card:hover .home-hub__icon {
    color: var(--accent);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
}

.card__label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.card__label--with-delta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}

.card__label-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.card__label-sep {
    opacity: 0.55;
}

.metric-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.05rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    vertical-align: middle;
}

.metric-delta svg {
    width: 0.85rem;
    height: 0.85rem;
    display: block;
}

.metric-delta--up { color: var(--success); }
.metric-delta--down { color: var(--danger); }
.metric-delta--flat { color: var(--text-muted); }

.card__hint .metric-delta {
    margin-left: 0.25rem;
}

.card__value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-display);
}

.card__value--success { color: var(--success); }
.card__value--muted { color: var(--text-muted); }

.cards--mini {
    margin-bottom: 1.25rem;
}

.cards--mini .card {
    padding: 0.9rem 1.1rem;
}

.cards--mini .card__value {
    font-size: 1.45rem;
}

.users-ratio {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.panel__header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.panel__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.catalog-view-toggle {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.catalog-view-toggle__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.catalog-view-toggle__btn svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.catalog-view-toggle__btn:hover {
    color: var(--text);
}

.catalog-view-toggle__btn.is-active {
    color: var(--text);
    background: rgba(82, 229, 255, 0.14);
    color: var(--accent);
}

.catalog[data-view="list"] .catalog__cards {
    display: none !important;
}

.catalog[data-view="cards"] .catalog__list {
    display: none !important;
}

.catalog__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.85rem;
}

.catalog-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    min-width: 0;
}

.catalog-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
}

.catalog-card__identity {
    min-width: 0;
    flex: 1;
}

.catalog-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    word-break: break-word;
}

.catalog-card__state {
    margin: 0.2rem 0 0;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--danger);
}

.catalog-card__state.is-on {
    color: #34c759;
}

.catalog-card__state.is-warn {
    color: #f0b429;
}

.catalog-card__status {
    flex-shrink: 0;
    padding-top: 0.1rem;
}

.catalog-card__meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.catalog-card__meta div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.45rem;
    align-items: baseline;
}

.catalog-card__meta dt {
    font-weight: 600;
    color: var(--text-muted);
}

.catalog-card__meta dd {
    margin: 0;
    color: var(--text);
}

.catalog-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(42, 45, 62, 0.85);
}

.catalog__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 720px) {
    .catalog-view-toggle__btn span {
        display: none;
    }
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.filters input,
.filters select,
.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font: inherit;
}

.filters input { min-width: 180px; }

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1;
    filter: invert(79%) sepia(48%) saturate(1200%) hue-rotate(146deg) brightness(103%) contrast(101%);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 0.95rem;
    font: inherit;
    cursor: pointer;
    background: var(--accent);
    color: var(--accent-ink);
}

.btn svg {
    flex: 0 0 auto;
    display: block;
}

.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }

.btn--ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #d44848; color: #fff; }

.btn--sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th, td {
    text-align: left;
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge--active { background: rgba(62, 207, 142, 0.15); color: var(--success); }
.badge--inactive { background: rgba(154, 160, 181, 0.15); color: var(--text-muted); }
.badge--suspended { background: rgba(240, 180, 41, 0.15); color: var(--warning); }
.badge--warn { background: rgba(240, 180, 41, 0.15); color: var(--warning); }
.badge--online { background: rgba(62, 207, 142, 0.15); color: var(--success); }
.badge--offline { background: rgba(154, 160, 181, 0.15); color: var(--text-muted); }
.badge--maintenance { background: rgba(91, 141, 239, 0.15); color: var(--info); }

/* iOS-style status toggle (verde / rojo) */
.ios-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    user-select: none;
    position: relative;
}

.ios-toggle__input {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    opacity: 0 !important;
}

.ios-toggle__ui {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    margin: 0;
}

.ios-toggle__track {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    border-radius: 999px;
    background: var(--danger);
    border: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    transition: background 0.22s ease, box-shadow 0.22s ease;
    flex-shrink: 0;
}

.ios-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.22),
        0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}

/* ON = verde */
.ios-toggle__input:checked + .ios-toggle__ui .ios-toggle__track,
.ios-toggle__track.is-on {
    background: #34c759;
    box-shadow: inset 0 0 0 1px rgba(52, 199, 89, 0.35);
}

.ios-toggle__input:checked + .ios-toggle__ui .ios-toggle__thumb,
.ios-toggle__track.is-on .ios-toggle__thumb {
    transform: translateX(22px);
}

/* Suspendido = ámbar */
.ios-toggle__track.is-warn {
    background: #f0b429;
    box-shadow: inset 0 0 0 1px rgba(240, 180, 41, 0.4);
}

.ios-toggle__text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--danger);
    min-width: 4.2rem;
}

.ios-toggle__input:checked + .ios-toggle__ui .ios-toggle__text {
    color: #34c759;
}

.ios-toggle.is-disabled {
    opacity: 0.7;
}

.ios-toggle.is-disabled .ios-toggle__ui {
    cursor: not-allowed;
}

.ios-toggle-form {
    display: inline-flex;
    margin: 0;
    vertical-align: middle;
}

.ios-toggle--sm {
    gap: 0;
}

.ios-toggle--sm .ios-toggle__ui {
    gap: 0;
}

.ios-toggle--sm .ios-toggle__track {
    width: 34px;
    height: 20px;
}

.ios-toggle--sm .ios-toggle__thumb {
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
}

.ios-toggle--sm .ios-toggle__input:checked + .ios-toggle__ui .ios-toggle__thumb,
.ios-toggle--sm .ios-toggle__track.is-on .ios-toggle__thumb {
    transform: translateX(14px);
}

.ios-toggle--sm .ios-toggle__input:focus-visible + .ios-toggle__ui .ios-toggle__track {
    outline-offset: 2px;
}

.ios-toggle__input:focus-visible + .ios-toggle__ui .ios-toggle__track {
    outline: 2px solid rgba(52, 199, 89, 0.55);
    outline-offset: 3px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-group .error {
    color: var(--danger);
    font-size: 0.8rem;
}

.form-group--full {
    grid-column: 1 / -1;
}

.camera-ai-context {
    padding: 1rem 1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.camera-ai-context__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
}

.camera-ai-context__help {
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
}

.camera-ai-context textarea {
    width: 100%;
    min-height: 4.2rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0f111a;
    color: var(--text);
    resize: vertical;
}

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 148px;
    padding: 1.25rem;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone--dragover {
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.06);
}

.dropzone--has-file {
    border-style: solid;
    cursor: default;
}

.dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    pointer-events: none;
}

.dropzone__icon {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.dropzone__title {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
}

.dropzone__hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropzone__preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.dropzone__preview img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    object-fit: contain;
    background: #0b0c14;
}

.dropzone__preview-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dropzone__clear {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.dropzone__clear:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dropzone__remove-saved {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert--success { background: rgba(62, 207, 142, 0.12); color: var(--success); }
.alert--error { background: rgba(239, 91, 91, 0.12); color: var(--danger); }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(82, 229, 255, 0.18), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(91, 141, 239, 0.12), transparent 45%),
        var(--bg);
}

.login-box {
    width: min(400px, 92vw);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
}

.login-box h1 {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
}

.login-box p {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
}

.actions-inline {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.icon-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

.icon-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.08);
}

.icon-btn:disabled,
.icon-btn[disabled] {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.icon-btn--danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 91, 91, 0.1);
}

button.icon-btn {
    font: inherit;
}

.icon-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    background: #0e1018;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 20;
}

.icon-btn[data-tooltip]::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: #0e1018;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 20;
}

.icon-btn[data-tooltip]:hover::after,
.icon-btn[data-tooltip]:hover::before,
.icon-btn[data-tooltip]:focus-visible::after,
.icon-btn[data-tooltip]:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.pagination {
    display: flex;
    gap: 0.35rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
}

.pagination .active span {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.perm-groups {
    display: grid;
    gap: 1rem;
}

.perm-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.perm-group h3 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    text-transform: capitalize;
}

.perm-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.25rem 0.75rem 0.25rem 0;
    font-size: 0.88rem;
}

.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--warning); }
.dot { margin: 0 0.35rem; opacity: 0.55; }

.webhook-log-summary {
    display: inline-block;
    max-width: 42rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.webhook-log-detail__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
}

.webhook-log-detail__item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.webhook-log-detail__item--wide {
    grid-column: 1 / -1;
}

.webhook-log-detail__item strong {
    font-weight: 600;
    word-break: break-word;
}

.webhook-log-empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    background: rgba(154, 160, 181, 0.08);
}

.webhook-log-empty p {
    margin: 0;
}

.webhook-log-empty p + p {
    margin-top: 0.35rem;
}

.webhook-log-section {
    margin-top: 1.25rem;
}

.webhook-log-section h3 {
    margin: 0 0 0.55rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.client-summary__header {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.client-summary__title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.client-summary__company select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    min-width: 220px;
}

.client-summary__title h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.55rem;
}

.client-summary__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.35rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.report-help {
    position: relative;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.report-help:hover,
.report-help:focus-visible {
    color: var(--text);
    border-color: var(--accent);
    outline: none;
}

.report-help[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    background: #1a1d27;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 30;
}

.report-help[data-tooltip]:hover::after,
.report-help[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.report-help-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.75rem;
}

.report-help-row__label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.client-summary__filters {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.period-tabs__item {
    position: relative;
    cursor: pointer;
}

.period-tabs__item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.period-tabs__item span {
    display: inline-flex;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg);
}

.period-tabs__item.is-active span,
.period-tabs__item:hover span {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.1);
}

.compare-point {
    margin: 1rem 0 1.25rem;
    padding: 0.9rem 1rem;
}

.compare-point__header {
    margin-bottom: 0.65rem;
}

.compare-point__form {
    margin: 0;
}

.client-summary__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.client-summary__controls select,
.client-summary__custom input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font: inherit;
}

.client-summary__custom {
    display: none;
    align-items: center;
    gap: 0.45rem;
}

.client-summary__custom.is-visible {
    display: inline-flex;
}

.cards--kpi {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card__value--sm {
    font-size: 1.35rem;
}

.card__hint {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

button.card__hint--hotspot {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
}

button.card__hint--hotspot:hover {
    color: var(--text);
}

.summary-places {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 0.35rem 0 0.75rem;
}

.webhook-box {
    margin: 0.25rem 0 0.85rem;
}

.webhook-box__row {
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
}

.webhook-box .code-block {
    margin-top: 0.35rem;
}

.title-with-action {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.title-with-action h2 {
    margin: 0;
}

.camera-meta,
.camera-place {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.camera-meta .dot {
    opacity: 0.5;
}

.camera-place {
    margin: 0.35rem 0 0;
}

.camera-place strong {
    color: var(--text);
    font-weight: 600;
}

.pop[hidden] {
    display: none !important;
}

.pop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.pop__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 16, 0.72);
}

.pop__card {
    position: relative;
    width: min(100%, 520px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem 1.25rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.pop__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.pop__header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.pop__text {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.pop__field {
    margin-bottom: 0.85rem;
}

.pop__field:last-child {
    margin-bottom: 0;
}

.pop__label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pop__copy-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pop__code {
    flex: 1;
    display: block;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    word-break: break-all;
}

.pop__code--muted {
    color: var(--text-muted);
}

.summary-place {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}

.summary-place__label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-tabs {
    display: flex;
    gap: 0.4rem;
    margin: 0 0 1rem;
    flex-wrap: wrap;
}

.report-tabs__item {
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    background: var(--bg-elevated);
}

.report-tabs__item:hover,
.report-tabs__item.is-active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.1);
}

.camera-show-layout {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.camera-info-card {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.camera-show-header {
    align-items: flex-start;
}

.camera-show-header .client-summary__title {
    flex: 1 1 220px;
    min-width: 0;
}

.camera-tab-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 0 0 auto;
    width: 7.25rem;
    max-width: 7.25rem;
    align-self: stretch;
    box-sizing: border-box;
    padding: 0.55rem;
    border-radius: 14px;
    border: 1px solid rgba(82, 229, 255, 0.35);
    background:
        linear-gradient(160deg, rgba(82, 229, 255, 0.28), rgba(82, 229, 255, 0.1) 55%, rgba(82, 229, 255, 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.camera-tab-nav__title {
    margin: 0;
    width: 100%;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: left;
}

.camera-tab-cards {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 0 0 auto;
    width: 100%;
    align-self: flex-start;
}

.camera-tab-card {
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    padding: 0.45rem 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-muted);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.camera-tab-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
}

.camera-tab-card__icon svg {
    width: 100%;
    height: 100%;
}

.camera-tab-card__label {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    max-width: 100%;
}

.camera-tab-card:hover {
    color: var(--text);
    border-color: rgba(82, 229, 255, 0.55);
    background: rgba(82, 229, 255, 0.06);
}

.camera-tab-card.is-active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.12);
}

.camera-tab-card.is-active .camera-tab-card__icon {
    color: var(--accent);
}

@media (max-width: 720px) {
    .camera-show-layout {
        flex-direction: column;
    }

    .camera-tab-nav {
        order: 2;
        width: 100%;
        max-width: 100%;
    }

    .camera-tab-nav__title {
        text-align: left;
    }

    .camera-tab-cards {
        flex-direction: row;
        width: 100%;
        align-self: stretch;
    }

    .camera-info-card {
        order: 1;
    }

    .camera-tab-card {
        flex: 1 1 0;
        width: 50%;
        max-width: calc(50% - 0.225rem);
        min-width: 0;
        min-height: 0;
        aspect-ratio: 1 / 1;
    }
}

.heatmap-viewer {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    width: 100%;
    max-width: 500px;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(82, 229, 255, 0.06), transparent 55%),
        #0b0c14;
}

.heatmap-view-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.35rem 0.65rem;
    width: 0;
    min-width: 100%;
    margin: 0 0 0.55rem;
    box-sizing: border-box;
}

.heatmap-view-title {
    margin: 0;
    flex: 0 0 auto;
    text-align: left;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--accent);
    line-height: 1.35;
}

.heatmap-view-period {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 0;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.heatmap-stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.heatmap-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding: 0;
}

.heatmap-layers {
    --hm-cols: 64;
    --hm-rows: 64;
    --hm-cell: 8px;
    --hm-aspect: 16 / 9;
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: var(--hm-aspect, 16 / 9);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    background-color: rgb(8, 12, 28);
}

.heatmap-layers--has-bg {
    background-image: var(--hm-bg);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

/* Camera report layout: IA Agent + main content */
.camera-report-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.camera-report-layout {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    margin-top: 0.5rem;
}

.camera-report-ai-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
}

.camera-report-ai-row .camera-ai-agent {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    align-self: stretch;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.camera-report-ai-row .camera-ai-agent__inner {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

.camera-report-ai-row .camera-report-charts {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
}

.camera-report-ai-row .camera-report-charts .charts-grid {
    margin-top: 0;
}

.camera-report-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.camera-ai-agent {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    align-self: stretch;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.camera-ai-agent__inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(82, 229, 255, 0.08), transparent 55%),
        rgba(255, 255, 255, 0.02);
}

.camera-ai-agent__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
    text-align: center;
    flex: 0 0 auto;
}

.camera-ai-agent__bot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(82, 229, 255, 0.14);
    border: 1px solid rgba(82, 229, 255, 0.35);
    color: var(--accent);
}

.camera-ai-agent__bot svg {
    width: 1.45rem;
    height: 1.45rem;
}

.camera-ai-agent__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text);
}

.camera-ai-agent__panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.camera-ai-agent__panel[data-ai-panel="loading"] {
    justify-content: center;
}

.camera-ai-agent__panel[data-ai-panel="options"] {
    gap: 0;
    overflow: hidden;
}

.camera-ai-agent__panel[data-ai-panel="options"] .camera-ai-agent__lead {
    flex: 0 0 auto;
}

.camera-ai-agent__panel[data-ai-panel="result"] {
    flex: 1 1 auto;
    min-height: 0;
    gap: 0;
    overflow: hidden;
}

.camera-ai-agent__panel[hidden] {
    display: none !important;
}

.camera-ai-agent__lead {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: center;
}

.camera-ai-agent__question {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.55rem;
    margin-bottom: 0.45rem;
    flex: 0 0 auto;
}

.camera-ai-agent__question-label {
    font-size: 0.68rem;
}

.camera-ai-agent__question-input {
    width: 100%;
    min-height: 2.6rem;
    resize: vertical;
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font: inherit;
    font-size: 0.72rem;
    line-height: 1.4;
}

.camera-ai-agent__question-input:focus {
    outline: none;
    border-color: rgba(82, 229, 255, 0.45);
}

.camera-ai-agent__question-hint {
    font-size: 0.64rem;
}

.camera-ai-agent__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.15rem 0 0.35rem;
}

.camera-ai-agent__chip {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font: inherit;
    font-size: 0.64rem;
    cursor: pointer;
}

.camera-ai-agent__chip:hover,
.camera-ai-agent__chip:focus-visible {
    color: var(--text);
    border-color: rgba(82, 229, 255, 0.4);
}
    line-height: 1.35;
}

.camera-ai-agent__submit {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.camera-ai-agent__quota {
    margin: 0.55rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    font-size: 0.66rem;
    line-height: 1.4;
    text-align: center;
    flex: 0 0 auto;
}

.camera-ai-agent__invalid {
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(240, 180, 41, 0.35);
    background: rgba(240, 180, 41, 0.08);
}

.camera-ai-agent__actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    overflow: auto;
}

.camera-ai-agent__action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.camera-ai-agent__action[hidden] {
    display: none !important;
}

.camera-ai-agent__action:hover:not([hidden]):not(:disabled) {
    border-color: rgba(82, 229, 255, 0.45);
    background: rgba(82, 229, 255, 0.1);
}

.camera-ai-agent__action.is-selected {
    border-color: rgba(82, 229, 255, 0.65);
    background: rgba(82, 229, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(82, 229, 255, 0.25);
}

.camera-ai-agent__action:disabled,
.camera-ai-agent__action.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.camera-ai-agent__action-label {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.camera-ai-agent__action-hint {
    font-size: 0.68rem;
    line-height: 1.35;
}

.camera-ai-agent__spinner {
    width: 2rem;
    height: 2rem;
    margin: 1.5rem auto 0.85rem;
    border: 2px solid rgba(82, 229, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: camera-ai-spin 0.75s linear infinite;
}

@keyframes camera-ai-spin {
    to { transform: rotate(360deg); }
}

.camera-ai-agent__loading-text {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.camera-ai-agent__loading-sub {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    text-align: center;
}

.camera-ai-agent__result-title {
    flex: 0 0 auto;
    margin: 0 0 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.35;
}

.camera-ai-agent__result-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
    padding-right: 0.35rem;
    margin-right: -0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(82, 229, 255, 0.55) rgba(148, 163, 184, 0.12);
}

.camera-ai-agent__result-body::-webkit-scrollbar {
    width: 7px;
}

.camera-ai-agent__result-body::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 999px;
}

.camera-ai-agent__result-body::-webkit-scrollbar-thumb {
    background: rgba(82, 229, 255, 0.5);
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.camera-ai-agent__result-body::-webkit-scrollbar-thumb:hover {
    background: rgba(82, 229, 255, 0.72);
}

.camera-ai-agent__result-body p {
    margin: 0 0 0.5rem;
}

.camera-ai-agent__headline {
    color: var(--text);
    font-size: 0.85rem;
}

.camera-ai-agent__insights,
.camera-ai-agent__warnings {
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.1rem;
}

.camera-ai-agent__insights li,
.camera-ai-agent__warnings li {
    margin-bottom: 0.35rem;
}

.camera-ai-agent__warnings {
    color: var(--warn, #f0b429);
}

.camera-ai-agent__suggested-action {
    margin-top: 0.65rem !important;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text);
}

.camera-ai-agent__error {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(82, 229, 255, 0.35);
    background: rgba(82, 229, 255, 0.08);
    color: var(--text);
}

.camera-ai-agent__error-badge {
    display: inline-block;
    margin: 0 0 0.45rem !important;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fecaca;
    background: rgba(82, 229, 255, 0.22);
}

.camera-ai-agent__error p {
    margin: 0 0 0.35rem;
}

.camera-ai-agent__error p:last-child {
    margin-bottom: 0;
}

.camera-ai-agent__back {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-top: 0.65rem;
    align-self: stretch;
    justify-content: center;
}

/* Heatmap: IA Agent + mapa + zonas llenan el 100% (1 : 2 : 1) */
.heatmap-main-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
    min-height: 0;
}

.heatmap-main-row > .camera-ai-agent,
.heatmap-main-row > .heatmap-map-card,
.heatmap-main-row > .heatmap-zones {
    min-height: 0;
    min-width: 0;
}

.heatmap-main-row > .camera-ai-agent {
    flex: 1 1 0;
    width: auto;
    max-width: none;
}

.heatmap-map-card {
    flex: 2 1 0;
    min-width: 0;
    max-width: none;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1.1rem 1.2rem;
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(82, 229, 255, 0.06), transparent 55%),
        var(--bg-elevated);
}

.heatmap-map-card .heatmap-viewer-col {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: none;
}

.heatmap-map-card .heatmap-viewer {
    margin-top: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.heatmap-map-card .heatmap-threshold {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0.85rem 0 0;
    padding: 0.85rem 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    border-top: 1px solid var(--border);
    box-shadow: none;
}

.heatmap-main-row .heatmap-zones {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: none;
    height: auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.heatmap-main-row .heatmap-zones__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

@media (max-width: 1100px) {
    .camera-report-layout {
        flex-direction: column;
    }

    .camera-report-ai-row {
        flex-direction: column;
        width: 100%;
    }

    .camera-report-ai-row .camera-ai-agent,
    .camera-ai-agent {
        flex: 0 0 auto;
        width: 100%;
        align-self: auto;
        max-height: 28rem;
    }

    .camera-report-ai-row .camera-report-charts {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
    }

    .camera-ai-agent__inner {
        min-height: 0;
        max-height: 100%;
    }

    .camera-ai-agent__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .camera-ai-agent__action {
        flex: 1 1 12rem;
    }

    .heatmap-main-row {
        flex-direction: column;
        width: 100%;
    }

    .heatmap-main-row > .camera-ai-agent,
    .heatmap-map-card,
    .heatmap-main-row .heatmap-zones {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: none;
    }

    .heatmap-map-card .heatmap-viewer-col,
    .heatmap-map-card .heatmap-viewer,
    .heatmap-map-card .heatmap-threshold {
        min-width: 0;
        max-width: none;
    }
}

.heatmap-layers__placeholder {
    display: none;
}

.heatmap-layers--no-bg .heatmap-layers__placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    pointer-events: none;
    color: rgba(154, 160, 181, 0.2);
    background:
        radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.02), transparent 55%),
        rgb(10, 12, 20);
}

.heatmap-layers__placeholder svg {
    width: 40px;
    height: 40px;
}

.heatmap-layers__placeholder span {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
}

.heatmap-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
    object-fit: fill;
}

.heatmap-timeline {
    margin-top: 1.15rem;
    padding: 0.95rem 1rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.heatmap-timeline__head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    color: var(--text);
}

.heatmap-timeline__head > span:first-child {
    justify-self: start;
    font-weight: 600;
}

.heatmap-timeline__head > span:last-child {
    justify-self: end;
    font-weight: 600;
}

.heatmap-timeline__hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
}

.heatmap-timeline__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
}

.heatmap-timeline__controls {
    display: inline-flex;
    gap: 0.4rem;
    flex-shrink: 0;
    padding-top: 1.85rem;
}

.heatmap-timeline__controls .icon-btn.is-playing,
.heatmap-timeline__controls .icon-btn.is-active,
.heatmap-threshold__actions .icon-btn.is-active,
.heatmap-timeline__controls .icon-btn[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(82, 229, 255, 0.12);
}

.heatmap-ctrl__icon {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

.heatmap-ctrl__icon[hidden] {
    display: none !important;
}

.heatmap-range {
    position: relative;
    height: 28px;
    touch-action: none;
    user-select: none;
}

.heatmap-range__rail {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 8px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.heatmap-range__fill {
    position: absolute;
    top: 50%;
    height: 8px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0.9;
}

.heatmap-range__ticks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.heatmap-range__tick {
    position: absolute;
    top: 50%;
    width: 1px;
    height: 14px;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.22);
}

.heatmap-range__thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 18px;
    transform: translate(-50%, -50%);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0;
    background: var(--bg-elevated);
    box-shadow: 0 0 0 1px var(--accent), 0 1px 4px rgba(0, 0, 0, 0.35);
    cursor: ew-resize;
    z-index: 2;
}

.heatmap-range__thumb:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.heatmap-range__playhead {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 20px;
    transform: translate(-50%, -50%);
    background: var(--warning);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(240, 180, 41, 0.45);
    pointer-events: none;
    z-index: 1;
}

.heatmap-timeline__meta {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.heatmap-timeline__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem 1rem;
    margin: 0 0 0.7rem;
}

.heatmap-timeline__ignore {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.heatmap-timeline__ignore input {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.heatmap-timeline__coverage {
    font-size: 0.75rem;
}

.heatmap-range__tick--empty {
    background: rgba(240, 180, 41, 0.75);
    height: 16px;
}

.heatmap-range__tick--zero {
    background: rgba(148, 163, 184, 0.85);
    height: 14px;
}

.heatmap-activity {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    min-width: 0;
}

.heatmap-activity__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem 0.85rem;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
}

.heatmap-activity__chart {
    height: 160px;
}

@media (max-width: 720px) {
    .heatmap-timeline__row {
        grid-template-columns: 1fr;
    }

    .heatmap-timeline__controls {
        padding-top: 0;
        justify-content: center;
    }

    .heatmap-timeline__head {
        grid-template-columns: 1fr;
        gap: 0.25rem;
        text-align: center;
    }

    .heatmap-timeline__head > span:first-child,
    .heatmap-timeline__head > span:last-child {
        justify-self: center;
    }
}

.heatmap-segmentation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    margin: -0.35rem 0 0.95rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.heatmap-agg-modes-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.95rem;
}

.heatmap-agg-modes {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0.2rem;
    border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.08);
}

.client-summary .compare-point {
    margin: 0.85rem 0 0;
    padding: 0.75rem 0 0;
    border: 0;
    border-top: 1px solid var(--border, rgba(148, 163, 184, 0.22));
    border-radius: 0;
    background: transparent;
}

.heatmap-agg-modes__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.2;
}

.heatmap-agg-modes__btn:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.14);
}

.heatmap-agg-modes__btn.is-active {
    color: var(--accent);
    background: rgba(82, 229, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(82, 229, 255, 0.35);
}

.heatmap-agg-modes__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.heatmap-diff-legend {
    margin: -0.55rem 0 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.45);
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.heatmap-diff-legend__title {
    margin: 0 0 0.45rem;
    color: var(--text);
}

.heatmap-diff-legend__keys {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
}

.heatmap-diff-legend__keys li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.heatmap-diff-legend__swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 3px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.heatmap-diff-legend__swatch--down {
    background: #3b82f6;
}

.heatmap-diff-legend__swatch--up {
    background: #e85d75;
}

.heatmap-diff-legend__swatch--same {
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.55);
}

.heatmap-diff-legend[hidden],
.heatmap-config-warn[hidden] {
    display: none !important;
}

.heatmap-config-warn {
    margin: 0 0 0.85rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid rgba(240, 180, 41, 0.45);
    background: rgba(240, 180, 41, 0.1);
    color: #f0b429;
    font-size: 0.78rem;
    line-height: 1.35;
}

.heatmap-segmentation__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(82, 229, 255, 0.35);
    background: rgba(82, 229, 255, 0.1);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.heatmap-segmentation__text {
    color: var(--text-muted);
}

.heatmap-segmentation__meta {
    font-size: 0.75rem;
}

.heatmap-threshold {
    margin-top: 0.85rem;
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem 1rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    max-width: 560px;
}

.heatmap-threshold__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.heatmap-threshold__label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.heatmap-threshold__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.heatmap-threshold__readout {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.heatmap-threshold__pct {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.heatmap-threshold__sep {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.heatmap-threshold__count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.heatmap-threshold__unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.heatmap-threshold__slider-wrap {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    touch-action: none;
}

.heatmap-threshold__bar {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        rgb(8, 12, 28) 0%,
        rgb(16, 36, 120) 8%,
        rgb(20, 110, 200) 28%,
        rgb(0, 180, 170) 45%,
        rgb(60, 200, 70) 62%,
        rgb(240, 220, 20) 78%,
        rgb(255, 120, 0) 90%,
        rgb(220, 30, 30) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.heatmap-threshold__heat[hidden],
.heatmap-threshold__diff[hidden] {
    display: none !important;
}

.heatmap-threshold__scale {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.heatmap-threshold__scale--diff span:first-child {
    color: #60a5fa;
}

.heatmap-threshold__scale--diff span:nth-child(2) {
    color: #cbd5e1;
}

.heatmap-threshold__scale--diff span:last-child {
    color: #f9a8d4;
}

.heatmap-threshold__diff-range {
    position: relative;
    height: 28px;
    touch-action: none;
    user-select: none;
    cursor: pointer;
}

.heatmap-threshold__diff-rail {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 8px;
    transform: translateY(-50%);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(
        to right,
        #1e3a8a 0%,
        #3b82f6 22%,
        #94a3b8 50%,
        #e85d75 78%,
        #7f1d1d 100%
    );
    pointer-events: none;
}

.heatmap-threshold__diff-band {
    position: absolute;
    top: 50%;
    height: 8px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
    pointer-events: none;
    z-index: 1;
}

.heatmap-threshold__diff-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    background: #1a1f2e;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.55);
}

.heatmap-threshold__diff-thumb:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(82, 229, 255, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.55);
}

.heatmap-threshold__diff-thumb.is-dragging,
.heatmap-threshold__diff-thumb:active {
    cursor: grabbing;
    border-color: var(--accent);
}

.heatmap-threshold__slider {
    position: relative;
    width: 100%;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 28px;
    cursor: pointer;
    z-index: 1;
    touch-action: none;
}

.heatmap-threshold__slider:focus {
    outline: none;
}

.heatmap-threshold__slider:focus-visible::-webkit-slider-thumb {
    box-shadow:
        0 0 0 3px rgba(82, 229, 255, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.55);
}

.heatmap-threshold__slider:focus-visible::-moz-range-thumb {
    box-shadow:
        0 0 0 3px rgba(82, 229, 255, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.55);
}

.heatmap-threshold__slider::-webkit-slider-runnable-track {
    height: 8px;
    background: transparent;
    border: 0;
    border-radius: 999px;
}

.heatmap-threshold__slider::-moz-range-track {
    height: 8px;
    background: transparent;
    border: 0;
    border-radius: 999px;
}

.heatmap-threshold__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -5px;
    border-radius: 5px;
    background: #1a1f2e;
    border: 2.5px solid var(--accent);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.55);
    cursor: grab;
}

.heatmap-threshold__slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: #1a1f2e;
    border: 2.5px solid var(--accent);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.55);
    cursor: grab;
}

.heatmap-threshold__slider:active {
    cursor: grabbing;
}

.heatmap-threshold__slider:active::-webkit-slider-thumb,
.heatmap-threshold__slider.is-dragging::-webkit-slider-thumb {
    cursor: grabbing;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.35),
        0 0 0 4px rgba(82, 229, 255, 0.28),
        0 3px 10px rgba(0, 0, 0, 0.6);
}

.heatmap-threshold__slider:active::-moz-range-thumb,
.heatmap-threshold__slider.is-dragging::-moz-range-thumb {
    cursor: grabbing;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.35),
        0 0 0 4px rgba(82, 229, 255, 0.28),
        0 3px 10px rgba(0, 0, 0, 0.6);
}

.heatmap-threshold__hint {
    margin: 0.45rem 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .heatmap-threshold {
        max-width: none;
    }
}

.heatmap-viewer-col {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.heatmap-zone-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border-radius: 4px;
    object-fit: fill;
}

.heatmap-layers.is-zone-editing .heatmap-zone-overlay {
    pointer-events: auto;
    cursor: crosshair;
}

.heatmap-layers.is-zone-editing[data-zone-tool="brush"] .heatmap-zone-overlay,
.heatmap-layers.is-zone-editing[data-zone-tool="eraser"] .heatmap-zone-overlay {
    cursor: cell;
}

.heatmap-zone-editbar {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    order: -1;
}

.heatmap-zone-editbar[hidden] {
    display: none !important;
}

.heatmap-zone-editbar__tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.heatmap-zone-editbar__group {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.15rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.2);
}

.heatmap-zone-editbar__icon {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    position: relative;
}

.heatmap-zone-editbar__icon svg {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
    pointer-events: none;
}

.heatmap-zone-editbar__icon:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.heatmap-zone-editbar__icon.is-tool[aria-pressed="true"] {
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.16);
    color: var(--text);
}

.heatmap-zone-editbar__icon--save {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
}

.heatmap-zone-editbar__icon--save:hover {
    background: var(--accent-hover);
    color: var(--accent-ink);
}

.heatmap-zones #heatmapZonesToggle[aria-pressed="true"] {
    border-color: var(--accent);
    background: rgba(82, 229, 255, 0.14);
    color: var(--text);
}

.heatmap-zone-editbar__icon[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    background: #1a1d2b;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 5;
}

.heatmap-zone-editbar__icon[data-tooltip]:hover::after,
.heatmap-zone-editbar__icon[data-tooltip]:focus-visible::after {
    opacity: 1;
}

.heatmap-zone-toolbar__name,
.heatmap-zone-toolbar__role,
.heatmap-zone-toolbar__note,
.heatmap-zone-toolbar__color {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.heatmap-zone-toolbar__name input[type="text"] {
    width: 9rem;
    max-width: 40vw;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #0f111a;
    color: var(--text);
}

.heatmap-zone-toolbar__role select,
.heatmap-zone-toolbar__note input[type="text"] {
    min-width: 8.5rem;
    max-width: 28vw;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #0f111a;
    color: var(--text);
}

.heatmap-zone-toolbar__note input[type="text"] {
    width: 12rem;
}

.heatmap-zone-toolbar__color input[type="color"] {
    width: 2rem;
    height: 1.7rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.heatmap-zone-toolbar__hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
}

.heatmap-zones {
    flex: 0 0 300px;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.85rem;
    max-height: min(70vh, 640px);
    overflow: auto;
}

.heatmap-zones__drawer-toggle {
    display: none;
}

.heatmap-zones__head {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.heatmap-zones__title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.heatmap-zones__title-row h3 {
    margin: 0;
    font-size: 0.95rem;
}

.heatmap-zones__drawer-close {
    display: none;
    width: 2rem;
    height: 2rem;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.heatmap-zones__drawer-close svg {
    width: 1.1rem;
    height: 1.1rem;
}

.heatmap-zones__count {
    margin-left: auto;
    font-size: 0.8rem;
}

.heatmap-zones__help {
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.heatmap-zones__help svg {
    width: 0.85rem;
    height: 0.85rem;
}

.heatmap-zones__help:hover {
    color: var(--text);
    border-color: var(--accent);
}

.heatmap-zones__head-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}

.heatmap-zones__head-actions #heatmapZonesToggle {
    flex: 1 1 auto;
    min-width: 0;
}

.heatmap-zones__add {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: 0 1px 4px rgba(82, 229, 255, 0.35);
}

.heatmap-zones__add svg {
    width: 1.2rem;
    height: 1.2rem;
    display: block;
    pointer-events: none;
}

.heatmap-zones__add:hover {
    background: var(--accent-hover, #3AD8F5);
    color: var(--accent-ink);
    border-color: transparent;
}

.heatmap-zones__add[hidden] {
    display: none !important;
}

.heatmap-zones__drawer-bar {
    display: none;
}

.heatmap-zones__list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.heatmap-zones__empty {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
}

.heatmap-zones__empty[hidden] {
    display: none !important;
}

.heatmap-zones__overlap {
    margin: 0.65rem 0 0;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(240, 180, 41, 0.45);
    background: rgba(240, 180, 41, 0.1);
    color: #f0b429;
    font-size: 0.75rem;
    line-height: 1.35;
}

.heatmap-zones__overlap[hidden] {
    display: none !important;
}

.heatmap-zones__rank {
    margin: 0.55rem 0 0;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.heatmap-zones__rank strong {
    color: var(--text);
    font-weight: 600;
}

.heatmap-zones__rank[hidden] {
    display: none !important;
}

.heatmap-zone-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.7rem;
    background: #0f111a;
}

.heatmap-zone-card.is-editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(82, 229, 255, 0.25);
}

.heatmap-zone-card__top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.heatmap-zone-card__swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    flex: 0 0 auto;
}

.heatmap-zone-card__title-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.heatmap-zone-card__title {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heatmap-zone-card__title-wrap .metric-delta {
    flex: 0 0 auto;
}

.heatmap-zone-card__peak {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.05rem;
    min-width: 2.75rem;
    line-height: 1.05;
}

.heatmap-zone-card__peak-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.heatmap-zone-card__peak-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-family: var(--font-display, inherit);
}

.heatmap-zone-card__actions {
    display: flex;
    gap: 0.15rem;
    align-items: center;
}

.heatmap-zone-card__icon {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.heatmap-zone-card__icon svg {
    width: 1rem;
    height: 1rem;
}

.heatmap-zone-card__icon:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.heatmap-zone-card__icon--danger:hover {
    color: var(--danger);
}

.heatmap-zone-card__icon--expand[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.heatmap-zone-card__icon--expand svg {
    transition: transform 0.15s ease;
}

.heatmap-zone-card__body {
    display: none;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.heatmap-zone-card.is-open .heatmap-zone-card__body {
    display: block;
}

.heatmap-zone-card__metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.55rem;
    font-size: 0.72rem;
    margin: 0;
}

.heatmap-zone-card__metrics dt {
    margin: 0;
    color: var(--text-muted);
}

.heatmap-zone-card__metrics dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 600;
}

.heatmap-zone-card__metrics .metric-full {
    grid-column: 1 / -1;
}

.heatmap-zone-card__footer {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.heatmap-zone-card__hotspot {
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.heatmap-zone-card__hotspot:hover {
    color: var(--text);
}

.pop__card--help {
    max-width: 440px;
    max-height: min(86vh, 640px);
    overflow: auto;
}

.heatmap-zones-help {
    font-size: 0.85rem;
    line-height: 1.45;
}

.heatmap-zones-help p {
    margin: 0 0 0.85rem;
}

.heatmap-zones-help dl {
    margin: 0;
    display: grid;
    gap: 0.65rem;
}

.heatmap-zones-help dt {
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.heatmap-zones-help dd {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

@media (max-width: 1100px) {
    .heatmap-main-row {
        flex-direction: column;
    }

    .heatmap-zones {
        flex: 0 0 auto;
        width: 100%;
        max-height: none;
        padding: 0;
        overflow: visible;
        border-radius: 12px;
        position: relative;
        z-index: 20;
    }

    .heatmap-zones__drawer-bar {
        display: block;
    }

    .heatmap-zones__drawer-toggle {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.85rem 1rem;
        border: none;
        border-radius: 12px;
        background: transparent;
        color: var(--text);
        font: inherit;
        font-weight: 600;
        cursor: pointer;
    }

    .heatmap-zones__drawer-label {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
    }

    .heatmap-zones__drawer-chevron {
        width: 1.25rem;
        height: 1.25rem;
        flex: 0 0 auto;
        transition: transform 0.18s ease;
        color: var(--text-muted);
    }

    .heatmap-zones.is-drawer-open .heatmap-zones__drawer-chevron {
        transform: rotate(180deg);
    }

    .heatmap-zones__body {
        display: none;
    }

    .heatmap-zones.is-drawer-open .heatmap-zones__body {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 80;
        padding: 1rem 1rem 1.25rem;
        background: #0b0c14;
        border: none;
        border-radius: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .heatmap-zones.is-drawer-open .heatmap-zones__head {
        position: sticky;
        top: 0;
        z-index: 1;
        padding-bottom: 0.75rem;
        background: #0b0c14;
    }

    .heatmap-zones.is-drawer-open .heatmap-zones__count {
        display: none;
    }

    .heatmap-zones.is-drawer-open .heatmap-zones__drawer-close {
        display: inline-flex;
    }

    .heatmap-zones.is-drawer-open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 79;
        background: rgba(0, 0, 0, 0.45);
        pointer-events: none;
    }
}

.btn--sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 7px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 0.25rem;
}

.charts-grid__full {
    grid-column: 1 / -1;
}

.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap--wide {
    max-width: 720px;
}

@media (max-width: 900px) {
    .summary-places {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--sidebar-width), 86vw);
        border-right: 1px solid var(--border);
        border-bottom: none;
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.35);
        transform: translateX(0);
    }

    .app.is-sidebar-collapsed .sidebar {
        transform: translateX(-105%);
        box-shadow: none;
    }

    .main {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .app.is-sidebar-collapsed .main {
        margin-left: 0;
        width: 100%;
    }

    .home-hub__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
