/* The frame: the charcoal rail on the left (a bottom bar on phones), the search pill, and the quick-action dock on
   Home. Loaded after ce.css on every page. The rail rules are scoped to html.ce-rail (staff screens), so the sign-in
   page and the public pages keep their own layout. Colors come from tokens.css (--hq-*) and the company's own scale
   (--brand-*, written in the page head by {% brand_vars %}), so the frame follows whatever color a company picks.
   Cards, tables, buttons and forms inside the screens are ce.css's (the shared parts). */

/* ---------- the frame's own measures (colors are ce.css's, from the tokens) */
html.ce-rail {
  --dock-rail: 88px;
  --dock-key: #25282C; --dock-key-hover: #2B2E33; --dock-quiet: #C9CDD3;
  --dock-wash: rgba(255,255,255,.07);
  --dock-raise: var(--hq-resting);
  --dock-raise-hover: var(--hq-raised);
}

/* ---------- the rail */
html.ce-rail #container { padding-left: var(--dock-rail); box-sizing: border-box; }
html.ce-rail.ce-in-window #container { padding-left: 0; }  /* pop-up windows have no rail */
html.ce-rail #header.ce-top { position: fixed; left: 0; top: 0; bottom: 0; width: var(--dock-rail); height: auto;
  flex-direction: column; align-items: stretch; gap: 4px; padding: 18px 10px 14px; border-bottom: 0; border-right: 0;
  background: var(--hq-charcoal); color: #FFFFFF;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06), 1px 0 0 rgba(22,24,27,.35), 8px 0 28px -10px rgba(22,24,27,.40);
  box-sizing: border-box; z-index: 900; }
html.ce-rail .ce-brand { justify-content: center; margin: 0 0 10px; font-size: 0; gap: 0; }
html.ce-rail .ce-brand small { display: none; }
/* the mark: the lid, straight on the charcoal rail with no circle behind it (core/_mark.html) */
html.ce-rail .ce-mark { width: 40px; height: 40px; }
html.ce-rail .ce-nav { flex-direction: column; align-items: stretch; gap: 1px; flex: 1 1 auto; min-height: 0; }
/* each item: a white icon over a white label; hover is a 7% white wash */
html.ce-rail .ce-nav > a, html.ce-rail .ce-nav > .ce-dd > button {
  flex-direction: column; justify-content: center; gap: 3px; width: 100%; min-height: 46px; padding: 5px 0 4px; border-radius: 14px;
  box-sizing: border-box; font-size: 12px; font-weight: 500; letter-spacing: .01em; color: #FFFFFF !important; transition: background .12s, box-shadow .12s; }
html.ce-rail .ce-nav > a .ic, html.ce-rail .ce-nav > .ce-dd > button .ic { width: 22px; height: 22px; opacity: 1; }
html.ce-rail .ce-nav > .ce-dd > button .ic.sm { display: none; }
/* the rail's icons draw a lighter line than the rest of the app; its menus keep the default */
html.ce-rail #header.ce-top .ic { stroke-width: 1.6; }
html.ce-rail #header.ce-top :is(.ce-menu, .ce-search) .ic { stroke-width: 2; }
html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { display: inline !important; }
html.ce-rail .ce-nav > a:hover, html.ce-rail .ce-nav > .ce-dd > button:hover, html.ce-rail .ce-nav > .ce-dd.open > button {
  background: var(--dock-wash); color: #FFFFFF !important; }
html.ce-rail .ce-nav > a:active, html.ce-rail .ce-nav > .ce-dd > button:active { transform: translateY(1px); }
/* the current section: a raised button in the company color */
html.ce-rail .ce-nav > a.on, html.ce-rail .ce-nav > .ce-dd > button.on {
  background: var(--brand-700); color: var(--on-brand-700) !important;
  box-shadow: var(--hq-highlight), 0 1px 2px rgba(0,0,0,.35), 0 6px 14px -6px rgba(var(--brand-rgb), .55); }
/* focus on the charcoal: a light ring in the company color */
html.ce-rail #header :is(a, button, input):focus-visible { outline: 2px solid var(--brand-300); outline-offset: 2px; }
html.ce-rail .ce-histnav { margin: 6px 0 0; padding: 6px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.08); justify-content: center; }
html.ce-rail .ce-histnav button { color: var(--dock-quiet); }
html.ce-rail .ce-histnav button:hover { background: var(--dock-wash); color: #FFFFFF; }
html.ce-rail .ce-histnav button { width: 22px; height: 26px; }
html.ce-rail .ce-histnav .ic { width: 14px; height: 14px; }
/* the rail scrolls on its own when it's taller than the window, so every item stays reachable */
html.ce-rail #header.ce-top { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
html.ce-rail #header.ce-top > *, html.ce-rail .ce-nav > * { flex-shrink: 0; }  /* the list scrolls; items never squash */
html.ce-rail .ce-nav { flex: 1 0 auto; }
/* menus open beside the rail, placed by ce/dock.js (fixed, so the rail's scrolling never cuts them off) */
html.ce-rail #header .ce-menu { position: fixed; top: 8px; left: calc(var(--dock-rail) + 10px); right: auto; bottom: auto;
  max-height: calc(100 * var(--ce-vh, 1vh) - 16px); overflow-y: auto; }
html.ce-rail #header > .ce-dd { align-self: center; }
html.ce-rail #header .ce-new { width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 0; gap: 0; border-radius: 14px;
  background: var(--brand-700); color: var(--on-brand-700); border-color: transparent;
  box-shadow: var(--hq-highlight), 0 1px 0 rgba(0,0,0,.5), 0 6px 14px -6px rgba(var(--brand-rgb), .7); }
