/* ================================================================
   DASHBOARD GRID — Apple 12-column composition
   ================================================================
   Use with <DashboardLayout>/<DashboardGrid>/<DashboardZone>.

   Sizing (zone width variants):
     OneThird   — span 4  (4/12)  — sparkline mini chart, side stat
     Half       — span 6  (6/12)  — comparison chart, donut, simple bar
     TwoThirds  — span 8  (8/12)  — main trend (DEFAULT)
     Full       — span 12 (12/12) — high-detail, multi-series, tables

   Auto-collapse responsive:
     ≥1200px : as-is (12-col)
     992-1199: TwoThirds → Full, OneThird → Half
     <992px  : all zones → Full
   ================================================================ */

.dp-dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0;
}

.dp-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    width: 100%;
}

.dp-dashboard-zone {
    min-width: 0; /* allow grid items to shrink below content */
}

/* Width variants */
.dp-zone--1-3   { grid-column: span 4; }
.dp-zone--1-2   { grid-column: span 6; }
.dp-zone--2-3   { grid-column: span 8; }
.dp-zone--full  { grid-column: span 12; }

/* Tablet (992-1199): collapse 2/3 → full, 1/3 → 1/2 */
@media (max-width: 1199.98px) {
    .dp-zone--2-3 { grid-column: span 12; }
    .dp-zone--1-3 { grid-column: span 6; }
}

/* Mobile (<992): all full */
@media (max-width: 991.98px) {
    .dp-dashboard-grid { gap: 12px; }
    .dp-zone--1-3,
    .dp-zone--1-2,
    .dp-zone--2-3,
    .dp-zone--full { grid-column: span 12; }
}

/* ================================================================
   DASHBOARD HEADER
   ================================================================ */
.dp-dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.dp-dashboard-header-text {
    flex: 1;
    min-width: 0;
}

.dp-dashboard-breadcrumb {
    font-size: 12px;
    color: var(--dp-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.01em;
}
.dp-dashboard-breadcrumb a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-micro, 150ms ease);
}
.dp-dashboard-breadcrumb a:hover {
    color: var(--dp-text-primary);
}
.dp-dashboard-breadcrumb-sep {
    opacity: 0.55;
    font-size: 10px;
}

.dp-dashboard-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0 0 6px;
    color: var(--dp-text-primary);
}

.dp-dashboard-subtitle {
    font-size: 13.5px;
    color: var(--dp-text-secondary);
    line-height: 1.5;
}

.dp-dashboard-subtitle strong {
    color: var(--dp-text-primary);
    font-weight: 600;
}

.dp-dashboard-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Subtitle dot separator */
.dp-dashboard-subtitle .dot-sep {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--dp-text-muted);
    margin: 0 8px;
    vertical-align: middle;
    opacity: 0.6;
}

@media (max-width: 575.98px) {
    .dp-dashboard-title {
        font-size: 24px;
    }
    .dp-dashboard-header {
        align-items: flex-start;
    }
}

/* ================================================================
   KPI STRIP — 4-up KPI card grid
   Reflows: 4 → 2 → 1 columns
   ================================================================ */
.dp-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 100%;
    align-items: stretch;
    --dp-kpi-card-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.05);
    --dp-kpi-card-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.07);
}

.dp-kpi-strip > *,
.dp-kpi-strip .dp-lmc,
.dp-kpi-strip .dp-lmc__inner,
.dp-kpi-strip .dp-kpi-card,
.dp-kpi-strip .kpi-card {
    width: 100%;
    min-width: 0;
}

/* LazyMetricCard's base wrapper uses overflow:hidden for skeleton/stale
   overlays. In the ready KPI strip, that clips the inner KpiCard shadow while
   empty-state cards draw shadow on the wrapper itself. Keep shadows consistent
   by allowing ready/stale KPI cells to paint outside their wrapper bounds. */
.dp-kpi-strip .dp-lmc--ready,
.dp-kpi-strip .dp-lmc--stale {
    overflow: visible;
}

@media (max-width: 1199.98px) {
    .dp-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .dp-kpi-strip { grid-template-columns: 1fr; gap: 12px; }
}

/* ================================================================
   KPI STRIP — 5-up variant (Privacy Notices Dashboard)
   Applied via KpiStrip's CssClass="pn-kpi-strip" parameter. Lives here
   (unscoped, global) rather than in Dashboard.razor.css: Blazor CSS
   isolation only stamps the page's scope attribute onto literal HTML
   elements written in that .razor file, never onto a child component's
   own rendered root element — so a scoped selector targeting KpiStrip's
   output can never match. Compound class selector (0,2,0 specificity)
   beats the base .dp-kpi-strip rule (0,1,0) regardless of source order.
   ================================================================ */
