/* ================================================================
   Restaurant Operations - application shell
   Menu bar of module groups, tabs for open modules, status bar, the
   Home launcher and the jump box. Additive: styles.css (a copy of the
   prototype) is untouched, and everything here reuses its tokens.
================================================================ */

:root { --sh-bar-h: 56px; --sh-tab-h: 38px; --sh-status-h: 26px; }

/* ---------------- Group colours (one tint set per group) ---------------- */
[data-group] { --g: var(--brand-600); --g-tint: var(--brand-50); --g-line: var(--brand-200); }
[data-group="back-office"] { --g: #6d28d9; --g-tint: #f5f0ff; --g-line: #ddd0fb; }
[data-group="admin"]       { --g: #be185d; --g-tint: #fdf2f8; --g-line: #f9c9e0; }
[data-group="front-desk"]  { --g: var(--brand-600); --g-tint: var(--brand-50); --g-line: var(--brand-200); }
[data-group="inventory"]   { --g: var(--green-700); --g-tint: #f0fdf4; --g-line: #bbf0cd; }
[data-group="accounting"]  { --g: var(--blue-700); --g-tint: #eff6ff; --g-line: #c5dafc; }
[data-group="crm"]         { --g: #0f766e; --g-tint: #f0fdfa; --g-line: #b4ece4; }
[data-group="settings"]    { --g: var(--ink-700); --g-tint: var(--ink-100); --g-line: var(--ink-200); }

/* ---------------- Frame ---------------- */
.sh-app { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.sh-app > .content { flex: 1; min-width: 0; }
.sh-app kbd {
  font: 600 10.5px/1 var(--font); color: var(--ink-500);
  border: 1px solid var(--ink-300); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: var(--ink-50);
}

/* ---------------- Application bar ---------------- */
.sh-appbar {
  position: sticky; top: 0; z-index: 40; flex: none; height: var(--sh-bar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 14px 0 10px;
  background: rgba(255,255,255,0.88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); box-shadow: 0 6px 18px rgba(28,25,23,0.04);
}
.sh-home-btn { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 4px 8px 4px 4px; color: var(--ink-900); }
.sh-home-btn:hover, .sh-home-btn:focus-visible { background: var(--ink-100); outline: none; }
.sh-brand-name { display: none; font-size: 14px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.sh-spacer { flex: 1; min-width: 8px; }

/* Group menus */
.sh-menubar { display: flex; align-items: center; gap: 2px; min-width: 0; }
.sh-menu { position: relative; }
.sh-menu-btn {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 9px 11px;
  border: none; border-radius: 9px; background: transparent; color: var(--ink-700);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.sh-menu-btn .sh-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--g); flex-shrink: 0; }
.sh-menu-btn .sh-caret { width: 11px; height: 11px; opacity: .45; transition: transform .15s ease; }
.sh-menu-btn:hover, .sh-menu.open .sh-menu-btn { background: var(--g-tint); color: var(--ink-900); }
.sh-menu.open .sh-caret { transform: rotate(180deg); opacity: .8; }
.sh-menu-btn:focus-visible { outline: 2px solid var(--g); outline-offset: -2px; }
.sh-menu.has-active .sh-menu-btn::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--g);
}

.sh-dropdown {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 340px; max-width: min(430px, 92vw);
  background: var(--surface); border: 1px solid var(--g-line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 6px; animation: sh-drop .14s ease-out;
}
@keyframes sh-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sh-dropdown-head {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; margin: -6px -6px 6px;
  background: var(--g-tint); border-bottom: 1px solid var(--g-line); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.sh-dropdown-head strong { display: block; font-size: 13.5px; color: var(--ink-900); }
.sh-dropdown-head span:not(.lp-group-icon) { font-size: 12px; color: var(--ink-600); }
.sh-dropdown-icon { width: 34px !important; height: 34px !important; border-radius: 10px !important; }
.sh-dropdown-icon svg { width: 18px; height: 18px; }
.sh-dropdown .lp-module { padding: 8px 10px; }
.sh-dropdown .lp-module-icon { width: 32px; height: 32px; }
.sh-dropdown .lp-module-text span { font-size: 12px; }
.sh-scrim { position: fixed; inset: 0; z-index: 30; background: transparent; }

/* Jump box */
.sh-jump {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; min-width: 214px;
  border: 1px solid var(--ink-300); border-radius: 11px; background: var(--ink-50);
  color: var(--ink-500); font-size: 13px; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.sh-jump:hover { border-color: var(--brand-400); background: var(--surface); }
.sh-jump .nav-icon { width: 15px; height: 15px; }
.sh-jump-text { flex: 1; text-align: left; }
.store-switch select { max-width: 170px; }

/* User menu */
.sh-user { position: relative; }
.sh-user .sh-dropdown { left: auto; right: 0; min-width: 280px; border-color: var(--border); }
.sh-user-menu { padding: 6px; }
.sh-user-card { display: flex; align-items: center; gap: 12px; padding: 12px; margin: -6px -6px 6px; background: var(--ink-50); border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.sh-user-card strong { display: block; font-size: 13.5px; color: var(--ink-900); }
.sh-user-card span:not(.avatar) { display: block; font-size: 12px; color: var(--ink-500); }
.sh-user-card .sh-user-role { margin-top: 4px; width: fit-content; font-size: 11px; font-weight: 700; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-200); border-radius: 999px; padding: 1px 8px; }
.sh-user-avatar { width: 40px; height: 40px; font-size: 14px; }
.sh-user-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; border-radius: var(--radius-md);
  background: transparent; color: var(--ink-800); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left;
}
.sh-user-item:hover { background: var(--ink-100); }
.sh-user-item .nav-icon { width: 16px; height: 16px; color: var(--ink-500); }
.sh-user-item kbd { margin-left: auto; }
.sh-user-item.danger { color: var(--red-700); }
.sh-user-item.danger .nav-icon { color: var(--red-600); }
.sh-user-item.danger:hover { background: var(--red-100); }

/* ---------------- Tabs ---------------- */
.sh-tabs {
  position: sticky; top: var(--sh-bar-h); z-index: 35; flex: none;
  display: flex; align-items: flex-end; gap: 3px; padding: 7px 12px 0;
  background: var(--ink-100); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: thin;
}
.sh-tab {
  position: relative; top: 1px; flex: none; max-width: 240px; height: var(--sh-tab-h);
  display: flex; align-items: center; border: 1px solid transparent; border-bottom: none;
  border-radius: 11px 11px 0 0; color: var(--ink-600); font-size: 13px; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.sh-tab:hover { background: rgba(255,255,255,.7); color: var(--ink-900); }
.sh-tab.active { background: var(--surface); border-color: var(--border); color: var(--ink-900); }
.sh-tab.active::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--g);
}
.sh-tab-home { padding: 0 14px 0 12px; gap: 8px; }
.sh-tab-home.active::before { background: var(--brand-500); }
.sh-tab-link { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 4px 0 12px; min-width: 0; color: inherit; border-radius: 11px 0 0 0; }
.sh-tab .nav-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--g, var(--ink-500)); }
.sh-tab-home .nav-icon { color: var(--ink-500); }
.sh-tab-home.active .nav-icon { color: var(--brand-600); }
.sh-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-tab:focus-within { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.sh-tab-link:focus-visible, .sh-tab-close:focus-visible { outline: none; }
.sh-tab-close {
  width: 22px; height: 22px; margin: 0 7px 0 2px; flex: none; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 7px; background: transparent; color: var(--ink-500); cursor: pointer; font-size: 16px; line-height: 1;
}
.sh-tab-close:hover { background: var(--ink-200); color: var(--ink-900); }
.sh-tabs-end { margin-left: auto; padding: 0 0 6px 10px; display: flex; gap: 6px; flex: none; }
.sh-fullscreen-btn { padding: 5px 11px; font-size: 12px; }
.sh-fullscreen-btn .nav-icon { width: 14px; height: 14px; }

/* ---------------- Home ---------------- */
.is-home .page-head { display: none; }
.is-home .sh-app > .content, .is-home.sh-app > .content { padding: 0; }
.sh-home { max-width: 1180px; margin: 0 auto; padding: 26px 16px 44px; }

.sh-hero {
  position: relative; overflow: hidden; display: grid; gap: 18px; padding: 28px 30px 26px; margin-bottom: 22px;
  border: 1px solid var(--brand-200); border-radius: 22px;
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(251,146,60,.28), transparent 70%),
    radial-gradient(420px 220px at 0% 120%, rgba(124,58,237,.10), transparent 70%),
    linear-gradient(135deg, var(--brand-50), #ffffff 62%);
  box-shadow: var(--shadow-sm);
}
.lp-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-700); }
.sh-hero h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.1; letter-spacing: -0.025em; margin-top: 4px; text-wrap: balance; }
.sh-hero p { color: var(--ink-600); font-size: 15px; max-width: 58ch; margin-top: 8px; }
.sh-hero p kbd { vertical-align: 1px; }
.sh-hero-search {
  display: flex; align-items: center; gap: 12px; width: min(520px, 100%); padding: 14px 14px 14px 16px;
  border: 1px solid var(--ink-300); border-radius: 14px; background: var(--surface); color: var(--ink-400);
  font-size: 14px; cursor: pointer; box-shadow: var(--shadow-md); text-align: left;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.sh-hero-search:hover { border-color: var(--brand-400); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.sh-hero-search .nav-icon { width: 18px; height: 18px; color: var(--brand-600); flex-shrink: 0; }
.sh-hero-search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 999px;
  border: 1px solid var(--ink-200); background: rgba(255,255,255,.75); color: var(--ink-700); font-size: 12.5px; font-weight: 600;
}
.sh-chip .nav-icon { width: 14px; height: 14px; color: var(--brand-600); }
.sh-recent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sh-recent-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); margin-right: 4px; }
.sh-recent a {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 10px; border-radius: 999px;
  border: 1px solid var(--g-line); background: var(--g-tint); color: var(--ink-800); font-size: 13px; font-weight: 600;
  transition: background .15s ease, transform .15s ease;
}
.sh-recent a .nav-icon { width: 15px; height: 15px; color: var(--g); }
.sh-recent a:hover { background: var(--surface); transform: translateY(-1px); }

/* Group cards (Home) */
.lp-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.lp-group {
  grid-column: span 4; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .2s ease, transform .2s ease;
}
.lp-group:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lp-group[data-size="wide"]   { grid-column: span 7; }
.lp-group[data-size="narrow"] { grid-column: span 5; }
.lp-group[data-size="full"]   { grid-column: 1 / -1; }
.lp-group-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--g-tint); border-bottom: 1px solid var(--g-line); }
.lp-group-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--g); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--g) 30%, transparent);
}
.lp-group-icon svg { width: 22px; height: 22px; }
.lp-group-title { min-width: 0; }
.lp-group-title h2 { font-size: 18px; color: var(--ink-900); }
.lp-group-title p { font-size: 12.5px; color: var(--ink-600); margin-top: 2px; }
.lp-count {
  margin-left: auto; flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--g);
  background: var(--surface); border: 1px solid var(--g-line); border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums;
}
.lp-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2px; padding: 10px; flex: 1; }