html.ce-rail #header .ce-new:hover { background: var(--brand-800); color: var(--on-brand-800); }
html.ce-rail #header .ce-new .ic { width: 20px; height: 20px; }
html.ce-rail #header .ce-iconbtn { width: 40px; height: 36px; color: var(--dock-quiet); }
html.ce-rail #header .ce-iconbtn:hover, html.ce-rail #header .ce-dd.open > .ce-iconbtn { background: var(--dock-wash); color: #FFFFFF; }
/* the initials: a quiet white-on-charcoal circle */
html.ce-rail #header .ce-avatar { margin-top: 6px; width: 44px; height: 44px; background: rgba(255,255,255,.08); color: #FFFFFF;
  font: 600 12.5px var(--ce-font); box-shadow: inset 0 1px 0 rgba(255,255,255,.10), inset 0 0 0 1px rgba(255,255,255,.12); }
html.ce-rail #header .ce-avatar:hover, html.ce-rail #header .ce-dd.open > .ce-avatar { background: rgba(255,255,255,.14); }
html.ce-rail #header .ce-avatar:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.12); }
/* search: a pill at the top right of the page */
html.ce-rail #header .ce-search { position: fixed; top: 10px; right: clamp(16px, calc(2.4 * var(--ce-vw, 1vw)), 40px);
  width: clamp(220px, calc(24 * var(--ce-vw, 1vw)), 360px); margin: 0; z-index: 905; }
html.ce-rail #header .ce-search input[type=search] { height: 40px; border-radius: 999px; background: var(--ce-surface); color: var(--ce-text);
  border: 0; box-shadow: var(--ce-shadow); }
