/* LGPD — superfície de ataque. Tokens come from rksam-theme.css.
   Indicator colours are inline (set via the IndicatorList ColorByIndicator
   map). The heatmap uses --lgpd-cell-base passed through inline style,
   then derives intensity stops in CSS. */

.lgpd-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    align-items: stretch;
    min-height: calc(100vh - 240px);
}

/* ---- Indicator list (left rail) ---------------------------------------- */
.lgpd-indicator-list {
    background: var(--surface-2, #f5f6f8);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    height: fit-content;
}
.lgpd-indicator-list__header {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 6px 8px;
    font-weight: 500;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 4px;
}
.lgpd-indicator-list__empty {
    padding: 14px 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

.lgpd-indicator {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: start;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.12s;
    margin-bottom: 2px;
}
.lgpd-indicator:hover { background: rgba(0, 0, 0, 0.04); }
.lgpd-indicator.sel { background: #E6F1FB; }
.lgpd-indicator__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-top: 4px;
}
.lgpd-indicator__body { min-width: 0; }
.lgpd-indicator__name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}
.lgpd-indicator__metrics {
    display: flex;
    gap: 6px;
    align-items: baseline;
    margin-top: 2px;
}
.lgpd-indicator__count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.lgpd-indicator__sub {
    font-size: 10px;
    color: var(--text-tertiary);
}
.lgpd-indicator__trend {
    font-size: 10px;
    line-height: 1.3;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.lgpd-trend--up    { color: #A04444; }   /* growing surface = bad */
.lgpd-trend--down  { color: #639922; }   /* shrinking surface = good */
.lgpd-trend--flat  { color: var(--text-tertiary); }
.lgpd-trend--new   { color: #A04444; font-weight: 500; }

/* ---- Right-side main area --------------------------------------------- */
.lgpd-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.lgpd-main__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.lgpd-main__active {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lgpd-main__active-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lgpd-main__active-name {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.lgpd-main__active-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
}

/* ---- Toggle ------------------------------------------------------------ */
.lgpd-heatmap-toggle {
    display: inline-flex;
    border: 0.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.lgpd-heatmap-toggle__btn {
    background: transparent;
    border: 0;
    border-right: 0.5px solid var(--border);
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}
.lgpd-heatmap-toggle__btn:last-child { border-right: 0; }
.lgpd-heatmap-toggle__btn:hover { background: rgba(0,0,0,0.03); }
.lgpd-heatmap-toggle__btn.active {
    background: #185FA5;
    color: #fff;
    font-weight: 500;
}

/* ---- Heatmap grid ------------------------------------------------------ */
.lgpd-heatmap {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    min-height: 140px;
    --lgpd-cell-base: #185FA5;
}
.lgpd-heatmap__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 116px;
    color: var(--text-tertiary);
    font-size: 12px;
}
.lgpd-heatmap__grid {
    display: grid;
    gap: 3px;
    align-items: stretch;
}
.lgpd-heatmap__cell {
    background: var(--surface-2, #f5f6f8);
    border: 0;
    border-radius: 3px;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    min-height: 64px;
    color: var(--text-primary);
    font-size: 10px;
    transition: filter 0.12s, transform 0.12s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}
/* Intensity 0 = empty cell (uses surface-2 above). 1-4 walk from light
   to full base colour by mixing with white. The mix() gives a sequential
   scale per active indicator without coding 4 separate stops per colour. */
.lgpd-heatmap__cell.intensity-1 { background: color-mix(in srgb, var(--lgpd-cell-base) 18%, white); }
.lgpd-heatmap__cell.intensity-2 { background: color-mix(in srgb, var(--lgpd-cell-base) 38%, white); }
.lgpd-heatmap__cell.intensity-3 { background: color-mix(in srgb, var(--lgpd-cell-base) 64%, white); color: #fff; }
.lgpd-heatmap__cell.intensity-4 { background: var(--lgpd-cell-base); color: #fff; }

.lgpd-heatmap__cell:hover { filter: brightness(0.95); transform: translateY(-1px); }
.lgpd-heatmap__cell.sel   { outline: 2px solid #185FA5; outline-offset: 1px; }

.lgpd-heatmap__cell-label {
    font-size: 10px;
    line-height: 1.2;
    word-break: break-word;
}
.lgpd-heatmap__cell-count {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---- Drill-down panel -------------------------------------------------- */
.lgpd-drilldown {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 4px;
}
.lgpd-drilldown__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 8px;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 8px;
}
.lgpd-drilldown__title {
    font-size: 13px;
    color: var(--text-primary);
}
.lgpd-drilldown__indicator-name { font-weight: 500; }
.lgpd-drilldown__sep {
    color: var(--text-tertiary);
    margin: 0 6px;
}
.lgpd-drilldown__metrics {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.lgpd-drilldown__metrics strong { color: var(--text-primary); }
.lgpd-drilldown__close {
    background: transparent;
    border: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 4px;
}
.lgpd-drilldown__close:hover { color: var(--text-primary); }

.lgpd-drilldown__empty {
    padding: 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.lgpd-drilldown__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.lgpd-drilldown__table th {
    text-align: left;
    font-weight: 500;
    color: #0C447C;
    background: #E6F1FB;
    padding: 6px 8px;
    font-size: 11px;
}
.lgpd-drilldown__table th.num,
.lgpd-drilldown__table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.lgpd-drilldown__table th.actions,
.lgpd-drilldown__table td.actions {
    width: 28px;
    text-align: center;
}
.lgpd-drilldown__table td {
    padding: 5px 8px;
    border-top: 0.5px solid var(--border);
    color: var(--text-primary);
}
.lgpd-drilldown__table td.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

.lgpd-drilldown__wl {
    background: transparent;
    border: 0;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    padding: 0 4px;
}
.lgpd-drilldown__wl:hover { color: #A04444; }

.lgpd-drilldown__footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 0.5px solid var(--border);
    font-size: 11px;
    color: var(--text-tertiary);
}
.lgpd-drilldown__hint {
    margin-left: 6px;
}
