/* =====================================================================
   Connectwell UI kit — CIS shell: menu, top bar and page frame.
   Same measurements as the UI/UX mockup (ui.css .sb / .topbar / .content).
   The menu markup is _LayoutMainSidebarDynamic.cshtml, the top bar
   _LayoutMainHeader.cshtml; behaviour is in js/kit/cw-shell.js.
   ===================================================================== */

/* ---------------- Page frame ---------------- */
#mainDashboard.dashboard { margin-left: var(--sb-w); width: calc(100% - var(--sb-w)); transition: margin-left .25s ease, width .25s ease; }
#mainDashboard.dashboard.sidebar-collapsed { margin-left: var(--sb-rail); width: calc(100% - var(--sb-rail)); }
/* overflow: clip keeps the page from scrolling sideways like hidden did, without stopping the sticky top bar */
#mainDashboard > .dashboard__body.overflow-hidden { overflow: clip !important; }
/* the page gutter: 16px on every side (global.css forced 25px 20px !important) */
.dashboard__body main.detail__content { padding: var(--s4) !important; }
.dashboard__body main .dashboard__table { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--card); box-shadow: var(--sh-1); padding: 0; overflow: visible; }

/* ---------------- Menu ---------------- */
#sidebar.cw-sb {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w) !important; min-height: 0; height: 100vh;
  background: var(--card); color: var(--text); border-right: 1px solid var(--line); box-shadow: 0 0 15px rgba(0, 0, 0, .06);
  display: flex; flex-direction: column; z-index: 1000; transition: width .25s ease; font-size: var(--fs-md);
}
#sidebar.cw-sb.collapsed { width: var(--sb-rail) !important; }

#sidebar .cw-sb__logo { height: var(--h-top); min-height: var(--h-top); display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); border-bottom: 1px solid var(--line); margin: 0; flex: 0 0 auto; background: var(--card); }
#sidebar .cw-sb__brand { display: flex; align-items: center; text-decoration: none; min-width: 0; }
#sidebar .cw-sb__brand .dashboard__logo-full { height: 26px; width: auto; max-height: 26px; display: block; }
#sidebar .cw-sb__brand .dashboard__logo-icon { display: none; width: 30px; height: 30px; }
#sidebar .cw-sb__app { font-size: 11px; font-weight: 800; letter-spacing: .6px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-sm); padding: 1px 6px; line-height: 1.4; }
#sidebar.collapsed .cw-sb__logo { justify-content: center; padding: 0; }
#sidebar.collapsed .cw-sb__brand .dashboard__logo-full, #sidebar.collapsed .cw-sb__app { display: none; }
#sidebar.collapsed .cw-sb__brand .dashboard__logo-icon { display: block; }

#sidebar .cw-menu-tools { display: flex; gap: var(--s1); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-2); align-items: center; flex: 0 0 auto; }
#sidebar .cw-menu-find { flex: 1 1 auto; position: relative; min-width: 0; }
#sidebar .cw-menu-find input { width: 100%; height: 30px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 var(--s2) 0 28px; font-size: var(--fs-sm); background: var(--bg); color: var(--text); outline: none; }
#sidebar .cw-menu-find input::-webkit-search-cancel-button { cursor: pointer; }
#sidebar .cw-menu-find input:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-ring); }
#sidebar .cw-menu-find .cw-i { position: absolute; left: 8px; top: 8px; width: 14px; height: 14px; color: var(--faint); }
#sidebar .cw-menu-tool { width: 28px; height: 28px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--text-2); display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; cursor: pointer; }
#sidebar .cw-menu-tool:hover { background: var(--hover); color: var(--text); }
#sidebar .cw-menu-tool .cw-i { width: 15px; height: 15px; }
#sidebar.collapsed .cw-menu-tools { display: none; }