.dp-kpi-strip.pn-kpi-strip {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1399.98px) {
    .dp-kpi-strip.pn-kpi-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1199.98px) {
    .dp-kpi-strip.pn-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .dp-kpi-strip.pn-kpi-strip { grid-template-columns: 1fr; gap: 12px; }
}

/* ================================================================
   KPI CARD — Apple hero
   ================================================================ */
.dp-kpi-card {
    box-sizing: border-box;
    width: 100%;
    background: var(--dp-surface-primary);
    border: none;
    border-radius: var(--radius-lg, 14px);
    padding: 20px;
    box-shadow: var(--dp-kpi-card-shadow);
    transition: box-shadow var(--transition-state, 250ms ease);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 132px;
    height: 100%;
    font: inherit;
    text-align: left;
    animation: kpiCardRise 600ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.dp-kpi-card:hover {
    box-shadow: var(--dp-kpi-card-shadow-hover);
}

.dp-kpi-card--clickable {
    cursor: pointer;
}
.dp-kpi-card--clickable:hover {
    box-shadow: var(--dp-kpi-card-shadow-hover);
}
.dp-kpi-card--clickable:active {
    transform: scale(0.99);
}
.dp-kpi-card--clickable:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(var(--pp-primary-rgb, 0, 122, 130), 0.28));
}

/* Stagger entry — apply class .dp-kpi-stagger-N (1-4) on parent strip children */
.dp-kpi-strip > .dp-kpi-card:nth-child(1) { animation-delay: 60ms; }
.dp-kpi-strip > .dp-kpi-card:nth-child(2) { animation-delay: 120ms; }
.dp-kpi-strip > .dp-kpi-card:nth-child(3) { animation-delay: 180ms; }
.dp-kpi-strip > .dp-kpi-card:nth-child(4) { animation-delay: 240ms; }

@keyframes kpiCardRise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dp-kpi-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
}

.dp-kpi-card__icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md, 10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

/* Icon variants (tinted circles) */
.dp-kpi-card__icon--brand {
    background: rgba(var(--pp-primary-rgb, 0, 122, 130), 0.10);
    color: var(--dp-interactive-primary);
}
.dp-kpi-card__icon--success {
    background: var(--dp-status-success-bg);
    color: var(--dp-status-success);
}
.dp-kpi-card__icon--warning {
    background: var(--dp-status-warning-bg);
    color: var(--dp-status-warning);
}
.dp-kpi-card__icon--danger {
    background: var(--dp-status-danger-bg);
    color: var(--dp-status-danger);
}
.dp-kpi-card__icon--info {
    background: var(--dp-status-info-bg);
    color: var(--dp-status-info);
}
.dp-kpi-card__icon--neutral {
    background: var(--dp-bg-tint, rgba(0, 0, 0, 0.04));
    color: var(--dp-text-secondary);
}

.dp-kpi-card__sparkline {
    width: 64px;
    height: 22px;
    opacity: 0.7;
}

.dp-kpi-card__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dp-text-muted);
    margin-bottom: 6px;
}

.dp-kpi-card__value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--dp-text-primary);
    margin: 0 0 8px;
    font-feature-settings: 'tnum', 'cv11';
    font-variant-numeric: tabular-nums;
}

.dp-kpi-card__value-suffix {
    font-size: 17px;
    font-weight: 500;
    color: var(--dp-text-muted);
    margin-left: 2px;
    letter-spacing: -0.01em;
}

.dp-kpi-card__delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 500;
    margin-top: auto;
    padding-top: 8px;
}

.dp-kpi-card__delta-text {
    color: var(--dp-text-muted);
    margin-left: 4px;
    font-weight: 400;
}

.dp-kpi-card__delta--positive { color: var(--dp-status-success); }
.dp-kpi-card__delta--negative { color: var(--dp-status-danger); }
.dp-kpi-card__delta--flat     { color: var(--dp-text-muted); }

.dp-kpi-card__chevron {
    position: absolute;
    top: 18px;
    right: 18px;
    color: var(--dp-text-muted);
    opacity: 0;
    transition: opacity var(--transition-micro, 150ms ease),
                transform var(--transition-micro, 150ms ease);
    font-size: 12px;
}

.dp-kpi-card--clickable:hover .dp-kpi-card__chevron {
    opacity: 1;
    transform: translateX(2px);
}

/* Compatibility for legacy dashboard KPI markup still rendered inside
   LazyMetricCard on DSR pages. Without this, the grid cell is equal height
   but the visible .kpi-card inside it stays content-height. */