/* A module row (Home cards, menus) */
.lp-module { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-md); color: inherit; transition: background .15s ease; }
.lp-module:hover { background: var(--g-tint); }
.lp-module:focus-visible { outline: 2px solid var(--g); outline-offset: -2px; background: var(--g-tint); }
.lp-module-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--g-tint); color: var(--g); border: 1px solid var(--g-line); transition: background .15s ease, color .15s ease;
}
.lp-module:hover .lp-module-icon, .lp-module:focus-visible .lp-module-icon { background: var(--g); color: #fff; border-color: var(--g); }
.lp-module-icon svg { width: 18px; height: 18px; }
.lp-module-text { min-width: 0; flex: 1; }
.lp-module-text strong { display: block; font-size: 14px; color: var(--ink-900); }
.lp-module-text span { display: block; font-size: 12.5px; color: var(--ink-500); line-height: 1.4; margin-top: 1px; }
.lp-go { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-300); transition: transform .15s ease, color .15s ease; }
.lp-module:hover .lp-go, .lp-module:focus-visible .lp-go { color: var(--g); transform: translateX(3px); }
.lp-module.is-open .lp-module-text strong::after {
  content: "open"; margin-left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--g); background: var(--g-tint); border: 1px solid var(--g-line); border-radius: 999px; padding: 1px 7px; vertical-align: 1px;
}