#sidebar .dashboard__nav.cw-sb__nav { flex: 1 1 auto; height: auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 0 var(--s3); margin: 0; overflow-anchor: none; }
#sidebar .dashboard__navLinks { list-style: none; margin: 0 !important; padding: 0; gap: 0 !important; }
#sidebar .cw-sb__nav::-webkit-scrollbar { width: 6px; }
#sidebar .cw-sb__nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; border: 0; }

/* Sections */
#sidebar .cw-sec { list-style: none; margin: 0; padding: 0; }
#sidebar .cw-sec__hd { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-2); cursor: pointer; user-select: none; white-space: nowrap; margin: 0; position: static; }
#sidebar .cw-sec__hd:hover { color: var(--text); background: var(--hover); }
#sidebar .cw-sec__hd::after { display: none !important; }
#sidebar .cw-sec__hd .cw-sec__ic { width: 13px; height: 13px; }
#sidebar .cw-sec__hd .cw-chev { margin-left: auto; width: 12px; height: 12px; transition: transform .2s; }
#sidebar .cw-sec__hd .cw-gear { position: static; transform: none; display: inline-grid; place-items: center; color: var(--faint); cursor: pointer; border-radius: var(--r-sm); width: 18px; height: 18px; }
#sidebar .cw-sec__hd .cw-gear .cw-i { width: 13px; height: 13px; }
#sidebar .cw-sec__hd .cw-gear:hover { color: var(--accent); }
#sidebar .cw-sec.closed > .cw-sec__hd .cw-chev { transform: rotate(-90deg); }
#sidebar .cw-sec.closed > .cw-sec__body { display: none; }
#sidebar .cw-sec__body { list-style: none; margin: 0; padding: 0; max-height: none !important; opacity: 1 !important; overflow: visible; }
#sidebar .cw-sec__empty { padding: var(--s2) var(--s4); font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 4px; }
#sidebar .cw-sec__empty .cw-i { width: 13px; height: 13px; }

/* Module rows (top level): a group header when it has pages, otherwise a direct link */
#sidebar .dashboard__navLink { margin: 0; padding: 0; border: 0; list-style: none; }
#sidebar .dashboard__navLink > a { display: block; padding: 7px var(--s4); color: var(--text); text-decoration: none; border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; font-size: var(--fs-md); font-weight: 600; background: transparent; position: relative; transition: background-color .12s, color .12s; }
#sidebar .dashboard__navLink > a::before, #sidebar .dashboard__navLink > a::after { display: none !important; }
#sidebar .nav-link-content { display: flex; align-items: center; gap: var(--s2); width: 100%; min-width: 0; }
#sidebar .nav-link-content > span:not(.cw-n-chip) { flex: 1 1 auto; min-width: 0; margin: 0; font-size: inherit; font-weight: inherit; overflow: hidden; text-overflow: ellipsis; }
#sidebar .dashboard__navLink-icon { width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-2); flex: 0 0 auto; margin: 0; }
#sidebar .dashboard__navLink-icon .cw-i { width: 16px; height: 16px; }
#sidebar .dashboard__navLink-icon img { width: 16px; height: 16px; filter: none; }
:root[data-theme="dark"] #sidebar .dashboard__navLink-icon img { filter: invert(.85); }
#sidebar .cw-n-chip { font-size: 10px; font-weight: 800; color: var(--faint); background: var(--chip-bg); border-radius: 9px; padding: 1px 6px; line-height: 1.4; flex: 0 0 auto; }
#sidebar .nav-link-content .cw-chev { width: 12px; height: 12px; color: var(--faint); transition: transform .2s; flex: 0 0 auto; transform: rotate(-90deg); }
#sidebar .menu-item.has-children.expanded > a .nav-link-content .cw-chev { transform: none; }
#sidebar .dashboard__navLink > a:hover { background: var(--hover); color: var(--text); }
#sidebar .dashboard__navLink:not(.has-children) > a:hover { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }
#sidebar .dashboard__navLink:not(.has-children) > a:hover .dashboard__navLink-icon { color: var(--accent); }
#sidebar .dashboard__navLink:not(.has-children).active > a,
#sidebar .dashboard__navLink:not(.has-children) > a.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
#sidebar .dashboard__navLink:not(.has-children).active > a .dashboard__navLink-icon { color: var(--accent); }
#sidebar .menu-item.has-children.cw-has-active > a,
#sidebar .menu-item.has-children.cw-has-active > a .dashboard__navLink-icon { color: var(--accent); }
#sidebar .menu-item.has-children > a.active { background: transparent; }

