/* ===========================
   Admin Shell / Frame
   =========================== */
.admin-shell {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    padding: 10px 16px 34px;
    gap: 10px;
}

.admin-frame {
    width: min(var(--admin-frame-width, 1320px), 100%);
    display: grid;
    grid-template-rows: auto auto;
    gap: 10px;
    align-items: start;
}

/* ===========================
   Admin Taskbar (top nav)
   =========================== */
.admin-taskbar {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    color: #000000;
    background-color: var(--w98-gray);
    background-image: linear-gradient(180deg, rgba(255,255,255,.36), rgba(0,0,0,.08)), repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 1px, transparent 1px 5px);
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 4px 4px 0 rgba(0,0,0,.45);
    padding: 3px;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: box-shadow 120ms steps(2, end), filter 120ms steps(2, end);
}

.admin-taskbar.is-scrolled {
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 0 5px 0 rgba(0,0,0,.55), 0 11px 0 rgba(0,0,0,.18);
    filter: brightness(1.02);
}

.admin-taskbar.is-scrolled::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,.46), rgba(0,0,0,0));
}

/* ===========================
   Start Button
   =========================== */
.admin-start-button {
    min-width: 108px;
    height: 24px;
    display: inline-grid;
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

.admin-start-button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
    padding-top: 1px;
}

.admin-start-logo {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: #000078;
    border: 1px solid #ffffff;
    box-shadow: inset -5px 0 0 #0f80cd, inset 0 -5px 0 #4c1ca0;
    font-size: 10px;
    line-height: 10px;
}

/* ===========================
   Taskbar Nav Buttons
   =========================== */
.admin-taskbar-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 1px;
}

.admin-taskbar-button {
    height: 24px;
    min-width: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    text-decoration: none;
    white-space: nowrap;
}

.admin-taskbar-button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
    padding-top: 1px;
}

