/*
 * Staff production dashboard.
 * Scoped under .pd-dash so it cannot leak into the rest of the app.
 */

.pd-dash {
    --pd-bg: #ffffff;
    --pd-surface: #f7f8fb;
    --pd-border: #eceef3;
    --pd-ink: #1c2434;
    --pd-ink-soft: #6b7684;
    --pd-ink-faint: #98a1b0;
    --pd-accent: #4466f2;
    --pd-accent-soft: rgba(68, 102, 242, 0.1);
    --pd-alert: #e0484d;
    --pd-ok: #1f9d63;
    --pd-radius: 12px;
    --pd-shadow: 0 6px 18px rgba(28, 36, 52, 0.06);
}

body.color-1E202D .pd-dash,
body.dark-mode .pd-dash {
    --pd-bg: #252932;
    --pd-surface: #20242c;
    --pd-border: #2f3541;
    --pd-ink: #d7dbe8;
    --pd-ink-soft: #9aa1b5;
    --pd-ink-faint: #7f8699;
    --pd-accent: #5b73e8;
    --pd-accent-soft: rgba(91, 115, 232, 0.18);
    --pd-alert: #f2646a;
    --pd-ok: #35c48b;
    --pd-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.pd-dash.dashboard-view {
    padding-bottom: 40px;
}

.pd-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 24px;
    margin: 8px 0 20px;
}

.pd-hero__copy h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    color: var(--pd-ink);
}

.pd-hero__copy p {
    margin: 4px 0 0;
    color: var(--pd-ink-soft);
}

.pd-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.pd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    color: var(--pd-ink-soft);
    font-size: 12px;
}

.pd-chip strong {
    color: var(--pd-ink);
    font-size: 13px;
}

.pd-chip.is-alert {
    border-color: rgba(224, 72, 77, 0.35);
    color: var(--pd-alert);
}

.pd-chip.is-alert strong {
    color: var(--pd-alert);
}

.pd-chip.is-ok strong {
    color: var(--pd-ok);
}

.pd-chip.is-quote {
    border-color: rgba(124, 92, 214, 0.35);
    color: #7c5cd6;
}

.pd-chip.is-quote strong {
    color: #7c5cd6;
}

.pd-hero__actions {
    display: flex;
    gap: 8px;
}

.pd-kpis {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.pd-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 12px 12px;
    background: var(--pd-bg);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    box-shadow: var(--pd-shadow);
    text-decoration: none !important;
    color: var(--pd-ink);
    min-height: 92px;
    position: relative;
}

.pd-kpi:hover {
    border-color: var(--pd-accent);
}

.pd-kpi__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: 12px;
    right: 12px;
}

.pd-kpi__value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--pd-ink);
}

.pd-kpi__label {
    font-size: 12px;
    color: var(--pd-ink-soft);
    margin-top: 4px;
}

.pd-kpi__mine {
    font-size: 11px;
    color: var(--pd-ink-faint);
    margin-top: auto;
}

.pd-kpi--overdue .pd-kpi__value {
    color: var(--pd-alert);
}

.pd-charts {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.pd-charts--secondary {
    grid-template-columns: 1fr 1fr;
}

.pd-card--chart {
    min-height: 0;
}

.pd-chart-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 16px 0;
    font-size: 12px;
    color: var(--pd-ink-soft);
}

.pd-chart-meta strong {
    color: var(--pd-ink);
}

.pd-chart-meta.is-ok strong {
    color: var(--pd-ok);
}

.pd-chart-meta.is-alert strong {
    color: var(--pd-alert);
}

.pd-chart {
    height: 240px;
    padding: 8px 12px 16px;
    position: relative;
}

.pd-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.pd-mix {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px;
    padding: 8px 16px 16px;
    align-items: center;
}

.pd-mix__wrap {
    position: relative;
    height: 180px;
}

.pd-mix__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pd-mix__center strong {
    font-size: 26px;
    letter-spacing: -0.04em;
    color: var(--pd-ink);
}

.pd-mix__center span {
    font-size: 11px;
    color: var(--pd-ink-faint);
}

