/* ============================================
   OKC MOBILE AUTO — PORTAL STYLES
   Admin + Client Portal
   Industrial-Automotive Aesthetic
   Fonts: Teko (display) + Outfit (body)
   Navy / Red / White palette
   ============================================ */

/* ---------- PORTAL DESIGN TOKENS ---------- */
:root {
  --portal-navy: #0d1321;
  --portal-navy-mid: #1a1f3d;
  --portal-navy-light: #252b50;
  --portal-red: #d32f2f;
  --portal-red-dark: #b71c1c;
  --portal-red-glow: rgba(211, 47, 47, 0.35);
  --portal-red-subtle: rgba(211, 47, 47, 0.08);
  --portal-green: #2e7d32;
  --portal-green-bg: #e8f5e9;
  --portal-white: #ffffff;
  --portal-off-white: #f4f5f7;
  --portal-gray-100: #e8eaed;
  --portal-gray-300: #b0b3b8;
  --portal-gray-500: #6b7280;
  --portal-gray-800: #1f2937;
  --portal-radius: 8px;
  --portal-radius-lg: 12px;
  --portal-radius-xl: 16px;
  --portal-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --portal-shadow-md: 0 8px 30px rgba(0, 0, 0, 0.10);
  --portal-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.16);
  --portal-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --portal-shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.14);
  --portal-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --portal-transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --portal-sidebar-w: 260px;
}


/* ============================================
   1. AUTH PAGES
   ============================================ */

/* --- Auth Page Container --- */
.auth-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--portal-navy);
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
}

/* Noise texture overlay — same approach as battery hero */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 0;
}

/* Subtle radial glow behind the card */
.auth-page::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(211, 47, 47, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Auth Card --- */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 24px;
  background: var(--portal-white);
  border-radius: var(--portal-radius-xl);
  box-shadow: var(--portal-shadow-lg);
  overflow: hidden;
  animation: authCardIn 0.5s var(--portal-ease) both;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Auth Card Header --- */
.auth-card__header {
  background: var(--portal-navy);
  padding: 24px 32px;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.auth-card__header img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.auth-card__header span {
  font-family: 'Teko', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--portal-white);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Subtle bottom edge glow */
.auth-card__header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--portal-red), transparent);
  opacity: 0.6;
}

.auth-card__header h1 {
  font-family: 'Teko', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--portal-white);
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1;
  margin: 0;
}

.auth-card__header p {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--portal-gray-300);
  margin-top: 6px;
  letter-spacing: 0.3px;
}

/* --- Auth Card Body --- */
.auth-card__body {
  padding: 32px;
}

/* --- Auth Back Link --- */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--portal-gray-500);
  margin-bottom: 20px;
  transition: color var(--portal-transition);
}

.auth-back:hover {
  color: var(--portal-red);
}

.auth-back svg,
.auth-back i {
  font-size: 12px;
}

/* --- Auth Tabs (Client / Admin toggle) --- */
.auth-tabs {
  display: flex;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--portal-gray-100);
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  font-family: 'Teko', sans-serif;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  color: var(--portal-gray-500);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all var(--portal-transition);
  margin-bottom: -2px;
}

.auth-tab:hover {
  color: var(--portal-gray-800);
}

.auth-tab.is-active {
  color: var(--portal-navy);
  border-bottom-color: var(--portal-red);
}

/* --- Auth Form Elements --- */
.auth-form__group {
  margin-bottom: 20px;
}

.auth-form__label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--portal-gray-800);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.auth-input {
  display: block;
  width: 100%;
  padding: 13px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  color: var(--portal-gray-800);
  background: var(--portal-off-white);
  border: 2px solid var(--portal-gray-100);
  border-radius: var(--portal-radius);
  outline: none;
  transition: all var(--portal-transition);
  -webkit-appearance: none;
}

.auth-input::placeholder {
  color: var(--portal-gray-300);
}

.auth-input:focus {
  border-color: var(--portal-red);
  background: var(--portal-white);
  box-shadow: 0 0 0 4px var(--portal-red-subtle);
}

.auth-input:hover:not(:focus) {
  border-color: var(--portal-gray-300);
}