/* Pages inside a module */
#sidebar .submenu { display: none; list-style: none; margin: 0; padding: 0; background: transparent; border: 0; overflow: hidden; }
#sidebar .submenu.expanded, #sidebar .menu-item.expanded > .submenu { display: block !important; }
#sidebar .submenu .dashboard__navLink > a { padding: 6px var(--s4) 6px 44px; font-size: var(--fs-md); font-weight: 400; color: var(--text-2); background: transparent; box-shadow: none; }
#sidebar .submenu .dashboard__navLink.has-children > a { color: var(--text); font-weight: 600; }
#sidebar .submenu .submenu .dashboard__navLink > a { padding-left: 58px; }
#sidebar .submenu .dashboard__navLink:not(.has-children) > a:hover { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }
#sidebar .submenu .dashboard__navLink:not(.has-children).active > a,
#sidebar .submenu .dashboard__navLink:not(.has-children) > a.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
#sidebar .submenu .cw-n-chip { display: none; }

/* Menu badges */
#sidebar .nav-link-content .menu-badge { margin: 0 0 0 auto; position: relative; display: inline-flex; align-items: center; }
#sidebar .badge-counter { min-width: 18px; height: 18px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent) !important; color: #fff !important; font-size: 10.5px; font-weight: 700; display: inline-grid !important; place-items: center; line-height: 1; box-shadow: none; animation: none; }

/* Find a page */
#sidebar.cw-filtering .dashboard__nav li.menu-item:not(.cw-keep) { display: none; }
#sidebar.cw-filtering .dashboard__nav li.menu-item.cw-keep > .submenu { display: block !important; }
#sidebar.cw-filtering .cw-sec { display: none; }
#sidebar.cw-filtering .cw-sec.cw-keep { display: block; }
#sidebar.cw-filtering .cw-sec.cw-keep > .cw-sec__body { display: block; }
#sidebar.cw-filtering .favourites-section { display: none !important; }
#sidebar mark.cw-hl { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
#sidebar .cw-nomatch { padding: 30px 16px; text-align: center; color: var(--muted); font-size: var(--fs-md); }

/* Collapsed menu: icons only */
#sidebar.collapsed .cw-sec__hd { display: none; }
#sidebar.collapsed .cw-sec.closed > .cw-sec__body { display: block; }
#sidebar.collapsed .submenu, #sidebar.collapsed .submenu.expanded, #sidebar.collapsed .menu-item.expanded > .submenu { display: none !important; }
#sidebar.collapsed .dashboard__navLink > a { padding: 9px 0; display: flex; justify-content: center; border-left-color: transparent; }
#sidebar.collapsed .nav-link-content { justify-content: center; flex-direction: row; }
#sidebar.collapsed .nav-link-content > span, #sidebar.collapsed .nav-link-content .cw-chev, #sidebar.collapsed .nav-link-content .menu-badge, #sidebar.collapsed .nav-link-content .menu-badges-horizontal { display: none !important; }
#sidebar.collapsed .dashboard__navLink-icon { width: 20px; height: 20px; margin: 0; }
#sidebar.collapsed .dashboard__navLink-icon .cw-i { width: 18px; height: 18px; }
#sidebar.collapsed .cw-sec__empty { display: none; }

