/* Incidents page — migrated from Incidents.razor.css; scoped under .page-incidents. */
.page-incidents { display: flex; flex-direction: column; gap: 34px; }

/* ─── Load animations (skeleton shimmer + no slide-in) ────────────
   Mirrors the dashboard: real content is rendered (true sizes), masked
   with a shimmer while loading, then revealed as the numbers count up. */

.page-incidents .loading .head-actions > *,
.page-incidents .loading .inc-stat > *,
.page-incidents .loading .inc-toolbar > *,
.page-incidents .loading .inc-filterbar > *,
.page-incidents .loading .panel > * { visibility: hidden; }

.page-incidents .loading .head-actions,
.page-incidents .loading .inc-stat,
.page-incidents .loading .inc-toolbar,
.page-incidents .loading .inc-filterbar,
.page-incidents .loading .panel { position: relative; }

/* while loading, keep the (default-selected) card neutral — no accent outline
   until the skeleton clears */
.page-incidents .loading .inc-stat.is-active {
    border-color: var(--line);
    background: var(--surface);
}

.page-incidents .loading .head-actions::after,
.page-incidents .loading .inc-toolbar::after,
.page-incidents .loading .inc-filterbar::after { border: 1px solid var(--line); }

.page-incidents .loading .head-actions::after,
.page-incidents .loading .inc-stat::after,
.page-incidents .loading .inc-toolbar::after,
.page-incidents .loading .inc-filterbar::after,
.page-incidents .loading .panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    background-color: var(--surface-2);
    background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: skel-shimmer 1.4s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .page-incidents .loading .head-actions::after,
    .page-incidents .loading .inc-stat::after,
    .page-incidents .loading .inc-toolbar::after,
    .page-incidents .loading .inc-filterbar::after,
    .page-incidents .loading .panel::after { animation: none; }
}

/* ─── Header action button ────────────────────────────────────── */

.page-incidents .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #04201D;
    font: 600 13px var(--font-body);
    cursor: pointer;
    transition: filter .18s ease, transform .18s ease;
}

.page-incidents .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.page-incidents .btn-primary svg { width: 15px; height: 15px; }

/* ─── Status overview cards (also act as filters) ─────────────── */

.page-incidents .inc-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.page-incidents .inc-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 18px 0;
    min-height: 150px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    overflow: hidden;
    transition: border-color .2s ease, background .2s ease;
}

.page-incidents .inc-stat:hover {
    border-color: rgba(255, 255, 255, 0.20);
    background: var(--surface-2);
}

.page-incidents .inc-stat.is-active {
    border-color: color-mix(in srgb, var(--c) 55%, transparent);
    background: color-mix(in srgb, var(--c) 10%, var(--surface));
}

.page-incidents .inc-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-incidents .inc-stat-count {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.page-incidents .inc-stat-desc {
    margin-top: -4px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--faint);
    max-width: 30ch;
}

/* severity mix pinned to the bottom of the card */
.page-incidents .inc-sevmini {
    margin-top: auto;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    min-height: 15px;
}

.page-incidents .inc-sevmini-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.page-incidents .inc-sevmini-dot {
    width: 11px;
    height: 11px;
    flex: none;
    display: inline-block;
}

/* ─── Toolbar (actions · range · search · columns) ────────────── */

.page-incidents .inc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

/* ─── Popover menus (Add filter · Customize columns) ──────────── */

/* the list section is raised above the backdrop while a menu is open */
.page-incidents .section.menus-open { position: relative; z-index: 50; }

/* ─── Filter row ──────────────────────────────────────────────── */

.page-incidents .inc-filterbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ─── Incident list ───────────────────────────────────────────── */

.page-incidents .inc-head,
.page-incidents .inc-row {
    display: grid;
    grid-template-columns:
        minmax(200px, 2fr)   /* incident name */
        84px                 /* incident id */
        minmax(96px, 0.85fr) /* severity */
        minmax(150px, 1.1fr) /* status */
        minmax(118px, 1fr)   /* classification */
        minmax(94px, 0.85fr) /* created */
        minmax(94px, 0.85fr) /* updated */
        40px;                /* go */
    gap: 16px;
    align-items: center;
}

.page-incidents .inc-head {
    padding: 12px 22px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-soft);
}

.page-incidents .inc-head span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
}

.page-incidents .inc-row {
    position: relative;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .18s ease;
}

/* severity accent rail */
.page-incidents .inc-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--c);
    opacity: 0;
    transition: opacity .18s ease;
}

.page-incidents .inc-row:hover { background: rgba(255, 255, 255, 0.035); }
.page-incidents .inc-row:hover::before { opacity: 0.8; }
.page-incidents .inc-row:last-of-type { border-bottom: 0; }

/* incident name */
.page-incidents .inc-name-cell { min-width: 0; }
.page-incidents .inc-name-cell strong {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* incident id tag */
.page-incidents .inc-idcell { min-width: 0; }
.page-incidents .inc-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--accent-2);
    background: var(--accent-soft);
}

/* severity — colored square + label */
.page-incidents .inc-sev,
.page-incidents .inc-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    min-width: 0;
}

.page-incidents .inc-sq {
    width: 11px;
    height: 11px;
    flex: none;
}

.page-incidents .inc-dot2 {
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
}

/* created / updated timestamps */
.page-incidents .inc-time { display: grid; gap: 2px; min-width: 0; }
.page-incidents .inc-time > span:first-child { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.page-incidents .inc-time-abs { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.page-incidents .inc-row { cursor: pointer; }

.page-incidents .inc-empty {
    padding: 36px 22px;
    text-align: center;
    color: var(--faint);
    font-size: 13.5px;
}

.page-incidents .inc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 22px;
    border-top: 1px solid var(--line-soft);
    color: var(--faint);
    font-size: 12.5px;
}

.page-incidents .inc-foot strong { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ─── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1080px) {
    .page-incidents .inc-head { display: none; }
    /* !important overrides the inline grid-template set for column customisation */
    .page-incidents .inc-row {
        grid-template-columns: 1fr auto !important;
        row-gap: 10px;
        column-gap: 14px;
    }
    .page-incidents .inc-name-cell { grid-column: 1 / -1; }
    .page-incidents .inc-created { display: none; }
    .page-incidents .inc-updated { text-align: right; }
}

@media (max-width: 640px) {
    .page-incidents .inc-stats { grid-template-columns: 1fr; }
}

/* ─── Raise-incident modal (mirrors the Service Requests modal) ──── */

.page-incidents .modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.55); }

.page-incidents .modal {
    position: fixed;
    z-index: 210;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
    animation: modal-in .2s ease both;
}

.page-incidents .modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.page-incidents .modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }

.page-incidents .req-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
}
.page-incidents .req-icon svg { width: 22px; height: 22px; }
.page-incidents .req-icon.sm { width: 30px; height: 30px; }
.page-incidents .req-icon.sm svg { width: 16px; height: 16px; }

.page-incidents .modal-x {
    width: 28px; height: 28px;
    border: none;
    background: transparent;
    color: var(--faint);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.page-incidents .modal-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.page-incidents .modal-body { padding: 18px; overflow-y: auto; }
.page-incidents .modal-hint { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.page-incidents .modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
}

@media (prefers-reduced-motion: reduce) {
    .page-incidents .modal { animation: none; }
}
