/* dw3-chrome.css — DW3 B7: the global chrome row (search + bell),
 * the bell's panel and the search palette. Loaded last (after the
 * B7 marker); rules use body.skin-billdr like every light-skin sheet. */

/* ---------- the row under the logo: [ Search … / ] [ bell ] ---------- */
body.skin-billdr #topbar .gc-row {
  display: flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 0 2px;
}
body.skin-billdr #topbar .gs-trigger {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px;
  border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl); background: var(--ds-bg);
  color: var(--ds-muted); font: inherit; font-size: var(--ds-fs-sm); cursor: pointer; text-align: left;
}
body.skin-billdr #topbar .gs-trigger:hover { border-color: var(--ds-line-strong); color: var(--ds-navy); background: var(--ds-card); }
body.skin-billdr #topbar .gs-trigger:focus-visible { outline: none; box-shadow: var(--ds-focus); }
body.skin-billdr #topbar .gs-trigger .ico { width: 15px; height: 15px; flex: none; }
.gs-trigger-t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-kbd {
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ds-muted, #6b7685);
  border: 1px solid var(--ds-line, #e3e7ec); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: var(--ds-card, #fff);
}
body.skin-billdr #topbar .nb-wrap { position: relative; flex: none; display: inline-flex; }
body.skin-billdr #topbar .nb-bell {
  position: relative; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl); background: var(--ds-card); color: #4c5869; cursor: pointer; padding: 0;
}
body.skin-billdr #topbar .nb-bell:hover, body.skin-billdr #topbar .nb-bell[aria-expanded="true"] { background: var(--ds-bg); color: var(--ds-navy); border-color: var(--ds-line-strong); }
body.skin-billdr #topbar .nb-bell:focus-visible { outline: none; box-shadow: var(--ds-focus); }
body.skin-billdr #topbar .nb-bell .ico { width: 19px; height: 19px; }
body.skin-billdr #topbar .nb-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ds-danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--ds-card);
}
body.skin-billdr #topbar .nb-count.hidden { display: none; }
/* One count on screen: the bell carries it; the nav entry's badge
 * (same number, same computation) steps aside while the bell is up. */
body.skin-billdr.has-nb #topbar #foryou-badge { display: none; }

