/* ── SHARED NAV ─────────────────────────────────────────── */
/* Top bar + left sidebar layout for all authenticated pages */
/* Overrides any per-page nav styles with #shared-nav scope  */

/* ── Layout constants ───────────────────────────────────── */
:root {
  --nav-topbar-h:    52px;
  --nav-sidebar-w:   52px;   /* collapsed = icon-only */
  --nav-sidebar-ew:  220px;  /* expanded = with labels */
  --nav-subnav-h:    38px;
  --accent:          #184A9E;
}

/* Hide old inline navs immediately to prevent FOUC */
body > nav:not(#shared-nav):not(#sn-dispatch-sub) { display: none !important; }

/* ── Top bar ────────────────────────────────────────────── */
#shared-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  height: var(--nav-topbar-h);
  display: flex;
  align-items: center;
  background: rgba(10, 15, 26, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

#shared-nav *,
#shared-nav *::before,
#shared-nav *::after {
  box-sizing: border-box;
}

.sn-topbar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
}

.sn-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sn-topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sn-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* ── Logo ───────────────────────────────────────────────── */
.sn-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #f8fafc;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.sn-logo span { color: #184A9E; }

/* ── Hamburger (visible on mobile, hidden on desktop) ───── */
.sn-hamburger {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  transition: color 0.2s;
  flex-shrink: 0;
}
.sn-hamburger:hover { color: #f8fafc; }
.sn-hamburger svg { display: block; }

/* ── Left Sidebar ───────────────────────────────────────── */
#sn-sidebar {
  position: fixed;
  top: var(--nav-topbar-h);
  left: 0;
  bottom: 0;
  width: var(--nav-sidebar-w);
  z-index: 8990;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 26, 0.97);
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.4,0,0.2,1);
  font-family: 'Poppins', sans-serif;
}

/* Hover-expand (only when not pinned) */
#sn-sidebar:not(.pinned):hover,
#sn-sidebar.expanded {
  width: var(--nav-sidebar-ew);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}

/* Pinned = always expanded */
#sn-sidebar.pinned {
  width: var(--nav-sidebar-ew);
}

/* Scrollable area */
.sn-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}
.sn-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sn-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sn-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Sidebar groups ──────────────────────────────────────── */
.sn-sidebar-group {
  margin-bottom: 0.25rem;
}

.sn-sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  min-height: 32px;
}
.sn-sidebar-group-header:hover { color: #94a3b8; }

.sn-sidebar-group-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1;
  /* Icon always visible even when collapsed */
}

.sn-sidebar-group-label {
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
}

.sn-sidebar-group-caret {
  font-size: 0.55rem;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}

/* Show labels when sidebar is expanded */
#sn-sidebar:not(.pinned):hover .sn-sidebar-group-label,
#sn-sidebar.expanded .sn-sidebar-group-label,
#sn-sidebar.pinned .sn-sidebar-group-label {
  opacity: 1;
}
#sn-sidebar:not(.pinned):hover .sn-sidebar-group-caret,
#sn-sidebar.expanded .sn-sidebar-group-caret,
#sn-sidebar.pinned .sn-sidebar-group-caret {
  opacity: 0.7;
}

/* Collapsed group = items hidden */
.sn-sidebar-group.sn-group-collapsed .sn-sidebar-group-items {
  display: none;
}
.sn-sidebar-group.sn-group-collapsed .sn-sidebar-group-caret {
  transform: rotate(-90deg);
}

/* ── Groups without a header (exec-top) ─────────────────── */
.sn-sidebar-group:not(:has(.sn-sidebar-group-header)) .sn-sidebar-group-items,
.sn-sidebar-group .sn-sidebar-group-items:first-child {
  /* Exec-top group has no header - just items */
}

/* ── Sidebar items ───────────────────────────────────────── */
.sn-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.42rem 0.75rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  min-height: 36px;
}
.sn-sidebar-item:hover { color: #f8fafc; background: rgba(255,255,255,0.04); }
.sn-sidebar-item.active {
  color: #4a90d9;
  background: rgba(24, 74, 158, 0.12);
  font-weight: 600;
}
/* Active indicator bar on left edge */
.sn-sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: #4a90d9;
  border-radius: 0 2px 2px 0;
}