/* ---------------- Full screen ---------------- */
.sh-kiosk-btns { display: none; gap: 8px; }
.kiosk .sh-appbar, .kiosk .sh-tabs, .kiosk .sh-status { display: none; }
.kiosk .sh-kiosk-btns { display: flex; margin-left: auto; }
.kiosk .page-head { padding-top: 14px; }
.kiosk .page-head p { display: none; }

/* ---------------- Status bar ---------------- */
.sh-status {
  position: sticky; bottom: 0; z-index: 30; flex: none; height: var(--sh-status-h);
  display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: var(--ink-900); color: var(--ink-300); font-size: 11.5px; white-space: nowrap; overflow: hidden;
}
.sh-status-right { margin-left: auto; display: flex; gap: 18px; }
.sh-status-hint { color: var(--ink-400); }
.sh-clock { font-variant-numeric: tabular-nums; color: #fff; }

/* ---------------- Jump box ---------------- */
.sh-palette {
  position: fixed; inset: 0; z-index: 150; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 0; background: rgba(28,25,23,.45); backdrop-filter: blur(2px); animation: sh-fade .12s ease-out;
}
@keyframes sh-fade { from { opacity: 0; } to { opacity: 1; } }
.sh-palette-box {
  width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: sh-drop .14s ease-out;
}
.sh-palette-input { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.sh-palette-input .nav-icon { width: 18px; height: 18px; color: var(--brand-600); }
.sh-palette-input input { flex: 1; border: none; outline: none; font-size: 16px; background: transparent; color: var(--ink-900); }
.sh-palette-list { overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.sh-palette-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); }
.sh-palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-md); cursor: pointer; }
.sh-palette-item.sel { background: var(--g-tint); }
.sh-palette-item .lp-module-icon { background: var(--g-tint); color: var(--g); border-color: var(--g-line); }
.sh-palette-item.sel .lp-module-icon { background: var(--g); color: #fff; border-color: var(--g); }
.sh-palette-tag { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--g); background: var(--g-tint); border: 1px solid var(--g-line); border-radius: 999px; padding: 2px 9px; }
.sh-palette-empty { padding: 28px; text-align: center; color: var(--ink-500); }
.sh-palette-foot { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--border); background: var(--ink-50); font-size: 12px; color: var(--ink-500); }
.sh-palette-foot kbd { margin-right: 4px; }

