/* shell.css — application shell (sidebar + content) and flat card primitives.
   Loaded after custom.css; overrides the old header/nav/glass look. */

:root {
    --shell-bg: #0f172a;
    --shell-panel: #1a1f3a;
    --shell-line: rgba(255, 255, 255, 0.08);
    --shell-line-strong: rgba(255, 255, 255, 0.14);
    --shell-muted: #b0bec5;
    --shell-teal: #00d4aa;
    --shell-teal-soft: rgba(0, 212, 170, 0.15);
    --shell-violet: #a78bfa;
    --shell-violet-soft: rgba(124, 58, 237, 0.2);
    --shell-warn: #f59e0b;
    --shell-warn-soft: rgba(245, 158, 11, 0.18);
    --shell-danger: #ff416c;
    --shell-danger-soft: rgba(255, 65, 108, 0.18);
    --sidebar-w: 300px;
}

body {
    background: var(--shell-bg);
    color: #ffffff;
}

/* ---------- shell layout ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--shell-panel);
    border-right: 1px solid var(--shell-line);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 28px 36px 48px 36px;
}

.app-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--shell-panel);
    border-bottom: 1px solid var(--shell-line);
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (max-width: 991.98px) {
    .app-sidebar.d-lg-flex { display: none !important; }
    .app-topbar { display: flex; }
    .app-main { padding: 20px 16px 40px 16px; }
}

/* offcanvas version of the sidebar (small screens) */
.offcanvas.app-sidebar-offcanvas {
    background: var(--shell-panel);
    width: 320px;
}
.offcanvas.app-sidebar-offcanvas .offcanvas-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
}

/* ---------- sidebar pieces ---------- */
.sb-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}
.sb-brand small { color: var(--shell-muted); font-size: 12px; }

.sb-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding-top: 4px;
}
.sb-profile .sb-name { font-size: 18px; font-weight: 700; line-height: 1.2; }
.sb-profile .sb-meta { font-size: 12px; color: var(--shell-muted); }
.sb-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

.sb-ring { display: block; }

.sb-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    background: var(--shell-teal);
    color: var(--shell-bg);
    transition: filter 0.15s ease;
}
.sb-action:hover { filter: brightness(1.08); color: var(--shell-bg); }
.sb-action.sb-action-warn { background: var(--shell-warn); }
.sb-action.sb-action-muted { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 12px 6px 12px;
    background: none;
    border: 0;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--shell-muted);
    cursor: pointer;
}
.sb-section .bi { transition: transform 0.2s ease; font-size: 12px; }
.sb-section[aria-expanded="false"] .bi { transform: rotate(-90deg); }

.sb-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s ease;
}
.sb-link .bi { font-size: 17px; color: var(--shell-muted); width: 20px; text-align: center; }
.sb-link:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.sb-link.active { background: var(--shell-teal-soft); font-weight: 600; }
.sb-link.active .bi { color: var(--shell-teal); }
.sb-link .sb-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--shell-muted);
}

.sb-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 0 4px;
    font-size: 12px;
    color: var(--shell-muted);
}
.sb-foot a { color: var(--shell-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.sb-foot a:hover { color: #ffffff; }

/* ---------- page primitives ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.page-head h1, .page-head h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}
.page-head .page-sub { color: var(--shell-muted); font-size: 13px; margin-top: 2px; }
.page-head .page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.panel {
    background: var(--shell-panel);
    border: 1px solid var(--shell-line);
    border-radius: 12px;
    padding: 22px 24px;
}
.panel-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.stat-card .stat-label { font-size: 12px; color: var(--shell-muted); }
.stat-card .stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; line-height: 1.2; }
.stat-card .stat-sub { font-size: 12px; color: var(--shell-muted); margin-top: 4px; }

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shell-muted);
    vertical-align: middle;
}
.dot.dot-on { background: var(--shell-teal); box-shadow: 0 0 8px var(--shell-teal); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.06);
    color: var(--shell-muted);
}
.pill-ok { background: var(--shell-teal-soft); color: var(--shell-teal); }
.pill-warn { background: var(--shell-warn-soft); color: var(--shell-warn); }
.pill-danger { background: var(--shell-danger-soft); color: var(--shell-danger); }
.pill-violet { background: var(--shell-violet-soft); color: var(--shell-violet); }

.btn-teal {
    --bs-btn-bg: var(--shell-teal);
    --bs-btn-border-color: var(--shell-teal);
    --bs-btn-color: var(--shell-bg);
    --bs-btn-hover-bg: #33e0bf;
    --bs-btn-hover-border-color: #33e0bf;
    --bs-btn-hover-color: var(--shell-bg);
    --bs-btn-active-bg: #00b894;
    --bs-btn-active-border-color: #00b894;
    --bs-btn-active-color: var(--shell-bg);
    font-weight: 700;
}
.btn-ghost {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--shell-line-strong);
    --bs-btn-color: #ffffff;
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-btn-hover-border-color: rgba(255, 255, 255, 0.24);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: rgba(255, 255, 255, 0.1);
    --bs-btn-active-border-color: rgba(255, 255, 255, 0.24);
    --bs-btn-active-color: #ffffff;
    font-weight: 600;
}

.notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--shell-panel);
    border: 1px solid var(--shell-line);
}
.notice .bi { font-size: 24px; flex: 0 0 auto; }
.notice-warn { border-color: rgba(245, 158, 11, 0.5); }
.notice-warn .bi { color: var(--shell-warn); }
.notice-danger { border-color: rgba(255, 65, 108, 0.5); }
.notice-danger .bi { color: var(--shell-danger); }
.notice .notice-body { flex: 1 1 auto; min-width: 0; }
.notice .notice-title { font-size: 15px; font-weight: 600; }
.notice .notice-text { font-size: 13px; color: var(--shell-muted); margin-top: 2px; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 36px 20px;
}
.empty-state .bi { font-size: 40px; color: var(--shell-muted); }
.empty-state .empty-title { font-size: 18px; font-weight: 600; }
.empty-state .empty-text { font-size: 14px; color: var(--shell-muted); max-width: 520px; }

/* flat data table */
.table-flat {
    --bs-table-bg: transparent;
    --bs-table-color: #ffffff;
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
    margin-bottom: 0;
}
.table-flat thead th {
    font-size: 12px;
    font-weight: 500;
    color: var(--shell-muted);
    border-bottom: 1px solid var(--shell-line);
    padding: 8px 10px;
    white-space: nowrap;
}
.table-flat td {
    padding: 10px 10px;
    font-size: 13px;
    vertical-align: middle;
}
.table-flat tbody tr:last-child td { border-bottom: 0; }
.table-flat .mono { font-family: var(--font-mono); font-size: 12.5px; }
.text-muted-2 { color: var(--shell-muted) !important; }

/* ---------- retune the legacy primitives used by other pages ---------- */
/* legacy breadcrumb/menu blocks wrap themselves in .container; inside .app-main the
   content already has its gutter, so drop Bootstrap's max-width and side padding */
.app-main > .container,
.app-main > .row > .container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}
.glass-card {
    background: var(--shell-panel);
    backdrop-filter: none;
    border: 1px solid var(--shell-line);
    border-radius: 12px;
    box-shadow: none;
}
.glass-card:hover { transform: none; box-shadow: none; }
.table-modern th { color: var(--shell-muted); font-weight: 500; font-size: 12px; }
.breadcrumb { font-size: 13px; }
.alert-modern { border-radius: 12px; }