/* Signed-in user */
#sidebar .cw-sb__foot { border-top: 1px solid var(--line); padding: 6px var(--s2); flex: 0 0 auto; background: var(--card); }
#sidebar .cw-urow { display: flex; align-items: center; gap: 10px; padding: 6px var(--s2); border-radius: var(--r-md); cursor: pointer; outline: none; }
#sidebar .cw-urow:hover, #sidebar .cw-urow:focus-visible, #sidebar .cw-urow[aria-expanded="true"] { background: var(--hover); }
#sidebar .cw-av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: var(--fs-sm); display: grid; place-items: center; flex: 0 0 auto; letter-spacing: .5px; }
#sidebar .cw-urow__t { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
#sidebar .cw-urow__t b { display: block; font-size: var(--fs-md); color: var(--title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebar .cw-urow__t span { display: block; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebar .cw-urow .cw-out { color: #dc3545; }
#sidebar .cw-sb__ver { font-size: 10px; color: var(--faint); text-align: center; padding-top: 2px; }
#sidebar.collapsed .cw-urow__t, #sidebar.collapsed .cw-sb__ver { display: none; }
#sidebar.collapsed .cw-urow { justify-content: center; flex-direction: column; padding: 6px 0; gap: 6px; }

/* ---------------- Icon buttons (top bar and pages) ---------------- */
.cw-ibtn { width: 34px; height: 34px; border-radius: var(--r-md); border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--text-2); cursor: pointer; position: relative; flex: 0 0 auto; padding: 0; text-decoration: none; }
.cw-ibtn:hover, .cw-ibtn[aria-expanded="true"], .cw-ibtn.cw-on { background: var(--hover); color: var(--text); }
.cw-ibtn .cw-i { width: 18px; height: 18px; }
.cw-ibtn.cw-round { border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; }
.cw-ibtn .cw-dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--card); line-height: 1; }
.cw-ibtn .cw-dot[hidden] { display: none; }
.cw-when-on { display: none; }
.cw-on > .cw-when-on, [aria-pressed="true"] > .cw-when-on { display: contents; }
.cw-on > .cw-when-off, [aria-pressed="true"] > .cw-when-off { display: none; }

/* ---------------- Top bar ---------------- */
.dashboard__body .dashboard__header.cw-topbar {
  position: sticky; top: 0; z-index: 900; height: var(--h-top); min-height: var(--h-top); flex: 0 0 auto;
  background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5) 0 var(--s3); justify-content: flex-start !important;
}
.cw-topbar .cw-top__left { display: flex; align-items: center; gap: var(--s2); flex: 0 1 auto; min-width: 0; overflow: hidden; }
.cw-topbar .dashboard__hamburger { margin: 0; }
.cw-topbar .dashboard__headerBackButton { margin: 0 !important; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; display: inline-grid !important; place-items: center; color: var(--text-2); flex: 0 0 auto; }
.cw-topbar .dashboard__headerBackButton:hover { background: var(--hover); color: var(--ink); }
.cw-topbar .dashboard__headerBackButton[style*="display: none"] { display: none !important; }
.cw-topbar .dashboard__headerBackButton img { width: 18px; height: 18px; }
:root[data-theme="dark"] .cw-topbar .dashboard__headerBackButton img { filter: invert(.88); }
.cw-topbar .dashboard__headerTitle { margin: 0; padding: 0 !important; font-size: var(--fs-h2) !important; font-weight: 600; color: var(--title) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; line-height: 1.3; }
.cw-topbar .dashboard__headerTitle small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-left: var(--s2); }
.cw-topbar .cw-top__right { display: flex; align-items: center; gap: var(--s1); margin-left: auto; flex: 0 0 auto; }
.cw-topbar .cw-top__right > .dropdown { display: inline-flex; }
.cw-theme-btn .cw-theme-moon { display: none; }
:root[data-theme="dark"] .cw-theme-btn .cw-theme-sun { display: none; }
:root[data-theme="dark"] .cw-theme-btn .cw-theme-moon { display: contents; }