/* --- Auth Button --- */
.auth-btn {
  display: block;
  width: 100%;
  padding: 15px 24px;
  font-family: 'Teko', sans-serif;
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--portal-white);
  background: var(--portal-red);
  border: 2px solid var(--portal-red);
  border-radius: var(--portal-radius);
  cursor: pointer;
  transition: all var(--portal-transition);
  line-height: 1;
  box-shadow: 0 4px 16px var(--portal-red-glow);
  margin-top: 8px;
}

.auth-btn:hover {
  background: var(--portal-red-dark);
  border-color: var(--portal-red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--portal-red-glow);
}

.auth-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--portal-red-glow);
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Auth Links --- */
.auth-link {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-red);
  transition: color var(--portal-transition);
}

.auth-link:hover {
  color: var(--portal-red-dark);
}
.auth-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  text-align: center;
}
.auth-link--back {
  display: block;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--portal-gray-100);
  font-size: 13px;
  color: var(--portal-gray-300) !important;
  text-align: center;
}
.auth-link--back:hover {
  color: var(--portal-red) !important;
}

.auth-form__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: 14px;
}

.auth-form__footer-center {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

/* --- Auth Messages --- */
.auth-error {
  padding: 12px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-white);
  background: var(--portal-red);
  border-radius: var(--portal-radius);
  margin-bottom: 20px;
  line-height: 1.5;
  animation: authMsgIn 0.3s var(--portal-ease) both;
}

.auth-success {
  padding: 12px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-white);
  background: var(--portal-green);
  border-radius: var(--portal-radius);
  margin-bottom: 20px;
  line-height: 1.5;
  animation: authMsgIn 0.3s var(--portal-ease) both;
}

@keyframes authMsgIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Auth Divider --- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: var(--portal-gray-300);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--portal-gray-100);
}


/* ============================================
   2. PORTAL LAYOUT
   ============================================ */

.portal {
  display: flex;
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  background: var(--portal-off-white);
}

/* --- Sidebar --- */
.portal__sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--portal-sidebar-w);
  height: 100vh;
  background: var(--portal-navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--portal-transition);

  /* Custom scrollbar for sidebar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.portal__sidebar::-webkit-scrollbar {
  width: 4px;
}

.portal__sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.portal__sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.portal__sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Sidebar Header --- */
.portal__sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
}

.portal__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.portal__logo img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
}

.portal__logo span {
  font-family: 'Teko', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--portal-white);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1;
}

.portal__logo-client {
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.5px;
}

.portal__version {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 0.5px;
}

/* --- Sidebar Close (mobile only) --- */
/* --- Sidebar toggle pill --- */
.portal__sidebar-pill {
  position: fixed;
  left: var(--portal-sidebar-w);
  top: 16px;
  z-index: 101;
  width: 20px;
  height: 40px;
  background: var(--portal-navy);
  border: none;
  border-radius: 0 8px 8px 0;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: left var(--portal-transition), background 0.2s, color 0.2s;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.portal__sidebar-pill:hover {
  background: #1a2340;
  color: #fff;
}

.portal__sidebar-pill {
  animation: pillPulse 2s ease-in-out 6;
}

@keyframes pillPulse {
  0%, 100% { box-shadow: 2px 0 8px rgba(0,0,0,0.15); }
  50% { box-shadow: 2px 0 24px rgba(211,47,47,0.7); background: #d32f2f; }
}

.portal__sidebar-pill svg {
  transition: transform var(--portal-transition);
}

/* When collapsed, pill moves to left edge and arrow flips */
.portal__sidebar.is-collapsed ~ .portal__sidebar-pill {
  left: 0;
}

.portal__sidebar.is-collapsed ~ .portal__sidebar-pill svg {
  transform: rotate(180deg);
}

/* --- Sidebar Footer --- */
.portal__sidebar-footer {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  text-align: center;
}

/* --- Logout Button --- */
.portal__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-red);
  background: transparent;
  border: 1.5px solid rgba(211, 47, 47, 0.4);
  border-radius: var(--portal-radius);
  cursor: pointer;
  transition: all var(--portal-transition);
  line-height: 1;
}

.portal__logout:hover {
  color: var(--portal-white);
  background: var(--portal-red);
  border-color: var(--portal-red);
  box-shadow: 0 4px 16px var(--portal-red-glow);
}

.portal__logout:active {
  transform: scale(0.98);
}

