/* ===========================================
   CRM Team - Design System
   RTL | Hebrew | Modern Dashboard
   Based on crm-leads CSS
   =========================================== */

/* ---- CSS Variables ---- */
:root {
  color-scheme: light;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f3f4f6;
  --bg-sidebar-active: #eff6ff;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  --text-sidebar: #6b7280;
  --text-sidebar-active: #3b82f6;

  --accent: #3b82f6;
  --accent-light: #dbeafe;
  --accent-hover: #2563eb;

  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #6366f1;
  --info-light: #e0e7ff;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 60px;
  --mobile-nav-height: 60px;

  --font: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;
}

[hidden] { display: none !important; }

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body { overflow-x: hidden; overscroll-behavior-x: none; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  direction: rtl;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); font-size: 14px; }

/* ---- Auth View ---- */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1d23 0%, #2d3748 100%);
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}
.auth-logo { font-size: 56px; margin-bottom: 16px; }
.auth-title { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 16px; }
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 32px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { background: var(--bg); box-shadow: var(--shadow); }
.google-icon { flex-shrink: 0; }

/* ---- App Shell Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s ease;
  overflow: hidden;
  border-left: 1px solid var(--border);
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon { color: var(--accent); }
.sidebar-title { font-size: 18px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  text-decoration: none;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 400;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); font-weight: 500; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 14px; }
.nav-external { opacity: 0.75; }
.nav-external:hover { opacity: 1; }
.nav-label { white-space: nowrap; }

/* Sidebar collapse toggle */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  right: var(--sidebar-width);
  transform: translate(50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  z-index: 101;
  transition: all 0.3s;
  padding: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); box-shadow: var(--shadow-sm); }
.sidebar-toggle svg { transition: transform 0.3s; }
.sidebar.collapsed + .sidebar-toggle { right: var(--sidebar-collapsed); }
.sidebar.collapsed + .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-name { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 8px; }
.sidebar.collapsed .sidebar-footer { flex-direction: column; align-items: center; padding: 8px; }
.sidebar.collapsed .nav-divider { display: none; }
.sidebar.collapsed ~ .main-content { margin-right: var(--sidebar-collapsed); }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-info { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.user-name { color: var(--text-sidebar); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-sign-out { color: var(--text-sidebar); padding: 6px; border-radius: var(--radius-sm); transition: all 0.15s; flex-shrink: 0; }
.btn-sign-out:hover { background: var(--border); color: var(--danger); }

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.views-container { flex: 1; padding: 0; }

/* ---- Split View ---- */
.split-view {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--mobile-nav-height));
}
.split-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.split-panel-list { width: 100%; background: var(--bg); }
.split-panel-detail { width: 100%; background: var(--bg); display: none; }
.split-view.showing-detail .split-panel-list { display: none; }
.split-view.showing-detail .split-panel-detail { display: block; }

/* Empty state for detail */
.split-panel-detail .crm-view:empty::after {
  content: 'בחר פריט מהרשימה';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  font-size: 16px;
}

/* ---- Mobile Bottom Nav ---- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  padding: 6px 12px;
  transition: color 0.15s;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:hover { text-decoration: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--text-inverse); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #3730a3; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* ---- Loading ---- */
.loading-spinner { display: flex; justify-content: center; padding: 40px; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 32px; margin-bottom: 12px; }