/* ---------------- Narrower screens ---------------- */
@media (min-width: 1500px) { .sh-brand-name { display: inline; } }
@media (max-width: 1500px) {
  .sh-jump-text, .sh-jump kbd { display: none; }
  .sh-jump { min-width: 0; padding: 9px 11px; }
  .user-chip-text { display: none !important; }
}
@media (max-width: 1180px) {
  .sh-kbd-tip { display: none; }
  .sh-menubar { display: none; }            /* tablets and phones use Home and the jump box instead */
  .sh-status-hint { display: none; }
  .sh-jump-text { display: inline; }
}
@media (max-width: 1000px) {
  .lp-group, .lp-group[data-size="wide"], .lp-group[data-size="narrow"], .lp-group[data-size="full"] { grid-column: 1 / -1; }
  .lp-group[data-group="inventory"], .lp-group[data-group="accounting"] { grid-column: span 6; }
}
@media (max-width: 700px) {
  .sh-jump-text { display: none; }
  .sh-status { display: none; }
  .sh-appbar { gap: 6px; padding: 0 8px; }
  .store-switch select { max-width: 120px; }
  .offline-pill { display: none; }
  .sh-home { padding-top: 14px; }
  .sh-hero { padding: 22px 18px 20px; border-radius: 18px; }
  .sh-hero-search kbd { display: none; }
  .lp-group, .lp-group[data-group="inventory"], .lp-group[data-group="accounting"] { grid-column: 1 / -1; }
  .lp-modules { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-dropdown, .sh-palette, .sh-palette-box { animation: none; }
  .lp-group, .lp-module, .lp-go, .sh-hero-search, .sh-recent a { transition: none; }
  .lp-group:hover, .sh-hero-search:hover, .sh-recent a:hover { transform: none; }
}

/* ---------------- Connection pill states ---------------- */
.offline-pill.sh-conn-offline { background: var(--red-100); color: var(--red-700); }
.offline-pill.sh-conn-offline .dot { background: var(--red-600); }
.offline-pill.sh-conn-serverunreachable { background: var(--amber-100); color: var(--amber-700); }
.offline-pill.sh-conn-serverunreachable .dot { background: var(--amber-600); }

/* ---------------- "A new version is ready" ---------------- */
.sh-update {
  position: fixed; left: 16px; bottom: calc(var(--sh-status-h) + 14px); z-index: 120;
  display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--brand-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: sh-drop .18s ease-out;
}
.sh-update-icon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); }
.sh-update-icon .nav-icon { width: 18px; height: 18px; }
.sh-update-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.sh-update-text strong { font-size: 13px; color: var(--ink-900); }
.sh-update-text span { font-size: 12px; color: var(--ink-500); }
.sh-update .btn { flex: none; padding: 7px 12px; font-size: 12.5px; }
.kiosk .sh-update { bottom: 14px; }
@media (max-width: 700px) {
  .sh-update { left: 12px; right: 12px; bottom: 12px; max-width: none; flex-wrap: wrap; }
  .sh-update-text { flex: 1 1 60%; }
}
@media (prefers-reduced-motion: reduce) { .sh-update { animation: none; } }