/* Appearance picker */
.dropdown-menu.cw-appear { width: 300px; padding: var(--s4); border-radius: var(--r-xl); }
.cw-appear h5 { margin: 0 0 var(--s2); font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cw-appear .cw-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.cw-appear .cw-modes button { height: 64px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.cw-appear .cw-modes button:hover { border-color: var(--line-strong); color: var(--text); }
.cw-appear .cw-modes button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.cw-appear .cw-modes .cw-i { width: 18px; height: 18px; }
.cw-appear .cw-note { font-size: var(--fs-xs); color: var(--muted); margin: var(--s3) 0 0; }

/* App launcher */
.dropdown-menu.cw-apps-menu { width: 340px; padding: var(--s4); border-radius: var(--r-xl); }
.cw-apps-menu .cw-menu-title { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: var(--s2); }
.cw-apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.cw-app-t { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3) var(--s1); border-radius: var(--r-lg); cursor: pointer; text-align: center; font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-decoration: none; }
.cw-app-t:hover { background: var(--hover); color: var(--text); }
.cw-app-t i { width: 44px; height: 44px; border-radius: var(--r-xl); display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 800; font-size: 13px; }
.cw-app-t.cw-cur { background: var(--accent-soft); }

/* Health status as an icon with a status dot */
.cw-topbar .cis-health { display: inline-flex; }
.cw-topbar .cis-health__pill { width: 34px; height: 34px; border-radius: var(--r-md) !important; border: 0 !important; background: transparent !important; padding: 0 !important; display: inline-grid !important; place-items: center; position: relative; color: var(--text-2); box-shadow: none !important; }
.cw-topbar .cis-health__pill:hover, .cw-topbar .cis-health__pill[aria-expanded="true"] { background: var(--hover) !important; color: var(--text); }
.cw-topbar .cis-health__pill #cisHealthLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cw-topbar .cis-health__pill .cis-health__icon { font-size: 15px; }
.cw-topbar .cis-health__pill::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--card); background: var(--idle); box-sizing: content-box; }
.cw-topbar .cis-health__pill[data-status="Healthy"]::after { background: var(--ok); }
.cw-topbar .cis-health__pill[data-status="Degraded"]::after { background: var(--wip); }
.cw-topbar .cis-health__pill[data-status="Critical"]::after { background: var(--crit); }

/* Global search */
.cw-gs { flex: 1 1 auto; max-width: 560px; margin: 0 auto; position: relative; min-width: 180px; }
.cw-gs__box { display: flex; align-items: center; height: 36px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg); padding: 0 var(--s2) 0 var(--s1); }
.cw-gs__box:focus-within { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-ring); }
.cw-gs__scope { border: 0; background: var(--card); border-radius: var(--r-pill); height: 28px; padding: 0 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: var(--s1); box-shadow: var(--sh-1); white-space: nowrap; flex: 0 0 auto; }
.cw-gs__scope .cw-i { width: 13px; height: 13px; }
.cw-gs__box input { flex: 1 1 auto; border: 0; background: transparent; height: 100%; padding: 0 var(--s2); font-size: var(--fs-md); outline: none; color: var(--text); min-width: 0; }
.cw-gs__box input::placeholder { color: var(--faint); }
/* Users/adduser.js uppercases every input inline; the kit's own search boxes keep the case people type */
.cw-gs__box input, #sidebar .cw-menu-find input, .cw-pop input, .cw-palette input { text-transform: none !important; }

