/* α²Tracking — Alerts view styles (ported verbatim from docs/a2tracking/dashboard.css)
   All rules scoped under .al-view so they only apply to /alerts. */

.al-view {
    /* design tokens (mirrored from docs/a2tracking/dashboard.css :root)
       defined here so /alerts has them — dashboard-ops.css scopes them
       to .db-view only and they don't leak this far. */
    --brand-orange:      #F0532D;
    --brand-orange-soft: #FCE9E1;
    --brand-orange-deep: #C13E1D;
    --ink:               #191919;
    --ink-2:             #2D2D2D;
    --subhead:           #616161;
    --grey:              #808080;
    --grey-light:        #EEEEEE;
    --grey-semi:         #E3E3E3;
    --surface:           #ffffff;
    --bg:                #FAFAF7;
    --bg-warm:           #F5F1EC;
    --ok:                #14B86A;
    --warn:              #E08A00;
    --danger:            #D93B3B;
    --info:              #2D6BD6;
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 18px;
    padding: 18px 22px;
    overflow-y: auto;
    color: var(--ink);
    background: var(--bg);
    font-family: 'Nexa', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- View header ---- */
.view-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 18px;
    gap: 24px;
}
.view-title {
    font-family: 'Nexa', sans-serif; font-weight: 900;
    font-size: 26px; letter-spacing: -0.015em; color: var(--ink);
}
.view-sub { color: var(--subhead); font-size: 13px; margin-top: 4px; }

/* ---- Buttons ---- */
.btn-row {
    display: flex; gap: 6px; align-items: center; justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px; font-weight: 700;
    background: var(--bg); border: 1px solid var(--grey-semi);
    color: var(--ink-2); cursor: pointer;
    font-family: inherit;
}
.btn-row:hover { background: var(--surface); border-color: var(--ink); }
.btn-row.primary { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }
.btn-row.primary:hover { background: var(--brand-orange-deep); border-color: var(--brand-orange-deep); }
.btn-row.danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-row.danger:hover { background: #b32c2c; }
.btn-row.dark    { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }
.btn-row.dark:hover { background: rgba(255,255,255,0.18); }

/* ---- KPI strip (6 cards) ---- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--grey-semi);
    border-radius: var(--r-lg);
    padding: 16px 18px;
}
.kpi .l { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--subhead); font-weight: 800; }
.kpi .v { font-family: 'Rift Soft', sans-serif; font-size: 36px; line-height: 1; margin-top: 8px; color: var(--ink); }
.kpi .d { font-size: 11px; color: var(--ok); font-weight: 700; margin-top: 6px; display: inline-flex; gap: 4px; align-items: center; }
.kpi .d.down { color: var(--danger); }
.kpi.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.accent .l { color: rgba(255,255,255,0.6); }
.kpi.accent .v { color: var(--brand-orange); }

/* ---- Critical banner ---- */
.al-crit-banner {
    background: linear-gradient(135deg, var(--danger) 0%, #b32c2c 100%);
    color: #fff;
    border-radius: var(--r-lg);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px -10px rgba(217,59,59,0.4);
}
.al-crit-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: grid; place-items: center;
    font-size: 22px;
}
.al-crit-title {
    font-family: 'Nexa', sans-serif;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.al-crit-sub { font-size: 12px; opacity: 0.92; margin-top: 3px; font-weight: 700; }
.al-crit-actions { display: flex; gap: 8px; }

/* ---- Hero strip (dark) ---- */
.al-hero {
    background: var(--ink);
    color: #fff;
    border-radius: var(--r-lg);
    padding: 18px 22px;
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}
.al-hero-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 16px;
}
.al-hero-kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45); font-weight: 700;
    text-transform: uppercase;
}
.al-hero-head h3 {
    margin: 4px 0 0;
    font-family: 'Nexa', sans-serif;
    font-weight: 900; font-size: 18px;
    letter-spacing: -0.01em;
}
.al-hero-legend {
    display: flex; gap: 16px;
    font-size: 11px; color: rgba(255,255,255,0.7);
    font-weight: 700;
}
.al-hero-legend i {
    display: inline-block;
    width: 12px; height: 4px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}