/* ---------------- A module the role can't open ---------------- */
.sh-noaccess { max-width: 460px; margin: 8vh auto 0; padding: 0 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.sh-noaccess-icon { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--brand-50); color: var(--brand-600); }
.sh-noaccess-icon .nav-icon { width: 26px; height: 26px; }
.sh-noaccess h2 { font-size: 18px; color: var(--ink-900); text-wrap: balance; }
.sh-noaccess p { font-size: 13.5px; color: var(--ink-500); line-height: 1.5; margin-bottom: 6px; }

/* ---------------- Role editor ---------------- */
.role-editor { display: flex; flex-direction: column; gap: 14px; }
.role-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--ink-900); }
.role-h small { font-size: 11.5px; font-weight: 500; color: var(--ink-500); }
.role-switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.role-switch input { margin-top: 3px; flex: none; }
.role-switch span { display: flex; flex-direction: column; gap: 1px; }
.role-switch strong { font-size: 13px; color: var(--ink-900); }
.role-switch small { font-size: 12px; color: var(--ink-500); line-height: 1.4; }
.role-grid { min-width: 520px; }
.role-grid th, .role-grid td { padding: 7px 10px; }
.role-col { width: 64px; text-align: center; }
.role-group th { background: var(--ink-50); text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-500); padding: 6px 10px; }
.role-na { color: var(--ink-300); }
.role-quick { background: none; border: 0; padding: 2px 6px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--brand-600); cursor: pointer; }
.role-quick:hover { background: var(--brand-50); }
.role-quick:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.role-note { margin: -6px 0 0; font-size: 12px; }
.role-actions-group { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 8px; border-top: 1px solid var(--ink-100); }
.role-actions-title { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-500); font-weight: 700; padding-top: 6px; }

/* ---------------- Orders: filters and times ---------------- */
.orders-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding-top: 0; }
.orders-filters > .input:not(.orders-search), .orders-date .input { width: auto; min-width: 136px; }
.orders-search { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; max-width: 280px; padding: 6px 10px; }
.orders-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; color: inherit; }
.orders-date { display: flex; flex-direction: column; gap: 3px; }
.orders-date span { font-size: 11px; font-weight: 600; color: var(--ink-500); }
.orders-filters .input, .orders-filters .btn { height: 38px; box-sizing: border-box; }
.orders-filters .btn { padding-block: 0; }
.orders-time { white-space: nowrap; font-size: 12.5px; color: var(--ink-700); font-variant-numeric: tabular-nums; }
.orders-table td, .orders-table th { vertical-align: middle; }
@media (max-width: 700px) {
  .orders-filters > .input:not(.orders-search), .orders-date, .orders-date .input { flex: 1 1 140px; min-width: 0; }
  .orders-search { max-width: none; }
}

