:root {
  --primary: #ee4823;
  --primary-hover: #bc3926;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #2d2d2d;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --warning: #f6eb15;
  --error: #ef4444;
  --danger: #ef4444;
  --font-family: Inter, system-ui, sans-serif;
  --font-size-base: 16px;
  --sidebar-width: 240px;
  --header-height: 56px;
}

[data-theme="dark"] {
  --primary: #f19d23;
  --primary-hover: #ee6f23;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
}

/* =============================================================================
   SHARED COMPONENT STYLES - Served from Portal /api/branding/css
   DO NOT duplicate these styles in individual container CSS files
   ============================================================================= */

/* === Shared Sidebar === */
.shared-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.25s ease;
}

.shared-sidebar.collapsed {
  width: 64px;
}

/* Sidebar Header */
.shared-sidebar .sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sidebar-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.sidebar-logo .logo-full {
  height: 32px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.sidebar-logo .logo-mark {
  height: 32px;
  width: 32px;
  object-fit: contain;
}

.sidebar-logo .logo-placeholder {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
}

.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* App Selector — prefixed with .shared-sidebar for specificity over local CSS */
.shared-sidebar .sidebar-app-selector {
  padding: 0.375rem 0.75rem;
  position: relative;
}

.shared-sidebar .sidebar-app-selector .app-selector-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--text);
}

.shared-sidebar .sidebar-app-selector .app-selector-btn:hover {
  border-color: var(--primary);
}

.shared-sidebar .sidebar-app-selector .app-icon {
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.shared-sidebar .sidebar-app-selector .app-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-sidebar .sidebar-app-selector .dropdown-arrow {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.shared-sidebar .sidebar-app-selector .app-dropdown {
  position: absolute;
  top: 100%;
  left: 0.75rem;
  right: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.shared-sidebar .sidebar-app-selector .app-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.shared-sidebar .sidebar-app-selector .app-dropdown-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.shared-sidebar .sidebar-app-selector .app-emoji {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

/* Constrain image-based app icons (Veeam, Sophos, etc.) */
.sidebar-app-icon-img {
  width: 1.125rem;
  height: 1.125rem;
  object-fit: contain;
  border-radius: 2px;
  display: block;
}

/* Sidebar Divider */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0.75rem 0.75rem;
}

/* Sidebar Navigation */
.shared-sidebar .sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.75rem;
}

.nav-section {
  margin-bottom: 1rem;
}

.shared-sidebar .nav-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.25rem;
}

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

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  color: var(--text);
  font-size: 0.875rem;
}

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

.sidebar-nav-item.active {
  background: var(--primary);
  color: white;
}

.sidebar-nav-item .nav-icon {
  font-size: 1.125rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav-item .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed sidebar nav */
.shared-sidebar.collapsed .sidebar-nav-item {
  justify-content: center;
  padding: 0.75rem;
}

.shared-sidebar.collapsed .sidebar-nav-item .nav-icon {
  width: auto;
}

/* Sidebar Footer */
.shared-sidebar .sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.bug-report-sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.bug-report-sidebar-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.bug-report-sidebar-btn.capturing {
  opacity: 0.7;
  pointer-events: none;
}

.bug-report-sidebar-btn .bug-icon {
  font-size: 1.125rem;
}

.bug-report-sidebar-btn .bug-label {
  white-space: nowrap;
}

.shared-sidebar.collapsed .bug-report-sidebar-btn {
  padding: 0.75rem;
}

/* Sidebar Collapse Toggle */
.sidebar-collapse-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0.375rem 0.375rem 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: all 0.15s;
  z-index: 10;
}

.sidebar-collapse-toggle:hover {
  background: var(--bg);
  color: var(--text);
}

/* === Shared Layout === */
.shared-layout {
  display: flex;
  min-height: 100vh;
}

.shared-main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.shared-main.sidebar-collapsed {
  margin-left: 64px;
}

.shared-content {
  flex: 1;
  padding: 1.5rem;
  background: var(--bg);
}

/* === Modal Styles === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal {
  background: var(--bg-card);
  border-radius: 0.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.modal-header .close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.modal-header .close-btn:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-body .form-group {
  margin-bottom: 1rem;
}

.modal-body .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.modal-body .form-group select,
.modal-body .form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
}

.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(238, 72, 35, 0.1);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Bug Report Modal */
.bug-report-modal {
  max-width: 550px;
}

