/* tersOS Layout — Sidebar, Header, Main Content, Mobile */

/* ========================================
   Sidebar Navigation
   ======================================== */
.tersos-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--sidebar-transition, width 0.2s ease);
}

/* Collapsed sidebar — supports both .collapsed on sidebar and .sidebar-collapsed on body */
.tersos-sidebar.collapsed,
.sidebar-collapsed .tersos-sidebar {
  width: 64px;
}

.tersos-sidebar.collapsed .nav-item span,
.sidebar-collapsed .tersos-sidebar .nav-item span,
.tersos-sidebar.collapsed .nav-section-title,
.sidebar-collapsed .tersos-sidebar .nav-section-title,
.tersos-sidebar.collapsed .sidebar-logo,
.sidebar-collapsed .tersos-sidebar .sidebar-logo,
.tersos-sidebar.collapsed .nav-count,
.sidebar-collapsed .tersos-sidebar .nav-count,
.tersos-sidebar.collapsed .billing-nav-count,
.sidebar-collapsed .tersos-sidebar .billing-nav-count,
.tersos-sidebar.collapsed .billing-nav-count-alt,
.sidebar-collapsed .tersos-sidebar .billing-nav-count-alt,
.tersos-sidebar.collapsed .sidebar-collapse-label,
.sidebar-collapsed .tersos-sidebar .sidebar-collapse-label,
.tersos-sidebar.collapsed .sidebar-search,
.sidebar-collapsed .tersos-sidebar .sidebar-search,
.tersos-sidebar.collapsed .sidebar-footer,
.sidebar-collapsed .tersos-sidebar .sidebar-footer,
.tersos-sidebar.collapsed .nav-count-badge,
.sidebar-collapsed .tersos-sidebar .nav-count-badge {
  display: none;
}

.tersos-sidebar.collapsed .nav-item,
.sidebar-collapsed .tersos-sidebar .nav-item {
  justify-content: center;
  padding: 10px;
  overflow: hidden;
}

.tersos-sidebar.collapsed .nav-icon,
.sidebar-collapsed .tersos-sidebar .nav-icon {
  margin: 0;
}

.tersos-sidebar.collapsed .sidebar-header,
.sidebar-collapsed .tersos-sidebar .sidebar-header {
  justify-content: center !important;
  padding: var(--space-3);
}

.tersos-sidebar.collapsed .sidebar-nav,
.sidebar-collapsed .tersos-sidebar .sidebar-nav {
  overflow-x: hidden;
}

.tersos-sidebar.collapsed .nav-section,
.sidebar-collapsed .tersos-sidebar .nav-section {
  overflow: hidden;
}

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--ui-radius);
  transition: color 0.15s ease;
  font-size: 16px;
  line-height: 1;
}

.sidebar-collapse-btn:hover {
  color: #fff;
}

.sidebar-header {
  padding: var(--space-5) var(--space-4);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo .logo-img {
  height: 28px;
  width: auto;
}

/* Theme-based logo switching */
.sidebar-logo .logo-dark {
  display: none;
}
.sidebar-logo .logo-light {
  display: block;
}

[data-theme="dark"] .sidebar-logo .logo-dark {
  display: block;
}
[data-theme="dark"] .sidebar-logo .logo-light {
  display: none;
}

.sidebar-logo .logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3);
}

.nav-section {
  margin-bottom: var(--space-5);
}

.nav-section-title {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--ui-radius);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-item.active:hover {
  background: #f7d633;
  color: var(--sidebar-active-text);
}

.nav-icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
  flex-shrink: 0;
}

/* Sidebar Light Mode */
[data-theme="light"] .tersos-sidebar {
  background: #fafafa;
  border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-logo .logo-text {
  color: var(--sidebar-active-text);
}

[data-theme="light"] .nav-section-title {
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .nav-item {
  color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--sidebar-active-text);
}

[data-theme="light"] .nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

/* Sidebar Mobile */
@media (max-width: 991.98px) {
  .tersos-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .tersos-sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

/* ========================================
   Header
   ======================================== */
.tersos-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ui-border);
}

[data-theme="dark"] .tersos-header {
  background: rgba(15, 15, 15, 0.8);
  border-bottom-color: var(--sidebar-border);
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Switcher */
/* Theme switcher (inside user dropdown) */
.dropdown-theme-switcher {
  display: flex;
  gap: 4px;
  padding: 4px 12px 8px;
}

.dropdown-theme-switcher .theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--ui-border);
  background: transparent;
  border-radius: var(--ui-radius);
  color: var(--ui-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: var(--text-xs);
  font-weight: 500;
}

.dropdown-theme-switcher .theme-btn i {
  font-size: 14px;
}