/* ---------------- Floor view: wider table cards ---------------- */
/* About 2.5 times the width they had, at the same height, so a card reads at a glance from across the till. The grid
   still measures its own columns (responsiveGrid.js), so the page size follows. Scoped to the grid so the legend
   swatches, which reuse .table-tile, keep their size. */
.floor-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.floor-grid .table-tile { aspect-ratio: auto; min-height: 92px; padding: 10px 12px; gap: 4px; }
.floor-grid .table-tile .t-num { font-size: 16px; }
.floor-grid .table-tile .t-meta { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-grid .table-tile .pill { font-size: 10px; padding: 2px 8px; }

/* ---------------- On-screen keyboard (wwwroot/js/keyboard.js) ---------------- */
.osk {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 400;
  background: var(--ink-100); border-top: 1px solid var(--border); box-shadow: 0 -10px 30px rgba(28, 25, 23, .16);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: osk-rise .16s ease-out;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.osk[hidden] { display: none; }
@keyframes osk-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* a grab-bar style handle: tapping it hides the keyboard */
.osk-handle { display: flex; justify-content: center; width: 100%; padding: 7px 0 3px; background: none; border: 0; cursor: pointer; }
.osk-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--ink-300); }
.osk-inner { max-width: 1120px; margin: 0 auto; padding: 4px 12px 12px; }

.osk-body { display: flex; flex-direction: column; gap: 7px; }
.osk-row { display: flex; gap: 6px; }
.osk-spacer { flex: var(--w, 1) 1 0; min-width: 0; }

