/* The side panel, LaundryHub style: light, one flat list under small section
   headings, Settings as a single row (its sections live on the Settings page),
   and the signed-in person with a Log out button at the bottom.

   Uses new class names (lh-*) so none of the old dark-panel rules apply. Colours
   come from the app's theme tokens, so dark mode follows without a second set. */

body.has-rail .app-rail.rail-lh,
:root[data-theme="dark"] body.has-rail .app-rail.rail-lh {
  display: grid; grid-template-rows: auto 1fr auto; min-height: 0; padding: 0;
  background: var(--surface); color: var(--ink);
  border-right: 1px solid var(--line);
}

/* brand */
.lh-brand { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px; }
.lh-logo { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px;
  background: linear-gradient(135deg, #2F7BEA, #1C53A8); box-shadow: 0 6px 14px -6px rgba(28, 83, 168, .55); }
.lh-logo .logo-mark { width: 22px; height: 22px; color: #fff; --logo-knockout: #1C53A8; }
.lh-brand-name { font-size: 17px; font-weight: 700; line-height: 20px; color: var(--ink); }
.lh-brand-org { font-size: 12.5px; line-height: 16px; color: var(--ink-2); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the list */
.lh-scroll { overflow-y: auto; min-height: 0; padding: 4px 10px 10px; }
.lh-group { display: grid; gap: 1px; margin-top: 10px; }
.lh-title { padding: 0 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3, #94A3B8); }
.lh-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 0 12px;
  border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 500;
  text-align: left; cursor: pointer;
}
.lh-link .rail-ic { color: var(--ink-2); }
.lh-link .rail-ic svg { width: 19px; height: 19px; }
.lh-link:hover { background: var(--surface-2); }
.lh-link[aria-current="page"] { background: var(--t-blue-soft); color: var(--primary); font-weight: 600; }
.lh-link[aria-current="page"] .rail-ic { color: var(--primary); }
:root[data-theme="dark"] .lh-link[aria-current="page"] { color: #BBD2F6; }
:root[data-theme="dark"] .lh-link[aria-current="page"] .rail-ic { color: #BBD2F6; }
.lh-label { flex: 1; }
.lh-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--t-amber-soft); color: var(--t-amber); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.lh-badge.bad { background: #D9482B; color: #fff; }
.lh-badge[hidden] { display: none; }

/* signed-in person + Log out */
.lh-foot { padding: 10px; }
.lh-user { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.lh-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: var(--t-blue-soft); color: var(--primary); font-weight: 700; }
.lh-user-text { flex: 1; min-width: 0; }
.lh-user-name { font-size: 14.5px; font-weight: 700; line-height: 18px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-user-role { font-size: 12.5px; line-height: 16px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .lh-user-name { color: #8DB6F5; }
:root[data-theme="dark"] .lh-avatar { color: #BBD2F6; }
.lh-net { color: var(--t-green); font-weight: 600; }
.lh-net.off { color: var(--t-red); }
.lh-logout { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.lh-logout:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }
.lh-logout .rail-ic svg { width: 18px; height: 18px; }

/* Section lists (Settings, Reports, Accounting) as a horizontal tab strip across the top of the page
   (it used to be a long list inside the side menu). */
body.has-rail .with-nav:has(> .page-nav-rail) { display: block; }
body.has-rail .with-nav > .page-nav-rail {
  display: block; position: sticky; top: 0; z-index: 6; width: auto; max-height: none; overflow: visible;
  margin: 0 0 14px; padding: 0; border: 0; border-radius: 0; background: var(--bg);
}
.page-nav-rail .rail-heading { display: none; }
body.has-rail .page-nav-rail nav.page-nav { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; align-items: stretch; width: auto !important; max-height: none !important; gap: 2px; overflow: visible; padding: 0 2px; border-bottom: 1px solid var(--line); }
.page-nav-rail .page-nav-group { display: none; }
body.has-rail .page-nav-rail nav.page-nav .page-nav-item {
  flex: 0 0 auto !important; display: flex; align-items: center; width: auto !important; padding: 12px 14px; margin: 0;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.page-nav-rail .page-nav-item:hover { color: var(--ink); background: none; }
.page-nav-rail .page-nav-ic, .page-nav-rail .page-nav-sub { display: none; }
.page-nav-rail .page-nav-text { display: block; }
.page-nav-rail .page-nav-item[aria-current="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: none; }
:root[data-theme="dark"] .page-nav-rail .page-nav-item[aria-current="true"] { color: #BBD2F6; border-bottom-color: #BBD2F6; }

.page-nav-rail .page-nav-item[hidden] { display: none !important; }

/* The Save settings bar used to be stuck to the bottom of the screen, covering whatever
   sat beneath it. It now sits at the end of the form like any other content, and only
   floats (slim) while there are unsaved changes, so Save is in reach when it matters. */
body.has-rail .with-nav-body .save-bar {
  position: static; margin: 16px 0 8px; padding: 10px 14px; border-radius: 12px; box-shadow: none;
}
body.has-rail .with-nav-body .save-bar:has(.unsaved:not([hidden])) {
  position: sticky; bottom: 8px; box-shadow: 0 -4px 14px -8px rgba(20, 16, 13, .35);
}
body.has-rail .with-nav-body .save-bar .btn.primary { min-height: 38px; padding: 0 20px; }

/* 2.19.3 - the four rows every signed-in person gets at the top of the menu:
   Dashboard, Sales, Messages, Shift. The Shift row says "Open shift" or
   "Close shift" and carries a dot: green while a shift is open, amber when not. */
.lh-group.lh-top { margin-top: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lh-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--ink-3, #94A3B8); }
[data-shift="open"] .lh-dot { background: var(--t-green, #15803D); box-shadow: 0 0 0 3px var(--t-green-soft, rgba(21, 128, 61, .18)); }
[data-shift="closed"] .lh-dot { background: var(--t-amber, #B45309); }
.drawer-link .rail-ic { display: inline-grid; place-items: center; flex: 0 0 auto; color: inherit; }
.drawer-link .rail-ic svg { width: 20px; height: 20px; }
.drawer-link .lh-dot, .drawer-link .sx-msg-badge { margin-left: auto; }
.sx-item.sx-shift .lh-dot { margin-left: auto; }
.sx-msg.sx-msg-static { cursor: default; }
/* Fingers, not a mouse, on most till tablets: give every menu row room. */
@media (pointer: coarse) {
  .lh-link, .drawer-link, .sx-item { min-height: 44px; }
}
/* The till's own side panel on a tablet or phone: the four rows sit in one
   full-width strip (two by two on a phone) instead of running off the edge. */
@media (max-width: 820px) {
  html[data-layout="simple"] .qb-sidebar .sx-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; width: 100%; }
  html[data-layout="simple"] .qb-sidebar .sx-nav .sx-item { min-width: 0; padding: 0 8px; }
}
@media (max-width: 560px) {
  html[data-layout="simple"] .qb-sidebar .sx-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