.portal__logout-top {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--portal-gray-500);
  background: none;
  border: 1px solid var(--portal-gray-100);
  padding: 6px 16px;
  border-radius: var(--portal-radius);
  cursor: pointer;
  transition: all var(--portal-transition);
}
.portal__logout-top:hover {
  color: var(--portal-red);
  border-color: var(--portal-red);
}

.portal__topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  position: relative;
}

@media (max-width: 768px) {
  .portal__topbar-right {
    justify-content: flex-end;
    gap: 10px;
  }
}

/* Notification bell */
.portal__bell {
  position: relative;
  background: none;
  border: none;
  color: var(--portal-gray-500);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}
.portal__bell:hover { color: var(--portal-gray-800); background: var(--portal-off-white); }
.portal__bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #d32f2f;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* Notification panel */
.portal__notif-panel {
  display: none;
  position: fixed;
  top: 56px;
  right: 16px;
  width: 340px;
  max-height: 400px;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 1000;
  overflow: hidden;
}
.portal__notif-panel.is-open { display: block; }
.portal__notif-header {
  padding: 12px 16px;
  background: #0d1321;
  color: #fff;
  font-family: 'Teko', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.portal__notif-list {
  max-height: 340px;
  overflow-y: auto;
}
.portal__notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f4f5f7;
  cursor: pointer;
  transition: background 0.15s;
}
.portal__notif-item:hover { background: #f9fafb; }
.portal__notif-item:last-child { border: none; }
.portal__notif-item--unread { background: rgba(211,47,47,0.03); border-left: 3px solid #d32f2f; }
.portal__notif-item__title { font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600; color: #0d1321; }
.portal__notif-item__detail { font-family: 'Outfit', sans-serif; font-size: 11px; color: #6b7280; margin-top: 2px; }
.portal__notif-item__time { font-family: 'Courier New', monospace; font-size: 10px; color: #b0b3b8; margin-top: 4px; }

@media (max-width: 768px) {
  .portal__notif-panel { width: calc(100vw - 24px); right: 12px; left: 12px; top: 46px; max-height: 60vh; }
}

/* --- Main Area --- */
.portal__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--portal-sidebar-w);
  min-height: 100vh;
  background: var(--portal-off-white);
}

/* --- Top Bar --- */
.portal__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--portal-white);
  border-bottom: 1px solid var(--portal-gray-100);
  flex-shrink: 0;
}

.portal__topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal__topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal__user-name {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-gray-800);
}

.portal__user-role {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--portal-red);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--portal-red-subtle);
  padding: 3px 10px;
  border-radius: 20px;
}

/* --- Burger Button (mobile) --- */
/* burger removed — using sidebar pill toggle */

/* --- Content Area --- */
.portal__content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* --- Portal Footer --- */
.portal__footer {
  padding: 14px 32px;
  background: var(--portal-navy);
  text-align: center;
  flex-shrink: 0;
}

.portal__footer p {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.3px;
}

.portal__footer a {
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--portal-transition);
}

.portal__footer a:hover {
  color: var(--portal-red);
}

/* --- Sidebar Overlay (mobile) --- */
.portal__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--portal-transition);
}

.portal__overlay.is-visible {
  display: block;
  opacity: 1;
}


/* ============================================
   3. SIDEBAR TREE NAVIGATION
   ============================================ */

.sidebar-tree {
  padding: 12px 0;
  flex: 1;
}

.sidebar-tree__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-tree__item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-tree__item:last-child {
  border-bottom: none;
}

/* --- Navigation Link --- */
.sidebar-tree__link {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all var(--portal-transition);
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-tree__link:hover {
  color: var(--portal-white);
  border-left-color: var(--portal-red);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tree__link.is-active {
  color: var(--portal-white);
  border-left-color: var(--portal-red);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 500;
}

/* Subtle active indicator dot */
.sidebar-tree__link.is-active::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--portal-red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--portal-red-glow);
}

/* --- Navigation Icon --- */
.sidebar-tree__icon {
  width: 24px;
  text-align: center;
  margin-right: 10px;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-tree__link:hover .sidebar-tree__icon,
.sidebar-tree__link.is-active .sidebar-tree__icon {
  opacity: 1;
}

/* --- Section Label --- */
.sidebar-tree__section {
  padding: 24px 20px 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
}

/* --- Parent / Toggle (expandable items) --- */
.sidebar-tree__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all var(--portal-transition);
  text-align: left;
}