.bug-report-modal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

.screenshot-preview-container {
  margin-bottom: 1rem;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 0.375rem;
  text-align: center;
}

.screenshot-preview-container img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

.screenshot-preview-container p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.word-count {
  font-size: 0.75rem;
  text-align: right;
  margin-top: 0.25rem;
}

.word-count.valid {
  color: var(--success);
}

.word-count.invalid {
  color: var(--danger);
}

.bug-report-success {
  text-align: center;
  padding: 1rem;
}

.bug-report-success .success-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.bug-report-success h4 {
  color: var(--success);
  margin-bottom: 0.5rem;
}

.bug-report-success p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Alert styles */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* === Shared Button Styles === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg);
}

/* === Main Layout Wrapper === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Support all main content class variations used across containers */
.main-wrapper,
.main-area,
.main-area-shared,
.shared-main,
.shared-layout-main,
.app-main,
.app-main-area {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.main-wrapper.sidebar-collapsed,
.main-area.sidebar-collapsed,
.main-area-shared.sidebar-collapsed,
.shared-main.sidebar-collapsed,
.shared-layout-main.sidebar-collapsed,
.app-main.sidebar-collapsed,
.app-main-area.sidebar-collapsed {
  margin-left: 64px;
}

.main-content,
.app-content {
  flex: 1;
  padding: 1.5rem;
  background: var(--bg);
  overflow-y: auto;
}

/* === Shared Header === */
.shared-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.shared-header .header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.shared-header .mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 0.5rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  border-radius: 0.375rem;
  transition: background 0.15s;
}

.shared-header .mobile-menu-btn:hover {
  background: var(--bg);
}

.shared-header .header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.shared-header .header-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  transition: all 0.15s;
}

.shared-header .header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(238, 72, 35, 0.1);
}

.shared-header .header-search .search-icon {
  font-size: 1rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.shared-header .header-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  outline: none;
  color: var(--text);
  min-width: 0;
}

.shared-header .header-search input::placeholder {
  color: var(--text-muted);
}

.shared-header .header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.shared-header .header-icon-btn {
  position: relative;
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}

.shared-header .header-icon-btn:hover {
  background: var(--bg);
}

.shared-header .header-icon-btn .icon {
  font-size: 1.25rem;
}

.shared-header .header-icon-btn .badge-count {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0 0.25rem;
}

.shared-header .header-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  padding: 0.25rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
}

.shared-header .header-user-btn:hover {
  background: var(--bg);
}

.shared-header .header-user-btn .user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.shared-header .header-user-btn .dropdown-arrow {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.shared-header .header-dropdown {
  position: relative;
}

.shared-header .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}

.shared-header .dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.shared-header .dropdown-header .user-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.shared-header .dropdown-header .user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.shared-header .dropdown-header .user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 0.25rem;
}

