/* ==========================================================================
   SHOPIFY-SHELL-1: admin shell restyled to match the Shopify admin reference
   (black top bar, grey sidebar, light canvas). Desktop only (>=861px): the
   phone drawer / bottom nav / "More" sheet are untouched.
   Loaded LAST (after product-form.css). Pure CSS + js/shopify-shell.js.
   To roll back, delete the <link> to this file and the <script> for the JS.

   Reference measurements: the screenshot is a 150% display, so
   1 CSS px = 1.5 screenshot px. Every value below was read off that image:
     top bar  56px  #0A0A0A      sidebar 240px  #EBEBEB      canvas #FBFBFB
     search   640x36, centred in the viewport, #282828, radius 8
     nav row  28px, radius 8, 13px, text #303030, active pill #FAFAFA
     plan card 216x104 at the foot of the sidebar, radius 8
   ========================================================================== */
/* Polaris glyphs exist only for the desktop shell; everywhere else (phones, More sheet) they stay hidden. */
.i-pol, .i-pol-f { display: none !important; }

@media (min-width: 861px) {

  :root {
    --header-h: 56px;
    --sidebar-w: 240px;
    --bg: #FBFBFB;
    --color-bg: #FBFBFB;
  }
  /* The collapsible rail (SIDEBAR-COLLAPSE-1) does not exist in the reference: always show the full 240px sidebar. */
  html.sb-collapsed { --sidebar-w: 240px; }
  .sidebar-collapse-toggle { display: none !important; }
  html.sb-collapsed .nav-link { gap: 8px; }
  html.sb-collapsed .nav-link .nav-label,
  html.sb-collapsed .sidebar-user .who {
    position: static !important; width: auto; height: auto; margin: 0; clip: auto; clip-path: none; overflow: visible;
  }

  body { background: #FBFBFB; }
  .main { margin-left: 240px; padding-top: 56px; background: #FBFBFB; transition: none; }

  /* ------------------------------ Top bar ------------------------------ */
  .topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: 56px; padding: 0 16px 0 20px; gap: 0;
    background: #0A0A0A; border-bottom: 0; box-shadow: none;
  }
  .topbar-left { flex: 0 0 auto; gap: 0; }

  /* Brand slot (left): the store's logo + name. Not interactive on desktop. */
  .topbar-store {
    display: flex !important; align-items: center; gap: 8px; height: 28px; padding: 0; margin: 0;
    background: none; border: 0; color: #FFFFFF; cursor: default; pointer-events: none;
  }
  .topbar-store .mark {
    flex: none; width: 24px; height: 24px; padding: 2px; border-radius: 6px; box-sizing: border-box;
    background: #FFFFFF; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  }
  .topbar-store .mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }
  .topbar-store .mark.is-initial { padding: 0; color: #0A0A0A; font-size: 13px; font-weight: 700; line-height: 1; }
  .topbar-store b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 24px; color: #FFFFFF; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-store i.ai { display: none; }

  /* Search: 640 x 36, centred in the viewport */
  .topbar-search {
    position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
    width: min(640px, calc(100vw - 560px)); min-width: 220px; height: 36px; box-sizing: border-box;
    padding: 0 10px 0 9px; gap: 2px; border-radius: 8px;
    background: #282828; border: 1px solid #303030; border-top-color: #474747; box-shadow: none;
  }
  .topbar-search:hover { border-color: #303030; border-top-color: #474747; background: #2C2C2C; }
  .topbar-search:focus-within { background: #2C2C2C; border-color: #5A5A5A; box-shadow: none; }
  .topbar-search i { display: inline-flex; width: 20px; height: 20px; font-size: 20px; color: #DCDCDC; flex: none; }
  .topbar-search i svg.i-svg { width: 20px; height: 20px; }
  .topbar-search input { font-size: 14px; line-height: 20px; color: #F3F3F3; min-width: 0; }
  .topbar-search input::placeholder { color: #DCDCDC; opacity: 1; }
  .tb-kbd { display: inline-flex; gap: 4px; flex: none; margin-left: auto; }
  .tb-kbd kbd {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px;
    background: #2F2F2F; color: #A6A6A6; font: 500 11px/1 var(--font, 'Inter', sans-serif); letter-spacing: .02em;
  }

  /* Right side: icon buttons + account */
  .topbar-right { gap: 8px; }
  .topbar .icon-btn {
    width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #E3E3E3;
  }
  .topbar .icon-btn i { width: 18px; height: 18px; font-size: 18px; display: inline-flex; }
  .topbar .icon-btn i svg.i-svg { width: 18px; height: 18px; }
  .topbar .icon-btn:hover, .topbar .icon-btn:focus-visible { background: rgba(255, 255, 255, .10); color: #FFFFFF; }
  .topbar .icon-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: -2px; }
  .topbar .icon-btn .notif-dot { top: 7px; right: 7px; border-color: #0A0A0A; }

  .topbar-account { flex-direction: row-reverse; gap: 8px; margin: 0 0 0 4px; padding: 0; border: 0; }
  .topbar-account .who { text-align: left; line-height: 20px; }
  .topbar-account .who b { font-size: 13px; font-weight: 600; line-height: 20px; color: #F7F7F7; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-account .who span { display: none; }
  .topbar-account .av {
    position: relative; width: 28px; height: 28px; border-radius: 6px; background: #51C0FF; color: #0A2A3A;
    font-size: 11px; font-weight: 700; letter-spacing: .01em; overflow: hidden;
  }
  .topbar-account .av:hover, .topbar-account .av:focus-visible { background: #6FCBFF; color: #0A2A3A; }
  .topbar-account .av:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
  .topbar-account .av i { display: none; }
  .topbar-account .av::after { content: attr(data-initials); line-height: 1; }

  /* ------------------------------ Sidebar ------------------------------ */
  .sidebar {
    top: 56px; width: 240px; background: #EBEBEB; color: #303030;
    border-right: 0; box-shadow: none; transition: none; overflow: visible;
  }
  .sidebar-brand { display: none; }   /* brand lives in the top bar now */

  .sidebar-nav {
    display: flex; flex-direction: column; padding: 12px 12px 8px 10px; border: 0;
    overflow-x: hidden; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .22) transparent;
  }
  .sidebar-nav::-webkit-scrollbar { width: 8px; }
  .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .22); border-radius: 8px; border: 2px solid #EBEBEB; }
  .sidebar .nav-section { margin: 0; }
  .sidebar .nav-divider { display: none; }

  /* Section captions are not part of the reference; only the two that start a separate block stay. */
  .sidebar .nav-section-label { display: none; }
  #navSectionPlatform .nav-section-label,
  #navSectionChannels .nav-section-label {
    display: flex; align-items: center; height: 28px; padding: 0 8px 0 10px;
    font-size: 13px; font-weight: 500; line-height: 20px; letter-spacing: 0; text-transform: none; color: #303030;
  }
  #navSectionPlatform { margin-bottom: 9px; }
  #navSectionChannels { order: 2; margin-top: 9px; }   /* Content (Blog) sits above "Channels", as in the reference */

  #sidebar .nav-link,
  #sidebar .nav-link:hover:not(.active),
  #sidebar .nav-link.active,
  #sidebar .nav-link.active:hover,
  #sidebar .nav-link:active {
    background-image: none; box-shadow: none; transform: none;   /* the reference is flat: no raised-button chrome */
  }
  #sidebar .nav-link {
    height: 28px; padding: 0 8px; margin: 0; gap: 8px; box-sizing: border-box;
    border-radius: 8px; background-color: transparent; color: #303030;
    font-size: 13px; line-height: 20px; font-weight: 450; letter-spacing: 0;
    transition: background-color .12s ease;
  }
  #sidebar .nav-link .nav-label { font-size: 13px; line-height: 20px; font-weight: inherit; }
  #sidebar .nav-link i { width: 20px; height: 20px; font-size: 16px; color: #4A4A4A; transition: none; }
  #sidebar .nav-link i svg.i-svg { width: 16px; height: 16px; }
  #sidebar .nav-link:hover:not(.active) { background-color: rgba(0, 0, 0, .06); color: #303030; }
  #sidebar .nav-link:hover i { color: #303030; }
  #sidebar .nav-link.active,
  #sidebar .nav-link.active:hover { background-color: #FAFAFA; color: #303030; font-weight: 550; }
  #sidebar .nav-link.active i,
  #sidebar .nav-link.active:hover i { color: #303030; }
  #sidebar .nav-link:focus-visible { outline: 2px solid #303030; outline-offset: -2px; }
  #sidebar #logoutLink:hover, #sidebar #logoutLink:hover i { color: #B42318; }

  /* ---- Foot: Settings (+ Logout) then the plan card, pinned to the bottom ---- */
  .sidebar-foot { padding: 0 12px 12px 10px; border: 0; }
  .sidebar-foot .nav-section { margin: 0 0 12px; }
  .sidebar-user { display: none; }

  .sidebar-plan {
    margin-left: 2px; padding: 12px; border-radius: 8px; box-sizing: border-box;
    background: linear-gradient(180deg, #06171A 0%, #040D0F 50%, #000001 100%);
  }
  .sidebar-plan[hidden] { display: none; }
  .sidebar-plan .sp-line1 { font-size: 13px; line-height: 20px; color: #B5B5B5; }
  .sidebar-plan .sp-line2 { font-size: 14px; line-height: 20px; font-weight: 600; color: #E3E3E3; }
  .sidebar-plan .sp-btn {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 28px; margin-top: 12px; padding: 0;
    border: 0; border-radius: 8px; background: #FFFFFF; color: #303030;
    font: 600 13px/20px var(--font, 'Inter', sans-serif); text-decoration: none; cursor: pointer;
  }
  .sidebar-plan .sp-btn:hover { background: #F1F1F1; }
  .sidebar-plan .sp-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

  /* ---- Shopify Polaris icons (js/icons-polaris.js) ----
     Sidebar: solid glyph on idle rows, outline glyph on the active row (as in the reference).
     Top bar / search: outline glyphs. Lucide is hidden wherever a Polaris glyph exists. */
  #sidebar i.ai:has(.i-pol) .i-lu,
  .topbar i.ai:has(.i-pol) .i-lu { display: none; }
  #sidebar i.ai .i-pol, #sidebar i.ai .i-pol-f,
  .topbar i.ai .i-pol { display: inline-block !important; width: 20px; height: 20px; fill: currentColor; }
  #sidebar i.ai:has(.i-pol-f) .i-pol { display: none !important; }
  #sidebar .nav-link.active i.ai:has(.i-pol-f) .i-pol { display: inline-block !important; }
  #sidebar .nav-link.active i.ai .i-pol-f { display: none !important; }
  #sidebar .nav-link i svg.i-pol, #sidebar .nav-link i svg.i-pol-f { width: 20px; height: 20px; }
  .topbar .icon-btn i svg.i-pol, .topbar-search i svg.i-pol { width: 20px; height: 20px; }
  .topbar-search svg.i-svg.i-pol { color: #DCDCDC; }
  .topbar .icon-btn svg.i-svg.i-pol { color: inherit; }
}

/* ---- Shopify Polaris icons on phones (ADMIN-BLUE-2) ----
   Same glyph set as the desktop shell. Bottom nav + More sheet: outline when idle, filled on the active tab
   (like the Shopify mobile app). POS keeps the filled Store glyph on its blue circle. Lucide stays as the
   fallback for any icon without a Polaris equivalent. */
@media (max-width: 860px) {
  .mobile-bottom-nav i.ai:has(.i-pol) .i-lu,
  .more-tile-ic i.ai:has(.i-pol) .i-lu,
  .topbar i.ai:has(.i-pol) .i-lu { display: none; }

  .mobile-bottom-nav i.ai .i-pol,
  .more-tile-ic i.ai .i-pol,
  .topbar i.ai .i-pol { display: inline-block !important; width: 24px; height: 24px; fill: currentColor; }
  .more-tile-ic i.ai .i-pol { width: 22px; height: 22px; }
  .topbar i.ai .i-pol { width: 20px; height: 20px; }

  /* active tab / tile -> filled glyph when one exists */
  .bottom-nav-link.active i.ai:has(.i-pol-f) .i-pol,
  .more-tile.active .more-tile-ic i.ai:has(.i-pol-f) .i-pol { display: none !important; }
  .bottom-nav-link.active i.ai .i-pol-f,
  .more-tile.active .more-tile-ic i.ai .i-pol-f { display: inline-block !important; width: 24px; height: 24px; fill: currentColor; }
  .more-tile.active .more-tile-ic i.ai .i-pol-f { width: 22px; height: 22px; }

  /* POS: filled Store glyph on the circle, always */
  .bottom-nav-pos i.ai:has(.i-pol-f) .i-pol { display: none !important; }
  .bottom-nav-pos i.ai .i-pol-f { display: inline-block !important; width: 22px; height: 22px; fill: currentColor; }
}
