/* MHS Tools landing page — Delivery Day's "Soft Instrument" look (raised
   keys and inset trays, navy masthead, mono uppercase labels, amber lamps),
   so the picker matches the tools it opens, with a little more depth: the
   trays sit a shade darker than the page and the keys a shade lighter, so
   every key reads clearly at a glance. Three department trays — Sales,
   Service, Delivery — side by side, with an Inventory Management shelf
   across the bottom on a desktop; on a phone they stack. Self-contained
   tokens like style/delivery-day.css; the page does not load shared.css
   (the error pages still do). */

:root {
  color-scheme: light;
  --surface: #e6ebf1;
  --tray: #dfe5ec;
  --key: #edf1f5;
  --ink: #1b2a3b;
  --muted: #4f6174;
  --navy: #1d2e48;
  --navy-hi: #26406a;
  --amber: #e9a100;
  --amber-hi: #ffc53d;
  --green: #1e8f5a;
  --grid: rgba(29, 46, 72, .05);
  --shade: #b4c0cd;
  --raised: 10px 10px 24px var(--shade), -9px -9px 22px #ffffff;
  --raised-sm: 5px 5px 12px var(--shade), -5px -5px 12px #ffffff;
  --inset: inset 5px 5px 11px #bfcad6, inset -5px -5px 11px #f8fafc;
  --key-edge: inset 0 -2px 0 rgba(27, 42, 59, .12), inset 0 1px 0 rgba(255, 255, 255, .8), 0 0 0 1px rgba(27, 42, 59, .05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--surface);
  background-size: 26px 26px, 26px 26px, auto;
}
a:focus-visible, button:focus-visible { outline: 3px solid #4176ab; outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 10; padding: 10px 14px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; }
.skip:focus { top: 12px; }

.shell { max-width: 1240px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 36px max(22px, env(safe-area-inset-left)); }

/* ---------- Masthead ---------- */
.mast {
  display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 22px; color: #fff;
  background: linear-gradient(180deg, #22365a, var(--navy));
  box-shadow: var(--raised), inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -3px 0 rgba(0, 0, 0, .22);
}
.plate { display: block; padding: 7px 10px; border-radius: 13px; background: #f4f1ea;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), 0 6px 14px rgba(0, 0, 0, .28); }
.plate img { display: block; height: 42px; width: auto; }
.mast-title { flex: 1 1 160px; min-width: 0; }
h1 { margin: 0; font: 900 clamp(26px, 3.2vw, 36px)/1 var(--sans); letter-spacing: -.01em; text-transform: uppercase; color: var(--amber-hi); }
h1 span { color: #fff; }
.mast small { display: block; margin-top: 7px; font: 700 10.5px/1.4 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: #b8c4d4; }

/* Who's signed in, from /.auth/me — filled by the script in index.html */
.who { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.readout {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 14px; border-radius: 10px;
  background: rgba(0, 0, 0, .2); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .3);
  font: 700 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #dbe3ee; white-space: nowrap;
}
.readout .dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #6d7f95; }
.who.in .readout .dot { background: #3dbe83; box-shadow: 0 0 7px #3dbe83; }
.mkey {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 13px; border-radius: 10px;
  border: 1.5px solid #3a5578; background: rgba(255, 255, 255, .05); color: #c9d4e3; text-decoration: none; white-space: nowrap;
  font: 700 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .28);
  transition: color .16s ease, border-color .16s ease;
}
.mkey:hover { color: #fff; border-color: var(--amber); }
.mkey:active { transform: translateY(1px); box-shadow: none; }

/* ---------- Trays: one per department, tools are raised keys inside ---------- */
/* Side by side, each tray spans the same three rows (bar, key, key) through
   subgrid, so a key whose title wraps sets the height for its whole row. */
.bays { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); gap: 0 22px; margin-top: 24px; counter-reset: bay; }
.bay {
  counter-increment: bay; display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 12px; align-content: start;
  padding: 11px 11px 13px; border-radius: 24px; background: var(--tray); box-shadow: var(--inset);
}
.bay h2 {
  display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 9px 14px; border-radius: 13px;
  background: var(--navy); color: #fff; box-shadow: 3px 3px 8px var(--shade), inset 0 -2px 0 rgba(0, 0, 0, .28);
  font: 800 12.5px var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.bay h2::before { content: counter(bay, decimal-leading-zero); color: var(--amber-hi); }
.bay h2 em { margin-left: auto; font: 700 10px var(--mono); font-style: normal; letter-spacing: .1em; color: #b8c4d4; }
/* 04 Inventory Management: on a desktop, a shelf across the bottom under the
   three department trays. Its keys sit on the same three columns as the keys
   above (44px = the 22px gap between trays plus 11px of tray padding either
   side), so the room to its right is ready for more inventory tools. When
   the trays stack it is simply the fourth tray. */
@media (min-width: 1041px) {
  .bay.shelf { grid-column: 1 / -1; grid-row: auto; grid-template-rows: none; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 44px; margin-top: 22px; }
  .bay.shelf h2 { grid-column: 1 / -1; }
}

.tool {
  position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr) 32px; align-items: center; gap: 14px;
  min-height: 84px; padding: 13px 14px; border-radius: 18px; text-decoration: none; color: var(--ink);
  background: var(--key); box-shadow: var(--raised-sm), var(--key-edge);
  transition: box-shadow .16s ease, transform .16s ease;
}
.tool:hover { box-shadow: var(--raised), var(--key-edge); }
.tool:active { transform: translateY(1px); box-shadow: var(--inset); }
.well { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; background: var(--surface); box-shadow: var(--inset); }
.well svg { display: block; width: 36px; height: 36px; }
.tt { min-width: 0; }
.tt b { display: block; font: 800 16px/1.15 var(--sans); letter-spacing: .02em; text-transform: uppercase; color: var(--navy); }
.tt small { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.35; color: var(--muted); }
.tt .last { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; font: 700 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #8a5d00; }
.tt .last::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px rgba(233, 161, 0, .8); }
.go {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--key);
  box-shadow: 3px 3px 7px var(--shade), -3px -3px 7px #fff; color: var(--muted); transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.go svg { width: 15px; height: 15px; }
.tool:hover .go, .tool:focus-visible .go { background: var(--navy); color: var(--amber-hi); box-shadow: 2px 2px 6px var(--shade), -2px -2px 6px #fff, inset 0 -2px 0 rgba(0, 0, 0, .3); }
.tool .lamp { position: absolute; top: 9px; right: 18px; width: 20px; height: 4px; border-radius: 2px; background: #c3cdd8; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .18); }
.tool.is-last .lamp { background: var(--amber); box-shadow: 0 0 10px rgba(233, 161, 0, .75); }

.page-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; padding: 0 4px;
  font: 700 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Responsive: trays stack, then a compact phone layout ---------- */
@media (max-width: 1040px) {
  .bays { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 18px; }
  .bay { grid-row: auto; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .bay h2 { grid-column: 1 / -1; }
}
/* Phones: the masthead becomes one row (logo, title over who's signed in,
   Sign in/out) and the keys shrink so the trays stay compact — Sales,
   Service and Delivery fit on a typical phone screen, Inventory Management
   is a short scroll below. */
@media (max-width: 680px) {
  .shell { padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 28px max(12px, env(safe-area-inset-left)); }
  .mast {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "plate title key" "plate who key";
    align-items: center; gap: 2px 12px; padding: 10px 12px; border-radius: 18px;
  }
  .plate { grid-area: plate; padding: 5px 7px; border-radius: 10px; }
  .plate img { height: 26px; }
  .mast-title { grid-area: title; align-self: end; }
  h1 { font-size: 22px; }
  .mast small { display: none; }
  .mast:has(.who[hidden]) small { display: block; margin-top: 4px; font-size: 9.5px; letter-spacing: .1em; }
  .who { display: contents; }
  .readout {
    grid-area: who; align-self: start; min-width: 0; min-height: 0; padding: 0; gap: 7px; overflow: hidden;
    background: none; box-shadow: none; font-size: 10px; letter-spacing: .06em; color: #b8c4d4;
  }
  .readout span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .readout .dot { width: 7px; height: 7px; }
  .mkey { grid-area: key; min-height: 36px; padding: 8px 10px; font-size: 10.5px; }

  .bays { margin-top: 12px; gap: 12px; }
  .bay { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px; border-radius: 20px; }
  .bay h2 { padding: 7px 12px; border-radius: 11px; font-size: 11.5px; }
  .bay h2 em { font-size: 9px; letter-spacing: .06em; }
  .tool { grid-template-columns: 42px minmax(0, 1fr) 26px; gap: 10px; min-height: 0; padding: 9px 10px; border-radius: 15px; }
  .well { width: 42px; height: 42px; border-radius: 12px; }
  .well svg { width: 28px; height: 28px; }
  .tt b { font-size: 14.5px; }
  .tt small { margin-top: 1px; font-size: 12.5px; line-height: 1.3; }
  /* No room for a third line here: the lit lamp and an amber ring on the
     icon mark the last tool; the words stay for screen readers. */
  .tt .last { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tool.is-last .well { box-shadow: var(--inset), 0 0 0 2px rgba(233, 161, 0, .85); }
  .go { width: 26px; height: 26px; box-shadow: 2px 2px 5px var(--shade), -2px -2px 5px #fff; }
  .go svg { width: 13px; height: 13px; }
  .tool .lamp { top: 6px; right: 14px; width: 16px; height: 3px; }
  .page-footer { flex-direction: column; gap: 6px; margin-top: 22px; letter-spacing: .1em; }
}
@media (max-width: 380px) {
  .mast { column-gap: 10px; }
  .plate img { height: 22px; }
  h1 { font-size: 20px; white-space: nowrap; }
  .mkey { padding: 8px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media (forced-colors: active) {
  .tool { border: 2px solid CanvasText; }
  .tool.is-last { outline: 3px solid Highlight; }
}
