/* ── CMMS Activity (FEAT-556-FE) — prefix: cma- ─────────────────────────── */

/* Page shell */
.cma-page { padding: 1rem 1.25rem; }

.cma-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cma-page-title { margin: 0; font-size: 1.35rem; font-weight: 600; }

.cma-env-pill {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 9999px;
}
.cma-env-prod { background: #16a34a; color: #fff; }
.cma-env-uat  { background: #d97706; color: #fff; }

/* Controls */
.cma-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cma-controls-label { font-size: 0.85rem; opacity: 0.7; }

.cma-range-btn {
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #d1d5db);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}
.cma-range-btn:hover { background: rgba(59,130,246,.12); }
.cma-range-btn-active {
    background: rgba(59,130,246,.18);
    border-color: #3b82f6;
    font-weight: 600;
}

/* Grid wrapper — horizontal scroll at narrow widths */
.cma-grid-wrap { width: 100%; }

.cma-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Heartbeat table */
.cma-heartbeat-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
    min-width: 480px;   /* ensures scroll kicks in before cells squash */
}

.cma-heartbeat-table th,
.cma-heartbeat-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,.08));
    white-space: nowrap;
    text-align: center;
}

.cma-th-series,
.cma-series-name {
    text-align: left !important;
    min-width: 160px;
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
}

.cma-th-day { min-width: 38px; font-weight: 500; opacity: 0.75; font-size: 0.74rem; }
.cma-th-last, .cma-th-users { min-width: 72px; }

/* Day cells */
.cma-cell {
    min-width: 38px;
    font-variant-numeric: tabular-nums;
    border-radius: 4px;
    transition: background 0.1s;
}
.cma-cell-zero { color: var(--text-muted, rgba(128,128,128,.5)); font-size: 0.65rem; }
.cma-cell-count { font-weight: 600; }

/* Last activity */
.cma-last { text-align: right !important; opacity: 0.85; }
.cma-last-never { opacity: 0.45; font-style: italic; }

/* Users */
.cma-users { font-variant-numeric: tabular-nums; }

/* Kind separator */
.cma-kind-separator {
    background: rgba(245,158,11,.08);
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: left !important;
    padding: 6px 8px !important;
    border-top: 2px solid rgba(245,158,11,.25);
}

/* States */
.cma-loading, .cma-empty {
    padding: 2rem 1rem;
    text-align: center;
    opacity: 0.6;
    font-size: 0.9rem;
}

.cma-error {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid #fca5a5;
    background: rgba(220,38,38,.07);
    color: #b91c1c;
}
.cma-error-title { font-weight: 600; margin-bottom: 4px; }
.cma-error-detail { font-size: 0.82rem; opacity: 0.85; }

/* Dark theme */
body[data-theme="dark"] .cma-range-btn { border-color: rgba(255,255,255,.15); }
body[data-theme="dark"] .cma-range-btn-active { border-color: #60a5fa; background: rgba(96,165,250,.18); }
body[data-theme="dark"] .cma-heartbeat-table th,
body[data-theme="dark"] .cma-heartbeat-table td { border-bottom-color: rgba(255,255,255,.07); }
body[data-theme="dark"] .cma-cell-zero { color: rgba(255,255,255,.22); }
body[data-theme="dark"] .cma-kind-separator { color: #fbbf24; background: rgba(251,191,36,.08); border-top-color: rgba(251,191,36,.2); }
body[data-theme="dark"] .cma-error { border-color: rgba(248,113,113,.35); background: rgba(185,28,28,.12); color: #fca5a5; }

/* 390px responsive — already handled by overflow-x on .cma-table-scroll */
@media (max-width: 420px) {
    .cma-page { padding: 0.75rem; }
    .cma-th-series, .cma-series-name { min-width: 110px; max-width: 140px; }
}