html.ce-rail #header .ce-search input[type=search]:focus { box-shadow: 0 0 0 2px var(--brand-ring), 0 0 0 6px rgba(var(--brand-rgb), .15); }
html.ce-rail #header .ce-search input:focus-visible { outline: 0; }
html.ce-rail #header .ce-search input::placeholder { color: var(--ce-subtle); }
html.ce-rail .ce-search > .ic { top: 12px; color: var(--ce-subtle); }
html.ce-rail .ce-search kbd { top: 11px; color: var(--ce-subtle); border-color: var(--ce-border); }
html.ce-rail .ce-results { top: 46px; left: auto; right: 0; }
/* A–Z quick find: a quiet strip at the top of the page, leaving room for the search pill */
html.ce-rail .ce-az { top: 0; background: var(--ce-bg); border-bottom: 0; padding: 14px 400px 6px 28px; min-height: 38px; box-sizing: border-box; }
/* the shared-demo or practice band under the room at the top starts below the search pill, so the pill never covers it */
@media (min-width: 761px) { html.ce-rail body:not(.hq-banded) .ce-topspace + .ce-banner { margin-top: 18px; } }
html.ce-rail .ce-az b { color: var(--ce-subtle); }
html.ce-rail .ce-az button { color: var(--ce-muted); }
html.ce-rail .ce-az button:hover, html.ce-rail .ce-az button.on { background: var(--ce-accent); color: #fff; }
html.ce-rail .breadcrumbs { padding-left: 28px; }

/* ---------- Home */
html.ce-rail .ce-pagehead h1 { font-size: 32px; letter-spacing: -.02em; }
html.ce-rail .ce-dash { gap: 24px; }
html.ce-rail .ce-dash.editing .ce-w { outline-color: var(--ce-border-strong); outline-offset: 5px; border-radius: 18px; }

/* Home's band (the date and company, the greeting, the summary, the notices button): the shared band part
   (ce.css, .hq-band) with the display heading at 48 */
.hq-home-band.ce-pagehead { display: block; min-height: 196px; }
.hq-home-top { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-height: 44px; }
.hq-home-date { font-size: 13px; font-weight: 600; }
.hq-home-band .hq-home-short { display: none; }  /* the short date is for a phone (ce.css, look step 7a) */
.hq-home-top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
html.ce-rail .hq-home-band h1 { margin: 14px 0 0; font-size: 48px; line-height: 1; letter-spacing: -.035em; }
.hq-home-band .hq-lede { margin: 10px 0 0; font-size: 20px; line-height: 1.3; font-weight: 500; color: var(--brand-band-soft); }
.hq-home-band .hq-lede .ce-need { color: var(--on-brand-800); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.hq-band .ce-ver.hq-bchip { border: 0; padding: 6px 12px; font-size: 12.5px; }
.hq-band .ce-seg { background: color-mix(in srgb, var(--on-brand-800) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-brand-800) 14%, transparent); }
.hq-band .ce-seg a { color: var(--on-brand-800) !important; min-height: 34px; }
.hq-band .ce-seg .on { background: var(--ce-surface); color: var(--ce-text) !important; box-shadow: var(--hq-onband); }
@media (max-width: 760px) {
  .hq-home-band.ce-pagehead { min-height: 0; }
  html.ce-rail .hq-home-band h1 { font-size: 34px; margin-top: 8px; }
  .hq-home-band .hq-lede { font-size: 16px; }
  .hq-home-top .right { margin-left: 0; }
  .hq-home-band .ce-ver { display: none; }  /* the version is at the foot of Home too */
  .hq-home-band .hq-ghost, .hq-home-band .hq-onband { height: 38px; }
  .hq-home-band .hq-onband.round { width: 38px; }
  .hq-home-band .hq-onband .dot { top: 7px; right: 8px; }
}

/* key numbers: one card of four, the first number big (the artboard's "booked" card) */
.dk-kpis { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); overflow: hidden; }
.dk-kpis > a { display: flex; flex-direction: column; justify-content: center; padding: 20px 24px; min-height: 120px; box-sizing: border-box;
  text-decoration: none !important; color: var(--ce-text); transition: background .12s; }