.osk-key {
  flex: var(--w, 1) 1 0; min-width: 0; height: clamp(44px, 6.8vh, 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 0; font: inherit; font-size: clamp(16px, 2.5vh, 21px); font-weight: 600; color: var(--ink-900);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 2px 0 rgba(28, 25, 23, .1);
  cursor: pointer; transition: background .06s ease, transform .06s ease, box-shadow .06s ease;
}
.osk-key svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.osk-key:active, .osk-key.is-down { background: var(--brand-100); border-color: var(--brand-600); transform: translateY(1px); box-shadow: none; }
.osk-key--fn { background: var(--ink-200, #e7e5e4); font-size: clamp(13px, 2vh, 17px); }
.osk-key--fn.is-on { background: var(--brand-100); border-color: var(--brand-600); color: var(--brand-700); }
.osk-key--primary { background: var(--brand-600); border-color: var(--brand-700); color: #fff; box-shadow: 0 2px 0 var(--brand-700); }
.osk-key--primary:active { background: var(--brand-700); border-color: var(--brand-700); }
.osk-key--space { font-weight: 500; font-size: 14px; color: var(--ink-500); letter-spacing: .02em; }
.osk-key:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }

/* number pad: the value being typed, then the digits with the quick amounts and Done beside them */
.osk-body--pad { max-width: 600px; margin: 0 auto; gap: 8px; }
.osk-display {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.osk-display-label { font-size: 12.5px; font-weight: 600; color: var(--ink-500); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osk-display-value { font-size: clamp(24px, 3.8vh, 32px); font-weight: 800; color: var(--ink-900); font-variant-numeric: tabular-nums; text-align: right; }
.osk-display-value.is-placeholder { color: var(--ink-300); }
.osk-display-value.is-selected { background: var(--brand-100); border-radius: 6px; padding: 0 8px; margin-right: -8px; }
.osk-pad { display: flex; gap: 8px; align-items: stretch; }
.osk-pad-grid { flex: 3 1 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.osk-pad-grid .osk-key { flex: none; height: clamp(46px, 6.2vh, 60px); font-size: clamp(20px, 3.2vh, 28px); }
.osk-pad-side { flex: 1 1 0; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.osk-pad-side .osk-key { flex: none; height: clamp(46px, 6.2vh, 60px); }
.osk-pad-side .osk-key--grow { flex: 1 1 auto; height: auto; min-height: clamp(46px, 6.2vh, 60px); font-size: clamp(18px, 2.8vh, 24px); }
/* quick amounts for cash received: a row of one-tap chips above the digits */
.osk-quick { display: flex; gap: 7px; }
.osk-quick .osk-key { height: clamp(40px, 5.2vh, 50px); font-size: clamp(14px, 2.1vh, 17px); }
.osk-key--quick { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.osk-key--quick:active { background: var(--brand-100); border-color: var(--brand-600); }

/* room for the keyboard: dialogs sit above it, the page scrolls further */
body.osk-open { padding-bottom: var(--osk-h, 0px); }
body.osk-open .modal-backdrop { padding-bottom: calc(20px + var(--osk-h, 0px)); }
body.osk-open .modal:not(.modal-order) { max-height: calc(100vh - 40px - var(--osk-h, 0px)); }
body.osk-open .modal.modal-order { height: calc(100vh - var(--osk-h, 0px)); height: calc(100dvh - var(--osk-h, 0px)); min-height: 0; max-height: calc(100vh - var(--osk-h, 0px)); max-height: calc(100dvh - var(--osk-h, 0px)); }
body.osk-open .sh-status { display: none; }

@media (max-width: 700px) {
  .osk-inner { padding: 2px 6px 8px; }
  .osk-row { gap: 4px; }
  .osk-body { gap: 5px; }
  .osk-key { border-radius: 8px; }
}
@media (prefers-reduced-motion: reduce) { .osk { animation: none; } .osk-key { transition: none; } }
@media print { .osk { display: none !important; } }

/* the switch in the status bar */
.sh-status-kbd {
  display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; height: 20px; margin: 0; font: inherit; font-size: 11px;
  color: var(--ink-500); background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.sh-status-kbd .nav-icon { width: 14px; height: 14px; }
.sh-status-kbd:hover { background: var(--ink-100); color: var(--ink-700); }
.sh-status-kbd.is-on { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-200); }
.sh-status-kbd:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }

/* ---- Offline till ---- */
/* Wraps the page body without changing its layout; hidden (state kept) while the "needs a connection" notice is up. */
.sh-body-wrap { display: contents; }
.sh-body-wrap[hidden] { display: none; }

/* Sales rung up offline that the server hasn't received yet. */
/* ---------------- Alerts: the bell and its list ---------------- */
.sh-bell { position: relative; }
.sh-bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-700); cursor: pointer; }
.sh-bell-btn.serious { color: var(--red-700); border-color: var(--red-600); }
.sh-bell-btn:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.sh-bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-600); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.sh-bell-panel { position: absolute; right: 0; top: 44px; width: 380px; max-width: 92vw; max-height: 70vh; overflow-y: auto; z-index: 300; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.sh-bell-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.sh-bell-item { display: flex; gap: 6px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--border); border-left: 4px solid var(--amber-600); }
.sh-bell-item.serious { border-left-color: var(--red-600); background: var(--red-100); }
.sh-bell-item.info { border-left-color: var(--blue-600); }
.sh-bell-item-main { flex: 1; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.sh-bell-item-main strong { font-size: 13px; }
.sh-bell-item-main span { font-size: 12px; color: var(--ink-600); }
.sh-bell-item-main small { font-size: 11px; color: var(--ink-500); }

.sh-unsent {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 0;
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  background: var(--amber-100); color: var(--amber-700);
}
.sh-unsent.needs-attention { background: var(--red-100); color: var(--red-700); }
.sh-unsent:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }

/* ---------------- Plan limits: warning strip and usage meters ---------------- */
.sh-plan { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.4; }
.sh-plan .nav-icon { width: 18px; height: 18px; flex: none; }
.sh-plan-warning { background: var(--amber-100); color: var(--amber-700); }
.sh-plan-danger { background: var(--red-100); color: var(--red-700); }
.plan-row { margin-bottom: 14px; }
.plan-row-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: 13px; }
.plan-meter { height: 8px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.plan-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-500); }
.plan-meter.is-warning > span { background: var(--amber-600); }
.plan-meter.is-full > span { background: var(--red-600); }
.text-red { color: var(--red-700); font-size: 12px; font-weight: 600; }