/* Watch List: an icon button like the others (its old red pill styles are in the header partial) */
.cw-topbar .cw-ibtn.custom-watchlist-btn { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text-2); border: 0; padding: 0; height: 34px; width: 34px; gap: 0; box-shadow: none; border-radius: var(--r-md) !important; margin: 0 !important; }
.cw-topbar .cw-ibtn.custom-watchlist-btn:hover { background: var(--hover); color: var(--text); }
.cw-topbar .cis-health__pill .cis-health__icon { display: none; }
.cw-topbar .cis-health__pill .cw-i { width: 18px; height: 18px; }
.cw-kbd { font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--card); line-height: 1.5; white-space: nowrap; }
.cw-gs__res { position: absolute; top: 42px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: var(--s2); display: none; max-height: 440px; overflow: auto; z-index: 1100; }
.cw-gs.cw-open .cw-gs__res { display: block; }
.cw-gs__grp { font-size: var(--fs-xs); font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; padding: var(--s2) var(--s2) var(--s1); }
.cw-gs__it { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--r-md); cursor: pointer; text-decoration: none; color: var(--text); min-width: 0; }
.cw-gs__it.cw-on, .cw-gs__it:hover { background: var(--accent-soft); color: var(--text); }
.cw-gs__it b { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cw-gs__it > span:last-child:not(.cw-ent) { color: var(--muted); font-size: var(--fs-xs); margin-left: auto; white-space: nowrap; padding-left: var(--s2); }
/* the title keeps its width; the subtitle takes what is left and is the one cut short (full text on hover) */
.cw-gs__it b { flex: 0 1 auto; max-width: 72%; }
.cw-gs__it > span:last-child:not(.cw-ent) { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; }
/* results may be wider than a narrow box (1280–1440 px screens) so names and subtitles stay readable */
.cw-gs__res { min-width: min(560px, calc(100vw - 32px)); }
.cw-gs__it mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0; }
.cw-gs__empty { padding: 24px; text-align: center; color: var(--muted); font-size: var(--fs-md); }
.cw-gs__busy { padding: 10px var(--s2); color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.cw-gs__scope:hover, .cw-gs__scope[aria-expanded="true"] { color: var(--ink); }
.cw-gs__scope:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring), var(--sh-1); }
.cw-gs__scope[aria-expanded="true"] .cw-i { transform: rotate(180deg); }
.cw-gs__scope .cw-i { transition: transform .15s ease; }
.cw-gs__box input::-webkit-search-cancel-button { display: none; }
.cw-gs__box .cw-kbd { flex: 0 0 auto; }
/* a short reason pill after the title (e.g. Mine / My team on records the user can reach) */
.cw-gs__tag { flex: 0 0 auto; font-size: 10px; font-weight: 600; line-height: 1.5; padding: 0 7px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--text-2); background: var(--bg); white-space: nowrap; }
.cw-gs__tag.is-mine { border-color: transparent; color: var(--accent); background: var(--accent-soft); }
.cw-gs__tag.is-team { border-color: transparent; color: var(--info); background: var(--info-bg); }
.cw-gs__err { margin-top: var(--s1); padding: 10px var(--s2); border-radius: var(--r-md); background: var(--crit-bg); color: var(--crit); font-size: var(--fs-sm); }
.cw-gs__foot { display: flex; gap: var(--s3); margin-top: var(--s2); padding: var(--s2) var(--s2) 2px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-xs); }
.cw-gs__foot > span { display: inline-flex; align-items: center; gap: 4px; }
.cw-ent { font-size: 10px; font-weight: 700; white-space: nowrap; padding: 2px 6px; border-radius: var(--r-sm); text-transform: uppercase; letter-spacing: .3px; flex: 0 0 auto; }
.cw-ent.kz { background: var(--ok-bg); color: var(--ok); }
.cw-ent.rv { background: var(--info-bg); color: var(--info); }
.cw-ent.is { background: var(--crit-bg); color: var(--crit); }
.cw-ent.rr { background: var(--wip-bg); color: var(--wip); }
.cw-ent.us, .cw-ent.pg { background: var(--idle-bg); color: var(--idle); }

/* Focus mode: menu as icons, page summaries hidden */
body.cw-focus .cw-kpis-wrap, body.cw-focus .cw-crumb, body.cw-focus .cw-hide-in-focus { display: none !important; }
:where(body.cw-focus) .dashboard__body main.detail__content { padding: var(--s3) !important; }

@media (max-width: 1440px) {
  .cw-gs { max-width: 420px; }
}
@media (max-width: 1366px) {
  .cw-gs { max-width: 320px; }
  .cw-gs__box .cw-kbd { display: none; }
}
@media (max-width: 1279px) {
  .cw-gs { max-width: 260px; }
  .cw-gs__scope { display: none; }
}

