/* =========================================================
   SPACING BUILDER — Dashboard preview
   assets/css/pages/spacing-builder/preview/dashboard-preview.css
   =========================================================
   Chrome only (colors / borders / radius / typography). All spacing
   (padding, gaps) is set inline as var(--sp-*) by the preview module.
   Chrome colors use the shared --preview-* palette.
   ========================================================= */

.sp-dp {
    background: var(--preview-surface);
    color: var(--preview-text);
    border: 1px solid var(--preview-border);
    border-radius: 12px;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    min-height: 360px;
}


/* ── Top bar ── */
.sp-dp-top {
    background: var(--preview-bg);
    border-bottom: 1px solid var(--preview-border);
}

.sp-dp-brand { font-weight: 700; font-size: 0.9rem; color: var(--preview-text); }

.sp-dp-navlink { color: var(--preview-muted); font-size: 0.8rem; }

.sp-dp-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--preview-accent);
    color: var(--preview-accent-ct);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--preview-bg), 0 0 0 3px var(--preview-border);
    flex-shrink: 0;
}


/* ── Sidebar ── */
.sp-dp-side {
    background: var(--preview-bg);
    border-right: 1px solid var(--preview-border);
    min-width: 148px;
}

.sp-dp-side-label {
    color: var(--preview-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sp-dp-side-item { color: var(--preview-muted); font-size: 0.8rem; border-radius: 6px; }
.sp-dp-side-item--active { color: var(--preview-text); font-weight: 600; background: var(--preview-surface); }


/* ── Main ── */
.sp-dp-main { background: var(--preview-surface); }


/* Content header */
.sp-dp-header-title { font-size: 0.95rem; font-weight: 700; color: var(--preview-text); }
.sp-dp-header-sub { font-size: 0.75rem; color: var(--preview-muted); }

.sp-dp-search {
    background: var(--preview-bg);
    border: 1px solid var(--preview-border);
    border-radius: 8px;
    min-width: 168px;
    line-height: 1;
}

.sp-dp-search-icon {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.4px solid var(--preview-muted);
    opacity: 0.6;
    flex-shrink: 0;
}
.sp-dp-search-icon::after {
    content: '';
    position: absolute;
    right: -3.5px;
    bottom: -1px;
    width: 4px;
    height: 1.4px;
    background: var(--preview-muted);
    border-radius: 1px;
    transform: rotate(45deg);
}

.sp-dp-search-text { font-size: 0.78rem; line-height: 1; color: var(--preview-muted); white-space: nowrap; }

.sp-dp-btn {
    background: var(--preview-accent);
    color: var(--preview-accent-ct);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.sp-dp-btn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--preview-accent-ct);
    opacity: 0.85;
    flex-shrink: 0;
}


/* KPI cards */
.sp-dp-kpi {
    background: var(--preview-bg);
    border: 1px solid var(--preview-border);
    border-radius: 10px;
}

.sp-dp-kpi-label {
    color: var(--preview-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sp-dp-kpi-value { font-size: 1.1rem; font-weight: 700; color: var(--preview-text); }

.sp-dp-kpi-trend {
    padding: 1px 6px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}
.sp-dp-kpi-trend--up   { color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.sp-dp-kpi-trend--down { color: #dc2626; background: rgba(220, 38, 38, 0.12); }

.sp-dp-kpi-sub { font-size: 0.68rem; color: var(--preview-muted); }

.sp-dp-kpi-spark { height: 20px; }

.sp-dp-kpi-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--preview-accent);
    opacity: 0.35;
    flex-shrink: 0;
}
.sp-dp-kpi-bar:last-child { opacity: 0.9; }


/* Panel + order list */
.sp-dp-panel {
    background: var(--preview-bg);
    border: 1px solid var(--preview-border);
    border-radius: 10px;
}

.sp-dp-panel-title { font-size: 0.85rem; font-weight: 700; color: var(--preview-text); }
.sp-dp-panel-link { font-size: 0.75rem; font-weight: 600; color: var(--preview-accent); cursor: pointer; }

.sp-dp-row-head { border-bottom: 1px solid var(--preview-border); line-height: 1.2; }

.sp-dp-col-label {
    color: var(--preview-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sp-dp-row { border-bottom: 1px solid var(--preview-border); line-height: 1.2; }
.sp-dp-row:last-child { border-bottom: none; }

.sp-dp-row-id {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--preview-muted);
}

.sp-dp-row-name { font-size: 0.82rem; font-weight: 600; color: var(--preview-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sp-dp-row-date { font-size: 0.75rem; color: var(--preview-muted); }

.sp-dp-row-amount { font-size: 0.82rem; font-weight: 600; color: var(--preview-text); font-variant-numeric: tabular-nums; }

.sp-dp-row-status {
    padding: 1px 8px;
    border-radius: 9999px;
    background: var(--preview-surface);
    color: var(--preview-muted);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    text-align: center;
}
.sp-dp-row-status--paid      { color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.sp-dp-row-status--pending   { color: #d97706; background: rgba(217, 119, 6, 0.12); }
.sp-dp-row-status--refunded  { color: var(--preview-muted); background: var(--preview-surface); }

.sp-dp-row-action { color: var(--preview-muted); font-size: 0.9rem; text-align: center; }


/* =========================================================
   SPACING OVERLAY — dashboard-specific micro-spacing guides,
   shown when the overlay toggle is ON. Visual language mirrors
   the Website Preview overlay (sp-wp-ov-*), but this is a
   separate guide set: dense/micro spacing, not macro spacing.
   Sits as a sibling of .sp-dp inside the mount container
   (set to position:relative by dashboard-preview.js).
   ========================================================= */
.sp-dp-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.sp-dp-ov-line {
    position: absolute;
}

.sp-dp-ov-line--v {
    width: 0;
    border-left: 1px dashed var(--preview-muted);
    opacity: 0.42;
    transform: translateX(-50%);
}

.sp-dp-ov-line--h {
    height: 0;
    border-top: 1px dashed var(--preview-muted);
    opacity: 0.42;
    transform: translateY(-50%);
}

/* End-cap ticks so each guide reads as a bounded measurement, not a stray dash */
.sp-dp-ov-line--v::before,
.sp-dp-ov-line--v::after {
    content: "";
    position: absolute;
    left: -4px;
    width: 8px;
    height: 0;
    border-top: 1px solid var(--preview-muted);
    opacity: 0.42;
}
.sp-dp-ov-line--v::before { top: 0; }
.sp-dp-ov-line--v::after  { bottom: 0; }

.sp-dp-ov-line--h::before,
.sp-dp-ov-line--h::after {
    content: "";
    position: absolute;
    top: -4px;
    height: 8px;
    width: 0;
    border-left: 1px solid var(--preview-muted);
    opacity: 0.42;
}
.sp-dp-ov-line--h::before { left: 0; }
.sp-dp-ov-line--h::after  { right: 0; }

.sp-dp-ov-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: var(--preview-surface);
    color: var(--preview-text);
    border: 1px solid var(--preview-muted);
    box-shadow: var(--shadow-sm);
    opacity: 0.74;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 9px;
    border-radius: 9999px;
    white-space: nowrap;
}

/* Card padding — corner brackets instead of a full debug-style rectangle */
.sp-dp-ov-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0.42;
}
.sp-dp-ov-corner--tl { border-top: 1.5px solid var(--preview-muted); border-left: 1.5px solid var(--preview-muted); }
.sp-dp-ov-corner--tr { border-top: 1.5px solid var(--preview-muted); border-right: 1.5px solid var(--preview-muted); }
.sp-dp-ov-corner--bl { border-bottom: 1.5px solid var(--preview-muted); border-left: 1.5px solid var(--preview-muted); }
.sp-dp-ov-corner--br { border-bottom: 1.5px solid var(--preview-muted); border-right: 1.5px solid var(--preview-muted); }


/* =========================================================
   MOBILE FRAME — overrides the preview's inline layout only
   ========================================================= */
.sp-preview-root--mobile .sp-dp-side         { display: none !important; }
.sp-preview-root--mobile .sp-dp-navlink      { display: none !important; }
.sp-preview-root--mobile .sp-dp-kpis         { grid-template-columns: repeat(2, 1fr) !important; }
.sp-preview-root--mobile .sp-dp-header-right { display: none !important; }
.sp-preview-root--mobile .sp-dp-row-head     { display: none !important; }
.sp-preview-root--mobile .sp-dp-row-date,
.sp-preview-root--mobile .sp-dp-row-action   { display: none !important; }
.sp-preview-root--mobile .sp-dp-row          { grid-template-columns: 56px 1fr 70px 64px !important; }