.sidebar-tree__toggle:hover {
  color: var(--portal-white);
  border-left-color: var(--portal-red);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tree__toggle-left {
  display: flex;
  align-items: center;
}

/* --- Arrow --- */
.sidebar-tree__arrow {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  transition: transform var(--portal-transition);
  flex-shrink: 0;
}

.sidebar-tree__parent.is-expanded .sidebar-tree__arrow {
  transform: rotate(180deg);
}

.sidebar-tree__parent.is-expanded .sidebar-tree__toggle {
  color: var(--portal-white);
}

/* --- Submenu --- */
.sidebar-tree__sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--portal-ease);
  padding-left: 20px;
  background: rgba(0, 0, 0, 0.12);
}

.sidebar-tree__parent.is-expanded .sidebar-tree__sub {
  max-height: 300px;
}

.sidebar-tree__sub a {
  display: block;
  padding: 10px 20px 10px 44px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: all var(--portal-transition);
  position: relative;
}

.sidebar-tree__sub a::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background var(--portal-transition);
}

.sidebar-tree__sub a:hover {
  color: rgba(255, 255, 255, 0.85);
}

.sidebar-tree__sub a:hover::before {
  background: rgba(255, 255, 255, 0.5);
}

.sidebar-tree__sub a.is-active {
  color: var(--portal-red);
  font-weight: 500;
}

.sidebar-tree__sub a.is-active::before {
  background: var(--portal-red);
  box-shadow: 0 0 6px var(--portal-red-glow);
}


/* ============================================
   4. PORTAL PAGE CONTENT
   ============================================ */

/* --- Page Header --- */
.portal-page__header {
  margin-bottom: 32px;
}

.portal-page__title {
  font-family: 'Teko', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--portal-navy);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.1;
  margin: 0;
}

.portal-page__sub {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--portal-gray-500);
  margin-top: 6px;
  line-height: 1.5;
}

/* --- Dashboard Cards Grid --- */
.portal-page__cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 24px;
}

/* --- Stat Card --- */
.portal-card {
  background: var(--portal-white);
  border-radius: var(--portal-radius-lg);
  padding: 24px;
  border: 1px solid var(--portal-gray-100);
  transition: all var(--portal-transition);
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--portal-gray-100);
  transition: background var(--portal-transition);
}

.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--portal-shadow-card-hover);
  border-color: transparent;
}

.portal-card:hover::before {
  background: var(--portal-red);
}

.portal-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--portal-gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.portal-card__value {
  font-family: 'Teko', sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--portal-navy);
  margin-top: 8px;
  line-height: 1;
}

.portal-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  margin-top: 12px;
  padding: 3px 8px;
  border-radius: 20px;
}

.portal-card__trend--up {
  color: var(--portal-green);
  background: var(--portal-green-bg);
}

.portal-card__trend--down {
  color: var(--portal-red);
  background: var(--portal-red-subtle);
}

.portal-card__icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--portal-off-white);
  border-radius: 10px;
  font-size: 18px;
  color: var(--portal-gray-500);
  transition: all var(--portal-transition);
}

.portal-card:hover .portal-card__icon {
  background: var(--portal-red-subtle);
  color: var(--portal-red);
}

/* --- Content Panels --- */
.portal-panel {
  background: var(--portal-white);
  border-radius: var(--portal-radius-lg);
  border: 1px solid var(--portal-gray-100);
  margin-top: 24px;
  overflow: hidden;
}

.portal-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--portal-gray-100);
}

.portal-panel__title {
  font-family: 'Teko', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--portal-navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.portal-panel__body {
  padding: 24px;
}

/* --- Tables --- */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
}

.portal-table thead {
  background: var(--portal-off-white);
}

.portal-table th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  color: var(--portal-gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: left;
  border-bottom: 2px solid var(--portal-gray-100);
}

.portal-table td {
  padding: 14px 16px;
  color: var(--portal-gray-800);
  border-bottom: 1px solid var(--portal-gray-100);
  transition: background var(--portal-transition);
}

.portal-table tbody tr:hover td {
  background: rgba(244, 245, 247, 0.5);
}

.portal-table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Status Badges --- */
.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.portal-badge--pending {
  color: #f57c00;
  background: #fff3e0;
}