.sn-sidebar-item-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  /* Always visible */
}

.sn-sidebar-item-label {
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Show labels on expand */
#sn-sidebar:not(.pinned):hover .sn-sidebar-item-label,
#sn-sidebar.expanded .sn-sidebar-item-label,
#sn-sidebar.pinned .sn-sidebar-item-label {
  opacity: 1;
}

/* ── Badge on sidebar items ─────────────────────────────── */
.sn-sidebar-item .sn-badge {
  position: absolute;
  top: 6px;
  left: 28px;  /* Offset from icon */
  font-size: 8px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  padding: 0 3px;
  background: #ef4444;
  color: #fff;
  font-weight: 700;
  text-align: center;
  border-radius: 7px;
  display: none;
}
.sn-sidebar-item .sn-badge.visible { display: block; }

/* ── Bottom-anchored group (User/Admin) ─────────────────── */
.sn-sidebar-group-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 0.25rem;
}

/* ── Sidebar footer (pin + surface toggle) ──────────────── */
.sn-sidebar-footer {
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sn-sidebar-pin {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.42rem 0.75rem;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  min-height: 36px;
}
.sn-sidebar-pin:hover { color: #94a3b8; background: rgba(255,255,255,0.04); }

.sn-sidebar-pin-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sn-sidebar-pin-label {
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  font-size: 0.78rem;
}

#sn-sidebar:not(.pinned):hover .sn-sidebar-pin-label,
#sn-sidebar.expanded .sn-sidebar-pin-label,
#sn-sidebar.pinned .sn-sidebar-pin-label {
  opacity: 1;
}

/* ── Surface toggle in sidebar footer ───────────────────── */
.sn-sidebar-surface-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.42rem 0.75rem;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  min-height: 36px;
  border-radius: 0;
}
.sn-sidebar-surface-toggle:hover { color: #94a3b8; background: rgba(255,255,255,0.04); }
.sn-sidebar-surface-toggle .sn-sidebar-item-icon {
  width: 24px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sn-sidebar-surface-toggle .sn-sidebar-item-label {
  opacity: 0;
  transition: opacity 0.15s;
}
#sn-sidebar:not(.pinned):hover .sn-sidebar-surface-toggle .sn-sidebar-item-label,
#sn-sidebar.expanded .sn-sidebar-surface-toggle .sn-sidebar-item-label,
#sn-sidebar.pinned .sn-sidebar-surface-toggle .sn-sidebar-item-label {
  opacity: 1;
}

/* ── Dispatch sub-nav (positioned below topbar) ─────────── */
#sn-dispatch-sub {
  position: fixed !important;
  top: var(--nav-topbar-h);
  left: var(--nav-sidebar-w);
  right: 0;
  z-index: 8989;
  height: var(--nav-subnav-h);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: rgba(10, 15, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: 'Poppins', sans-serif;
  transition: left 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* When sidebar is pinned, push subnav right */
body.sn-sidebar-pinned #sn-dispatch-sub {
  left: var(--nav-sidebar-ew);
}

.sn-sub-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.sn-sub-inner::-webkit-scrollbar { display: none; }

.sn-sub-link {
  font-size: 0.72rem;
  color: #94a3b8;
  text-decoration: none;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.sn-sub-link:hover { color: #f8fafc; background: rgba(255,255,255,0.05); }
.sn-sub-link.active { color: #184A9E; font-weight: 600; background: rgba(24, 74, 158, 0.1); }

/* ── Body layout: offset for topbar + sidebar ───────────── */
/* Always add topbar padding */
body.sn-has-topbar {
  padding-top: var(--nav-topbar-h) !important;
}

/* Sidebar collapsed: small left offset */
body.sn-sidebar-collapsed {
  padding-left: var(--nav-sidebar-w) !important;
}

/* Sidebar pinned: full expanded offset */
body.sn-sidebar-pinned {
  padding-left: var(--nav-sidebar-ew) !important;
}

/* No sidebar (customer/carrier/warehouse): just topbar */
body.sn-has-topbar:not(.sn-sidebar-collapsed):not(.sn-sidebar-pinned) {
  padding-left: 0 !important;
}

/* With dispatch subnav: add subnav height */
body.sn-has-subnav {
  padding-top: calc(var(--nav-topbar-h) + var(--nav-subnav-h)) !important;
}

/* ── Search bar ─────────────────────────────────────────── */
.sn-search-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.3rem 0.8rem;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  min-width: 140px;
  max-width: 280px;
  width: 100%;
}
.sn-search-btn:hover {
  background: rgba(255,255,255,0.09);
  color: #94a3b8;
  border-color: rgba(255,255,255,0.18);
}
.sn-search-btn svg { flex-shrink: 0; color: #475569; }
.sn-search-label { flex: 1; text-align: left; }
.sn-search-kbd {
  font-size: 0.65rem;
  color: #374151;
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  font-family: 'Poppins', sans-serif;
}

/* ── Badge (general) ────────────────────────────────────── */
.sn-badge {
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  display: none;
}
.sn-badge.visible { display: block; }

/* ── Notification bell ──────────────────────────────────── */
.sn-notif-wrap { position: relative; }

.sn-notif-btn {
  position: relative;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 8px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  font-family: 'Poppins', sans-serif;
}
.sn-notif-btn:hover { background: rgba(255,255,255,0.1); color: #f8fafc; }

.sn-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  padding: 0 3px;
  display: none;
}
.sn-notif-badge.visible { display: block; }

.sn-notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9100;
  overflow: hidden;
}
.sn-notif-dropdown.open { display: block; }

.sn-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
}
.sn-notif-mark-all {
  background: none;
  border: none;
  color: #184A9E;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}
.sn-notif-mark-all:hover { text-decoration: underline; }
.sn-notif-list { max-height: 300px; overflow-y: auto; }
.sn-notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.78rem;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s;
}
.sn-notif-item:hover { background: rgba(255,255,255,0.03); }
.sn-notif-item.unread { color: #e2e8f0; background: rgba(24, 74, 158, 0.06); }
.sn-notif-item .sn-notif-time { font-size: 0.68rem; color: #64748b; margin-top: 2px; }
.sn-notif-empty { padding: 20px 14px; text-align: center; font-size: 0.78rem; color: #64748b; }
.sn-notif-footer {
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}
.sn-notif-footer a { font-size: 0.72rem; color: #184A9E; text-decoration: none; }
.sn-notif-footer a:hover { text-decoration: underline; }

/* ── User button + dropdown ─────────────────────────────── */
.sn-user-wrap { position: relative; }

.sn-user-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.28rem 0.6rem;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
}
.sn-user-btn:hover { background: rgba(255,255,255,0.1); color: #f8fafc; }
.sn-user-btn.open  { background: rgba(255,255,255,0.1); color: #f8fafc; }

.sn-user-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(24, 74, 158, 0.3);
  border: 1px solid rgba(24, 74, 158, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  flex-shrink: 0;
}

.sn-role-badge {
  font-size: 0.58rem;
  padding: 0.1rem 0.32rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  flex-shrink: 0;
}
.sn-role-badge.role-admin        { background: rgba(234,179,8,0.2);  color: #fbbf24; }
.sn-role-badge.role-broker_agent { background: rgba(59,130,246,0.2); color: #60a5fa; }
.sn-role-badge.role-carrier      { background: rgba(16,185,129,0.2); color: #34d399; }
.sn-role-badge.role-customer     { background: rgba(168,85,247,0.2); color: #a78bfa; }

.sn-chevron {
  font-size: 0.6rem;
  transition: transform 0.2s;
  color: #64748b;
}
.sn-user-btn.open .sn-chevron { transform: rotate(180deg); }

.sn-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 6px;
  min-width: 210px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9100;
}
.sn-user-dropdown.open { display: block; }

/* ── Dropdown items ─────────────────────────────────────── */
.sn-item,
.sn-dd-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.48rem 0.7rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.79rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: 'Poppins', sans-serif;
}
.sn-item:hover,
.sn-dd-item:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }
.sn-item.active,
.sn-dd-item.active { color: #184A9E; background: rgba(24,74,158,0.08); }
.sn-item.danger,
.sn-dd-item.danger { color: #ef4444; }
.sn-item.danger:hover,
.sn-dd-item.danger:hover { background: rgba(239,68,68,0.1); }

.sn-item-section-label,
.sn-dd-section-label {
  padding: 6px 10px 4px;
  font-size: 0.63rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.sn-item-divider,
.sn-dd-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0;
}

/* ── Theme toggle (inside user dropdown) ────────────────── */
.sn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.48rem 0.7rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.79rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: 'Poppins', sans-serif;
  gap: 0.5rem;
}
.sn-theme-toggle:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }

.sn-theme-toggle-track {
  width: 28px;
  height: 15px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.sn-theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: #64748b;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
[data-theme="light"] .sn-theme-toggle-track { background: rgba(24,74,158,0.4); }
[data-theme="light"] .sn-theme-toggle-thumb { transform: translateX(13px); background: #184A9E; }

/* ── Brand switcher ─────────────────────────────────────── */
.sn-brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sn-brand-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
  cursor: pointer;
  max-width: 140px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.sn-brand-select:hover,
.sn-brand-select:focus {
  border-color: rgba(99,102,241,0.5);
  background: rgba(255,255,255,0.1);
  color: #f1f5f9;
}
[data-theme="light"] .sn-brand-select {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.15);
  color: #374151;
}
[data-theme="light"] .sn-brand-select:hover,
[data-theme="light"] .sn-brand-select:focus {
  background: rgba(0,0,0,0.1);
  border-color: #6366f1;
  color: #111827;
}

/* ── Change Password Modal ──────────────────────────────── */
.sn-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: 'Poppins', sans-serif;
}
.sn-modal-overlay.open { display: flex; }

.sn-modal {
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.sn-modal h3 { color: #f8fafc; margin-bottom: 20px; font-size: 1.1rem; }
.sn-modal-field { margin-bottom: 16px; }
.sn-modal-field label { display: block; font-size: 0.8rem; color: #94a3b8; margin-bottom: 6px; }
.sn-modal-field input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  transition: border-color 0.2s;
}
.sn-modal-field input:focus { outline: none; border-color: #184A9E; }
.sn-modal-msg { font-size: 0.82rem; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; display: none; }
.sn-modal-msg.error   { background: rgba(239,68,68,0.1); color: #f87171; display: block; }
.sn-modal-msg.success { background: rgba(16,185,129,0.1); color: #34d399; display: block; }
.sn-modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.sn-modal-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
}
.sn-modal-btn.primary   { background: #184A9E; color: #fff; }
.sn-modal-btn.primary:hover { background: #1a5ac8; }
.sn-modal-btn.secondary { background: rgba(255,255,255,0.06); color: #94a3b8; }
.sn-modal-btn.secondary:hover { background: rgba(255,255,255,0.1); color: #f8fafc; }

/* ── Mobile menu overlay ──────────────────────────────────── */
.sn-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 26, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 8998;
  padding: 1rem;
  overflow-y: auto;
  font-family: 'Poppins', sans-serif;
}
.sn-mobile-menu.open { display: block; }

.sn-mobile-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}
.sn-mobile-link:hover { color: #f8fafc; background: rgba(255,255,255,0.05); }
.sn-mobile-link.active { color: #184A9E; font-weight: 600; background: rgba(24, 74, 158, 0.1); }

.sn-mobile-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0.5rem 0;
}

.sn-mobile-section-label {
  font-size: 0.68rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 0.75rem 1rem 0.25rem;
}

/* Surface toggle in mobile menu */
.sn-surface-toggle-mobile {
  width: 100%;
  text-align: left;
  background: rgba(24,74,158,0.1);
  border: 1px solid rgba(24,74,158,0.2);
  border-radius: 8px;
  color: #60a5fa;
  font-weight: 600;
  margin-top: 0.25rem;
}
.sn-surface-toggle-mobile:hover { background: rgba(24,74,158,0.18); }

/* ── Dispatch sub-nav scroll indicator ────────────────────── */
#sn-dispatch-sub::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, rgba(10, 15, 26, 0.88));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}
#sn-dispatch-sub.scrolled-end::after { opacity: 0; }

/* ── Global select/option contrast fix ──────────────────── */
select option {
  background: #1a2332;
  color: #e2e8f0;
}

/* ── Mobile bottom-tab nav ───────────────────────────────── */
.sn-bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(13,17,23,0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.25rem 0 max(0.25rem, env(safe-area-inset-bottom));
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}
[data-theme="light"] .sn-bottom-tabs {
  background: rgba(248,250,252,0.97);
  border-top-color: rgba(0,0,0,0.1);
}

.sn-btab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.375rem 0.5rem;
  text-decoration: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: 8px;
  min-width: 52px;
  transition: color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
}
.sn-btab.active { color: #60a5fa; }
.sn-btab:hover  { color: rgba(255,255,255,0.75); }
.sn-btab-icon   { font-size: 1.25rem; line-height: 1; }
.sn-btab-label  { line-height: 1; }
[data-theme="light"] .sn-btab { color: #94a3b8; }
[data-theme="light"] .sn-btab.active { color: #0969da; }
[data-theme="light"] .sn-btab:hover { color: #475569; }

/* ── Light theme overrides ─────────────────────────────── */
[data-theme="light"] #shared-nav {
  background: rgba(248,250,252,0.96);
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .sn-logo          { color: #0f172a; }
[data-theme="light"] .sn-logo span     { color: #184A9E; }
[data-theme="light"] .sn-search-btn    { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #64748b; }
[data-theme="light"] .sn-search-btn:hover { background: rgba(0,0,0,0.08); color: #334155; }
[data-theme="light"] .sn-search-kbd    { color: #94a3b8; border-color: rgba(0,0,0,0.12); background: transparent; }
[data-theme="light"] .sn-notif-btn     { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: #64748b; }
[data-theme="light"] .sn-notif-btn:hover { background: rgba(0,0,0,0.08); color: #334155; }
[data-theme="light"] .sn-user-btn      { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #64748b; }
[data-theme="light"] .sn-user-btn:hover { background: rgba(0,0,0,0.08); color: #334155; }
[data-theme="light"] .sn-user-btn.open  { background: rgba(0,0,0,0.08); color: #334155; }
[data-theme="light"] .sn-user-dropdown,
[data-theme="light"] .sn-notif-dropdown { background: #ffffff; border-color: rgba(0,0,0,0.1); box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
[data-theme="light"] .sn-item,
[data-theme="light"] .sn-dd-item        { color: #475569; }
[data-theme="light"] .sn-item:hover,
[data-theme="light"] .sn-dd-item:hover  { background: rgba(0,0,0,0.05); color: #0f172a; }
[data-theme="light"] .sn-item-section-label,
[data-theme="light"] .sn-dd-section-label { color: #94a3b8; }
[data-theme="light"] .sn-item-divider,
[data-theme="light"] .sn-dd-divider     { background: rgba(0,0,0,0.08); }
[data-theme="light"] .sn-notif-header   { color: #0f172a; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .sn-notif-item     { color: #475569; border-color: rgba(0,0,0,0.04); }
[data-theme="light"] .sn-notif-item.unread { color: #0f172a; background: rgba(24,74,158,0.06); }
[data-theme="light"] .sn-notif-footer   { border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .sn-hamburger      { color: #64748b; }
[data-theme="light"] #sn-dispatch-sub   { background: rgba(241,245,249,0.96); border-color: rgba(0,0,0,0.07); }
[data-theme="light"] .sn-sub-link       { color: #64748b; }
[data-theme="light"] .sn-sub-link:hover { color: #0f172a; background: rgba(0,0,0,0.05); }
[data-theme="light"] .sn-sub-link.active { color: #184A9E; background: rgba(24,74,158,0.08); }
[data-theme="light"] #sn-dispatch-sub::after { background: linear-gradient(to right, transparent, rgba(241,245,249,0.96)); }
[data-theme="light"] .sn-mobile-menu    { background: rgba(248,250,252,0.99); }
[data-theme="light"] .sn-mobile-link    { color: #475569; }
[data-theme="light"] .sn-mobile-link:hover { color: #0f172a; background: rgba(0,0,0,0.04); }
[data-theme="light"] .sn-mobile-link.active { color: #184A9E; }
[data-theme="light"] .sn-mobile-section-label { color: #94a3b8; }
[data-theme="light"] .sn-theme-toggle   { color: #475569; }
[data-theme="light"] .sn-theme-toggle:hover { background: rgba(0,0,0,0.05); color: #0f172a; }
[data-theme="light"] select option      { background: #ffffff; color: #0f172a; }

/* Sidebar light theme */
[data-theme="light"] #sn-sidebar {
  background: rgba(248, 250, 252, 0.98);
  border-right-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .sn-sidebar-group-header { color: #94a3b8; }
[data-theme="light"] .sn-sidebar-group-header:hover { color: #64748b; }
[data-theme="light"] .sn-sidebar-item { color: #64748b; }
[data-theme="light"] .sn-sidebar-item:hover { color: #0f172a; background: rgba(0,0,0,0.04); }
[data-theme="light"] .sn-sidebar-item.active { color: #184A9E; background: rgba(24,74,158,0.08); }
[data-theme="light"] .sn-sidebar-item.active::before { background: #184A9E; }
[data-theme="light"] .sn-sidebar-pin { color: #94a3b8; }
[data-theme="light"] .sn-sidebar-pin:hover { color: #64748b; background: rgba(0,0,0,0.04); }
[data-theme="light"] .sn-sidebar-footer { border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .sn-sidebar-group-bottom { border-top-color: rgba(0,0,0,0.06); }
[data-theme="light"] .sn-sidebar-surface-toggle { color: #94a3b8; }
[data-theme="light"] .sn-sidebar-surface-toggle:hover { color: #64748b; background: rgba(0,0,0,0.04); }
[data-theme="light"] .sn-surface-toggle-mobile {
  background: rgba(9,105,218,0.08);
  border-color: rgba(9,105,218,0.2);
  color: #0969da;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* On tablets/mobile: hide sidebar, show hamburger */
  #sn-sidebar { display: none; }
  .sn-hamburger { display: flex !important; }

  /* Remove sidebar-based padding on smaller screens */
  body.sn-sidebar-collapsed,
  body.sn-sidebar-pinned {
    padding-left: 0 !important;
  }

  /* Dispatch subnav goes full width on mobile */
  #sn-dispatch-sub {
    left: 0 !important;
  }

  .sn-topbar-inner { padding: 0 0.75rem; }
  .sn-search-btn { min-width: 36px; }
  .sn-search-label { display: none; }
  .sn-user-icon  { display: none; }
  .sn-user-name  { display: none; }
  .sn-role-badge { display: none; }
  .sn-user-btn   { padding: 0.25rem 0.5rem; }
  .sn-notif-dropdown { width: 280px; right: -40px; }
}

@media (max-width: 768px) {
  .sn-bottom-tabs { display: flex; }
  body.sn-has-topbar,
  body.sn-has-subnav { padding-bottom: 68px; }
  .sn-logo { font-size: 0.95rem; }
  .sn-right { gap: 0.4rem; }
}

@media (max-width: 480px) {
  .sn-user-dropdown { min-width: 180px; }
  #sn-dispatch-sub { padding: 0 0.75rem; }
  .sn-sub-link { font-size: 0.68rem; padding: 0.2rem 0.4rem; }
}

/* Backward compat: old body classes still work */
body.sn-has-nav    { padding-top: var(--nav-topbar-h) !important; }
body.sn-has-subnav { padding-top: calc(var(--nav-topbar-h) + var(--nav-subnav-h)) !important; }