.dp-kpi-strip .kpi-card {
    box-sizing: border-box;
    min-height: 132px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dp-kpi-strip .kpi-card .kpi-footer {
    margin-top: auto;
}

/* ================================================================
   STATUS BADGE — semantic with dot prefix (WCAG 1.4.1 multi-channel)
   ================================================================ */
.dp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.005em;
    border-radius: var(--radius-sm, 6px);
    white-space: nowrap;
    line-height: 1.4;
}

.dp-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.dp-status-badge--brand {
    background: rgba(var(--pp-primary-rgb, 0, 122, 130), 0.12);
    color: var(--dp-interactive-primary);
}
.dp-status-badge--success {
    background: var(--dp-status-success-bg);
    color: var(--dp-status-success);
}
.dp-status-badge--warning {
    background: var(--dp-status-warning-bg);
    color: var(--dp-status-warning);
}
.dp-status-badge--danger {
    background: var(--dp-status-danger-bg);
    color: var(--dp-status-danger);
}
.dp-status-badge--info {
    background: var(--dp-status-info-bg);
    color: var(--dp-status-info);
}
.dp-status-badge--neutral {
    background: var(--dp-bg-tint, rgba(0, 0, 0, 0.04));
    color: var(--dp-text-secondary);
}

/* ================================================================
   SUBJECT CELL — avatar + name + email
   ================================================================ */
.dp-subject {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dp-subject__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5B6B80 0%, #1E293B 100%);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    font-feature-settings: 'tnum';
}

.dp-subject__avatar--brand {
    background: linear-gradient(135deg, var(--dp-interactive-primary) 0%, #003A40 100%);
}

.dp-subject__body {
    min-width: 0;
    overflow: hidden;
}

.dp-subject__name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--dp-text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-subject__email {
    font-size: 11.5px;
    color: var(--dp-text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================================
   ROW ACTION BUTTON — table action icon button
   ================================================================ */
.dp-row-action-group {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.dp-row-action {
    width: 30px;
    height: 30px;
    border: none;
    padding: 0;
    border-radius: var(--radius-sm, 6px);
    background: transparent;
    color: var(--dp-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-micro, 150ms ease),
                color var(--transition-micro, 150ms ease);
}

.dp-row-action:hover {
    background: var(--dp-bg-tint, rgba(0, 0, 0, 0.04));
    color: var(--dp-text-primary);
}

.dp-row-action:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(var(--pp-primary-rgb, 0, 122, 130), 0.28));
}

.dp-row-action--danger:hover {
    background: var(--dp-status-danger-bg);
    color: var(--dp-status-danger);
}

.dp-row-action svg,
.dp-row-action i {
    font-size: 13px;
    width: 14px;
    height: 14px;
}

/* ================================================================
   ACTIVITY FEED — Apple vertical timeline
   ================================================================ */
.dp-activity {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.dp-activity::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--dp-border-subtle);
    border-radius: 1px;
}

.dp-activity__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0 10px 4px;
    border-bottom: 1px solid var(--dp-border-subtle);
    position: relative;
}
.dp-activity__item:first-child { padding-top: 4px; }
.dp-activity__item:last-child {
    border-bottom: none;
    padding-bottom: 4px;
}

.dp-activity__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 7px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--dp-surface-primary);
    z-index: 1;
}

.dp-activity__dot--brand   { background: var(--dp-interactive-primary); }
.dp-activity__dot--success { background: var(--dp-status-success); }
.dp-activity__dot--warning { background: var(--dp-status-warning); }
.dp-activity__dot--danger  { background: var(--dp-status-danger); }
.dp-activity__dot--info    { background: var(--dp-status-info); }
.dp-activity__dot--neutral { background: var(--dp-text-muted); }

.dp-activity__body {
    flex: 1;
    min-width: 0;
}

.dp-activity__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dp-text-primary);
    line-height: 1.35;
    letter-spacing: -0.005em;
}

.dp-activity__desc {
    font-size: 12.5px;
    color: var(--dp-text-secondary);
    line-height: 1.4;
    margin-top: 2px;
}

.dp-activity__time {
    font-size: 11px;
    color: var(--dp-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 5px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-feature-settings: 'tnum';
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.dp-activity__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--dp-text-muted);
    font-size: 13px;
    line-height: 1.5;
}

/* ================================================================
   TABLE DATE COLUMN — tabular nums monospace for alignment
   ================================================================ */
.due {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--dp-text-secondary);
    font-feature-settings: 'tnum';
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.due-urgent { color: var(--dp-status-danger); font-weight: 600; }
.due-soon { color: var(--dp-status-warning); font-weight: 500; }

/* ================================================================
   REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .dp-kpi-card { animation: none; }
    .dp-kpi-card,
    .dp-row-action,
    .dp-kpi-card__chevron {
        transition: none;
    }
}