.dk-kpis > a + a { box-shadow: inset 1px 0 0 var(--ce-border); }
.dk-kpis > a:hover { background: var(--ce-surface-2); }
.dk-kpis .k { color: var(--ce-muted); font-size: 12.5px; font-weight: 500; }
.dk-kpis .v { color: var(--ce-text); font: 700 26px/1.1 var(--ce-font-display); letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dk-kpis .hero .v { font-size: 44px; line-height: 1; letter-spacing: -.035em; }
.dk-kpis .d { color: var(--ce-muted); font-size: 12.5px; margin-top: 6px; }
html.ce-onecol .dk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.ce-onecol .dk-kpis > a:nth-child(3) { box-shadow: inset 0 1px 0 var(--ce-border); }
html.ce-onecol .dk-kpis > a:nth-child(4) { box-shadow: inset 1px 0 0 var(--ce-border), inset 0 1px 0 var(--ce-border); }

/* coming up: one list card, a date tile on each row (today's raised in the company color) */
.dk-cards { display: block; padding: 4px 18px 8px; }
.dk-ev { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 10px 10px; margin: 0 -10px;
  border-radius: 14px; color: var(--ce-text) !important; text-decoration: none !important; transition: background .12s; }
.dk-ev + .dk-ev { box-shadow: inset 0 1px 0 var(--ce-border); }
.dk-ev:hover { background: var(--ce-surface-2); }
.dk-tile { width: 52px; height: 52px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--ce-pick); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-100); }
.dk-tile b { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dk-tile .num { font: 700 21px/1 var(--ce-font-display); font-variant-numeric: tabular-nums; }
.dk-tile.today { background: var(--brand-700); color: var(--on-brand-700); box-shadow: var(--hq-highlight), 0 1px 2px rgba(var(--brand-rgb), .30), 0 6px 14px -6px rgba(var(--brand-rgb), .45); }
.dk-what { min-width: 0; }
.dk-ev .t { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-ev .m { display: block; color: var(--ce-muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-g { font-weight: 600; font-size: 14px; text-align: right; white-space: nowrap; }
.dk-g small { color: var(--ce-muted); font-weight: 500; font-size: 12px; }
.dk-st { min-width: 0; }
.dk-no { color: var(--ce-muted); font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .dk-ev { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; }
  .dk-tile { width: 46px; height: 46px; }
  .dk-st, .dk-no { display: none; }
}

/* needs you: a numbered to-do list */
html.ce-rail .ce-w[data-id="attention"] .ce-list { counter-reset: dk; }
html.ce-rail .ce-w[data-id="attention"] .ce-list > a:not(.ce-empty), html.ce-rail .ce-w[data-id="attention"] .ce-list > li:not(.ce-empty) { counter-increment: dk; }
html.ce-rail .ce-w[data-id="attention"] .ce-list > a:not(.ce-empty) > .ce-dot,
html.ce-rail .ce-w[data-id="attention"] .ce-list > li:not(.ce-empty) > .ce-dot { width: 26px; height: 26px; background: none; border: 1.5px solid var(--ce-border-strong);
  display: grid; place-items: center; position: relative; }
html.ce-rail .ce-w[data-id="attention"] .ce-list > a:not(.ce-empty) > .ce-dot::after,
html.ce-rail .ce-w[data-id="attention"] .ce-list > li:not(.ce-empty) > .ce-dot::after { content: counter(dk); font-size: 12px; font-weight: 700; color: var(--ce-muted); }
html.ce-rail .ce-w[data-id="attention"] .ce-list > a .r { color: var(--ce-accent); font-weight: 600; }
html.ce-rail .ce-w[data-id="attention"] .ce-list > a .r::after { content: " →"; }

/* the quick-action dock: charcoal, floating; New event in the company color, the other keys raised dark keys with
   their counts */
.dk-dock { position: fixed; left: calc(50% + var(--dock-rail) / 2); bottom: 22px; transform: translateX(-50%); z-index: 880; display: flex; align-items: center;
  gap: 6px; padding: 8px; background: var(--hq-charcoal); border-radius: 24px; box-shadow: var(--hq-floating);
  max-width: calc(100% - var(--dock-rail) - 32px); overflow-x: auto; box-sizing: border-box; color: #FFFFFF; }
.dk-dock a, .dk-dock .dk-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 86px; height: 64px; padding: 0 8px; box-sizing: border-box; border-radius: 16px; background: var(--dock-key); color: #FFFFFF !important;
  text-decoration: none !important; font: 600 12px var(--ce-font); white-space: nowrap; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 0 rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.28); transition: transform .08s, box-shadow .08s; }
.dk-dock a:hover { background: var(--dock-key-hover); }
.dk-dock a:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.dk-dock :is(a, button):focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.dk-dock a.primary { background: var(--brand-700); color: var(--on-brand-700) !important;
  box-shadow: var(--hq-highlight), 0 1px 0 rgba(0,0,0,.5), 0 6px 14px -6px rgba(var(--brand-rgb), .7); }
.dk-dock a.primary:hover { background: var(--brand-800); color: var(--on-brand-800) !important; }
.dk-dock a .ic { width: 20px; height: 20px; }
/* a key with something waiting shows the count, big, in place of its icon */
.dk-dock a .n { font: 700 20px/1 var(--ce-font-display); font-variant-numeric: tabular-nums; }
.dk-dock a:has(.n) .ic { display: none; }
.dk-dock a:not(.primary) > span:not(.n) { font-size: 12px; font-weight: 500; color: var(--dock-quiet); }
.dk-dock .sep { width: 1px; height: 40px; background: rgba(255,255,255,.08); box-shadow: 1px 0 0 rgba(0,0,0,.45); margin: 0 2px; flex: none; }
.dk-dock .dk-find { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 14px; border: 0; background: var(--dock-key);
  color: var(--dock-quiet); font: 13px var(--ce-font); cursor: pointer; min-width: 190px; white-space: nowrap; flex: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.04); }
.dk-dock .dk-find kbd { margin-left: auto; font: 12px var(--ce-font); border: 1px solid rgba(255,255,255,.16); border-radius: 4px; padding: 0 5px; }
.dk-dock .dk-edit { border: 0; background: transparent; color: var(--dock-quiet); width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
  display: grid; place-items: center; flex: none; }
.dk-dock .dk-edit:hover, .dk-dock.editing .dk-edit { background: var(--dock-wash); color: #FFFFFF; }
.dk-dock .dk-add { display: none; border: 1.5px dashed rgba(255,255,255,.28); background: transparent; box-shadow: none; cursor: pointer; color: var(--dock-quiet) !important; }
.dk-dock.editing { outline: 2px dashed var(--brand-300); outline-offset: 5px; }
.dk-dock.editing .dk-add { display: flex; }
.dk-dock.editing a { cursor: grab; }
.dk-dock.editing a::after { content: "×"; position: absolute; top: -4px; right: 0; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF;
  color: var(--hq-charcoal); border: 2px solid var(--hq-charcoal); font: 700 13px/16px var(--ce-font); text-align: center; box-sizing: border-box; }
.dk-dock a.drag { opacity: .4; }
.dk-pick { display: none; position: fixed; z-index: 890; bottom: 104px; left: calc(50% + var(--dock-rail) / 2); transform: translateX(-50%);
  width: min(520px, calc(100% - var(--dock-rail) - 32px)); max-height: 50vh; overflow: auto; background: var(--ce-surface); border-radius: 18px;
  box-shadow: var(--ce-shadow-lg); padding: 14px; box-sizing: border-box; }
.dk-pick.show { display: block; }
.dk-pick > b { display: block; font-size: 14px; color: var(--ce-text); margin: 2px 4px 10px; }
.dk-pick > b small { font-weight: 500; color: var(--ce-muted); margin-left: 6px; }
.dk-pick .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dk-pick button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ce-border);
  background: var(--ce-surface-2); color: var(--ce-text); font: 500 13px var(--ce-font); cursor: pointer; }
.dk-pick button:hover { border-color: var(--ce-accent); }
.dk-pick button .ic { color: var(--ce-accent); }
.dk-pick button:disabled { opacity: .45; cursor: not-allowed; }
html.ce-rail #content { padding-bottom: 130px !important; }

/* short windows: icons only, tighter, so the initials menu always stays on screen */
@media (max-height: 860px) {
  html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html.ce-rail .ce-nav > a, html.ce-rail .ce-nav > .ce-dd > button { padding: 9px 0; min-height: 44px; }
  html.ce-rail #header.ce-top { padding-top: 10px; padding-bottom: 8px; }
  html.ce-rail .ce-brand { margin-bottom: 6px; }
  html.ce-rail .ce-histnav { display: none; }
}
@media (max-width: 760px) {
  html.ce-rail { --dock-rail: 64px; }
  html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html.ce-rail .ce-az { padding-right: 16px; padding-top: 58px; }
}
@media print {
  html.ce-rail #container { padding-left: 0; }
  .dk-dock, .dk-pick { display: none !important; }
}
html.ce-rail .ce-dash.editing .dk-kpis, html.ce-rail .ce-dash.editing .dk-sec { pointer-events: none; }

/* ---------- Readability and screen fit */
/* rail labels stay on short windows too, at 12px (the rail scrolls when it runs out of room) */
html.ce-rail .ce-nav > a, html.ce-rail .ce-nav > .ce-dd > button { font-size: 12px; }
/* the label's own line is tall enough for the font's ascenders and descenders, so a long label is cut at its end,
   never through its letters */
html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 16px; padding: 1px 2px; box-sizing: border-box; }
@media (max-height: 860px) and (min-width: 761px) {
  html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { position: static !important; width: auto; height: auto; overflow: hidden; clip: auto; }
  html.ce-rail .ce-nav > a, html.ce-rail .ce-nav > .ce-dd > button { padding: 5px 0; gap: 2px; min-height: 44px; }
  html.ce-rail .ce-nav > a .ic, html.ce-rail .ce-nav > .ce-dd > button .ic { width: 19px; height: 19px; }
  html.ce-rail #header .ce-avatar, html.ce-rail #header .ce-new { width: 40px; height: 40px; }
}
/* very short windows (a 1024x600 netbook, a laptop with the browser's bars open) tighten the rail a
   little more so it fits without a scroll bar; it still scrolls if a login has more entries than fit */
