/* ============================================================
   style-48-compliance-snapshot.css — FEAT-266-P1-FE
   Compliance Snapshot board on /puspakom-forecast
   Prefix: .cs-*  |  Tab wrapper: .pf-*
   ============================================================ */

/* ── Page-level tab wrapper ────────────────────────────────── */
.pf-page-wrap { min-height: 100vh; }

.pf-page-tabs {
    border-bottom: 2px solid #2d3548;
}
body[data-theme="light"] .pf-page-tabs {
    border-bottom-color: #dde1eb;
}

.pf-tab {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: #9aa3b5 !important;
    background: #1e2537 !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.pf-tab:hover { color: #c8d4e8 !important; }

.pf-tab--selected {
    color: #e8eaf0 !important;
    background: #252b3b !important;
    border-bottom-color: #4a9eff !important;
    font-weight: 600;
}
body[data-theme="light"] .pf-tab        { color: #5a6478 !important; background: #f0f2f5 !important; }
body[data-theme="light"] .pf-tab:hover  { color: #1a1f2e !important; }
body[data-theme="light"] .pf-tab--selected {
    color: #1a202c !important;
    background: #ffffff !important;
    border-bottom-color: #2a7de1 !important;
}

/* ── Compliance Snapshot page shell ────────────────────────── */
.cs-page {
    padding: 20px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.cs-loading {
    padding: 40px;
    text-align: center;
    opacity: 0.6;
}

/* ── Header line ────────────────────────────────────────────── */
.cs-header-line {
    font-size: 0.82rem;
    margin-bottom: 16px;
    padding: 8px 12px;
    border-radius: 6px;
}
body[data-theme="dark"]  .cs-header-line { background: #1e2537; color: #9aa3b5; }
body[data-theme="light"] .cs-header-line { background: #f0f2f5; color: #5a6478; }

.cs-header-aat     { font-weight: 600; }
.cs-header-horizon { opacity: 0.85; }

/* ── Document cards grid ────────────────────────────────────── */
.cs-cards-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.cs-doc-card {
    flex: 1 1 200px;
    min-width: 180px;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
body[data-theme="dark"]  .cs-doc-card { background: #1e2537; border: 1px solid #2d3548; }
body[data-theme="light"] .cs-doc-card { background: #ffffff; border: 1px solid #dde1eb;
                                          box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

.cs-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
}

/* ── Headline (ACT NOW big number) ─────────────────────────── */
.cs-card-headline {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* ── Clickable count chips ──────────────────────────────────── */
.cs-count {
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: opacity 0.12s, box-shadow 0.12s;
    user-select: none;
}
.cs-count:hover { opacity: 0.8; box-shadow: 0 0 0 2px rgba(255,255,255,0.15); }

.cs-count--headline { font-size: 2rem; padding: 0; border-radius: 0; }

.cs-count--act_now    { color: #4a9eff; }
.cs-count--this_month { color: #fd7e14; }
.cs-count--overdue    { color: #dc3545; }
.cs-count--lapsed     { color: #c08090; }
.cs-count--no_date    { color: #9aa3b5; }
.cs-count--healthy    { color: #28a745; cursor: default; }

.cs-count-label {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.75;
}
.cs-count-label--act_now    { color: #4a9eff; }
.cs-count-label--this_month { color: #fd7e14; }
.cs-count-label--overdue    { color: #dc3545; }
.cs-count-label--lapsed     { color: #c08090; }
.cs-count-label--no_date    { color: #9aa3b5; }
.cs-count-label--healthy    { color: #28a745; }

.cs-card-counts-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.cs-card-count-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.cs-card-sub-counts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 8px;
}
body[data-theme="light"] .cs-card-sub-counts {
    border-top-color: rgba(0,0,0,0.08);
}

/* ── Stacked bar ────────────────────────────────────────────── */
.cs-bar-wrap {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    margin-top: 4px;
}
body[data-theme="light"] .cs-bar-wrap {
    background: rgba(0,0,0,0.06);
}

/* ── Section titles ─────────────────────────────────────────── */
.cs-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
body[data-theme="dark"]  .cs-section-title { color: #c8d4e8; }
body[data-theme="light"] .cs-section-title { color: #2a3245; }

/* ── Matrix section ─────────────────────────────────────────── */
.cs-matrix-section { margin-bottom: 28px; }

.cs-mx-hint {
    font-size: 0.75rem;
    opacity: 0.55;
    margin-bottom: 10px;
}

/* Desktop matrix (hidden on mobile) */
.cs-mx-desktop { display: block; }
.cs-mx-mobile  { display: none; }

.cs-mx-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.cs-mx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.cs-mx-th {
    padding: 8px 12px;
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid #2d3548;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.cs-mx-th--label { text-align: left; min-width: 160px; }

body[data-theme="dark"]  .cs-mx-th { background: #1e2537; color: #9aa3b5; }
body[data-theme="light"] .cs-mx-th { background: #f0f2f5; color: #5a6478; border-color: #dde1eb; }

.cs-mx-td {
    padding: 6px 12px;
    border: 1px solid #2d3548;
    text-align: right;
    vertical-align: middle;
}
body[data-theme="light"] .cs-mx-td { border-color: #dde1eb; }

.cs-mx-td--label { text-align: left; }
.cs-mx-td--proj  { text-align: left; padding-left: 24px; }
.cs-mx-td--region { text-align: left; }
.cs-mx-td--total { font-weight: 700; }

.cs-mx-row--region .cs-mx-td { font-weight: 600; }
body[data-theme="dark"]  .cs-mx-row--region .cs-mx-td { background: rgba(255,255,255,0.03); }
body[data-theme="light"] .cs-mx-row--region .cs-mx-td { background: rgba(0,0,0,0.03); }

body[data-theme="dark"]  .cs-mx-row--proj .cs-mx-td { background: #1a1f2e; }
body[data-theme="light"] .cs-mx-row--proj .cs-mx-td { background: #fafbfc; }

body[data-theme="dark"]  .cs-mx-row--total .cs-mx-td { background: #252b3b; }
body[data-theme="light"] .cs-mx-row--total .cs-mx-td { background: #f0f2f5; }

.cs-mx-region-name { font-weight: 600; }
.cs-mx-proj-name   { font-size: 0.8rem; opacity: 0.85; }

.cs-mx-cell {
    display: inline-block;
    min-width: 36px;
    text-align: right;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.82rem;
    font-weight: 700;
}
.cs-mx-cell--clickable {
    cursor: pointer;
    transition: opacity 0.12s, box-shadow 0.12s;
    color: #4a9eff;
}
.cs-mx-cell--clickable:hover {
    opacity: 0.78;
    box-shadow: 0 0 0 2px rgba(74,158,255,0.3);
}
.cs-mx-cell--total { color: #e8eaf0; }
body[data-theme="light"] .cs-mx-cell--total { color: #1a1f2e; }

.cs-matrix-empty { padding: 20px; opacity: 0.55; font-size: 0.85rem; }

/* ── Mobile accordion ───────────────────────────────────────── */
.cs-mob-accordion { display: flex; flex-direction: column; gap: 8px; }

.cs-mob-accordion-item {
    border-radius: 8px;
    overflow: hidden;
}
body[data-theme="dark"]  .cs-mob-accordion-item { background: #1e2537; border: 1px solid #2d3548; }
body[data-theme="light"] .cs-mob-accordion-item { background: #ffffff; border: 1px solid #dde1eb; }

.cs-mob-region-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 0.88rem;
}
.cs-mob-region-summary::-webkit-details-marker { display: none; }
body[data-theme="dark"]  .cs-mob-region-summary { color: #c8d4e8; }
body[data-theme="light"] .cs-mob-region-summary { color: #1a1f2e; }

.cs-mob-region-name  { flex: 1; }
.cs-mob-region-total { color: #4a9eff; font-size: 1.0rem; font-weight: 700; margin-left: 8px; }

.cs-mob-region-body { padding: 8px 14px 12px; }

.cs-mob-proj-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-direction: column;
}
body[data-theme="light"] .cs-mob-proj-row { border-top-color: rgba(0,0,0,0.06); }

.cs-mob-proj-name {
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0.85;
}

.cs-mob-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.cs-mob-chip {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(74,158,255,0.12);
    color: #4a9eff;
}
.cs-mob-chip--puspakom  { background: rgba(74,158,255,0.12);  color: #4a9eff; }
.cs-mob-chip--insurance { background: rgba(253,126,20,0.12);  color: #fd7e14; }
.cs-mob-chip--roadtax   { background: rgba(220,53,69,0.12);   color: #dc3545; }
.cs-mob-chip--permit    { background: rgba(154,96,112,0.12);  color: #c08090; }

/* ── Trend section ──────────────────────────────────────────── */
.cs-trend-section { margin-top: 24px; }

.cs-trend-note {
    font-size: 0.75rem;
    opacity: 0.55;
    margin-bottom: 6px;
    font-style: italic;
}

/* ── Drill panel table ──────────────────────────────────────── */
.cs-drill-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.cs-drill-table { font-size: 0.82rem; }
.cs-drill-table th, .cs-drill-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* ── Mobile overrides (≤768px) ──────────────────────────────── */
@media (max-width: 768px) {
    .cs-page { padding: 12px 14px; }

    .cs-cards-grid { gap: 10px; }
    .cs-doc-card   { flex: 1 1 calc(50% - 5px); min-width: 140px; }

    .cs-mx-desktop { display: none; }
    .cs-mx-mobile  { display: block; }
}

/* ── Extra-small (≤390px) ───────────────────────────────────── */
@media (max-width: 390px) {
    .cs-doc-card { flex: 1 1 100%; }
    .cs-count--headline { font-size: 1.6rem; }
}

/* ── Light theme overrides ──────────────────────────────────── */
body[data-theme="light"] .cs-header-aat { color: #1a1f2e; }
body[data-theme="light"] .cs-count--act_now    { color: #2a7de1; }
body[data-theme="light"] .cs-count-label--act_now { color: #2a7de1; }
body[data-theme="light"] .cs-mx-cell--clickable { color: #2a7de1; }