.shared-header .dropdown-divider {
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.shared-header .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.shared-header .dropdown-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.shared-header .dropdown-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

.shared-header .logout-item {
  color: var(--danger);
}

.shared-header .dropdown-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.shared-header .notifications-menu {
  min-width: 300px;
  max-width: 350px;
}

.shared-header .notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.shared-header .notification-item:last-child {
  border-bottom: none;
}

.shared-header .notification-item:hover {
  background: var(--bg);
}

.shared-header .notification-item.unread {
  background: rgba(238, 72, 35, 0.05);
}

.shared-header .notification-title {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.shared-header .notification-message {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  .shared-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

  .shared-main,
  .main-wrapper,
  .main-area,
  .main-area-shared,
  .shared-layout-main,
  .app-main {
    margin-left: 0 !important;
  }

  .main-wrapper.sidebar-collapsed,
  .main-area.sidebar-collapsed,
  .main-area-shared.sidebar-collapsed,
  .shared-main.sidebar-collapsed,
  .shared-layout-main.sidebar-collapsed,
  .app-main.sidebar-collapsed {
    margin-left: 0 !important;
  }

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

  .shared-header .mobile-menu-btn {
    display: flex;
  }

  .shared-header .header-center {
    display: none;
  }
}

/* =============================================================================
   ZENDESK-STYLE LAYOUT — Icon Rail + Context Panel + Top Bar
   ============================================================================= */

/* --- CSS Variables for new layout --- */
:root {
  --icon-rail-width: 48px;
  --icon-rail-bg: #1B2A4A;
  --icon-rail-bg-hover: #243556;
  --icon-rail-text: #8B99B0;
  --icon-rail-active: #ffffff;
  --icon-rail-active-border: var(--primary);
  --context-panel-width: 260px;
  --top-bar-height: 48px;
}

[data-theme="dark"] {
  --icon-rail-bg: #0B1929;
  --icon-rail-bg-hover: #132236;
  --icon-rail-text: #6B7B90;
  --icon-rail-active: #e2e8f0;
}

/* --- Zendesk Layout Container --- */
.zendesk-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.zendesk-main {
  flex: 1;
  min-width: 0;
  margin-left: calc(var(--icon-rail-width) + var(--context-panel-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.zendesk-main.panel-collapsed {
  margin-left: var(--icon-rail-width);
}

.zendesk-content {
  flex: 1;
  padding: 1.5rem;
  background: var(--bg);
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* When iframe is active, remove padding so iframe fills the space */
.zendesk-content.iframe-active {
  padding: 0;
  overflow: hidden;
}

/* --- Icon Rail --- */
.icon-rail {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--icon-rail-width);
  height: 100vh;
  background: var(--icon-rail-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 300;
  padding: 0;
  overflow: hidden;
}

.icon-rail-logo {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--top-bar-height);
}

.icon-rail-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-rail-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.icon-rail-logo-fallback {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.icon-rail-items {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0;
  gap: 0.125rem;
  overflow-y: auto;
}

.icon-rail-item {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--icon-rail-text);
  transition: all 0.15s ease;
  padding: 0;
}

.icon-rail-item:hover {
  background: var(--icon-rail-bg-hover);
  color: var(--icon-rail-active);
}

.icon-rail-item.active {
  color: var(--icon-rail-active);
  background: var(--icon-rail-bg-hover);
}

.icon-rail-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--icon-rail-active-border);
  border-radius: 0 3px 3px 0;
}

.icon-rail-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0;
  gap: 0.125rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.icon-rail-bug:hover {
  color: #ef4444;
}

/* --- Context Panel --- */
.context-panel {
  position: fixed;
  top: 0;
  left: var(--icon-rail-width);
  width: var(--context-panel-width);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.25s ease;
  overflow: hidden;
}

.context-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  min-height: var(--top-bar-height);
  border-bottom: 1px solid var(--border);
}

.context-panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-panel-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.context-panel-collapse-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.context-panel-expand-btn {
  position: fixed;
  top: calc(var(--top-bar-height) / 2 - 12px);
  left: var(--icon-rail-width);
  width: 24px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  z-index: 201;
  transition: all 0.15s;
}

.context-panel-expand-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.context-panel-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

.context-panel-section {
  margin-bottom: 0.75rem;
}

.context-panel-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.625rem 0.25rem;
}

.context-panel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.context-panel-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  color: var(--text);
  font-size: 0.8125rem;
}

.context-panel-nav-item:hover {
  background: var(--bg);
}

.context-panel-nav-item.active {
  background: var(--primary);
  color: white;
}

.context-panel-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  flex-shrink: 0;
}

.context-panel-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.context-panel-nav-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.context-panel-nav-item.active .context-panel-nav-badge {
  background: rgba(255,255,255,0.2);
  color: white;
}

.context-panel-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.context-panel-bug-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.context-panel-bug-btn:hover {
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.05);
}

/* --- Top Bar --- */
.top-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--top-bar-height);
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

/* App Switcher */
.top-bar-app-switcher {
  position: relative;
}

.top-bar-app-switcher-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s;
}

.top-bar-app-switcher-btn:hover {
  background: var(--bg);
}

.top-bar-chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.top-bar-chevron.open {
  transform: rotate(180deg);
}

.top-bar-app-name {
  white-space: nowrap;
}

.top-bar-app-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.25rem;
}

[data-theme="dark"] .top-bar-app-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.top-bar-app-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  border-radius: 6px;
}

.top-bar-app-dropdown-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.top-bar-app-dropdown-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

.top-bar-app-icon-img {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  border-radius: 2px;
}

/* Tab bar */
.top-bar-center {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.top-bar-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  padding: 0 0.25rem;
}