/* =====================================================================
   Page-to-page navigation that feels like one app (every app on the kit)
   - Cross-document view transitions (browser-native, same-origin page loads): the old page stays on screen until
     the new one can paint (no white flash), the menu and top bar stay perfectly still, and only the page content
     fades and rises in. Browsers without support simply load pages as before.
   - .cw-navbar: a thin progress line the moment a link is followed (cw-shell.js).
   ===================================================================== */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
#sidebar.cw-sb { view-transition-name: cw-sidebar; }
.cw-topbar { view-transition-name: cw-topbar; }
::view-transition-group(cw-sidebar), ::view-transition-group(cw-topbar) { animation-duration: 0s; }
::view-transition-old(cw-sidebar), ::view-transition-old(cw-topbar) { display: none; }
::view-transition-new(cw-sidebar), ::view-transition-new(cw-topbar) { animation: none; }
::view-transition-old(root) { animation: cw-vt-out .12s ease-in both; }
::view-transition-new(root) { animation: cw-vt-in .24s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes cw-vt-out { to { opacity: 0; } }
@keyframes cw-vt-in { from { opacity: 0; transform: translateY(8px); } }

.cw-navbar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30000; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .2s ease; }
.cw-navbar.cw-on { opacity: 1; }
.cw-navbar i { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent-ring); }
.cw-navbar.cw-on i { width: 85%; transition: width 6s cubic-bezier(.08, .8, .2, 1); }
.cw-navbar.cw-done i { width: 100%; transition: width .2s ease; }

/* No sideways jumps while a page loads:
   - the window's scrollbar space is always reserved, so pages do not narrow by its width once content fills them;
   - the top bar's icon cluster keeps the width it had on the last page (--cw-top-r, set in _Layout <head> from
     cw-shell.js), so the search box does not slide left as scripts add the icons. */
html { scrollbar-gutter: stable; }
.cw-topbar .cw-top__right { min-width: var(--cw-top-r, 0px); justify-content: flex-end; }

/* Manage favourites (sidebar ⚙ — Shared/_LayoutMainSidebarDynamic): the mockup's dialog — star heading with a lead
   line, search + pages grouped by menu section on the left, the pinned pages numbered in order on the right with
   move up / down / remove on each row, Cancel + Save favourites in the footer band */
.cw-favdlg .modal-dialog { width: min(880px, 94vw); max-width: min(880px, 94vw); }
.cw-favdlg .modal-content { border: 0; border-radius: var(--r-xl); overflow: hidden; background: var(--card); box-shadow: var(--sh-3); font-family: var(--font); }
.cw-favdlg .modal-header { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-2); }
.cw-favdlg__ic { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.cw-favdlg__ic svg { width: 18px; height: 18px; }
.cw-favdlg__heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.cw-favdlg .modal-title { margin: 0; font-size: var(--fs-h3) !important; font-weight: 700; color: var(--ink); }
.cw-favdlg__sub { font-size: var(--fs-sm); color: var(--muted); }
.cw-favdlg .modal-header .btn-close { margin: 2px 0 0 auto; }
.cw-favdlg .modal-body { padding: var(--s4) var(--s5); }
.cw-favdlg__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); }
.cw-favdlg__col { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.cw-favdlg__search { position: relative; }
.cw-favdlg__search svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--faint); pointer-events: none; }
.cw-favdlg__search input { width: 100%; height: var(--h-input); padding: 0 var(--s3) 0 34px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); color: var(--text);
  font: 500 var(--fs-md) var(--font); text-transform: none !important; outline: 0; }
