/* Nesher operator alert rail — restrained instrument-panel treatment. */
#nesherAlertRail {
    --ar-bg: rgba(16, 20, 25, .97);
    --ar-raised: #1b222a;
    --ar-line: rgba(219, 230, 239, .13);
    --ar-ink: #e6edf2;
    --ar-muted: #98a7b3;
    --ar-amber: #efad45;
    --ar-red: #ed6b64;
    --ar-green: #6fc6a0;
    position: fixed;
    /* Stay visible in fullscreen pilot mode without covering alert dialogs. */
    z-index: 10020;
    top: calc(var(--tac-bar-h, 54px) + 8px);
    right: clamp(12px, 2vw, 24px);
    width: min(326px, calc(100vw - 32px));
    max-height: min(55vh, 520px);
    display: flex;
    flex-direction: column;
    color: var(--ar-ink);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    background: var(--ar-bg);
    border: 1px solid var(--ar-line);
    border-radius: 12px;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .04);
    backdrop-filter: blur(14px);
    overflow: hidden;
    transition: width .18s ease, max-height .18s ease, transform .18s ease, opacity .18s ease;
}
#nesherAlertRail[hidden] { display: none; }
#nesherAlertRail .ar-head {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px 9px 14px;
    border-bottom: 1px solid var(--ar-line);
}
#nesherAlertRail .ar-heading { min-width: 0; flex: 1; }
#nesherAlertRail .ar-title {
    display: block;
    color: var(--ar-ink);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: .105em;
    text-transform: uppercase;
}
#nesherAlertRail .ar-summary { display: block; margin-top: 3px; color: var(--ar-muted); font-size: 11px; }
#nesherAlertRail .ar-count {
    min-width: 23px;
    height: 23px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    color: #20170a;
    background: var(--ar-amber);
    border-radius: 99px;
    font: 750 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
#nesherAlertRail .ar-icon-button {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: var(--ar-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
}
#nesherAlertRail .ar-icon-button:hover,
#nesherAlertRail .ar-icon-button:focus-visible { color: var(--ar-ink); background: var(--ar-raised); border-color: var(--ar-line); outline: none; }
#nesherAlertRail .ar-icon-button svg { width: 15px; height: 15px; }
#nesherAlertRail .ar-list {
    min-height: 68px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #4a5965 transparent;
}
#nesherAlertRail .ar-alert {
    position: relative;
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 12px 12px 13px;
    border-bottom: 1px solid rgba(219, 230, 239, .08);
}
#nesherAlertRail .ar-alert:last-child { border-bottom: 0; }
#nesherAlertRail .ar-alert.is-unread { background: linear-gradient(90deg, rgba(239, 173, 69, .075), transparent 76%); }
#nesherAlertRail .ar-marker { align-self: stretch; min-height: 36px; border-radius: 3px; background: var(--ar-amber); }
#nesherAlertRail .ar-alert[data-severity="critical"] .ar-marker,
#nesherAlertRail .ar-alert[data-severity="high"] .ar-marker { background: var(--ar-red); }
#nesherAlertRail .ar-alert[data-severity="low"] .ar-marker { background: #82929e; }
#nesherAlertRail .ar-alert[data-severity="medium"] .ar-marker { background: var(--ar-amber); }
#nesherAlertRail .ar-content { min-width: 0; }
#nesherAlertRail .ar-row { display: flex; align-items: flex-start; gap: 8px; }
#nesherAlertRail .ar-alert-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; color: var(--ar-ink); }
#nesherAlertRail .ar-alert:not(.is-unread) .ar-alert-title { color: #bac5cd; font-weight: 550; }
#nesherAlertRail .ar-severity {
    flex: none;
    padding: 2px 5px;
    color: #e4b86e;
    border: 1px solid rgba(239, 173, 69, .29);
    border-radius: 4px;
    font: 700 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
}
#nesherAlertRail .ar-alert[data-severity="critical"] .ar-severity,
#nesherAlertRail .ar-alert[data-severity="high"] .ar-severity { color: #f08b83; border-color: rgba(237, 107, 100, .34); }
#nesherAlertRail .ar-context { margin-top: 4px; color: var(--ar-muted); font-size: 11px; overflow-wrap: anywhere; }
#nesherAlertRail .ar-time { display: block; margin-top: 7px; color: #73828e; font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
#nesherAlertRail .ar-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
#nesherAlertRail .ar-action {
    min-height: 28px;
    padding: 4px 9px;
    color: #dbe5ec;
    background: #222c35;
    border: 1px solid rgba(219, 230, 239, .15);
    border-radius: 6px;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}