@media (max-height: 680px) and (min-width: 761px) {
  html.ce-rail .ce-nav, html.ce-rail #header.ce-top { gap: 1px; }
  html.ce-rail .ce-nav > a, html.ce-rail .ce-nav > .ce-dd > button { padding: 2px 0; gap: 1px; min-height: 38px; }
  html.ce-rail #header.ce-top { padding-top: 8px; padding-bottom: 6px; }
  html.ce-rail .ce-mark { width: 34px; height: 34px; }
  html.ce-rail .ce-brand { margin-bottom: 4px; }
}
/* ✦ AI assistant sits in the rail, above the initials: a dark key like the dock's, its star in the company's light */
html.ce-rail #header #ai-fab.ce-in-bar, html.ce-rail #header #dv-fab.ce-in-bar { width: 40px !important; height: 36px !important; border-radius: 12px !important; margin: 2px 0; }
html.ce-rail #header #ai-fab.ce-in-bar { background: var(--dock-key); box-shadow: var(--hq-highlight); font-size: 20px; }
html.ce-rail #header #ai-fab.ce-in-bar:hover { background: var(--dock-key-hover); }
/* the quick-action dock is smaller on short windows, and the page always ends above it */
html.ce-rail #content { padding-bottom: 140px !important; }
@media (max-height: 860px) {
  .dk-dock { bottom: 12px; padding: 6px; border-radius: 20px; }
  .dk-dock a, .dk-dock .dk-add { min-width: 72px; height: 52px; padding: 0 6px; gap: 2px; font-size: 12px; }
  .dk-dock a .n { font-size: 18px; }
  .dk-dock .dk-find { height: 38px; min-width: 160px; }
  html.ce-rail #content { padding-bottom: 104px !important; }
}
/* on tablets the A–Z letters move below the search pill instead of running under it */
@media (max-width: 1180px) {
  html.ce-rail .ce-az { padding-right: 16px; padding-top: 58px; }
}
/* A–Z letters: at least 28 × 28 */
html.ce-rail .ce-az button { min-width: 28px; height: 28px; }

