/* Portal layout and components, formerly inline in base.html: cached once instead of resent with every page. */
/* Cascade order: the portal styles, then their light counterparts (*.light.css). The utilities stay unlayered. */
@layer portal, light;
@layer portal {
:root {
  color-scheme: light dark;
  --bg: #0e1117;
  --surface: #141922;
  --surface-2: #1b2230;
  --surface-3: #222b3b;
  --line: #313a4d;
  --text: #f3f6fb;
  --muted: #a9b4c6;
  --green: #2fb879;
  --green-soft: rgba(47, 184, 121, .14);
  --amber: #f3b33d;
  --amber-soft: rgba(243, 179, 61, .14);
  --red: #ef5b5b;
  --red-soft: rgba(239, 91, 91, .14);
  --cyan: #50b9d8;
  --cyan-soft: rgba(80, 185, 216, .14);
  --ink: #0b0d12;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 15% 0%, rgba(80,185,216,.20), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(47,184,121,.16), transparent 26%),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}
a { color: inherit; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(14,17,23,.92);
  padding: 12px 10px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex: 0 0 auto; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 10px 24px rgba(0,0,0,.38);
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: contain;
  background: radial-gradient(circle at 35% 25%, #ffffff, #dfe8ef 58%, #8ea0ac);
  padding: 3px;
  border: 1px solid rgba(255,255,255,.32);
  box-shadow: 0 0 0 3px rgba(80,185,216,.12), 0 10px 24px rgba(0,0,0,.46);
}
.brand h1 { font-size: 13px; line-height: 1.15; margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.sidebar-user {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sidebar-user .badge {
  padding: 3px 7px;
  font-size: 12px;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .dot {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 3px var(--green-soft);
}
.nav {
  display: grid;
  gap: 6px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 6px;
  scrollbar-gutter: auto;
}
.nav-module {
  --mod: #c5d0e0;
  --mod-soft: rgba(197, 208, 224, .10);
  --mod-glow: rgba(197, 208, 224, .22);
  display: grid;
  gap: 2px;
  padding: 5px 5px 5px 7px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--mod) 22%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--mod) 72%, transparent);
  background:
    linear-gradient(135deg, var(--mod-soft), transparent 58%),
    rgba(12, 16, 24, .55);
  box-shadow: 0 0 14px -10px var(--mod-glow);
}
.nav-module-portal { --mod: #d7e0ef; --mod-soft: rgba(215, 224, 239, .10); --mod-glow: rgba(215, 224, 239, .28); }
.nav-module-logs { --mod: #4ec9ef; --mod-soft: rgba(78, 201, 239, .12); --mod-glow: rgba(78, 201, 239, .38); }
.nav-module-authz { --mod: #3de0a0; --mod-soft: rgba(61, 224, 160, .11); --mod-glow: rgba(61, 224, 160, .36); }
.nav-module-packs { --mod: #f0c14d; --mod-soft: rgba(240, 193, 77, .11); --mod-glow: rgba(240, 193, 77, .34); }
.nav-module-account { --mod: #9aa8bd; --mod-soft: rgba(154, 168, 189, .10); --mod-glow: rgba(154, 168, 189, .26); }
.nav-module-label {
  margin: 0;
  padding: 0 4px 1px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--mod) 78%, #fff 22%);
  text-shadow: 0 0 10px var(--mod-glow);
}
.nav-module a,
.nav-module button,
.nav-module .nav-disabled {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: color .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.nav-module .nav-disabled {
  cursor: default;
  opacity: .55;
}
.nav-module a:hover,
.nav-module button:hover {
  color: color-mix(in srgb, var(--mod) 55%, #fff 45%);
  border-color: color-mix(in srgb, var(--mod) 34%, transparent);
  background: color-mix(in srgb, var(--mod-soft) 80%, transparent);
  box-shadow: 0 0 10px -6px var(--mod-glow);
}
.nav-module a.active,
.nav-module .nav-disabled.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--mod) 48%, transparent);
  background: color-mix(in srgb, var(--mod-soft) 100%, rgba(255,255,255,.04));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--mod) 18%, transparent),
    0 0 12px -4px var(--mod-glow);
}
@keyframes nav-amber-pulse {
  0%, 100% {
    color: #fff4c4;
    border-color: rgba(255, 210, 74, .75);
    background: rgba(243, 179, 61, .22);
    box-shadow: 0 0 0 0 rgba(243, 179, 61, .35);
  }
  50% {
    color: #18120a;
    border-color: #ffd24a;
    background: #ffd24a;
    box-shadow: 0 0 18px rgba(255, 210, 74, .55);
  }
}
.nav a.nav-alert-pulse {
  animation: nav-amber-pulse 1.05s ease-in-out infinite;
  font-weight: 800;
}
.btn.nav-alert-pulse,
.btn.btn-devices-alert {
  animation: nav-amber-pulse 1.05s ease-in-out infinite;
  color: #18120a;
}
@media (prefers-reduced-motion: reduce) {
  .nav a.nav-alert-pulse,
  .btn.nav-alert-pulse,
  .btn.btn-devices-alert {
    animation: none;
    color: #18120a;
    background: #ffd24a;
    border-color: #ffd24a;
  }
}
.sidebar-footer {
  position: static;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.sidebar-footer .build-badge {
  padding: 3px 7px;
  font-size: 12px;
  max-width: 58%;
}
.sidebar-footer .btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}
.sidebar-footer .session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.page { width: 100%; min-width: 0; padding: 28px clamp(20px, 3vw, 44px); }
.topbar { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.topbar h2 { margin: 0; font-size: 28px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.panel { background: rgba(20,25,34,.94); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.section-title { margin: 0 0 14px; font-size: 17px; }
.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.pill.ok { color: #8ff0bd; background: var(--green-soft); border-color: rgba(47,184,121,.34); }
.pill.warn { color: #ffd88b; background: var(--amber-soft); border-color: rgba(243,179,61,.34); }
.pill.err { color: #ffa1a1; background: var(--red-soft); border-color: rgba(239,91,91,.34); }
.pill.info { color: #9ee7fb; background: var(--cyan-soft); border-color: rgba(80,185,216,.34); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  text-decoration: none;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  border: 0;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
}
.btn-blue { background: #287a94; }
.btn-green { background: #23885b; }
.btn-amber { background: var(--amber); color: #18120a; }
.btn-red { background: #a93f45; }
.btn-slate { background: var(--surface-3); }
.password-field {
  position: relative;
  display: block;
}
.password-field input[type="password"],
.password-field input[type="text"] {
  width: 100%;
  padding-right: 46px;
}
.password-field-actions {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.password-field .password-toggle {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.password-field .password-toggle:hover {
  color: var(--text);
  background: rgba(255,255,255,.06);
}
.password-field .password-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}
.btn-disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
  filter: saturate(.65);
}
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.layout-wide { max-width: 1180px; width: 100%; }
.layout-fluid { max-width: none; width: 100%; }
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.form-panel { max-width: 520px; }
.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}
.policy-item {
  min-height: 116px;
  background: rgba(27,34,48,.76);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.policy-item strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.policy-item span { display: block; font-size: 16px; line-height: 1.35; }
.muted { color: var(--muted); }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.card-value { font-size: 34px; font-weight: 900; margin-top: 8px; }
input, textarea, select {
  width: 100%;
  background: #0f141c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}
input[type="file"] { padding: 9px; }
label { display: block; margin-bottom: 8px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { min-width: 180px; }
.actions.compact .btn { min-width: 0; padding: 8px 12px; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap.no-x-scroll { overflow-x: hidden; }
table { width: 100%; border-collapse: collapse; }
table.fluid-table { table-layout: fixed; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; }
.cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.cell-clip code { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.logs-reports-table .col-select { width: 2.4rem; }
.logs-reports-table .col-when { width: 7.2rem; white-space: normal; overflow: visible; }
.logs-reports-table .col-session { width: 6.8rem; min-width: 0; }
.logs-reports-table .col-tech { width: 20%; min-width: 0; }
.logs-reports-table .col-equip { width: 11%; min-width: 0; }
.logs-reports-table .col-file { width: 24%; min-width: 0; }
.logs-reports-table .col-size { width: 6rem; }
.logs-reports-table .col-actions {
  width: 8.6rem;
  overflow: hidden;
  vertical-align: middle;
  padding-left: 8px;
  padding-right: 10px;
}
.logs-reports-table .report-when {
  white-space: normal;
  overflow: visible;
}
.logs-reports-table .report-when strong,
.logs-reports-table .report-when span {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.logs-reports-table .report-when time {
  display: block;
}
.logs-live-table th:nth-child(1),
.logs-live-table td:nth-child(1) { width: 12%; }
.logs-live-table th:nth-child(2),
.logs-live-table td:nth-child(2) { width: 24%; }
.logs-live-table th:nth-child(3),
.logs-live-table td:nth-child(3) { width: 14%; }
.logs-live-table th:nth-child(4),
.logs-live-table td:nth-child(4) { width: 16%; }
.logs-live-table th:nth-child(5),
.logs-live-table td:nth-child(5) { width: 14%; }
.logs-live-table th:nth-child(6),
.logs-live-table td:nth-child(6) { width: 20%; }
body.immersive-report .shell { grid-template-columns: 1fr; }
body.immersive-report .sidebar { display: none; }
body.immersive-report .page { padding: 0; min-height: 100vh; }
.report-stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #070a0f;
}
.report-toolbar {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,17,23,.96);
}
.report-toolbar h2 {
  margin: 0;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-toolbar .meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.report-toolbar .meta-strip .pill { padding: 6px 9px; }
.report-frame-wrap { min-height: 0; background: #fff; }
.report-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 92px);
  border: 0;
  background: #fff;
}
code { color: #b5f3d2; overflow-wrap: anywhere; }
.ok { color: #4ade80; font-weight: 700; }
.warn { color: #fbbf24; font-weight: 700; }
.err { color: #fb7185; font-weight: 700; }
.msg { padding: 11px 12px; border-radius: 8px; margin-bottom: 12px; font-weight: 700; }
.msg.error { background: var(--red-soft); border: 1px solid rgba(239,91,91,.5); }
.msg.success { background: var(--green-soft); border: 1px solid rgba(47,184,121,.5); }
.empty { padding: 24px; color: var(--muted); text-align: center; }
.two-line strong, .two-line span { display: block; }
.two-line span { color: var(--muted); margin-top: 3px; font-size: 12px; }
.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.build-badge {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}
.portal-update {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 50% 18%, rgba(80,185,216,.16), transparent 42%),
    rgba(6, 9, 14, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.portal-update[hidden] { display: none; }
.portal-update-card {
  width: min(440px, 100%);
  padding: 26px 24px 22px;
  border-radius: 18px;
  border: 1px solid rgba(154, 214, 232, .28);
  background:
    linear-gradient(180deg, rgba(36, 48, 64, .55), transparent 46%),
    linear-gradient(135deg, rgba(20, 25, 34, .98), rgba(12, 16, 24, .98));
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04),
    0 28px 80px rgba(0, 0, 0, .55),
    0 0 60px rgba(80, 185, 216, .08);
  animation: portal-update-in .42s ease;
}
.portal-update-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: #9ee7fb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.portal-update-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-soft);
}
.portal-update-card h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.portal-update-version {
  display: inline-flex;
  margin: 12px 0 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(80,185,216,.34);
  background: var(--cyan-soft);
  color: #9ee7fb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.portal-update-card #portal-update-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}
.portal-update-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #c5d0e0;
  font-size: 13px;
}
.portal-update-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15, 20, 28, .88);
  box-shadow: 0 2px 0 rgba(255,255,255,.08);
  color: var(--text);
  font: 800 12px/1.2 "Segoe UI", Arial, sans-serif;
}
.portal-update-actions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.portal-update-actions .btn { width: 100%; min-height: 44px; }
.portal-update-later {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px;
}
.portal-update-later:hover { color: var(--text); }
@keyframes portal-update-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-update-card { animation: none; }
}
@media (max-width: 980px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .nav {
    overflow: visible;
    flex: none;
    max-height: none;
    margin-bottom: 0;
  }
  .sidebar-footer { margin-top: 12px; }
  .topbar { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .form-panel { max-width: none; }
}
@media (max-width: 640px) {
  .page { padding: 22px 16px; }
  .policy-grid { grid-template-columns: 1fr; }
  .report-toolbar { flex-direction: column; align-items: stretch; }
  .report-toolbar .topbar-actions { justify-content: flex-start; }
  .report-frame-wrap iframe { min-height: calc(100vh - 180px); }
}
}