#nesherAlertRail .ar-action:hover { background: #2d3943; }
#nesherAlertRail .ar-action:focus-visible { outline: 2px solid var(--ar-amber); outline-offset: 2px; }
#nesherAlertRail .ar-action[disabled] { opacity: .55; cursor: wait; }
#nesherAlertRail .ar-action-link { color: #f0bd6c; background: transparent; }
#nesherAlertRail .ar-feedback { margin-top: 6px; color: var(--ar-red); font-size: 11px; }
#nesherAlertRail .ar-empty,
#nesherAlertRail .ar-loading,
#nesherAlertRail .ar-error {
    padding: 24px 18px;
    color: var(--ar-muted);
    text-align: center;
    font-size: 12px;
}
#nesherAlertRail .ar-skeleton { display: grid; grid-template-columns: 3px 1fr; gap: 10px; padding: 13px; border-bottom: 1px solid rgba(219, 230, 239, .08); }
#nesherAlertRail .ar-skeleton-marker,
#nesherAlertRail .ar-skeleton-line { display: block; background: rgba(180, 196, 208, .13); border-radius: 4px; animation: arSoftPulse 1.4s ease-in-out infinite alternate; }
#nesherAlertRail .ar-skeleton-marker { min-height: 38px; }
#nesherAlertRail .ar-skeleton-copy { display: grid; align-content: center; gap: 8px; }
#nesherAlertRail .ar-skeleton-line { width: 58%; height: 7px; }
#nesherAlertRail .ar-skeleton-line-wide { width: 84%; height: 9px; }
@keyframes arSoftPulse { from { opacity: .45; } to { opacity: .9; } }
#nesherAlertRail .ar-empty strong { display: block; margin-bottom: 4px; color: #cad4dc; font-size: 12px; }
#nesherAlertRail .ar-error button { margin-top: 10px; }
.ar-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    color: var(--text-muted, #aab5bf);
    background: transparent;
    border: 1px solid var(--tac-border, rgba(219, 230, 239, .2));
    border-radius: 6px;
    cursor: pointer;
}
.ar-toggle[hidden] { display: none !important; }
.ar-toggle:hover,
.ar-toggle[aria-expanded="true"] { color: var(--tac-amber, #efad45); border-color: rgba(239, 173, 69, .6); }
.ar-toggle:focus-visible { outline: 2px solid #efad45; outline-offset: 2px; }
.ar-toggle svg { width: 18px; height: 18px; }
.ar-toggle .ar-toggle-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    color: #20170a;
    background: #efad45;
    border-radius: 99px;
    font: 750 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ar-toggle .ar-toggle-count[hidden] { display: none; }
.pilot-topbar .ar-toggle,
.tactical-top-bar .ar-toggle { color: #e6edf2; background: rgba(16, 20, 25, .88); }
.pilot-topbar-actions .ar-toggle { margin-left: 0; }
body:has(#nesherAlertRail:not([hidden])) #tacticalOverlay .tactical-top-bar {
    opacity: 1;
    pointer-events: auto;
}
body:has(#pilotOverlay) #nesherAlertRail { top: calc(var(--pilot-bar-bottom, 64px) + 8px); }
body:has(#tacticalOverlay) #nesherAlertRail { top: calc(64px + env(safe-area-inset-top)); }
#nesherAlertRail.ar-collapsed { display: none; }
@media (max-width: 767px) {
    #nesherAlertRail {
        top: auto;
        right: 8px;
        bottom: calc(74px + env(safe-area-inset-bottom));
        left: 8px;
        width: auto;
        max-height: min(38dvh, 330px);
        border-radius: 11px;
    }
    #nesherAlertRail .ar-head { min-height: 48px; }
    #nesherAlertRail .ar-list { min-height: 48px; }
    #nesherAlertRail .ar-alert { padding: 10px; }
    .tac-mobile-topbar .ar-toggle { width: 36px; height: 36px; }
    body:has(#pilotOverlay) #nesherAlertRail,
    body:has(#tacticalOverlay) #nesherAlertRail { top: auto; }
    .tactical-top-bar { flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 380px) {
    #nesherAlertRail { bottom: calc(68px + env(safe-area-inset-bottom)); max-height: 34dvh; }
    #nesherAlertRail .ar-head { padding-left: 10px; }
    #nesherAlertRail .ar-alert { gap: 8px; padding: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    #nesherAlertRail { transition: none; }
    #nesherAlertRail .ar-skeleton-marker,
    #nesherAlertRail .ar-skeleton-line { animation: none; }
}