/* ---------- Phones. The rail becomes a bottom bar like the crew app's: Home, Events, Cal Glance, New,
   More and your initials. More opens the rest as a sheet. Menus open as bottom sheets. Search sits at the top. */
@media (max-width: 760px) {
  html.ce-rail { --dock-rail: 0px; --ce-bar-h: calc(62px + env(safe-area-inset-bottom)); }
  html.ce-rail #container { padding-left: 0; padding-bottom: calc(var(--ce-bar-h) + 16px); }
  html.ce-rail #header.ce-top { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; flex-direction: row; align-items: stretch;
    justify-content: space-between; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 -8px 24px -10px rgba(22,24,27,.40);
    overflow: visible; z-index: 950; }
  html.ce-rail #header > * { flex: 1 1 0; min-width: 0; }
  html.ce-rail .ce-brand, html.ce-rail .ce-histnav,
  html.ce-rail #header .ce-split-btn, html.ce-rail #header #dv-fab { display: none !important; }
  /* the nav shows its three main items in the bar; the others wait for More */
  html.ce-rail .ce-nav { display: contents; }
  html.ce-rail .ce-nav > * { display: none; }
  html.ce-rail .ce-nav > .ce-pri { display: flex; flex: 1 1 0; min-width: 0; }
  html.ce-rail .ce-nav > .ce-pri, html.ce-rail .ce-nav > .ce-pri > button, html.ce-rail .ce-morebtn {
    flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 0; border-radius: 12px; border: 0;
    background: none; color: #FFFFFF !important; font: 500 12px var(--ce-font); letter-spacing: .01em; text-decoration: none; cursor: pointer; width: 100%; min-height: 52px; }
  html.ce-rail .ce-nav > a span, html.ce-rail .ce-nav > .ce-dd > button span { position: static !important; width: auto; height: auto; clip: auto; }
  html.ce-rail .ce-nav > .ce-pri .ic { width: 22px; height: 22px; }
  html.ce-rail .ce-nav > .ce-pri > button .ic.sm { display: none; }
  html.ce-rail .ce-nav > .ce-pri.on, html.ce-rail .ce-nav > .ce-pri > button.on { background: var(--brand-700); color: var(--on-brand-700) !important;
    box-shadow: var(--hq-highlight); }
  html.ce-rail .ce-morebtn { display: flex !important; order: 5; }
  html.ce-rail .ce-morebtn .ic { width: 22px; height: 22px; }
  html.ce-rail #header > .ce-dd:has(.ce-new) { order: 4; display: flex; align-items: center; justify-content: center; }
  html.ce-rail #header .ce-new { width: 46px; height: 46px; border-radius: 14px; }
  html.ce-rail #header > .ce-dd:has(.ce-avatar) { order: 6; display: flex; align-items: center; justify-content: center; }
  html.ce-rail #header .ce-avatar { margin: 0; width: 38px; height: 38px; }
  /* ✦ AI assistant sits at the top, at the right end of the search bar: that strip is pinned already, so the star
     covers no row of the page (floating at the bottom right it sat on the end of rows, over their Open links) */
  html.ce-rail #header #ai-fab.ce-in-bar { position: fixed !important; top: 8px; right: 12px; bottom: auto; width: 44px !important; height: 44px !important;
    border-radius: 50% !important; flex: none; z-index: 951; background: var(--hq-charcoal); font-size: 20px;
    box-shadow: var(--hq-highlight), 0 0 0 1px rgba(255,255,255,.12), 0 4px 12px -4px rgba(22,24,27,.40) !important; }
  /* More: every other section as a sheet above the bar */
  html.ce-more-open.ce-rail .ce-nav { display: grid; position: fixed; left: 8px; right: 8px; bottom: calc(var(--ce-bar-h) + 8px); z-index: 952;
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 10px; background: var(--hq-charcoal); border-radius: 18px; box-shadow: 0 -10px 40px rgba(0,0,0,.35);
    max-height: 60vh; overflow-y: auto; }
  html.ce-more-open.ce-rail .ce-nav > *:not(.ce-histnav) { display: flex !important; }
  html.ce-more-open.ce-rail .ce-nav > a, html.ce-more-open.ce-rail .ce-nav > .ce-dd > button {
    flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; min-height: 64px; font-size: 12px; width: 100%; }
  html.ce-more-open.ce-rail .ce-morebtn { color: #fff !important; background: var(--dock-wash); }
  /* while More is open, Home, Events and Cal Glance stay in their places on the bar */
  html.ce-more-open.ce-rail #header.ce-top { justify-content: flex-end; }
  html.ce-more-open.ce-rail #header > * { flex: 0 0 calc(100% / 6); }
  html.ce-more-open.ce-rail .ce-nav > .ce-pri { position: fixed; z-index: 951; bottom: calc(4px + env(safe-area-inset-bottom)); width: calc((100vw - 8px) / 6);
    height: 52px; min-height: 0; box-sizing: border-box; flex-direction: column; padding: 0; font-size: 12px; }
  html.ce-more-open.ce-rail .ce-nav > .ce-p2 > button { height: 100%; min-height: 0; padding: 0; gap: 3px; justify-content: center; }
  html.ce-more-open.ce-rail .ce-nav > .ce-pri .ic:not(.sm) { width: 22px; height: 22px; }
  html.ce-more-open.ce-rail .ce-nav > .ce-p1 { left: 4px; }
  html.ce-more-open.ce-rail .ce-nav > .ce-p2 { left: calc(4px + (100vw - 8px) / 6); }
  html.ce-more-open.ce-rail .ce-nav > .ce-p3 { left: calc(4px + (100vw - 8px) / 3); }
  /* menus open as bottom sheets (dock.js places them beside the rail on bigger screens) */
  html.ce-rail #header .ce-menu { left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(var(--ce-bar-h) + 8px) !important;
    width: auto !important; min-width: 0; max-height: 65vh; z-index: 953; }
  html.ce-rail #header .ce-menu a, html.ce-rail #header .ce-menu button { min-height: 44px; }
  /* search at the top of the page */
  html.ce-rail #header .ce-search { display: block; position: fixed; top: 8px; left: 12px; right: 12px; width: auto; flex: none; z-index: 949; }
  html.ce-rail #header:has(#ai-fab) .ce-search { right: 64px; }  /* room for the ✦ beside it */
  html.ce-rail #header .ce-search input[type=search] { height: 44px; }
  html.ce-rail #header .ce-search kbd { display: none; }
  html.ce-rail #header .ce-search .ce-results { left: 0; right: 0; min-width: 0; }
  html.ce-rail .ce-topspace { min-height: 58px; }
  /* the quick-action dock is replaced by the bar */
  .dk-dock, .dk-pick { display: none !important; }
}

/* on a short window the nav list scrolls by itself and the buttons under it (Request, New, the
   AI star, the initials) stay pinned at the bottom of the rail, so the initials menu (Look, Log out) is never below the
   fold. The rail itself only scrolls if the pinned buttons alone are taller than the window. */
@media (min-width: 761px) {
  html.ce-rail #header.ce-top > .ce-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
}