/* ---- Toast ---- */
.crm-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--success); color: #fff; }
.toast-danger { background: var(--danger); color: #fff; }
.toast-info { background: var(--accent); color: #fff; }

/* ---- List Header ---- */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.list-title { font-size: 18px; font-weight: 600; }

/* ---- Filter Pills ---- */
.filter-pills {
  display: flex;
  gap: 6px;
  padding: 8px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-pill {
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}
.filter-pill:hover { background: var(--border); }
.filter-pill.active { background: var(--accent); color: #fff; }

/* ---- Search ---- */
.search-wrap {
  padding: 8px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }

/* ---- Card List ---- */
.card-list { padding: 4px 0; }

/* ---- Team Cards ---- */
.team-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.team-card:hover { background: var(--bg-sidebar-hover); }
.team-card-active {
  background: var(--accent-light) !important;
  border-right: 3px solid var(--accent);
}
.team-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  position: relative;
}
.team-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.team-card-info { flex: 1; min-width: 0; }
.team-card-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.team-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.team-card-roles { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.role-pill {
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 500;
  background: var(--border);
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}
.team-card-balance {
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

/* ---- User Cards ---- */
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-light);
}
.user-card:hover { background: var(--bg-sidebar-hover); }
.user-card-active { background: var(--accent-light) !important; }
.user-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-email { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-name { font-size: 12px; color: var(--text-secondary); }
.role-badge {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

/* ---- Detail View ---- */
.btn-back {
  display: none;
  padding: 8px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.detail-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
}
.detail-header-info { flex: 1; }
.detail-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-header-roles { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-header-roles .role-pill { font-size: 12px; padding: 3px 12px; }
.team-color-dot-lg {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Detail Cards ---- */
.detail-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.detail-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(to left, #fafbfc, #fff);
}
.detail-card-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-card-body {
  padding: 4px 0;
}

.detail-row {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  min-height: 44px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.detail-row:last-child { border-bottom: none; }
.detail-row:hover { background: #fafbfc; }
.detail-row-textarea { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.detail-label {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.detail-value {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  color: var(--text-primary);
}

/* ---- Inline Editing ---- */
.inline-editable {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.inline-editable:hover { background: var(--accent-light); }
.inline-input, .inline-textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  background: #fff;
}
.inline-textarea { resize: vertical; min-height: 60px; }
.inline-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  outline: none;
  cursor: pointer;
}
.inline-select:focus { border-color: var(--accent); }

/* ---- Role Checkboxes ---- */
.role-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 14px;
}
.role-checkbox input { cursor: pointer; }

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- Avatar Images ---- */
.team-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.detail-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid var(--bg);
}
.avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-preview-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  border-radius: 50%;
}

/* ---- Color Preview ---- */
.color-preview {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  vertical-align: middle;
  border: 1px solid var(--border);
}

/* ---- Card Note ---- */
.card-note {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
}

/* ---- LTR content ---- */
.ltr-content { direction: ltr; unicode-bidi: isolate; }

/* ---- Edit Modal (from form-helpers) ---- */
.edit-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: 9000;
}
.edit-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.edit-modal-header h3 { font-size: 16px; font-weight: 600; }
.edit-modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
}
.edit-modal-close:hover { background: var(--border); color: var(--text-primary); }
.edit-modal-body { padding: 16px 20px; }
.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.btn-cancel {
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
}
.btn-save {
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-save:hover { background: var(--accent-hover); }

/* ---- Photographer Colors (from crm-leads) ---- */
.photographer-blue-dark   { background: #156fe2; color: #fff; }
.photographer-red         { background: #dd04a8; color: #fff; }
.photographer-yellow-dark { background: #ffba06; color: #fff; }
.photographer-teal        { background: #05ddd5; color: #000 !important; }
.photographer-orange      { background: #c2410c; color: #fff; }
.photographer-gray        { background: #94a3b8; color: #fff; }

/* ==========================
   RESPONSIVE
   ========================== */

/* ---- Tablet: Collapsed sidebar by default + split view ---- */
@media (min-width: 769px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-title, .nav-label, .user-name { display: none; }
  .sidebar-header { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-footer { flex-direction: column; padding: 8px; }
  .user-info { justify-content: center; }
  .main-content { margin-right: var(--sidebar-collapsed); }

  .split-view {
    flex-direction: row-reverse;
    height: 100vh;
    min-height: 100vh;
  }
  .split-panel-list {
    width: 360px;
    min-width: 300px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    height: 100vh;
    overflow-y: auto;
  }
  .split-panel-detail {
    flex: 1;
    display: block;
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
  }
  .split-view.showing-detail .split-panel-list { display: block; }
  .btn-back { display: none !important; }
}

/* ---- Desktop: Sidebar starts collapsed, can be expanded ---- */
@media (min-width: 1025px) {
  /* Default collapsed — the HTML has class "collapsed" */
  /* When collapsed class is removed, full sidebar shows */
  .sidebar:not(.collapsed) { width: var(--sidebar-width); }
  .sidebar:not(.collapsed) .sidebar-title,
  .sidebar:not(.collapsed) .nav-label,
  .sidebar:not(.collapsed) .user-name { display: unset; }
  .sidebar:not(.collapsed) .sidebar-header { justify-content: flex-start; padding: 20px 20px 16px; }
  .sidebar:not(.collapsed) .nav-item { justify-content: flex-start; padding: 10px 14px; }
  .sidebar:not(.collapsed) .sidebar-footer { flex-direction: row; padding: 12px 14px; }
  .sidebar:not(.collapsed) .user-info { justify-content: flex-start; }
  .sidebar:not(.collapsed) ~ .main-content { margin-right: var(--sidebar-width); }
  .sidebar:not(.collapsed) + .sidebar-toggle { right: var(--sidebar-width); }

  .split-panel-list { width: 400px; }
  .split-panel-detail { padding: 24px; }
}

/* ---- Mobile: No sidebar, bottom nav ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .mobile-nav { display: flex; }
  .main-content {
    margin-right: 0;
    padding-bottom: var(--mobile-nav-height);
    overflow-x: hidden;
    max-width: 100vw;
  }
  .btn-back { display: block; }
  .detail-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
  }
  .detail-header { padding: 0 16px; }
}