.portal-badge--active {
  color: var(--portal-green);
  background: var(--portal-green-bg);
}

.portal-badge--completed {
  color: #1565c0;
  background: #e3f2fd;
}

.portal-badge--cancelled {
  color: var(--portal-red);
  background: #ffebee;
}

/* --- Portal Buttons --- */
.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--portal-radius);
  border: none;
  cursor: pointer;
  transition: all var(--portal-transition);
  line-height: 1;
}

.portal-btn--primary {
  color: var(--portal-white);
  background: var(--portal-red);
  box-shadow: 0 2px 8px var(--portal-red-glow);
}

.portal-btn--primary:hover {
  background: var(--portal-red-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--portal-red-glow);
}

.portal-btn--secondary {
  color: var(--portal-gray-800);
  background: var(--portal-white);
  border: 1px solid var(--portal-gray-100);
}

.portal-btn--secondary:hover {
  border-color: var(--portal-gray-300);
  background: var(--portal-off-white);
}

.portal-btn--sm {
  padding: 7px 14px;
  font-size: 13px;
}

/* --- Empty State --- */
.portal-empty {
  text-align: center;
  padding: 60px 24px;
}

.portal-empty__icon {
  font-size: 48px;
  color: var(--portal-gray-300);
  margin-bottom: 16px;
}

.portal-empty__title {
  font-family: 'Teko', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--portal-navy);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.portal-empty__text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-gray-500);
  max-width: 360px;
  margin: 0 auto;
}

/* --- Form Elements (portal context) --- */
.portal-form__group {
  margin-bottom: 20px;
}

.portal-form__label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--portal-gray-800);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.portal-form__input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-gray-800);
  background: var(--portal-off-white);
  border: 1.5px solid var(--portal-gray-100);
  border-radius: var(--portal-radius);
  outline: none;
  transition: all var(--portal-transition);
}

.portal-form__input:focus {
  border-color: var(--portal-red);
  background: var(--portal-white);
  box-shadow: 0 0 0 3px var(--portal-red-subtle);
}

.portal-form__input::placeholder {
  color: var(--portal-gray-300);
}

.portal-form__textarea {
  resize: vertical;
  min-height: 100px;
}

.portal-form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}


/* ============================================
   5. MOBILE RESPONSIVE
   ============================================ */

/* --- Desktop sidebar collapse --- */
.portal__sidebar.is-collapsed {
  transform: translateX(-100%);
}

.portal__main.sidebar-collapsed {
  margin-left: 0;
}

/* Prevent sidebar flash on load */
html.sidebar-start-collapsed .portal__sidebar {
  transform: translateX(-100%);
}

html.sidebar-start-collapsed .portal__main {
  margin-left: 0;
}

html.sidebar-start-collapsed .portal__sidebar-pill {
  left: 0;
}

/* --- Tablet (768px) --- */
@media (max-width: 768px) {

  /* Prevent horizontal scroll on body */
  html, body {
    overflow-x: hidden;
  }

  .portal {
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Sidebar overlay when open on mobile */
  .portal__sidebar {
    z-index: 200;
  }

  .portal__sidebar:not(.is-collapsed) {
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.4);
  }

  /* Main area always full width */
  .portal__main {
    margin-left: 0 !important;
    min-height: auto;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Pill toggle on mobile */
  .portal__sidebar-pill {
    z-index: 201;
  }

  /* Reduce content padding */
  .portal__content {
    padding: 20px 16px;
    overflow-x: hidden;
  }

  .portal__topbar {
    padding: 14px 16px;
  }

  /* Dashboard cards: 2 columns */
  .portal-page__cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Page title size down */
  .portal-page__title {
    font-size: 26px;
  }

  /* Tables — horizontal scroll */
  .portal-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    font-size: 13px;
  }

  .portal-table th,
  .portal-table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* Panel padding */
  .portal-panel__body {
    padding: 16px;
  }

  /* Auth card adjustments */
  .auth-card {
    max-width: 100%;
    margin: 16px;
  }

  .auth-card__body {
    padding: 24px;
  }

  .auth-card__header {
    padding: 22px 24px 20px;
  }
}