.cw-favdlg__search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.cw-favdlg__search input::placeholder { color: var(--faint); }
.cw-favdlg__cap { height: var(--h-input); display: flex; align-items: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cw-favdlg__list { height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px; background: var(--card); }
.cw-favdlg__list--sel { background: var(--surface-3); }
.cw-favdlg__grp { position: sticky; top: -4px; z-index: 1; padding: 8px 10px 4px; background: inherit; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cw-favdlg__list:not(.cw-favdlg__list--sel) .cw-favdlg__grp { background: var(--card); }
.cw-favdlg__row { display: flex; align-items: center; gap: 10px; min-height: 32px; margin: 0; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); color: var(--text); }
.cw-favdlg__row:hover { background: var(--hover); }
.cw-favdlg__row.cw-on .cw-favdlg__t { font-weight: 600; color: var(--ink); }
.cw-favdlg__row .form-check-input { flex: 0 0 auto; margin: 0; width: 15px; height: 15px; cursor: pointer; }
.cw-favdlg__t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-favdlg__g { flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); color: var(--faint); }
.cw-favdlg__none { padding: 40px 12px; text-align: center; font-size: var(--fs-sm); color: var(--muted); }
.cw-favdlg__pin { display: flex; align-items: center; gap: 10px; min-height: 38px; margin: 3px 0; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); font-size: var(--fs-sm); color: var(--ink); }
.cw-favdlg__pin:hover { border-color: var(--line-strong); }
.cw-favdlg__n { flex: 0 0 auto; width: 18px; font-size: var(--fs-xs); font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.cw-favdlg__acts { flex: 0 0 auto; display: inline-flex; gap: 2px; }
.cw-favdlg__b { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; }
.cw-favdlg__b svg { width: 14px; height: 14px; }
.cw-favdlg__b:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.cw-favdlg__b--rm:hover:not(:disabled) { background: var(--crit-bg); color: var(--crit); }
.cw-favdlg__b:disabled { opacity: .3; cursor: default; }
.cw-favdlg__b:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cw-favdlg__empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: var(--s5); text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.cw-favdlg__empty svg { width: 28px; height: 28px; color: var(--faint); margin-bottom: 4px; }
.cw-favdlg__empty b { color: var(--ink); font-size: var(--fs-md); }
.cw-favdlg .modal-footer { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line-2); background: var(--surface-3); }
.cw-favdlg .modal-footer > * { margin: 0; }
.cw-favdlg .modal-footer .btn { height: var(--h-btn); padding: 0 var(--s4); border-radius: var(--r-md); font: 600 var(--fs-md) var(--font); display: inline-flex; align-items: center; }
.cw-favdlg__cancel { background: transparent !important; border: 1px solid transparent !important; color: var(--text-2) !important; }
.cw-favdlg__cancel:hover { background: var(--hover) !important; color: var(--ink) !important; }
.cw-favdlg__save { background: var(--accent) !important; border: 1px solid var(--accent) !important; color: #fff !important; }
.cw-favdlg__save:hover { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; }
@media (max-width: 720px) { .cw-favdlg__cols { grid-template-columns: 1fr; } .cw-favdlg__list { height: 240px; } }
/* registers fill the window and never scroll the page (cw-grid.js), so no empty strip is kept for a page scrollbar:
   the right gutter equals the left. Content pages keep the reserved strip (no sideways jump when they scroll). */
html:has(> body.cw-has-reg), html:has(.dashboard__body .kd, .dashboard__body .kz-form) { scrollbar-gutter: auto; }   /* (Kaizen dashboard / form scroll inside their own panel) */

/* Pages that wrap their content in Bootstrap's .container-fluid would get its side padding on top of the page gutter
   (MES Requests: 25px instead of 16px). The gutter comes from main only. */
:root .dashboard__body main.detail__content > .dashboard__content > .container-fluid { padding-left: 0; padding-right: 0; }

/* Phones (≤ 767px): the page always keeps the icon rail's width; the full menu, when opened with ☰, slides over the
   page instead of squeezing it into a sliver. Phones also open on the rail (cw-shell.js / _Layout <head>). */
@media (max-width: 767px) {
  #mainDashboard.dashboard, #mainDashboard.dashboard.sidebar-collapsed { margin-left: var(--sb-rail); width: calc(100% - var(--sb-rail)); }
  #sidebar.cw-sb:not(.collapsed) { box-shadow: var(--sh-3, 0 12px 32px rgba(0, 0, 0, .25)); }
}