.dropdown-theme-switcher .theme-btn:hover {
  border-color: var(--ui-primary);
  color: var(--ui-text);
}

.dropdown-theme-switcher .theme-btn.active {
  background: var(--ui-primary-subtle);
  border-color: var(--ui-primary);
  color: var(--ui-primary);
}

.theme-btn.active {
  background: #fff;
  color: var(--sidebar-active-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .theme-btn {
  color: var(--sidebar-text-muted);
}

[data-theme="dark"] .theme-btn:hover {
  color: var(--sidebar-text);
}

[data-theme="dark"] .theme-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
}

/* Header Icon Button */
.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 20px;
}

.header-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--sidebar-active-text);
}

[data-theme="dark"] .header-icon-btn {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .header-icon-btn:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-trigger:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .user-trigger:hover {
  background: var(--sidebar-hover-bg);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--sidebar-active-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar.lg {
  width: 44px;
  height: 44px;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  display: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-active-text);
}

.user-avatar.lg .avatar-fallback {
  font-size: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-active-text);
}

[data-theme="dark"] .user-name {
  color: #fff;
}

.dropdown-caret {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

[data-theme="dark"] .dropdown-caret {
  color: var(--sidebar-text-muted);
}

.user-menu.open .dropdown-caret {
  transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--ui-surface-solid);
  border-radius: 12px;
  box-shadow: var(--ui-dropdown-shadow);
  border: 1px solid var(--ui-dropdown-border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 100;
}

.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

[data-theme="dark"] .user-dropdown {
  background: var(--ui-surface-solid);
  border-color: var(--ui-dropdown-border);
}

.user-dropdown .dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.dropdown-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-active-text);
}

[data-theme="dark"] .dropdown-name {
  color: #fff;
}

.dropdown-email {
  display: block;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.5);
  margin-top: 2px;
}

[data-theme="dark"] .dropdown-email {
  color: rgba(255, 255, 255, 0.5);
}

.user-dropdown .dropdown-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 4px 0;
}

[data-theme="dark"] .user-dropdown .dropdown-divider {
  background: rgba(255, 255, 255, 0.08);
}

.user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: var(--sidebar-active-text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-dropdown .dropdown-item i {
  font-size: 18px;
  color: rgba(0, 0, 0, 0.4);
}

.user-dropdown .dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .user-dropdown .dropdown-item {
  color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .user-dropdown .dropdown-item i {
  color: var(--sidebar-text-muted);
}

[data-theme="dark"] .user-dropdown .dropdown-item:hover {
  background: var(--sidebar-hover-bg);
}

.user-dropdown .dropdown-item.danger {
  color: var(--ui-danger);
}

.user-dropdown .dropdown-item.danger i {
  color: var(--ui-danger);
}

.user-dropdown .dropdown-item.danger:hover {
  background: rgba(var(--ui-danger-rgb), 0.08);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 24px;
}

.mobile-menu-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-menu-btn {
  color: var(--sidebar-text);
}

[data-theme="dark"] .mobile-menu-btn:hover {
  background: var(--sidebar-hover-bg);
}

@media (max-width: 991.98px) {
  .mobile-menu-btn {
    display: flex;
  }
  
  .tersos-header {
    padding: 12px 16px;
  }
  
  .user-info {
    display: none;
  }
}


/* ========================================
   Main Content Area (Sidebar Offset)
   ======================================== */
main {
  margin-left: 220px;
  max-width: calc(100vw - 220px);
  min-height: calc(100vh - 200px);
  transition: var(--sidebar-transition, margin-left 0.2s ease, max-width 0.2s ease);
}

header.tersos-header {
  margin-left: 220px;
  width: calc(100% - 220px);
  transition: var(--sidebar-transition, margin-left 0.2s ease, width 0.2s ease);
}

/* Collapsed sidebar offsets */
.sidebar-collapsed main {
  margin-left: 64px;
  max-width: calc(100vw - 64px);
}

.sidebar-collapsed header.tersos-header {
  margin-left: 64px;
  width: calc(100% - 64px);
}

/* Prevent horizontal scroll */
html, body {
  max-width: 100vw;
}

body {
  overflow-y: auto;
}

html[data-theme="dark"] body {
  background-color: var(--ui-bg-body);
}

/* Header dropdowns - z-index & overflow */
header .dropdown-menu {
  z-index: 9999;
  position: absolute;
}

header .dropdown {
  position: relative;
  z-index: 9998;
}

header, header * {
  overflow: visible;
}

/* Exception: notification dropdown must contain content */
#notificationDropdown {
  overflow: hidden;
}

#notificationList {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Content containment */
header.container-fluid,
main .container-fluid {
  max-width: 100%;
}

main .table-responsive,
main .table,
main .card {
  max-width: 100%;
}

/* Login page - center when no sidebar */
body:not(:has(.tersos-sidebar)) main,
main.container.d-flex {
  margin-left: 0;
  max-width: 100vw;
  width: 100%;
}

main.container.d-flex .row {
  margin: 0 auto;
}

main.container.d-flex .row > div {
  margin: 0 auto;
}

/* Mobile - sidebar & layout */
@media (max-width: 991.98px) {
  .tersos-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1100;
  }

  .tersos-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
  }

  .sidebar-overlay.show {
    display: block;
  }

  main {
    margin-left: 0;
    max-width: 100vw;
    width: 100%;
  }

  header.tersos-header {
    margin-left: 0;
    width: 100%;
  }
}