.al-hero-body {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
    height: 110px;
    align-items: flex-end;
}
.al-hero-col {
    height: 100%;
    display: flex; flex-direction: column-reverse;
    gap: 1px;
}
.al-hero-col .seg { width: 100%; min-height: 1px; border-radius: 1px; }
.al-hero-col .al-hero-spacer { background: transparent; min-height: 0; }
.al-hero-axis {
    position: relative; height: 14px; margin-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.al-hero-axis span {
    position: absolute; top: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px; color: rgba(255,255,255,0.45);
    transform: translateX(-50%);
}

/* ---- Filter bar ---- */
.filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin: 18px 0 0;
}
.filter-bar .seg {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--grey-semi);
    border-radius: 999px;
    padding: 3px;
}
.filter-bar .seg button {
    border: 0; background: transparent;
    padding: 7px 14px;
    font-size: 12px; font-weight: 800;
    color: var(--subhead);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
}
.filter-bar .seg button.active { background: var(--ink); color: #fff; }
.filter-bar .seg button:not(.active):hover { color: var(--ink); }
.filter-bar .grow { flex: 1; }
.filter-bar .input {
    flex: 1; min-width: 200px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid var(--grey-semi);
    background: var(--surface);
    color: var(--ink); font-size: 13px; font-weight: 600;
    font-family: inherit;
}
.filter-bar .input:focus {
    outline: 2px solid var(--brand-orange-soft);
    border-color: var(--brand-orange);
}

/* ---- Status pills ---- */
.status-pill {
    display: inline-flex; gap: 6px; align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px; font-weight: 800;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status-pill.active   { background: rgba(20,184,106,0.12); color: #0f8a4f; }
.status-pill.parked   { background: rgba(168,85,247,0.16); color: #7e22ce; }
.status-pill.alert    { background: rgba(217,59,59,0.12);  color: var(--danger); }
.status-pill.charging { background: rgba(45,107,214,0.12); color: var(--info); }

/* ---- Two-col layout ---- */
.al-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 14px;
    margin-top: 14px;
    align-items: flex-start;
}
@media (max-width: 1200px) { .al-layout { grid-template-columns: 1fr; } }

/* ---- List ---- */
.al-list-pretty {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--grey-semi);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.al-row {
    display: grid;
    grid-template-columns: 4px 40px 1fr 110px 110px;
    gap: 14px;
    align-items: center;
    padding: 14px 18px 14px 0;
    border-bottom: 1px solid var(--grey-light);
    cursor: pointer;
    transition: background 0.1s;
}
.al-row:last-child { border-bottom: 0; }
.al-row:hover { background: var(--bg); }
.al-row.selected { background: var(--brand-orange-soft); }
.al-row.resolved { opacity: 0.65; }
.al-row-stripe {
    width: 4px; height: 100%; min-height: 56px;
    border-radius: 0 4px 4px 0;
    background: var(--danger);
}
.al-row.sev-warning .al-row-stripe { background: var(--warn); }
.al-row.sev-info .al-row-stripe { background: var(--info); }
.al-row-ico {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 16px;
    background: rgba(217,59,59,0.12); color: var(--danger);
}
.al-row-ico.sev-warning { background: rgba(224,138,0,0.16); color: var(--warn); }
.al-row-ico.sev-info { background: rgba(45,107,214,0.12); color: var(--info); }
.al-row-body { min-width: 0; }
.al-row-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.al-row-rule {
    font-size: 10px; background: var(--bg);
    border: 1px solid var(--grey-semi);
    padding: 2px 7px; border-radius: 4px;
    color: var(--subhead); font-weight: 700; letter-spacing: 0.04em;
    font-family: 'JetBrains Mono', monospace;
}
.al-row-title { margin-top: 5px; font-size: 13px; font-weight: 800; color: var(--ink); }
.al-row-meta {
    margin-top: 3px; font-size: 11px; color: var(--subhead);
    display: flex; gap: 6px; align-items: center; font-weight: 600; flex-wrap: wrap;
}
.al-row-meta .sep { color: var(--grey); opacity: 0.6; }
.al-row-meta .mono { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--ink-2); }
.al-row-time { text-align: right; }
.al-row-time .mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; color: var(--ink); }
.al-row-time .sub { font-size: 10px; color: var(--subhead); margin-top: 2px; font-weight: 700; }
.al-row-actions { display: flex; gap: 4px; }
.al-act {
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1px solid var(--grey-semi);
    background: var(--surface);
    display: inline-grid; place-items: center;
    cursor: pointer; color: var(--subhead);
    font-family: inherit; font-size: 13px;
}
.al-act:hover         { border-color: var(--ink); color: var(--ink); background: var(--bg); }
.al-act.ack:hover     { border-color: var(--warn); color: var(--warn); }
.al-act.resolve:hover { border-color: var(--ok); color: var(--ok); }
.al-act.jump:hover    { border-color: var(--brand-orange); color: var(--brand-orange); }

/* ---- Side panel ---- */
.al-side {
    background: var(--surface);
    border: 1px solid var(--grey-semi);
    border-radius: var(--r-lg);
    overflow: hidden;
    position: sticky; top: 14px;
}
.al-side-head {
    padding: 18px 20px 22px;
    color: #fff;
    background: var(--danger);
}
.al-side-head.sev-warning { background: var(--warn); }
.al-side-head.sev-info { background: var(--info); }
.al-side-kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: 0.1em;
    font-weight: 700; opacity: 0.85;
    display: flex; gap: 6px; align-items: center;
}
.al-side h4 {
    margin: 6px 0 6px;
    font-family: 'Nexa', sans-serif;
    font-weight: 900; font-size: 18px;
    letter-spacing: -0.01em; line-height: 1.2;
}
.al-side-desc { font-size: 12.5px; opacity: 0.92; line-height: 1.4; font-weight: 700; }
.al-side-body { padding: 16px 20px 20px; }
.al-side-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.al-side-kv {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--grey-light);
    font-size: 12px;
}
.al-side-kv:last-of-type { border: 0; }
.al-side-kv .k { color: var(--subhead); font-weight: 700; }
.al-side-kv .v { color: var(--ink); font-weight: 800; }
.al-side-kv .v.mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.al-side-kv .v .mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.al-sensor-tag { font-weight: 800; font-size: 11px; }

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--subhead); font-weight: 700;
    margin: 18px 0 8px;
}