/* --- Phone (480px) --- */
@media (max-width: 480px) {

  /* Dashboard cards: 1 column */
  .portal-page__cards {
    grid-template-columns: 1fr;
  }

  /* Further reduce padding */
  .portal__content {
    padding: 14px 10px;
  }

  .portal__topbar {
    padding: 10px 12px;
  }

  .portal-page__title {
    font-size: 22px;
  }

  /* Card padding reduce */
  .portal-card {
    padding: 16px;
  }

  .portal-card__value {
    font-size: 26px;
  }

  /* Tables even more compact */
  .portal-table th,
  .portal-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Auth adjustments */
  .auth-card {
    margin: 12px;
    border-radius: 12px;
  }

  .auth-card__body {
    padding: 20px;
  }

  .auth-card__header h1 {
    font-size: 24px;
  }

  .auth-btn {
    padding: 13px 20px;
    font-size: 18px;
  }

  .auth-tabs {
    margin-bottom: 24px;
  }

  .auth-tab {
    font-size: 16px;
    padding: 10px 12px;
  }

  /* Portal footer */
  .portal__footer {
    padding: 12px;
  }

  .portal__footer p {
    font-size: 11px;
  }
}


/* ============================================
   6. UTILITY & HELPER CLASSES
   ============================================ */

/* --- Spacing --- */
.portal-mt-0 { margin-top: 0; }
.portal-mt-8 { margin-top: 8px; }
.portal-mt-16 { margin-top: 16px; }
.portal-mt-24 { margin-top: 24px; }
.portal-mt-32 { margin-top: 32px; }
.portal-mb-0 { margin-bottom: 0; }
.portal-mb-16 { margin-bottom: 16px; }
.portal-mb-24 { margin-bottom: 24px; }

/* --- Text --- */
.portal-text-center { text-align: center; }
.portal-text-right { text-align: right; }
.portal-text-muted { color: var(--portal-gray-500); }
.portal-text-red { color: var(--portal-red); }
.portal-text-sm { font-size: 13px; }

/* --- Flex helpers --- */
.portal-flex { display: flex; }
.portal-flex-between { display: flex; justify-content: space-between; align-items: center; }
.portal-flex-center { display: flex; align-items: center; justify-content: center; }
.portal-gap-8 { gap: 8px; }
.portal-gap-16 { gap: 16px; }

/* --- Loading Spinner --- */
.portal-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--portal-gray-100);
  border-top-color: var(--portal-red);
  border-radius: 50%;
  animation: portalSpin 0.7s linear infinite;
}

.portal-spinner--lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

@keyframes portalSpin {
  to { transform: rotate(360deg); }
}

/* --- Loading Overlay --- */
.portal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  flex-direction: column;
  gap: 16px;
}

.portal-loading__text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--portal-gray-500);
}

/* --- Auth page loading state on button --- */
.auth-btn .portal-spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: var(--portal-white);
}

/* --- Checkbox / Toggle --- */
.portal-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.portal-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.portal-toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--portal-gray-300);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--portal-transition);
}

.portal-toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--portal-white);
  border-radius: 50%;
  transition: transform var(--portal-transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.portal-toggle input:checked + .portal-toggle__slider {
  background: var(--portal-red);
}

.portal-toggle input:checked + .portal-toggle__slider::before {
  transform: translateX(20px);
}

/* --- Notification Dot --- */
.sidebar-tree__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--portal-white);
  background: var(--portal-red);
  border-radius: 10px;
  margin-left: auto;
  box-shadow: 0 2px 6px var(--portal-red-glow);
}

/* --- Breadcrumbs --- */
.portal-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--portal-gray-500);
  margin-bottom: 16px;
}

.portal-breadcrumbs a {
  color: var(--portal-gray-500);
  transition: color var(--portal-transition);
}

.portal-breadcrumbs a:hover {
  color: var(--portal-red);
}

.portal-breadcrumbs__sep {
  font-size: 10px;
  opacity: 0.5;
}

.portal-breadcrumbs__current {
  color: var(--portal-gray-800);
  font-weight: 500;
}


/* ============================================
   7. PRINT STYLES
   ============================================ */

@media print {
  .portal__sidebar,
  .portal__topbar,
  .portal__burger,
  .portal__footer,
  .portal__overlay {
    display: none !important;
  }

  .portal__main {
    margin-left: 0 !important;
  }

  .portal__content {
    padding: 0 !important;
  }

  .portal-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
