:root {
  --portal-bg: #f5faf7;
  --portal-surface: rgba(255, 255, 255, 0.9);
  --portal-border: #d7e6dc;
  --portal-text: #122033;
  --portal-muted: #6b7d74;
  --portal-accent: #198754;
  --portal-accent-soft: #ecfdf5;
  --portal-danger: #d95f5f;
  --portal-shadow: rgba(18, 32, 51, 0.06);
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

body.portal-shell-page {
  background:
    radial-gradient(circle at top left, rgba(25, 135, 84, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 157, 138, 0.08), transparent 24%),
    var(--portal-bg);
  font-family: var(--font-sans);
  color: var(--portal-text);
}

.portal-shell-page,
.portal-shell-page button,
.portal-shell-page input,
.portal-shell-page select,
.portal-shell-page textarea {
  font-family: var(--font-sans) !important;
}

.portal-shell-page .main {
  background: transparent;
}

.portal-shell-page .sidebar {
  background: var(--portal-surface);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--portal-border);
  box-shadow: 12px 0 34px var(--portal-shadow);
}

.portal-shell-page .sb-accent {
  height: 4px;
  background: linear-gradient(90deg, #198754 0%, #18a56f 56%, #0f9d8a 100%);
}

.portal-shell-page .sb-brand {
  height: 78px;
  padding: 0 16px;
  border-bottom: 1px solid var(--portal-border);
}

.portal-shell-page .sidebar.collapsed .sb-brand {
  justify-content: center;
  padding: 0;
}

.portal-shell-page .sb-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(25, 135, 84, 0.08), 0 8px 18px rgba(18, 32, 51, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.portal-shell-page .sb-logo-link {
  display: inline-flex;
  text-decoration: none;
  border-radius: 14px;
}

.portal-shell-page .sb-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-shell-page .sidebar.collapsed .sb-logo,
.portal-shell-page .sidebar.collapsed .sb-brand-text {
  opacity: 0;
  pointer-events: none;
  width: 0;
  margin: 0;
}

.portal-shell-page .sb-brand-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--portal-text);
  letter-spacing: -0.01em;
  text-transform: none;
}

.portal-shell-page .sb-brand-sub {
  font-size: 0.64rem;
  color: var(--portal-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-shell-page .sb-toggle,
.portal-shell-page .mob-ham {
  border: 1px solid var(--portal-border);
  background: #fff;
  color: var(--portal-muted);
  box-shadow: none;
}

.portal-shell-page .sb-toggle:hover,
.portal-shell-page .mob-ham:hover {
  border-color: #bfd0e4;
  background: #f8fbff;
  color: var(--portal-accent);
}

.portal-shell-page .sb-label {
  color: #8b98aa;
  font-size: 0.56rem;
  letter-spacing: 0.18em;
}

.portal-shell-page .sb-link {
  height: 44px;
  border-radius: 14px;
  color: #526173;
  font-size: 0.79rem;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.portal-shell-page .sb-link i {
  color: #8492a6;
  font-size: 0.94rem;
}

.portal-shell-page .sidebar.collapsed .sb-link {
  width: 48px;
  margin-inline: auto;
  justify-content: center;
  padding: 0;
  border-radius: 14px;
}

.portal-shell-page .sidebar.collapsed .sb-link i {
  width: auto;
  margin: 0;
  font-size: 1.05rem;
}

.portal-shell-page .sb-link:hover {
  background: #f3fbf7;
  color: var(--portal-text);
  transform: translateX(2px);
}

.portal-shell-page .sb-link:hover i {
  color: var(--portal-accent);
}

.portal-shell-page .sb-link.active {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  color: var(--portal-accent);
  box-shadow: inset 3px 0 0 var(--portal-accent), 0 10px 22px rgba(25, 135, 84, 0.08);
}

.portal-shell-page .sb-link.active i {
  color: var(--portal-accent);
}

.portal-shell-page .sb-sep {
  margin: 8px 12px;
  background: var(--portal-border);
}

.portal-shell-page .sb-live-wrap,
.portal-shell-page .sb-user {
  background: #fff;
  border: 1px solid var(--portal-border);
  box-shadow: none;
}

.portal-shell-page .sb-live-wrap {
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fffc 100%);
}

.portal-shell-page .sb-live-dot {
  background: #0f9d8a;
  box-shadow: 0 0 0 4px rgba(15, 157, 138, 0.1);
}

.portal-shell-page .sb-live-lbl,
.portal-shell-page .sb-uname {
  color: var(--portal-text);
}

.portal-shell-page .sb-urole {
  color: var(--portal-muted);
}

.portal-shell-page .sb-avatar {
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
  box-shadow: none;
}

.portal-shell-page .sb-bottom {
  border-top: 1px solid var(--portal-border);
  background: rgba(255, 255, 255, 0.72);
}

.portal-shell-page .sb-logout {
  border: 1px solid var(--portal-border);
  background: #fff;
  color: var(--portal-muted);
  border-radius: 12px;
  font-size: 0.73rem;
}

.portal-shell-page .sb-logout:hover {
  color: var(--portal-danger);
  border-color: #f2c9c9;
  background: #fff5f5;
}

.portal-shell-page .mob-topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--portal-border);
  backdrop-filter: blur(16px);
  box-shadow: none;
}

.portal-shell-page .mob-title {
  color: var(--portal-text);
  font-size: 0.92rem;
  font-weight: 800;
}

.portal-shell-page .qs-overlay {
  background: rgba(20, 32, 51, 0.2);
  backdrop-filter: blur(12px);
}

.portal-shell-page .qs-box {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--portal-border);
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(20, 32, 51, 0.14);
  color: var(--portal-text);
}