/* ---- Timeline ---- */
.al-timeline { position: relative; padding-left: 6px; margin: 6px 0 10px; }
.al-tl-item {
    display: grid; grid-template-columns: 18px 1fr;
    gap: 10px; padding: 10px 0; position: relative;
}
.al-tl-item:not(:last-child)::before {
    content: ""; position: absolute;
    left: 8px; top: 24px; bottom: -10px;
    width: 1px; background: var(--grey-light);
}
.al-tl-dot {
    width: 11px; height: 11px; border-radius: 999px;
    background: var(--grey-light); margin-top: 4px;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--grey-semi);
}
.al-tl-item.active   .al-tl-dot { background: var(--brand-orange); box-shadow: 0 0 0 1px var(--brand-orange); }
.al-tl-item.resolved .al-tl-dot { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.al-tl-item.pending  .al-tl-dot { background: var(--grey-light); animation: al-pulse-dot 1.6s ease-in-out infinite; }
@keyframes al-pulse-dot { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.al-tl-title { font-size: 12px; font-weight: 800; color: var(--ink); }
.al-tl-time  { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--subhead); font-weight: 700; margin-top: 1px; }

/* ---- Related ---- */
.al-related {
    display: grid; grid-template-columns: 10px 1fr 14px;
    gap: 10px; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--grey-light);
    cursor: pointer;
}
.al-related:last-child { border: 0; }
.al-related:hover .al-rel-title { color: var(--brand-orange-deep); }
.al-rel-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--danger); }
.al-rel-dot.sev-warning { background: var(--warn); }
.al-rel-dot.sev-info { background: var(--info); }
.al-rel-title { font-size: 12px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.al-rel-meta  { font-size: 10px; color: var(--subhead); margin-top: 2px; font-weight: 700; }
.al-rel-meta .mono { font-family: 'JetBrains Mono', monospace; }

.action-row { display: flex; gap: 8px; margin-top: 8px; }

/* ---- Chart card (top rules) ---- */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--grey-semi);
    border-radius: var(--r-lg);
    padding: 16px 18px;
}
.chart-card h4 {
    margin: 0; font-family: 'Nexa', sans-serif; font-weight: 900;
    font-size: 17px; letter-spacing: -0.01em;
}

/* ---- Top rules ---- */
.al-rules { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.al-rule-row {
    display: grid;
    grid-template-columns: 130px 1.6fr 1fr 50px;
    gap: 14px; align-items: center;
    padding: 9px 4px;
    border-radius: 8px;
    transition: background 0.1s;
}
.al-rule-row:hover { background: var(--bg); }
.al-rule-id    { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--subhead); font-weight: 700; letter-spacing: 0.04em; }
.al-rule-label { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.al-rule-bar   { height: 8px; background: var(--grey-light); border-radius: 999px; overflow: hidden; }
.al-rule-fill  { height: 100%; border-radius: 999px; transition: width 0.3s; }
.al-rule-count { font-family: 'Rift Soft', sans-serif; font-size: 18px; text-align: right; line-height: 1; }