/* ---------- the bell's panel ---------- */
.nb-panel {
  position: fixed; z-index: 260; max-height: min(560px, calc(100vh - 90px)); display: flex; flex-direction: column;
  background: var(--ds-card, #fff); border: 1px solid var(--ds-line, #e3e7ec); border-radius: var(--ds-r, 12px);
  box-shadow: var(--ds-shadow-pop, 0 18px 40px -16px rgba(15, 34, 51, .35)); overflow: hidden;
}
.nb-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--ds-hair, #eef1f5); }
.nb-head h2 { margin: 0; flex: 1; font-size: var(--ds-fs-md, 15px); font-weight: 700; color: var(--ds-navy, #0f2233); }
.nb-markall { color: var(--ds-navy, #0f2233); font-weight: 600; font-size: var(--ds-fs-sm, 13px); }
.nb-markall:disabled { color: var(--ds-faint, #9aa4b1); cursor: default; text-decoration: none; }
.nb-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.nb-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 16px; border: 0; background: none;
  text-align: left; font: inherit; cursor: pointer; color: var(--ds-ink, #1f2a37); position: relative;
}
.nb-item:hover { background: var(--ds-bg, #f4f6f9); }
.nb-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ds-navy, #0f2233); }
.nb-item.nb-nodoor { cursor: default; }
.nb-item.nb-nodoor:hover { background: none; }
.nb-item .nb-av { width: 30px; height: 30px; font-size: 10.5px; flex: none; margin: 1px 0 0; }
.nb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nb-what { font-size: var(--ds-fs-sm, 13px); font-weight: 600; color: var(--ds-navy, #0f2233); line-height: 1.35; }
.nb-item:not(.is-new) .nb-what { font-weight: 500; color: var(--ds-ink, #1f2a37); }
.nb-body { font-size: var(--ds-fs-sm, 13px); color: var(--ds-ink, #1f2a37); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: var(--ds-fs-xs, 12px); color: var(--ds-muted, #6b7685); margin-top: 2px; }
.nb-proj { --nb-tint: var(--ds-line-strong, #c9d0d9); display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--ds-ink, #1f2a37); max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--nb-tint); flex: none; }
.nb-newdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ds-danger, #c0392b); flex: none; margin-top: 6px; }
.nb-empty { margin: 0; padding: 22px 16px; font-size: var(--ds-fs-sm, 13px); color: var(--ds-muted, #6b7685); line-height: 1.5; }
.nb-foot { border-top: 1px solid var(--ds-hair, #eef1f5); padding: 8px; }
.nb-openall {
  width: 100%; height: 38px; border: 0; border-radius: var(--ds-r-sm, 8px); background: var(--ds-bg, #f4f6f9);
  color: var(--ds-navy, #0f2233); font: inherit; font-size: var(--ds-fs-sm, 13px); font-weight: 700; cursor: pointer;
}
.nb-openall:hover { background: var(--ds-nav-active, #e8edf3); }

/* ---------- the search palette ---------- */
.gs-overlay {
  position: fixed; inset: 0; z-index: 280; background: rgba(15, 34, 51, .32);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
}
.gs-box {
  width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--ds-card, #fff); border-radius: var(--ds-r, 12px); border: 1px solid var(--ds-line, #e3e7ec);
  box-shadow: 0 30px 70px -24px rgba(15, 34, 51, .5);
}
.gs-inrow { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--ds-line, #e3e7ec); color: var(--ds-muted, #6b7685); }
.gs-inrow > .ico { width: 18px; height: 18px; flex: none; }
.gs-inrow .gs-q {
  flex: 1; min-width: 0; height: 54px; border: 0 !important; outline: none; box-shadow: none !important; background: transparent;
  font: inherit; font-size: 16px; color: var(--ds-ink, #1f2a37); padding: 0;
}
.gs-inrow .gs-q::-webkit-search-cancel-button { display: none; }
.gs-results { overflow-y: auto; flex: 1; padding: 6px 0 8px; }
.gs-group { margin: 10px 16px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ds-muted, #6b7685); }
.gs-group span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ds-faint, #9aa4b1); }
.gs-item {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 12px); margin: 0 6px; padding: 8px 10px;
  border: 0; border-radius: var(--ds-r-sm, 8px); background: none; font: inherit; text-align: left; cursor: pointer; color: var(--ds-ink, #1f2a37);
}
.gs-item.on { background: var(--ds-nav-active, #e8edf3); }
.gs-ico {
  --gs-tint: var(--ds-muted, #6b7685); width: 32px; height: 32px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--gs-tint) 12%, #fff); color: var(--gs-tint);
}
.gs-ico .ico { width: 17px; height: 17px; }
.gs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gs-t { font-size: 14px; font-weight: 600; color: var(--ds-navy, #0f2233); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-s { font-size: 12.5px; color: var(--ds-muted, #6b7685); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item mark { background: var(--ds-gold-tint, #f6efdf); color: inherit; border-radius: 3px; padding: 0 1px; }
.gs-tag { font-size: 11px; font-weight: 600; color: var(--ds-muted, #6b7685); background: var(--ds-neutral-bg, #eef1f4); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.gs-go { color: var(--ds-faint, #9aa4b1); opacity: 0; }
.gs-item.on .gs-go { opacity: 1; }
.gs-hint { margin: 0; padding: 18px 18px 14px; font-size: var(--ds-fs-sm, 13px); color: var(--ds-muted, #6b7685); line-height: 1.5; }
.gs-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--ds-hair, #eef1f5); font-size: 12px; color: var(--ds-muted, #6b7685); line-height: 1.45; background: var(--ds-bg, #f7f9fb); }

/* ---------- narrow: the sidebar is a top bar ---------- */
@media (max-width: 900px) {
  body.skin-billdr #topbar .gc-row { margin: 0; padding: 0; order: 0; flex: none; }
  body.skin-billdr #topbar .gs-trigger { flex: none; width: 36px; padding: 0; justify-content: center; }
  body.skin-billdr #topbar .gs-trigger .gs-trigger-t,
  body.skin-billdr #topbar .gs-trigger .gs-kbd { display: none; }
  .gs-overlay { padding-top: 64px; }
  .gs-box { max-height: calc(100vh - 80px); }
}
@media (max-width: 560px) {
  .gs-overlay { padding: 8px; }
  .gs-group span { display: none; }
}

/* ---------- wave359-mobile (2026-11-03): the phone top bar ----------
 * Micheal's iPhone screenshot: the ≤900 bar crammed the brand, the
 * search + bell row, the whole nav, quick-add, the avatar and a
 * wrapping Sign out button into one 390px row — "My project…"
 * clipped, Sign out standing in a tall box, the logo squeezed out
 * entirely. The bar's phone shape: the nav is the one flexible
 * scroller (its scrollbar hidden), the separate Sign out button
 * goes (sign-out lives in the avatar's account menu), quick-add
 * loses its desktop margins, and ≤640 the brand lockup steps aside
 * — the page title says where you are. Desktop/sidebar untouched. */
@media (max-width: 900px) {
  body #topbar nav { flex: 1 1 auto; min-width: 0; scrollbar-width: none; }
  body #topbar nav::-webkit-scrollbar { display: none; }
  body #topbar .userbox { flex: none; }
  body #topbar .userbox #btn-logout { display: none; }
  body #topbar .dsx-quick-btn { margin: 0; flex: none; }
}
@media (max-width: 640px) {
  body #topbar { gap: 8px; padding: 0 10px; }
  body #topbar .brand { display: none; }
  body #topbar .navbtn { padding: 8px 10px; }
}

/* ---------- wave361-mnav (2026-11-03): the phone menu ----------
 * The ≤900 strip asked a phone user to swipe through ~35 entries
 * one at a time — Micheal: "no side menu". At bar widths the strip
 * steps aside and a hamburger (mobile-nav.js) opens a drawer with
 * the same entries at full width. Desktop keeps the sidebar.
 * wave584-pnav (2026-11-10): the burger shows inside a project too,
 * where the drawer's rows are the project's sections — and the
 * rail's in-bar section strip steps aside at bar widths so the
 * drawer is the single way in and the bar stays one row. The
 * project's Back button and identity head stay in the bar. */
.mnav-btn { display: none; }
@media (max-width: 900px) {
  body #topbar nav { display: none; }
  body #topbar .mnav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: none; padding: 0; cursor: pointer;
    background: rgba(255, 255, 255, .08); color: #fff;
    border: 1px solid rgba(255, 255, 255, .25); border-radius: 9px;
  }
  body #topbar .mnav-btn .ico { width: 21px; height: 21px; }
  body.in-project #proj-rail .pr-nav { display: none; }
}
.mnav-drawer { position: fixed; inset: 0; z-index: 900; }
.mnav-drawer[hidden] { display: none; }
.mnav-backdrop { position: absolute; inset: 0; background: rgba(10, 6, 24, .5); }
.mnav-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(320px, 86vw);
  background: #2A095E; color: #e8e2f4; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 18px 0 44px -18px rgba(10, 6, 24, .55); padding: 10px 10px 22px;
}
.mnav-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 16px; padding: 6px 8px 12px;
}
.mnav-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px;
}
.mnav-close .ico { width: 18px; height: 18px; }
.mnav-sec {
  font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase;
  color: #b9a8d9; padding: 16px 10px 6px;
}
.mnav-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 10px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: inherit; font: inherit; font-size: 15px; text-align: left;
}
.mnav-row:hover { background: rgba(255, 255, 255, .08); }
.mnav-row.active { background: rgba(192, 160, 96, .22); box-shadow: inset 3px 0 0 var(--gold, #c0a060); }
.mnav-ico { width: 21px; flex: none; display: inline-flex; justify-content: center; }
.mnav-ico .ico { width: 20px; height: 20px; }
.mnav-label { flex: 1; min-width: 0; }
.mnav-badge {
  flex: none; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
  background: var(--danger, #c0392b); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 19px; text-align: center;
}

/* ---------- wave362-tablet (2026-11-03): the tablet band ----------
 * Device strategy (Micheal, 2026-11-03): tablets run the full portal.
 * Until now the band between phone and desktop had almost no rules of
 * its own: above 900px the shell was the pure desktop layout (236px
 * sidebar), and iPad portrait fell into the phone band. This block
 * gives 901-1240px a sidebar that steps back (204px) so the work
 * surfaces get the width, finger-sized nav and quote-editor controls,
 * and gives portrait tablets (700-900 wide, tall screens only - the
 * min-height keeps landscape phones out) board lanes that run two-up
 * with snap instead of the desktop squeeze. Desktop >1240 and the
 * verified phone shapes <=900 are untouched. Proof is Micheal's iPad. */
@media (min-width: 901px) and (max-width: 1240px) {
  #topbar { width: var(--rail-w); padding-left: 10px; padding-right: 10px; }
  .brand .topbar-logo { width: 158px; }
  body:has(#topbar:not(.hidden)) #app { margin-left: var(--rail-w); }
  #view-projects:has(> #projects-kanban:not(.hidden)) { width: calc(100vw - var(--rail-w, 236px)); }
  #view-dashboard.dash-boarding { width: calc(100vw - var(--rail-w, 236px)); }
  body.skin-billdr #topbar .navbtn { min-height: 44px; }
  .quote-wizard :where(input[type="text"], input[type="date"], input:not([type]), select) { min-height: 40px; }
}
@media (min-width: 700px) and (max-width: 900px) and (min-height: 700px) {
  .kb-lanes { scroll-snap-type: x proximity; }
  .kb-col { min-width: min(300px, 44vw); scroll-snap-align: start; }
}

/* ---------- wave594-edgestrip (2026-11-11): the Pipedrive edge strip ----------
 * #topbar scrolls its own content (overflow-y:auto), so the Collapse
 * button under the logo — and the folded state's Expand, the same
 * button — scrolls out of reach inside the rail. The owner asked for
 * the collapse "like Pipedrive has": #rail-edge is a full-height
 * strip riding the rail's RIGHT EDGE (rail-toggle.js creates and
 * wires it; body-level + position:fixed, so the rail's own scroll
 * can never carry it away), invisible until hovered or focused,
 * with its own tag (#rail-edge-tip, the #rail-tip paint). A click
 * dispatches to the existing #rail-toggle / #pr-collapse — the
 * buttons stay; this is only a second door onto them. (wave603
 * briefly made this strip a drag handle; wave618 removed that —
 * the strip is click-only again.) z-index 60:
 * above #topbar (50), under the panels. Offsets: the strip's left
 * edge = the rail's width − its own 12px, via --rail-w in every
 * rail state. The folded rules carry two body classes, so they
 * outrank the band's width rule inside 901–1240 too: a fold is
 * 64px at every desktop width. */
#rail-edge {
  position: fixed; top: 0; bottom: 0; left: calc(var(--rail-w, 236px) - 12px); width: 12px; z-index: 60;
  padding: 0; border: 0; background: transparent; opacity: 0; cursor: ew-resize;
  transition: opacity .15s ease, background .15s ease;
}
#rail-edge:hover, #rail-edge:focus-visible { opacity: 1; background: rgba(192, 160, 96, .45); }
body.in-project:not(.proj-rail-min) #rail-edge { left: calc(var(--rail-w, 236px) - 12px); }
body.rail-min:not(.in-project) #rail-edge { left: calc(var(--rail-w, 236px) - 12px); }
body.in-project.proj-rail-min #rail-edge { left: calc(var(--rail-w, 236px) - 12px); }
#rail-edge-tip {
  position: fixed; transform: translateY(-50%); z-index: 200; pointer-events: none;
  background: #0b2235; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.2;
  padding: 5px 10px; border-radius: 8px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(11, 34, 53, .28); opacity: 0; transition: opacity .12s ease;
}
#rail-edge-tip.on { opacity: 1; }
@media (min-width: 901px) and (max-width: 1240px) {
  #rail-edge { left: calc(var(--rail-w, 236px) - 12px); }
  body.in-project:not(.proj-rail-min) #rail-edge { left: calc(var(--rail-w, 236px) - 12px); }
}
/* Phones keep the wave584 drawer; both toggles already hide there. */
@media (max-width: 900px) {
  #rail-edge { display: none; }
  #rail-edge-tip { display: none; }
}

/* ---------- wave618-railsnap (2026-11-11): one fixed rail width ----------
 * --rail-w is the shell's effective rail width, and it is FIXED.
 * Micheal reversed the wave603 drag-resize the day it landed, so
 * nothing in JS sets --rail-w any more: index-inline.js clears the
 * stored rkRailW / rkProjRailW device widths and nothing reads
 * them. Each rail has exactly ONE expanded width — main 236px on
 * desktop and 204px in the tablet step-back band, project 236px —
 * and the click folds snap it to 64px. The state values below are
 * the whole story, so a fold is always 64px at every desktop
 * width and the tablet step-back remains fixed at its band values. */
body { --rail-w: 236px; }
@media (min-width: 901px) and (max-width: 1240px) {
  body:not(.in-project) { --rail-w: 204px !important; }
  body.in-project:not(.proj-rail-min) { --rail-w: 236px !important; }
}
@media (min-width: 901px) {
  body.rail-min:not(.in-project), body.in-project.proj-rail-min { --rail-w: 64px !important; }
}