.admin-taskbar-button.is-active {
    color: #ffffff;
    background: #000078;
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.admin-taskbar-button:hover {
    color: #ffffff;
    background: #000078;
}

/* ===========================
   Taskbar Session Chips
   =========================== */
.admin-taskbar-session {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    white-space: nowrap;
}

.admin-session-chip,
.admin-alert-chip {
    height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    background: #dfdfdf;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    color: #000000;
    text-decoration: none;
    white-space: nowrap;
}

.admin-alert-chip.is-ok { background: #e8ffe8; border-color: #008000 #ffffff #ffffff #008000; }
.admin-alert-chip.is-info { background: #d8e5f8; }
.admin-alert-chip.is-warning {
    background: #ffffcc;
    border: 3px solid transparent;
    border-image: repeating-linear-gradient(45deg, #111111 0 8px, #ffcc00 8px 16px) 3;
}
.admin-alert-chip.is-danger {
    color: #ffffff;
    background: #800000;
    border: 3px solid transparent;
    border-image: repeating-linear-gradient(45deg, #ffcccc 0 8px, #300000 8px 16px) 3;
}

/* ===========================
   Dashboard Window
   =========================== */
.admin-dashboard-window,
.admin-workspace-window {
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: visible;
    color: #000000;
    background-color: var(--w98-gray);
    background-image: linear-gradient(180deg, rgba(255,255,255,.24), rgba(0,0,0,.06));
}

.admin-dashboard-window > .win98-titlebar,
.admin-workspace-window > .win98-titlebar {
    margin: 2px 2px 0;
}

.admin-dashboard-window > .menu-bar,
.admin-workspace-window > .menu-bar {
    flex: 0 0 auto;
    height: auto;
    min-height: 24px;
    margin: 0 2px;
    padding: 1px 6px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    z-index: 30;
}

.admin-dashboard-window > .menu-bar .menu-button,
.admin-workspace-window > .menu-bar .menu-button {
    color: #000000;
}

.admin-dashboard-window > .dashboard-body,
.admin-workspace-window > .admin-workspace-body {
    flex: 1 1 auto;
    margin-top: 0;
    padding: 0 10px 10px;
    background-color: var(--w98-gray);
    background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.05));
}

.admin-dashboard-statusbar {
    grid-template-columns: minmax(0, 1fr) 160px 210px;
    height: 28px;
    padding: 3px 4px 4px;
    background: var(--w98-gray);
    font-size: 12px;
    line-height: 14px;
}

.admin-dashboard-statusbar span {
    min-height: 19px;
    align-items: center;
    padding: 1px 6px;
}

/* ===========================
   Menu Bar (toolbar)
   =========================== */
.admin-menu-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 24px;
    padding: 1px 6px;
    font-size: 13px;
    line-height: 13px;
    z-index: 20;
}

.admin-menu-item {
    position: relative;
}

.admin-menu-button {
    height: 20px;
    min-width: 54px;
    padding: 0 8px;
    color: #000000;
    background: transparent;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
}

.admin-menu-button:hover,
.admin-menu-button:focus-visible {
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    outline: none;
}

.admin-menu-popup {
    position: absolute;
    top: 22px;
    left: 0;
    min-width: 220px;
    padding: 2px;
    background: var(--w98-gray);
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: 3px 3px 0 rgba(0,0,0,.35);
    display: none;
    z-index: 60;
}

.admin-menu-item.is-open .admin-menu-popup {
    display: block;
}

.admin-menu-action {
    width: 100%;
    min-height: 22px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 2px 6px;
    color: #000000;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 12px;
    text-align: left;
}

.admin-menu-action:hover,
.admin-menu-action:focus-visible {
    color: #ffffff;
    background: #000078;
    outline: none;
}

.admin-menu-separator {
    height: 1px;
    margin: 3px 2px;
    background: #808080;
    border-bottom: 1px solid #ffffff;
}

.admin-menu-action .shortcut {
    color: #555555;
}

.admin-menu-action:hover .shortcut {
    color: #ffffff;
}

/* ===========================
   Hero Section
   =========================== */
.admin-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 10px;
    padding: 9px;
    align-items: stretch;
}

.admin-hero-copy h2 {
    margin: 0 0 5px;
    font-size: 22px;
    line-height: 24px;
}

.admin-hero-copy p {
    margin: 0;
    color: #333333;
    font-size: 13px;
    line-height: 15px;
}

.admin-hero-status {
    display: grid;
    gap: 4px;
    align-content: center;
    padding: 7px;
    background: #ffffff;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    font-size: 12px;
    line-height: 13px;
}

.admin-hero-status-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.admin-status-ok { color: #008000; }
.admin-status-warn { color: #8a6200; }
.admin-status-danger { color: #800000; }

/* ===========================
   Stats Grid
   =========================== */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.admin-stat-card {
    position: relative;
    min-height: 122px;
    padding: 10px 11px 10px 14px;
    overflow: hidden;
}

/* Left accent bar */
.admin-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    border-left: 7px solid #000078;
    pointer-events: none;
}

/* Severity color states */
.admin-stat-card.is-ok { background: linear-gradient(180deg, #eeffee, #ffffff); }
.admin-stat-card.is-ok::before { border-left-color: #008000; }
.admin-stat-card.is-info { background: linear-gradient(180deg, #edf4ff, #ffffff); }
.admin-stat-card.is-info::before { border-left-color: #000078; }
.admin-stat-card.is-warning { background: linear-gradient(180deg, #ffffcc, #ffffff); }
.admin-stat-card.is-warning::before { border-left-color: #ffcc00; }
.admin-stat-card.is-danger {
    color: #000000;
    background: repeating-linear-gradient(45deg, #fff2f2 0 6px, #ffe1e1 6px 12px);
}
.admin-stat-card.is-danger::before { border-left-color: #800000; }

.admin-stat-label {
    margin: 0 0 6px;
    color: #333333;
    font-size: 13px;
    line-height: 13px;
    font-weight: bold;
}

.admin-stat-value {
    margin: 0 0 7px;
    font-size: 32px;
    line-height: 32px;
    font-weight: bold;
}

.admin-stat-note {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 0;
    color: #222222;
    font-size: 12px;
    line-height: 14px;
}

.admin-stat-note-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    background: #dfdfdf;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    white-space: nowrap;
}

/* ===========================
   Main Grid / Section Windows
   =========================== */
.admin-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.admin-span-2 {
    grid-column: 1 / -1;
}

.admin-section-window {
    min-height: 0;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 3px 4px 0 rgba(0,0,0,.38);
}

.admin-section-body {
    margin: 0 6px 6px;
    padding: 8px;
    min-height: 0;
}

/* ===========================
   Quick Actions
   =========================== */
.admin-link-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

.admin-link-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    color: #000000;
    font-size: 13px;
    line-height: 13px;
}

.admin-link-button {
    min-width: 112px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    padding: 0 10px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
    font-size: 12px;
    line-height: 12px;
    text-decoration: none;
}

.admin-link-button:hover {
    filter: brightness(1.06);
}

/* Titlebar action links (Show all) */
.titlebar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.titlebar-link-button {
    height: 18px;
    min-width: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
    text-decoration: none;
    font-size: 12px;
    line-height: 12px;
    white-space: nowrap;
}

.titlebar-link-button:hover {
    filter: brightness(1.08);
}

/* ===========================
   Compact Mode
   =========================== */
body.is-compact .admin-dashboard-body {
    gap: 8px;
}

body.is-compact .admin-section-body {
    padding: 5px;
}

/* ===========================
   Responsive: Medium (tablets)
   =========================== */
@media (max-width: 1180px) {
    .admin-taskbar {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .admin-taskbar-session {
        grid-column: 1 / -1;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-hero {
        grid-template-columns: 1fr;
    }

    .admin-main-grid {
        grid-template-columns: 1fr;
    }

    .admin-span-2 {
        grid-column: auto;
    }
}

/* ===========================
   Responsive: Small (mobile)
   =========================== */
@media (max-width: 760px) {
    .admin-shell {
        padding: 0 0 18px;
        align-items: stretch;
    }

    .admin-frame {
        width: 100%;
        gap: 8px;
    }

    .admin-taskbar {
        grid-template-columns: 1fr;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .admin-start-button {
        width: 100%;
        justify-content: center;
    }

    .admin-taskbar-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .admin-taskbar-button {
        min-width: 92px;
    }

    .admin-taskbar-session {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .admin-session-chip,
    .admin-alert-chip {
        flex: 0 0 auto;
    }

    .admin-dashboard-window,
    .admin-workspace-window {
        min-height: 100dvh;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .admin-dashboard-body {
        padding: 6px;
        gap: 8px;
    }

    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-stat-card {
        min-height: 112px;
    }

    .admin-menu-popup {
        position: fixed;
        left: 6px;
        right: 6px;
        top: 74px;
        min-width: 0;
    }

    .titlebar-actions {
        margin-left: 4px;
    }

    .titlebar-link-button {
        min-width: 58px;
        padding: 0 5px;
    }

    .admin-dashboard-statusbar {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 70px;
    }

    .win98-titlebar h1,
    .win98-titlebar h2 {
        font-size: 13px;
    }

    .win98-window-controls {
        display: none;
    }
}

/* Override global main layout on admin pages since admin uses its own shell */
body:has(.admin-shell) main {
    display: contents;
}
