﻿/* Admin shell, navigation, search, and profile styles */

    .app {
      min-height: 100vh;
      height: 100vh;
      display: grid;
      grid-template-columns: 300px 1fr;
      overflow: hidden;
    }
    .app.sidebar-collapsed {
      grid-template-columns: 64px 1fr;
    }
    .app.sidebar-collapsed .sidebar {
      display: flex;
      padding: 12px 6px;
    }
    .app.sidebar-collapsed .brand-wordmark,
    .app.sidebar-collapsed .nav-label,
    .app.sidebar-collapsed .nav-btn > span:last-child,
    .app.sidebar-collapsed .sidebar-status {
      display: none;
    }
    .app.sidebar-collapsed .sidebar-head {
      justify-content: center;
    }
    .app.sidebar-collapsed .brand {
      padding: 8px 0 12px;
      display: flex;
      justify-content: center;
    }
    .app.sidebar-collapsed .brand-lockup {
      justify-content: center;
    }
    .app.sidebar-collapsed .nav-group-wrap {
      margin-top: 8px;
    }
    .app.sidebar-collapsed .nav-group {
      margin-bottom: 10px;
    }
    .app.sidebar-collapsed .nav-btn {
      justify-content: center;
      width: auto;
      min-width: 0;
      padding: 0;
      margin: 0 auto 8px;
      border-radius: 0;
      background: transparent;
      border: 0;
    }
    .app.sidebar-collapsed .nav-btn.active {
      background: transparent;
    }
    .app.sidebar-collapsed .nav-icon {
      width: 24px;
      height: 24px;
      font-size: 10px;
    }
    .app.sidebar-collapsed .nav-btn.active .nav-icon {
      background: var(--nav-active-bg);
      border-color: rgba(28,143,132,0.24);
      color: #dffaf6;
    }
    .mobile-sidebar-backdrop {
      display: none;
    }
    .sidebar {
      background: linear-gradient(180deg, #14171b, #111417 40%, var(--nav) 100%);
      color: #fff;
      padding: 18px 16px;
      border-right: 1px solid var(--nav-line);
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow: hidden;
      overflow-x: hidden;
      scrollbar-width: none;
    }
    .sidebar::-webkit-scrollbar {
      display: none;
    }
    .sidebar-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }
    .sidebar-toggle {
      width: auto;
      min-width: 42px;
      height: 42px;
      padding: 0 12px;
      border-radius: 10px;
      background: rgba(255,255,255,0.05);
      color: #fff;
      border: 1px solid rgba(255,255,255,0.08);
      font-size: 13px;
      font-weight: 600;
      margin-top: 0;
    }
    .sidebar-close-mobile {
      display: none;
    }
    .admin-mobile-menu {
      width: auto;
      margin-top: 0;
      min-width: 44px;
      height: 44px;
      padding: 0 13px;
      border-radius: 10px;
      background: rgba(28,143,132,0.14);
      color: #fff;
      border: 1px solid rgba(28,143,132,0.22);
      font-size: 18px;
      font-weight: 800;
      line-height: 1;
    }
    .brand {
      padding: 10px 10px 18px;
      border-bottom: 1px solid var(--nav-line);
      margin-bottom: 14px;
      flex: 0 0 auto;
    }
    .sidebar-scroll {
      min-height: 0;
      flex: 1 1 auto;
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .sidebar-scroll::-webkit-scrollbar {
      display: none;
    }
    .brand-mark {
      width: 28px;
      height: 28px;
      border-radius: 10px;
      display: block;
      align-items: center;
      justify-content: center;
      background: rgba(28,143,132,0.12);
      border: 1px solid rgba(28,143,132,0.22);
      color: #49d8bf;
      font-size: 18px;
      line-height: 1;
      box-shadow: inset 0 0 0 1px rgba(73,216,191,0.08);
      flex: 0 0 auto;
      object-fit: contain;
      overflow: hidden;
    }
    .brand-lockup {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
    }
    .brand-wordmark {
      display: flex;
      align-items: baseline;
      gap: 3px;
      white-space: nowrap;
      font-size: 16px;
      line-height: 1;
    }
    .brand-wordmark strong {
      color: #f7fafc;
      font-weight: 800;
    }
    .brand-wordmark span {
      color: rgba(255,255,255,0.88);
      font-weight: 500;
    }
    .section-title-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: nowrap;
      justify-content: flex-start;
      width: fit-content;
      max-width: 100%;
      margin-bottom: 10px;
    }
    .section-title-row h3,
    .section-title-row h4 {
      margin: 0;
      white-space: nowrap;
    }
    .info-trigger {
      width: 18px !important;
      min-width: 18px !important;
      height: 18px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      display: inline-flex !important;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      padding: 0 !important;
      flex: 0 0 auto;
      margin-top: 0 !important;
      line-height: 1;
      position: relative;
      top: -4px;
    }
    .info-trigger:hover {
      color: var(--text);
      border-color: rgba(85,215,193,0.35);
      background: rgba(85,215,193,0.08);
    }
    .nav-group {
      margin-bottom: 16px;
    }
    .nav-label {
      font-size: var(--fs-helper);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: rgba(255,255,255,0.45);
      padding: 0 10px 8px;
    }
    .nav-btn {
      width: 100%;
      text-align: left;
      padding: 10px 12px;
      border-radius: 12px;
      border: 0;
      background: transparent;
      color: var(--nav-text);
      cursor: pointer;
      margin-bottom: 6px;
      font: inherit;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .nav-icon {
      width: 24px;
      height: 24px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.04em;
      background: rgba(255,255,255,0.04);
      color: #a9b4c1;
      border: 1px solid rgba(255,255,255,0.06);
      flex: 0 0 auto;
    }
    .nav-btn.active {
      background: var(--nav-active-bg);
      color: var(--nav-active);
      font-weight: 600;
    }
    .nav-btn.active .nav-icon {
      background: rgba(28,143,132,0.2);
      color: #dffaf6;
      border-color: rgba(28,143,132,0.24);
    }
    .nav-count-badge {
      margin-left: auto;
      min-width: 20px;
      height: 20px;
      border-radius: 999px;
      padding: 0 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 800;
      line-height: 1;
      color: #fff;
      background: rgba(209, 106, 104, 0.95);
    }
    .nav-count-badge.hidden {
      display: none;
    }
    .sidebar-status {
      margin-top: 18px;
      padding: 12px;
      border-radius: 16px;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.05);
      color: var(--nav-text);
      font-size: var(--fs-body);
      line-height: 1.45;
    }
    .info-popup-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(7, 10, 15, 0.42);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 70;
      padding: 18px;
    }
    .info-popup-backdrop.show {
      display: flex;
    }
    .info-popup {
      width: min(420px, 100%);
      border-radius: 18px;
      border: 1px solid var(--line);
      background: var(--panel);
      box-shadow: 0 20px 50px rgba(0,0,0,0.28);
      padding: 18px;
      display: grid;
      gap: 12px;
    }
    .info-popup-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .info-popup-head h4 {
      margin: 0;
    }
    .info-popup-close {
      width: 34px;
      min-width: 34px;
      height: 34px;
      padding: 0;
      border-radius: 10px;
    }
    .info-popup-body {
      color: var(--muted);
      line-height: 1.6;
      font-size: 14px;
    }
    .main {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      gap: 10px;
      align-content: start;
      padding: 0 18px 0;
      height: 100vh;
      overflow: hidden;
    }
    html:not(.light-theme) body .main,
    body.dark-theme .main {
      background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0));
    }
    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 14px;
      min-width: 0;
      padding: 14px 0 12px;
      border-bottom: 1px solid var(--line);
    }
    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      min-width: 0;
    }
    .admin-session-check-overlay {
      position: fixed;
      right: 22px;
      bottom: 22px;
      z-index: 80;
      pointer-events: none;
    }
    .admin-session-check-overlay.hidden {
      display: none;
    }
    body.admin-auth-checking .view {
      display: none !important;
    }
    body.admin-auth-checking #view-admin-boot {
      display: grid !important;
      place-items: center;
    }
    .admin-session-check-pill {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      min-height: 42px;
      padding: 0 14px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--panel);
      color: var(--text);
      box-shadow: 0 12px 28px rgba(0,0,0,0.22);
      font-size: 11px;
      font-weight: 700;
    }
    .admin-session-check-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--brand);
      animation: adminSessionPulse 0.9s ease-in-out infinite;
    }
    @keyframes adminSessionPulse {
      0%, 100% { transform: scale(0.85); opacity: 0.55; }
      50% { transform: scale(1.15); opacity: 1; }
    }
    body.admin-auth-guest .nav-group-wrap,
    body.admin-auth-guest .sidebar-status {
      display: none;
    }
    body.admin-auth-guest .sidebar {
      justify-content: flex-start;
    }
    body.admin-auth-guest .admin-mobile-menu,
    body.admin-auth-guest .admin-search-wrap,
    body.admin-auth-guest .admin-profile {
      visibility: hidden;
      pointer-events: none;
    }
    body.admin-auth-guest .admin-logout-button {
      display: none;
    }
    body.admin-auth-guest #view-overview .overview-grid > .card:not(.auth-card),
    body.admin-auth-guest .staff-workspace-grid > .card:not(.staff-role-card) {
      display: none;
    }
    body.admin-auth-guest .overview-grid,
    body.admin-auth-guest .staff-workspace-grid {
      display: grid;
      grid-template-columns: 320px 1fr;
      gap: 14px;
    }
    body.admin-auth-guest .auth-card,
    body.admin-auth-guest .staff-role-card {
      width: 100%;
      max-width: 560px;
      grid-column: 1 / -1;
      justify-self: center;
      align-self: start;
    }
    body.admin-auth-guest .staff-role-card {
      background: var(--panel);
      border-color: var(--line);
    }
    body.admin-auth-guest .staff-role-card > .staff-role-eyebrow,
    body.admin-auth-guest .staff-role-card > h3,
    body.admin-auth-guest .staff-role-card > .staff-role-meta,
    body.admin-auth-guest .staff-role-card > .toolbar {
      display: none;
    }
    body.admin-auth-guest .staff-role-card > .card-heading {
      display: none !important;
    }
    body.admin-auth-guest .staff-role-card > .card-section-content {
      display: block !important;
    }
    body.admin-auth-guest .staff-role-card > .card-section-content > .staff-role-eyebrow,
    body.admin-auth-guest .staff-role-card > .card-section-content > h3,
    body.admin-auth-guest .staff-role-card > .card-section-content > .staff-role-meta,
    body.admin-auth-guest .staff-role-card > .card-section-content > .toolbar {
      display: none !important;
    }
    body.admin-auth-guest .staff-login-panel {
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }
    body.admin-auth-guest .staff-login-panel .stack::before {
      content: "Login";
      color: var(--ink);
      font-size: var(--fs-section);
      font-weight: 700;
      line-height: 1.2;
      margin-bottom: -2px;
    }
    body.admin-auth-guest .staff-login-panel .stack::after {
      content: "Use your staff credentials to sign in here.";
      color: var(--muted);
      margin-top: 10px;
      padding: 9px 10px;
      border-radius: 10px;
      background: var(--surface);
      border: 1px solid var(--line);
      font-size: 13px;
      line-height: 1.45;
    }
    body.admin-auth-guest .admin-login-card .auth-actions {
      grid-template-columns: 1fr;
    }
    body.admin-auth-guest .admin-login-card .auth-actions .secondary,
    body.admin-auth-guest .admin-login-card .auth-actions .ghost {
      display: none;
    }
    body.admin-auth-active #view-overview .admin-login-card {
      display: none;
    }
    body.admin-auth-active .staff-workspace-grid > .staff-role-card {
      display: none;
    }
    .admin-search-wrap {
      position: relative;
      min-width: 0;
    }
    .admin-search {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 300px;
      max-width: 340px;
      min-height: 44px;
      padding: 0 14px;
      border-radius: 14px;
      border: 1px solid var(--line);
      background: #161a1f;
      color: #f4f7fb;
    }
    .admin-search::before {
      content: "";
      width: 13px;
      height: 13px;
      border: 2px solid currentColor;
      border-radius: 999px;
      opacity: 0.82;
      flex: 0 0 auto;
      box-sizing: border-box;
      box-shadow: 6px 6px 0 -4px currentColor;
    }
    .admin-search input {
      flex: 1 1 auto;
      min-width: 0;
      border: 0;
      outline: none;
      background: transparent;
      color: inherit;
      font: inherit;
      padding: 0;
    }
    .admin-search input::placeholder {
      color: #8f9aa8;
    }
    .admin-search-popup {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      width: min(420px, calc(100vw - 32px));
      padding: 10px;
      border-radius: 16px;
      border: 1px solid var(--line);
      background: rgba(18, 22, 27, 0.98);
      box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
      z-index: 40;
      display: none;
    }
    .admin-search-popup.show {
      display: block;
    }
    .admin-search-popup-header {
      color: var(--muted);
      font-size: var(--fs-helper);
      margin-bottom: 8px;
    }
    .admin-search-results {
      display: grid;
      gap: 8px;
    }
    .admin-search-result {
      width: 100%;
      text-align: left;
      border: 1px solid var(--line);
      background: #171c21;
      color: var(--text);
      border-radius: 12px;
      padding: 10px 12px;
      font: inherit;
      cursor: pointer;
    }
    .admin-search-result strong {
      display: block;
      font-size: var(--fs-body);
      margin-bottom: 2px;
    }
    .admin-search-result span {
      color: var(--muted);
      font-size: var(--fs-helper);
    }
    .admin-profile {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 7px 10px;
      border-radius: 14px;
      background: #15191d;
      border: 1px solid var(--line);
      min-width: 220px;
    }
    .admin-profile-avatar {
      width: 34px;
      height: 34px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: #2a3138;
      color: #f4f7fb;
      font-size: 12px;
      font-weight: 800;
      flex: 0 0 auto;
      object-fit: contain;
      overflow: hidden;
    }
    .admin-profile-meta {
      min-width: 0;
    }
    .admin-profile-name {
      color: #f4f7fb;
      font-size: var(--fs-body);
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .admin-profile-plan {
      color: #8fd7cb;
      font-size: var(--fs-helper);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .admin-logout-button {
      width: auto;
      min-width: 88px;
      height: 44px;
      margin-top: 0;
      padding: 0 14px;
      white-space: nowrap;
    }
    .page-heading h2 {
      margin: 0;
      font-size: var(--fs-title);
      letter-spacing: -0.03em;
    }

    .theme-toggle {
      width: auto;
      min-width: 108px;
      margin-top: 0;
      min-height: 44px;
      padding: 0 14px;
      border-radius: 999px;
      font-size: 13px;
      font-weight: 700;
    }

    body.light-theme .sidebar {
      background: linear-gradient(180deg, #f8fbfe, #eef4fa 42%, #e7eef6 100%);
      border-right-color: var(--line);
      color: var(--ink);
    }
    body.light-theme .mobile-sidebar-backdrop {
      background: rgba(235, 241, 247, 0.92);
    }
    body.light-theme .brand {
      border-bottom-color: var(--line);
    }
    body.light-theme .brand-mark {
      background: rgba(13,59,102,0.08);
      border-color: rgba(13,59,102,0.16);
      color: var(--brand);
      box-shadow: inset 0 0 0 1px rgba(13,59,102,0.04);
    }
    body.light-theme .brand-wordmark strong,
    body.light-theme .brand-wordmark span {
      color: var(--ink);
    }
    body.light-theme .nav-label {
      color: var(--muted);
    }
    body.light-theme .nav-btn {
      color: var(--muted);
      border-color: transparent;
    }
    body.light-theme .nav-btn:hover {
      background: rgba(13,59,102,0.06);
      color: var(--ink);
    }
    body.light-theme .nav-btn.active {
      background: rgba(13,59,102,0.1);
      border-color: rgba(13,59,102,0.14);
      color: var(--ink);
    }
    body.light-theme .nav-icon {
      background: #eef3f8;
      color: var(--brand);
    }
    body.light-theme .sidebar-status {
      background: rgba(13,59,102,0.04);
      border-color: rgba(13,59,102,0.12);
      color: var(--muted);
    }
    body.light-theme .topbar {
      border-color: var(--line);
    }
    body.light-theme .admin-search,
    body.light-theme .admin-profile,
    body.light-theme .theme-toggle,
    body.light-theme .admin-mobile-menu {
      background: #fff;
      border-color: var(--line);
      color: var(--ink);
    }
    body.light-theme .admin-search-popup {
      background: rgba(255,255,255,0.98);
      box-shadow: 0 16px 40px rgba(15, 23, 32, 0.14);
    }
    body.light-theme .admin-search-result {
      background: #f4f8fc;
    }
    body.light-theme .admin-profile-avatar {
      background: #ebf1f7;
      color: var(--ink);
    }
    body.light-theme .admin-profile-name {
      color: var(--ink);
    }
    body.light-theme .admin-profile-plan {
      color: var(--brand);
    }

    @media (max-width: 760px) {
      .main {
        padding: 12px 14px 0;
        height: 100dvh;
      }

      .topbar {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 44px 44px auto;
        gap: 8px;
        padding: 14px 0 12px;
      }

      .topbar-actions {
        display: contents;
      }

      .admin-mobile-menu,
      .theme-toggle {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
      }

      .admin-search-wrap,
      .admin-search {
        min-width: 0;
        width: 100%;
      }

      .admin-search {
        min-height: 44px;
        padding: 0 12px;
      }

      .admin-profile {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
      }

      .admin-profile-meta {
        display: none;
      }

      .admin-logout-button {
        min-width: 0;
        height: 44px;
        padding: 0 12px;
      }

      body.admin-auth-guest .overview-grid,
      body.admin-auth-guest .staff-workspace-grid {
        grid-template-columns: 1fr;
      }

      .admin-session-check-overlay {
        left: 14px;
        right: 14px;
        bottom: 14px;
      }

      .admin-session-check-pill {
        width: 100%;
        justify-content: center;
      }
    }

    @media (max-width: 420px) {
      .topbar {
        grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
      }

      .admin-logout-button {
        grid-column: 1 / -1;
        width: 100%;
      }
    }
