/* ---------- App Server admin panel ---------- */
:root {
  --side-w: 248px;
  --side-bg: #111827;
  --side-fg: #9ca3af;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --page-bg: #f3f4f8;
  --card-radius: 14px;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-primary: #4f46e5; --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5; --bs-link-color-rgb: 79, 70, 229; --bs-link-hover-color: #3730a3;
}
body.admin { background: var(--page-bg); color: #1f2937; }
.layout { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar { background: var(--side-bg); color: var(--side-fg); width: var(--side-w); display: flex; flex-direction: column; }
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; }
  .main { margin-left: var(--side-w); }
}
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: 270px; background: var(--side-bg); } }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem .9rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .6rem; }
.brand:hover { color: #fff; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.sidebar-nav { padding: .25rem .75rem; flex: 1; overflow-y: auto; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; margin: 1rem .6rem .35rem; }
.side-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 9px; color: var(--side-fg);
  text-decoration: none; font-size: .92rem; margin-bottom: 2px; transition: background .15s, color .15s; }
.side-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: linear-gradient(135deg, rgba(79,70,229,.9), rgba(124,58,237,.9)); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.35); }
.sidebar-foot { padding: 1rem 1.1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.07); }

/* main + topbar */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; height: 60px; padding: 0 1.25rem;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid #e5e7eb; }
.topbar-title { font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; padding: 0; font-size: 1.15rem; color: #374151; }
.btn-icon:hover { background: #f3f4f6; }
.btn-icon .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #fff; }
.avatar { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; font-weight: 600; font-size: .95rem; }
.avatar:hover { color: #fff; opacity: .9; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
@media (max-width: 575.98px) { .content { padding: 1rem .75rem; } .topbar { padding: 0 .75rem; } }

/* cards, tables, forms */
.card { border: 1px solid #eceef3; border-radius: var(--card-radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card > .table-responsive, .card > .table-responsive > .table { border-radius: var(--card-radius); }
.card-body h6 { font-weight: 600; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600;
  background: #f9fafb; border-bottom: 1px solid #eceef3; white-space: nowrap; padding-top: .65rem; padding-bottom: .65rem; }
.table td { border-color: #f1f2f6; }
.table td, .table th { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8f8fc; }
.form-control, .form-select { border-radius: 9px; border-color: #e1e4ea; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.btn { border-radius: 9px; }
.btn-dark, .btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-dark:hover, .btn-primary:hover, .btn-dark:focus, .btn-primary:focus { background: #4338ca; border-color: #4338ca; }
.btn-outline-dark { color: #3730a3; border-color: #c7d2fe; }
.btn-outline-dark:hover { background: #eef2ff; color: #3730a3; border-color: #a5b4fc; }
.pagination .page-link { border-radius: 8px; margin: 0 2px; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.alert { border-radius: 12px; border: 0; }

/* page header used on list pages */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h4 { margin: 0; font-weight: 700; }

/* stat tiles */
.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; }
.stat-icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.stat-label { font-size: .8rem; color: #6b7280; }
.stat { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.tone-indigo { background: #eef2ff; color: #4f46e5; } .tone-green { background: #ecfdf5; color: #059669; }
.tone-amber { background: #fffbeb; color: #d97706; } .tone-rose { background: #fff1f2; color: #e11d48; }
.tone-sky { background: #f0f9ff; color: #0284c7; } .tone-violet { background: #f5f3ff; color: #7c3aed; }
.tone-slate { background: #f1f5f9; color: #475569; }
a.card-link-reset { color: inherit; text-decoration: none; display: block; }
a.card-link-reset .card { transition: transform .12s, box-shadow .12s; }
a.card-link-reset:hover .card { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.08); }

/* severity */
.sev { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .2rem .5rem; border-radius: 999px; white-space: nowrap; }
.sev-high { background: #fee2e2; color: #b91c1c; } .sev-medium { background: #fef3c7; color: #92400e; } .sev-low { background: #e0f2fe; color: #075985; }

/* app tabs scroll sideways on phones */
.nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-bottom-color: #e5e7eb; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link { white-space: nowrap; color: #6b7280; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; border-bottom-color: var(--brand); font-weight: 600; }
.nav-tabs .nav-link:hover { color: #111827; border-bottom-color: #d1d5db; }

.thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; background: #eef0f4; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
pre.json { max-height: 70vh; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 10px; font-size: .8rem; margin: 0; }
.form-text { font-size: .78rem; }
.text-break-all { word-break: break-all; }
.min-w-0 { min-width: 0; }

/* sticky save bar on the long config form */
.save-bar { position: sticky; bottom: 0; z-index: 5; }

/* ---------- login ---------- */
body.login-page { min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(1200px 600px at 10% -10%, #c7d2fe 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ddd6fe 0%, transparent 55%), #f3f4f8; }
.login-card { width: 100%; max-width: 400px; border: 0; border-radius: 18px; box-shadow: 0 20px 50px rgba(30,27,75,.12); }
.login-card .brand-logo { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; }

/* fixes: Bootstrap makes .offcanvas-lg transparent on large screens */
@media (min-width: 992px) { .sidebar.offcanvas-lg { background-color: var(--side-bg) !important; } }
.sidebar .brand, .sidebar .text-white-50 { color: #fff; }
body.admin a:not(.btn):not(.side-link):not(.page-link):not(.dropdown-item) { text-decoration: none; }
body.admin a:not(.btn):not(.side-link):not(.page-link):not(.dropdown-item):hover { text-decoration: underline; }
.stat-label { line-height: 1.25; }
@media (max-width: 575.98px) {
  .stat-card { gap: .7rem; padding: .9rem; }
  .stat-icon { width: 38px; height: 38px; flex-basis: 38px; font-size: 1.05rem; }
  .stat { font-size: 1.35rem; }
  .page-head h4 { font-size: 1.25rem; }
}
pre.json { white-space: pre-wrap; word-break: break-word; }