/* ========================================
   Header Center (tersAI search)
   ======================================== */
.header-center {
  flex: 1;
  max-width: 540px;
  margin: 0 24px;
}

@media (max-width: 768px) {
  .header-center {
    display: none;
  }
}

/* ========================================
   Dropdown Section Labels
   ======================================== */
.dropdown-label {
  display: block;
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-theme="light"] .dropdown-label { color: var(--ui-text-muted); }
[data-theme="dark"] .dropdown-label { color: var(--ui-text-muted); }

/* ========================================
   Notification System
   ======================================== */
.notification-menu { position: relative; }
.notification-trigger { position: relative; }

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: var(--ui-danger);
  border-radius: 8px;
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 360px;
  height: 480px;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1100;
}

[data-theme="light"] .notification-dropdown {
  background: var(--ui-surface-solid);
  border: 1px solid var(--ui-dropdown-border);
  box-shadow: var(--ui-dropdown-shadow);
}

[data-theme="dark"] .notification-dropdown {
  background: var(--ui-surface-solid);
  border: 1px solid var(--ui-dropdown-border);
  box-shadow: var(--ui-dropdown-shadow);
}

.notification-menu.open .notification-dropdown {
  display: flex;
  flex-direction: column;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

.notification-title { font-size: 14px; font-weight: 600; }
[data-theme="light"] .notification-title { color: var(--ui-text); }
[data-theme="dark"] .notification-title { color: var(--ui-text); }

.mark-all-read-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 16px;
}

[data-theme="light"] .mark-all-read-btn { color: var(--ui-text-muted); }
[data-theme="light"] .mark-all-read-btn:hover { color: var(--ui-text); background: var(--ui-table-header-bg); }
[data-theme="dark"] .mark-all-read-btn { color: var(--ui-text-muted); }
[data-theme="dark"] .mark-all-read-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.notification-list { flex: 1; overflow-y: auto; min-height: 0; }

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  border-bottom: 1px solid var(--ui-border);
}

.notification-item:last-child { border-bottom: none; }
[data-theme="light"] .notification-item:hover { background: var(--ui-table-header-bg); }
[data-theme="dark"] .notification-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="light"] .notification-item.unread { background: #fff8e6; }
[data-theme="dark"] .notification-item.unread { background: rgba(239, 216, 93, 0.08); }

.notification-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 16px;
}

[data-theme="light"] .notification-icon { background: var(--ui-overlay); color: var(--ui-text-secondary); }
[data-theme="dark"] .notification-icon { background: rgba(255,255,255,0.1); color: var(--ui-text-secondary); }

.notification-content { flex: 1; min-width: 0; }

.notification-item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
[data-theme="light"] .notification-item-title { color: var(--ui-text); }
[data-theme="dark"] .notification-item-title { color: var(--ui-text); }

.notification-message {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

[data-theme="light"] .notification-message { color: var(--ui-text-muted); }
[data-theme="dark"] .notification-message { color: var(--ui-text-muted); }

.notification-time { font-size: 11px; }
[data-theme="light"] .notification-time { color: var(--ui-text-faint); }
[data-theme="dark"] .notification-time { color: var(--ui-text-muted); }

.notification-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--ui-border);
  text-align: center;
}

[data-theme="light"] .notification-footer { background: var(--ui-surface-solid); }
[data-theme="dark"] .notification-footer { background: var(--ui-surface-solid); }

