/* FEAT-719 — Workshop KPI: prefix wkpi- */

/* ── Page shell ──────────────────────────────────────────────────────────── */
.wkpi-page {
    padding: 1rem 1.25rem 2rem;
    max-width: 1600px;
}

.wkpi-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.wkpi-page-title {
    font-size: 1.3rem;
    font-weight: 600;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.wkpi-tabs { margin-bottom: 1rem; }
.wkpi-tab { padding: 0.5rem 1rem; cursor: pointer; }
.wkpi-tab--selected { font-weight: 600; border-bottom: 2px solid #4a9eff; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.wkpi-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.wkpi-label { font-size: 0.85rem; white-space: nowrap; }

.wkpi-dropdown {
    min-width: 160px;
}

.wkpi-reload-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.wkpi-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.wkpi-card {
    min-width: 120px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    flex: 1 1 120px;
}

.wkpi-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.wkpi-card-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.75;
}

/* ── Section ─────────────────────────────────────────────────────────────── */
.wkpi-section { margin-bottom: 1.5rem; }

.wkpi-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.75;
}

/* ── Category table ──────────────────────────────────────────────────────── */
.wkpi-cat-table { overflow-x: auto; }

.wkpi-cat-row { cursor: pointer; }
.wkpi-cat-row:hover td { background: rgba(74, 158, 255, 0.07); }
.wkpi-cat-row-selected td { background: rgba(74, 158, 255, 0.12) !important; }

.wkpi-right { text-align: right; }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.wkpi-charts-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.wkpi-chart-wrap {
    flex: 1 1 350px;
    min-width: 300px;
}

/* ── RO list ─────────────────────────────────────────────────────────────── */
.wkpi-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.wkpi-verdict-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.wkpi-verdict-btn {
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(128, 128, 128, 0.3);
}

.wkpi-export-btns { display: flex; gap: 0.4rem; margin-left: auto; }

.wkpi-ro-table { overflow-x: auto; }

/* ── Rules pane ──────────────────────────────────────────────────────────── */
.wkpi-rules-pane { padding: 0.75rem 0; }

.wkpi-rules-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.wkpi-rule-table { overflow-x: auto; }

.wkpi-rule-inactive { opacity: 0.5; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.wkpi-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wkpi-modal-box {
    background: var(--hi-surface, #fff);
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 360px;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.wkpi-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.wkpi-modal-context {
    font-size: 0.82rem;
    opacity: 0.7;
    margin-bottom: 1rem;
}

.wkpi-form-group { margin-bottom: 0.75rem; }
.wkpi-form-label { font-size: 0.82rem; display: block; margin-bottom: 0.25rem; opacity: 0.8; }
.wkpi-form-input { width: 100%; }

.wkpi-modal-status { min-height: 1.2rem; font-size: 0.85rem; margin-bottom: 0.5rem; color: #e05; }

.wkpi-modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

.wkpi-status-bar { min-height: 1.5rem; margin-bottom: 0.5rem; }
.wkpi-status-error { color: #e05; font-size: 0.85rem; }
.wkpi-status-warn  { color: #c90; font-size: 0.85rem; }

/* ── State feedback ──────────────────────────────────────────────────────── */
.wkpi-empty { padding: 1.5rem; text-align: center; opacity: 0.6; font-size: 0.9rem; }
.wkpi-error { padding: 1rem; color: #e05; font-size: 0.9rem; }

/* ── Dark theme overrides ────────────────────────────────────────────────── */
body[data-theme="dark"] .wkpi-card,
[data-theme="dark"] .wkpi-card {
    background: rgba(255, 255, 255, 0.05);
}

body[data-theme="light"] .wkpi-card,
[data-theme="light"] .wkpi-card {
    background: rgba(0, 0, 0, 0.04);
}

body[data-theme="dark"] .wkpi-modal-box,
[data-theme="dark"] .wkpi-modal-box {
    background: #1e2535;
    color: #d0d5e0;
}

body[data-theme="dark"] .wkpi-reload-btn,
[data-theme="dark"] .wkpi-reload-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: inherit;
}

body[data-theme="dark"] .wkpi-verdict-btn,
[data-theme="dark"] .wkpi-verdict-btn {
    background: rgba(255, 255, 255, 0.07);
    color: inherit;
}

body[data-theme="dark"] .wkpi-verdict-active,
[data-theme="dark"] .wkpi-verdict-active {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

body[data-theme="light"] .wkpi-verdict-active,
[data-theme="light"] .wkpi-verdict-active {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

/* ── Late / overdue row tints ────────────────────────────────────────────── */
.wkpi-ro-late td    { background: rgba(255, 180, 60, 0.08); }
.wkpi-ro-overdue td { background: rgba(220, 50, 50, 0.1); }

/* ── 390px responsive ────────────────────────────────────────────────────── */
@media (max-width: 420px) {
    .wkpi-toolbar { flex-direction: column; align-items: flex-start; }
    .wkpi-dropdown { min-width: 100%; }
    .wkpi-charts-row { flex-direction: column; }
    .wkpi-cards { gap: 0.5rem; }
    .wkpi-card { flex: 1 1 100%; }
    .wkpi-list-toolbar { flex-direction: column; align-items: flex-start; }
    .wkpi-export-btns { margin-left: 0; }
}
