/* ══════════════════════════════════════════════════════════════════════
   MockIQ — Desktop Sidebar & Layout (Unslop Graphite System)
   Scoped strictly to @media (min-width: 861px) — zero mobile impact.
   ══════════════════════════════════════════════════════════════════════ */

/* Mobile: sidebar completely hidden */
#desktopSidebar { display: none; }

/* ═══ DESKTOP SCREENS (861px+) ═══ */
@media (min-width: 861px) {

  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  body {
    min-width: 0 !important;
    padding-bottom: 24px !important;
  }

  /* ── Sidebar Container ─────────────────────────────────────────── */
  #desktopSidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: #fafafa;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 220;
    box-shadow: none;
    box-sizing: border-box;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    user-select: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.25) transparent;
  }

  body.dark #desktopSidebar {
    background: #0f0f10;
    border-right-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  /* ── Brand Header ──────────────────────────────────────────────── */
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
    background: transparent;
  }

  body.dark .sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    background: transparent;
  }

  .sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
  }
  body.dark .sidebar-brand-icon {
    background: #18181c;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .sidebar-brand-icon img {
    width: 100%; height: 100%; object-fit: cover;
  }

  .sidebar-brand-info { min-width: 0; flex: 1; }

  .sidebar-brand-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.015em;
    line-height: 1.2;
  }

  body.dark .sidebar-brand-title { color: #f4f4f5; }

  .sidebar-brand-badge { display: none; }

  .sidebar-brand-sub {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.dark .sidebar-brand-sub { color: #a1a1aa; }

  /* ── Nav Section ───────────────────────────────────────────────── */
  .sidebar-nav-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px 12px;
  }

  .sidebar-section-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    letter-spacing: 0;
    text-transform: none;
    padding: 0 12px 8px;
  }

  body.dark .sidebar-section-label { color: #71717a; }

  .sidebar-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
    white-space: nowrap;
    position: relative;
  }

  .sidebar-nav-btn:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #111827;
  }

  body.dark .sidebar-nav-btn { color: #a1a1aa; }

  body.dark .sidebar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f4f4f5;
  }

  .sidebar-nav-btn.active {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.09);
    color: #111827 !important;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  body.dark .sidebar-nav-btn.active {
    background: #1c1c21;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f4f4f5 !important;
    box-shadow: none;
  }

  .sidebar-nav-btn .snb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #6b7280;
    line-height: 1;
    flex-shrink: 0;
  }
  .sidebar-nav-btn.active .snb-icon { color: #4338ca; }
  body.dark .sidebar-nav-btn .snb-icon { color: #71717a; }
  body.dark .sidebar-nav-btn.active .snb-icon { color: #818cf8; }

  .sidebar-nav-btn .snb-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Quick Action CTA ──────────────────────────────────────────── */
  .sidebar-quick-action {
    padding: 12px 12px 8px;
    margin-top: 8px;
  }
  .sidebar-quick-action[hidden] {
    display: none !important;
  }

  .sidebar-import-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: #4338ca;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.15s ease;
  }

  .sidebar-import-btn:hover { background: #3730a3; }
  body.dark .sidebar-import-btn { background: #4f46e5; }
  body.dark .sidebar-import-btn:hover { background: #4338ca; }

  .sidebar-import-btn .sib-plus {
    font-size: 16px;
    font-weight: 600;
  }

  /* ── Sidebar Footer ────────────────────────────────────────────── */
  .sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.07);
    background: transparent;
  }

  body.dark .sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: transparent;
  }

  .sidebar-plan-btn,
  .sidebar-settings-btn,
  .sidebar-dark-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    color: #374151;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .sidebar-plan-btn:hover,
  .sidebar-settings-btn:hover,
  .sidebar-dark-toggle:hover {
    background: #f3f4f6;
    border-color: rgba(15, 23, 42, 0.14);
    color: #111827;
  }

  .sidebar-plan-btn .spb-icon,
  .sidebar-settings-btn .ssb-icon,
  .sidebar-dark-toggle .sdt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #6b7280;
    flex: 0 0 auto;
  }
  .sidebar-plan-btn .spb-icon { color: #d97706; }

  .sidebar-plan-btn .spb-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .sidebar-plan-btn .spb-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
  }
  .sidebar-plan-btn .spb-meta {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-plan-btn .spb-meta.is-paid { color: #059669; }

  .sidebar-settings-btn .ssb-label,
  .sidebar-dark-toggle .sdt-label { flex: 1; min-width: 0; }

  .sidebar-plan-btn .ssb-chev,
  .sidebar-settings-btn .ssb-chev {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    line-height: 1;
  }

  body.dark .sidebar-plan-btn,
  body.dark .sidebar-settings-btn,
  body.dark .sidebar-dark-toggle {
    background: #18181c;
    border-color: rgba(255, 255, 255, 0.08);
    color: #d4d4d8;
  }

  body.dark .sidebar-plan-btn:hover,
  body.dark .sidebar-settings-btn:hover,
  body.dark .sidebar-dark-toggle:hover {
    background: #222228;
    border-color: rgba(255, 255, 255, 0.14);
    color: #f4f4f5;
  }

  body.dark .sidebar-plan-btn .spb-label { color: #f4f4f5; }
  body.dark .sidebar-plan-btn .spb-meta { color: #a1a1aa; }
  body.dark .sidebar-plan-btn .spb-meta.is-paid { color: #34d399; }
  body.dark .sidebar-plan-btn .spb-icon { color: #fbbf24; }
  body.dark .sidebar-settings-btn .ssb-icon,
  body.dark .sidebar-dark-toggle .sdt-icon { color: #a1a1aa; }

  .sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }

  .sidebar-user-card:hover {
    background: #f3f4f6;
    border-color: rgba(15, 23, 42, 0.14);
  }

  body.dark .sidebar-user-card {
    background: #18181c;
    border-color: rgba(255, 255, 255, 0.08);
  }

  body.dark .sidebar-user-card:hover {
    background: #222228;
    border-color: rgba(255, 255, 255, 0.14);
  }

  .sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #4338ca;
    color: #ffffff;
    font-size: 12px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
  }
  body.dark .sidebar-user-avatar { background: #4f46e5; }

  .sidebar-user-info { min-width: 0; flex: 1; }

  .sidebar-user-name {
    font-size: 13px; font-weight: 600;
    color: #111827;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  body.dark .sidebar-user-name { color: #f4f4f5; }

  .sidebar-user-status {
    font-size: 11px; color: #6b7280; font-weight: 500;
    display: flex; align-items: center; gap: 4px; margin-top: 1px;
  }
  body.dark .sidebar-user-status { color: #71717a; }

  .sidebar-status-dot { display: none; }

  /* ═══ DESKTOP MAIN CONTENT ══════════════════════════════════════ */

  .top-bar {
    margin-left: 248px !important;
    width: calc(100% - 248px) !important;
    max-width: calc(100vw - 248px) !important;
    box-sizing: border-box !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none !important;
  }

  body.dark .top-bar {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: none !important;
  }

  .top-bar-content {
    max-width: none !important;
    width: 100% !important;
  }

  .tab-nav {
    display: none !important;
  }

  .main {
    margin-left: 248px !important;
    width: calc(100% - 248px) !important;
    max-width: calc(100vw - 248px) !important;
    padding: 24px 28px !important;
    box-sizing: border-box !important;
    min-height: calc(100vh - 100px);
    overflow-x: hidden !important;
  }

  #appDock, #dockScrim, #dockSheet {
    display: none !important;
  }

  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
  }

  .card {
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none !important;
    transition: border-color 0.15s ease;
  }

  .card:hover {
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: none !important;
  }

  body.dark .card {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none !important;
  }
  body.dark .card:hover {
    border-color: rgba(255, 255, 255, 0.14);
  }

  .sect-title {
    font-size: 15px !important;
    letter-spacing: -0.015em;
  }

  #zoomControl {
    right: 24px !important;
    bottom: 24px !important;
  }
}