.notification-settings-link {
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .notification-settings-link { color: var(--ui-text-muted); }
[data-theme="light"] .notification-settings-link:hover { color: var(--ui-text); }
[data-theme="dark"] .notification-settings-link { color: var(--ui-text-muted); }
[data-theme="dark"] .notification-settings-link:hover { color: #fff; }

.notification-loading { padding: 32px; text-align: center; }
.notification-empty { padding: 32px 16px; text-align: center; }
.notification-empty i { font-size: 32px; margin-bottom: 12px; }
[data-theme="light"] .notification-empty { color: var(--ui-text-muted); }
[data-theme="dark"] .notification-empty { color: var(--ui-text-muted); }
.notification-empty-text { font-size: 13px; }

/* ========================================
   Sidebar Extras (Footer, Reorder, Badges)
   ======================================== */
.sidebar-nav { scroll-behavior: auto; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--ui-accent); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #e6c94f; }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--ui-accent) transparent; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.customize-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.customize-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}

.customize-nav-btn i { font-size: 14px; }

/* Nav Reorder Modal */
.nav-reorder-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.nav-reorder-modal.show { display: flex; }
.nav-reorder-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.nav-reorder-content {
  position: relative;
  width: 340px;
  max-height: 80vh;
  border-radius: 12px;
  overflow: hidden;
  animation: navReorderSlideIn 0.2s ease;
}
[data-theme="light"] .nav-reorder-content { background: var(--ui-surface-solid); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2); }
[data-theme="dark"] .nav-reorder-content { background: var(--ui-surface-solid); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }

@keyframes navReorderSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.nav-reorder-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--ui-border); }
.nav-reorder-title { font-size: 16px; font-weight: 600; margin: 0; }
[data-theme="light"] .nav-reorder-title { color: var(--ui-text); }
[data-theme="dark"] .nav-reorder-title { color: var(--ui-text); }
.nav-reorder-close { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; border-radius: 4px; }
[data-theme="light"] .nav-reorder-close { color: var(--ui-text-muted); }
[data-theme="light"] .nav-reorder-close:hover { color: var(--ui-text); background: var(--ui-table-header-bg); }
[data-theme="dark"] .nav-reorder-close { color: var(--ui-text-muted); }
[data-theme="dark"] .nav-reorder-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.nav-reorder-body { padding: 12px; max-height: 400px; overflow-y: auto; }
.nav-reorder-hint { font-size: 12px; padding: 0 8px 12px; }
[data-theme="light"] .nav-reorder-hint { color: var(--ui-text-muted); }
[data-theme="dark"] .nav-reorder-hint { color: var(--ui-text-muted); }
.nav-reorder-list { list-style: none; padding: 0; margin: 0; }
.nav-reorder-item { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 6px; border-radius: 8px; cursor: grab; transition: all 0.15s ease; user-select: none; }
[data-theme="light"] .nav-reorder-item { background: var(--ui-table-header-bg); border: 1px solid var(--ui-border); }
[data-theme="light"] .nav-reorder-item:hover { background: var(--ui-overlay-hover); }
[data-theme="dark"] .nav-reorder-item { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .nav-reorder-item:hover { background: rgba(255, 255, 255, 0.1); }
.nav-reorder-item:active { cursor: grabbing; }
.nav-reorder-item.dragging { opacity: 0.5; transform: scale(1.02); }
.nav-reorder-item.drag-over { border-color: var(--ui-accent); background: rgba(239, 216, 93, 0.1); }
.nav-reorder-drag-handle { font-size: 16px; }
[data-theme="light"] .nav-reorder-drag-handle { color: var(--ui-text-muted); }
[data-theme="dark"] .nav-reorder-drag-handle { color: var(--ui-text-muted); }
.nav-reorder-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 14px; }
[data-theme="light"] .nav-reorder-icon { background: var(--ui-surface-solid); color: var(--ui-text-secondary); box-shadow: var(--ui-shadow-sm); }
[data-theme="dark"] .nav-reorder-icon { background: rgba(255,255,255,0.1); color: var(--ui-text-secondary); }
.nav-reorder-label { flex: 1; font-size: 14px; font-weight: 500; }
[data-theme="light"] .nav-reorder-label { color: var(--ui-text); }
[data-theme="dark"] .nav-reorder-label { color: var(--ui-text); }
.nav-reorder-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--ui-border); }
.nav-reorder-reset { background: none; border: none; font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: 6px; }
[data-theme="light"] .nav-reorder-reset { color: var(--ui-text-muted); }
[data-theme="light"] .nav-reorder-reset:hover { color: var(--ui-text); background: var(--ui-table-header-bg); }
[data-theme="dark"] .nav-reorder-reset { color: var(--ui-text-muted); }
[data-theme="dark"] .nav-reorder-reset:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-reorder-save { background: var(--ui-accent); border: none; color: #1a1a1a; font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: 6px; cursor: pointer; transition: all 0.15s ease; }
.nav-reorder-save:hover { filter: brightness(1.1); }

/* Nav Count Badges */
.nav-count-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: var(--ui-primary);
  border-radius: 9px;
}

/* Toggle switch - green when active */
.form-check-input.toggle-active:checked {
  background-color: var(--ui-success);
  border-color: var(--ui-success);
}

.form-check-input.toggle-active:focus {
  border-color: var(--ui-success);
  box-shadow: 0 0 0 0.25rem rgba(var(--ui-success-rgb), 0.25);
}