.pd-mix__legend {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pd-mix__legend li {
    padding: 6px 0;
    font-size: 13px;
    color: var(--pd-ink-soft);
}

.pd-mix__legend a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    color: inherit !important;
    text-decoration: none !important;
}

.pd-mix__legend strong {
    margin-left: auto;
    color: var(--pd-ink);
}

.pd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
}

.pd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.pd-grid--split {
    align-items: start;
}

.pd-grid--single {
    grid-template-columns: 1fr;
}

.pd-card {
    background: var(--pd-bg);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    box-shadow: var(--pd-shadow);
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.pd-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--pd-border);
}

.pd-card__head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    color: var(--pd-ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pd-card__count {
    font-size: 12px;
    color: var(--pd-ink-faint);
    background: var(--pd-surface);
    border-radius: 999px;
    padding: 2px 8px;
}

.pd-empty {
    margin: 0;
    padding: 28px 16px;
    color: var(--pd-ink-faint);
    text-align: center;
}

.pd-task-list {
    padding: 4px 0;
}

.pd-task {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--pd-border);
}

.pd-task:last-child {
    border-bottom: 0;
}

.pd-task:hover {
    background: var(--pd-surface);
}

.pd-task__bar {
    width: 3px;
    border-radius: 3px;
    flex: 0 0 3px;
    align-self: stretch;
}

.pd-task__body {
    min-width: 0;
    flex: 1;
}

.pd-task__top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.pd-task__id {
    color: var(--pd-ink-faint);
    font-size: 12px;
    flex: 0 0 auto;
}

.pd-task__title {
    color: var(--pd-ink) !important;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-task__meta {
    font-size: 12px;
    color: var(--pd-ink-soft);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-task__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--pd-ink-faint);
}

.pd-task__who {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pd-task__who img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.pd-task__due.is-late,
.pd-task.is-overdue .pd-task__due {
    color: var(--pd-alert);
    font-weight: 600;
}

.pd-card__more {
    display: block;
    text-align: center;
    padding: 10px 16px 14px;
    font-size: 12px;
    color: var(--pd-accent) !important;
}

.pd-team {
    padding: 6px 0 10px;
}

.pd-team__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--pd-ink);
    text-decoration: none !important;
}

.pd-team__row img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.pd-team__name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-team__bars {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pd-team__pill {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--pd-accent-soft);
    color: var(--pd-accent);
}

.pd-team__pill--qc {
    background: rgba(241, 196, 15, 0.16);
    color: #c39200;
}

.pd-team__pill--fb {
    background: rgba(231, 76, 60, 0.12);
    color: #c0392b;
}

.pd-team__total {
    font-size: 13px;
    font-weight: 700;
    min-width: 28px;
    text-align: right;
}

.pd-kpis--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

a.pd-task {
    text-decoration: none !important;
    color: inherit;
}

.cd-finance,
.cd-viewer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 8px;
}

.cd-viewer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cd-finance__kpi,
.cd-viewer__kpi {
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cd-finance__kpi span,
.cd-viewer__kpi span {
    font-size: 11px;
    color: var(--pd-ink-soft);
}

.cd-finance__kpi strong,
.cd-viewer__kpi strong {
    font-size: 20px;
    color: var(--pd-ink);
    line-height: 1.15;
}

.cd-finance__kpi.is-alert strong {
    color: var(--pd-alert);
}

.cd-viewer__products {
    padding: 4px 0 10px;
}

.cd-viewer__sku {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--pd-ink);
}

.cd-viewer__sku strong {
    color: var(--pd-ink-soft);
    font-weight: 600;
}

.pd-card__head a.pd-card__count {
    color: var(--pd-accent);
    text-decoration: none;
}

@media (max-width: 1200px) {
    .pd-kpis,
    .pd-kpis--five {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pd-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pd-kpis,
    .pd-kpis--five,
    .pd-grid,
    .pd-grid--split,
    .pd-charts,
    .pd-charts--secondary,
    .pd-mix,
    .cd-finance,
    .cd-viewer {
        grid-template-columns: 1fr;
    }

    .pd-hero__actions {
        width: 100%;
    }
}