.portal-shell-page .qs-ir {
  border-bottom: 1px solid var(--portal-border);
  padding: 16px 18px;
}

.portal-shell-page .qs-ir i,
.portal-shell-page .qs-ft {
  color: var(--portal-muted);
}

.portal-shell-page .qs-item {
  color: var(--portal-text);
  border-radius: 14px;
  padding: 10px 12px;
}

.portal-shell-page .qs-item:hover,
.portal-shell-page .qs-item.hi {
  background: #f1f6ff;
  color: var(--portal-text);
}

.portal-shell-page .qs-item:hover i,
.portal-shell-page .qs-item.hi i {
  color: var(--portal-accent);
}

.portal-shell-page .qs-item-sec,
.portal-shell-page .qs-k {
  background: #f6f8fb;
  color: #7e8da0;
  border: 1px solid var(--portal-border);
}

.portal-shell-page .portal-live-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
  z-index: 2200;
}

.portal-shell-page .portal-live-modal.open {
  display: flex;
}

.portal-shell-page .portal-live-box {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--portal-border);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.portal-shell-page .portal-live-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #e6eef6;
  background: linear-gradient(180deg, #f8fffb 0%, #ffffff 100%);
}

.portal-shell-page .portal-live-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #198754;
  margin-bottom: 4px;
}

.portal-shell-page .portal-live-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--portal-text);
  line-height: 1.2;
}

.portal-shell-page .portal-live-sub {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--portal-muted);
}

.portal-shell-page .portal-live-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: #fff;
  color: var(--portal-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.portal-shell-page .portal-live-close:hover {
  background: #fff5f5;
  color: var(--portal-danger);
  border-color: #f2c9c9;
}

.portal-shell-page .portal-live-body {
  padding: 20px 24px 16px;
  display: grid;
  gap: 12px;
}

.portal-shell-page .portal-live-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  font-size: 0.88rem;
  align-items: start;
}

.portal-shell-page .portal-live-key {
  color: var(--portal-muted);
  font-weight: 700;
}

.portal-shell-page .portal-live-val {
  color: var(--portal-text);
  font-weight: 600;
  line-height: 1.45;
}

.portal-shell-page .portal-live-actions {
  padding: 18px 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.portal-shell-page .portal-live-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--portal-border);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.portal-shell-page .portal-live-btn.secondary {
  background: #fff;
  color: var(--portal-muted);
}

.portal-shell-page .portal-live-btn.primary {
  background: #198754;
  border-color: #198754;
  color: #fff;
}

.portal-shell-page .portal-live-btn.secondary:hover {
  background: #f8fafc;
  color: var(--portal-text);
}

.portal-shell-page .portal-live-btn.primary:hover {
  background: #157347;
  border-color: #157347;
  color: #fff;
}

.portal-shell-page .sb-link:focus-visible,
.portal-shell-page .sb-toggle:focus-visible,
.portal-shell-page .sb-logout:focus-visible,
.portal-shell-page .mob-ham:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

.portal-shell-page .sidebar.collapsed .sb-link[title]:hover::after {
  background: #fff;
  border: 1px solid var(--portal-border);
  color: var(--portal-text);
  box-shadow: 0 14px 26px rgba(20, 32, 51, 0.1);
  left: calc(100% + 10px);
}

.portal-shell-page .sidebar.collapsed .sb-link[title]:hover::before {
  content: "";
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--portal-border);
  border-top: 1px solid var(--portal-border);
  z-index: 9998;
}

.portal-shell-page .sb-nav::-webkit-scrollbar-thumb {
  background: #d1ddeb;
}

/* ── Light-theme mobile QS button ── */
.portal-shell-page .mob-qs-btn {
  border: 1px solid var(--portal-border);
  background: #fff;
  color: var(--portal-muted);
}
.portal-shell-page .mob-qs-btn:hover {
  background: #f8fbff;
  border-color: #bfd0e4;
  color: var(--portal-accent);
}

/* ── Page-body responsive padding ── */
.portal-shell-page .page-body {
  padding-left: clamp(12px, 3vw, 28px);
  padding-right: clamp(12px, 3vw, 28px);
}

/* ── Sticky inner top-bar offset on mobile ──
   Pages that have position:sticky top-bar inside .main need to clear
   the 56px mob-topbar so the two bars don't overlap when scrolling. */
@media (max-width: 860px) {
  .portal-shell-page .top-bar,
  .portal-shell-page .page-top-bar,
  .portal-shell-page .section-topbar {
    top: 56px !important;
  }

  /* Tighten live modal on mobile */
  .portal-shell-page .portal-live-modal {
    padding: 12px;
  }

  .portal-shell-page .portal-live-box {
    border-radius: 18px;
  }

  .portal-shell-page .portal-live-head,
  .portal-shell-page .portal-live-body,
  .portal-shell-page .portal-live-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .portal-shell-page .portal-live-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .portal-shell-page .portal-live-actions {
    flex-direction: column-reverse;
  }

  .portal-shell-page .portal-live-btn {
    width: 100%;
  }

  /* Collapsed sidebar tokens reset for mobile (light theme parity) */
  .portal-shell-page .sb-live-wrap,
  .portal-shell-page .sb-user {
    background: rgba(255,255,255,.85);
  }
}

/* ── Tablet (861px – 1100px): slightly tighter sidebar ── */
@media (min-width: 861px) and (max-width: 1100px) {
  .portal-shell-page .sb-brand-name { font-size: .78rem; }
  .portal-shell-page .sb-link       { height: 40px; font-size: .76rem; }
}

/* ── Large screens (≥ 1440px): give the sidebar a touch more breathing room ── */
@media (min-width: 1440px) {
  .portal-shell-page .page-body {
    padding-left: 32px;
    padding-right: 32px;
  }
}