.top-bar-tabs::-webkit-scrollbar {
  height: 3px;
}
.top-bar-tabs::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.top-bar-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
  flex: 0 1 200px;
  min-width: 90px;
  max-width: 220px;
  transition: all 0.15s;
  margin-bottom: -1px;
  position: relative;
}

.top-bar-tab:hover {
  background: var(--bg-card);
  color: var(--text);
}

.top-bar-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  border-color: var(--border);
  border-bottom: 2px solid var(--bg-card);
  z-index: 1;
}

.top-bar-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.top-bar-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}

.top-bar-tab:hover .top-bar-tab-close {
  opacity: 0.6;
}

.top-bar-tab-close:hover {
  opacity: 1 !important;
  background: rgba(0,0,0,0.1);
}

[data-theme="dark"] .top-bar-tab-close:hover {
  background: rgba(255,255,255,0.1);
}

/* Context panel search bar */
.context-panel-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.context-panel-search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}
.context-panel-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  min-width: 0;
}
.context-panel-search-input::placeholder {
  color: var(--text-muted);
}

/* Right side actions */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.top-bar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
}

.top-bar-icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.top-bar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger, #ef4444);
  color: white;
  font-size: 0.5625rem;
  font-weight: 600;
  min-width: 0.875rem;
  height: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0 0.1875rem;
}

.top-bar-dropdown {
  position: relative;
}

/* Search dropdown */
.top-bar-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 0.5rem;
  z-index: 1000;
}

[data-theme="dark"] .top-bar-search-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.top-bar-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.top-bar-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(238, 72, 35, 0.1);
}

/* Notifications dropdown */
.top-bar-notif-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  overflow: hidden;
}

[data-theme="dark"] .top-bar-notif-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.top-bar-dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.top-bar-dropdown-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.top-bar-notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.top-bar-notif-item:last-child {
  border-bottom: none;
}

.top-bar-notif-item:hover {
  background: var(--bg);
}

.top-bar-notif-item.unread {
  background: rgba(238, 72, 35, 0.05);
}

.top-bar-notif-title {
  font-weight: 500;
  font-size: 0.8125rem;
  margin-bottom: 0.125rem;
  color: var(--text);
}

.top-bar-notif-message {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* User button and dropdown */
.top-bar-user-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0.25rem;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.15s;
}

.top-bar-user-btn:hover {
  opacity: 0.8;
}

.top-bar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.top-bar-user-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  overflow: hidden;
}

[data-theme="dark"] .top-bar-user-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.top-bar-user-name {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text);
}

.top-bar-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.top-bar-user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 0.25rem;
}

.top-bar-dropdown-divider {
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.top-bar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.top-bar-dropdown-item:hover {
  background: var(--bg);
  text-decoration: none;
}

.top-bar-logout {
  color: var(--danger, #ef4444);
}

.top-bar-mobile-menu {
  display: none;
}

/* --- Zendesk Layout Mobile Responsive --- */
@media (max-width: 768px) {
  .icon-rail {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 56px;
    flex-direction: row;
    padding: 0 0.5rem;
    z-index: 300;
  }

  .icon-rail-logo {
    display: none;
  }

  .icon-rail-items {
    flex-direction: row;
    justify-content: center;
    padding: 0;
    gap: 0.25rem;
    overflow-x: auto;
  }

  .icon-rail-item.active::before {
    left: 50%;
    top: auto;
    bottom: -4px;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }

  .icon-rail-bottom {
    flex-direction: row;
    border-top: none;
    border-left: 1px solid rgba(255,255,255,0.08);
    padding: 0 0.5rem;
    gap: 0.25rem;
  }

  .context-panel {
    display: none;
  }

  .context-panel-expand-btn {
    display: none;
  }

  .zendesk-main {
    margin-left: 0;
    margin-bottom: 56px;
  }

  .zendesk-main.panel-collapsed {
    margin-left: 0;
  }

  .top-bar-mobile-menu {
    display: flex;
  }

  .top-bar-center {
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .zendesk-main {
    margin-left: var(--icon-rail-width);
  }

  .context-panel {
    display: none;
  }

  .context-panel-expand-btn {
    display: none;
  }
}

/* --- Content Frame (iframe container) --- */
.content-frame-container {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.content-frame-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.content-frame-container iframe.hidden {
  display: none;
}