/* Phase 82.7.6.38.5.8.1.29 · Navigation / Interaction / Accessibility Foundation
   Presentation only. Builds on .1.24 UI + .1.25 responsive + .1.26 components + .1.27 forms + .1.28 data states.
   Scope: platform console, tenant admin shell and standalone employee/admin workbenches.
   Customer ordering, POS and legacy KDS are intentionally excluded. */

:root {
  --ui-focus:#0F766E;
  --ui-focus-ring:rgba(15,118,110,.22);
  --ui-nav-hover:rgba(255,255,255,.07);
  --ui-nav-active:rgba(15,118,110,.94);
  --ui-topbar-shadow:0 1px 0 rgba(15,23,42,.06),0 8px 24px rgba(15,23,42,.045);
  --ui-action-min:38px;
  --ui-touch-min:44px;
}

/* ---------- Keyboard focus / interactive state language ---------- */
html:not(.legacy-kds-view) .admin-shell :where(a,button,input,select,textarea,[tabindex]):focus-visible,
.platform-shell :where(a,button,input,select,textarea,[tabindex]):focus-visible,
.ui-foundation-page :where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline:3px solid var(--ui-focus-ring);
  outline-offset:2px;
  border-radius:10px;
}
html:not(.legacy-kds-view) .admin-shell :where(button,input,select,textarea):disabled,
.platform-shell :where(button,input,select,textarea):disabled,
.ui-foundation-page :where(button,input,select,textarea):disabled {
  cursor:not-allowed;
  opacity:.58;
}
html:not(.legacy-kds-view) .admin-shell :where(a,button),
.platform-shell :where(a,button),
.ui-foundation-page :where(a,button) {
  -webkit-tap-highlight-color:transparent;
}
html:not(.legacy-kds-view) .admin-shell :where(a,button):active,
.platform-shell :where(a,button):active,
.ui-foundation-page :where(a,button):active {
  transform:translateY(1px);
}
@media (prefers-reduced-motion:reduce) {
  html:not(.legacy-kds-view) .admin-shell :where(a,button),
  .platform-shell :where(a,button),
  .ui-foundation-page :where(a,button) { scroll-behavior:auto; transition:none!important; }
}

/* ---------- Tenant navigation hierarchy ---------- */
html:not(.legacy-kds-view) .admin-shell .sidebar {
  scrollbar-width:thin;
  scrollbar-color:rgba(148,163,184,.32) transparent;
}
html:not(.legacy-kds-view) .admin-shell .sidebar::-webkit-scrollbar { width:6px; }
html:not(.legacy-kds-view) .admin-shell .sidebar::-webkit-scrollbar-thumb { background:rgba(148,163,184,.28); border-radius:99px; }
html:not(.legacy-kds-view) .admin-shell .sidebar-brand {
  position:sticky;
  top:0;
  z-index:2;
  margin:-4px -4px 8px;
  padding:8px 8px 16px;
  background:linear-gradient(180deg,var(--ui-sidebar,#0F172A) 0%,var(--ui-sidebar,#0F172A) 78%,rgba(15,23,42,0) 100%);
}
html:not(.legacy-kds-view) .admin-shell .sidebar .sidebar-nav-title {
  margin:0 8px 5px;
  color:#64748B;
  font-size:10px;
  font-weight:800;
  letter-spacing:.105em;
  line-height:1.2;
  text-transform:uppercase;
}
html:not(.legacy-kds-view) .admin-shell .sidebar nav a {
  position:relative;
  min-height:42px;
  padding:9px 10px;
  border:1px solid transparent;
  border-radius:11px;
  color:#CBD5E1;
  transition:background-color .14s ease,border-color .14s ease,color .14s ease;
}
html:not(.legacy-kds-view) .admin-shell .sidebar nav a:hover,
html:not(.legacy-kds-view) .admin-shell .sidebar nav a:focus-visible {
  color:#F8FAFC;
  background:var(--ui-nav-hover);
  border-color:rgba(148,163,184,.12);
}
html:not(.legacy-kds-view) .admin-shell .sidebar nav a.active {
  color:#FFFFFF;
  background:var(--ui-nav-active);
  border-color:rgba(153,246,228,.18);
  box-shadow:0 8px 18px rgba(2,44,40,.18);
}
html:not(.legacy-kds-view) .admin-shell .sidebar nav a.active::before {
  content:"";
  position:absolute;
  left:-5px;
  top:50%;
  width:3px;
  height:22px;
  border-radius:99px;
  background:#5EEAD4;
  transform:translateY(-50%);
}
html:not(.legacy-kds-view) .admin-shell .sidebar .nav-glyph {
  flex:0 0 auto;
  width:26px;
  height:26px;
  border-radius:8px;
  opacity:.9;
}
html:not(.legacy-kds-view) .admin-shell .sidebar nav a.active .nav-glyph {
  background:rgba(255,255,255,.10);
  border-color:rgba(255,255,255,.34);
}
html:not(.legacy-kds-view) .admin-shell .sidebar-foot button {
  min-height:36px;
  padding:7px 0;
  cursor:pointer;
}

/* ---------- Top bar / current-location clarity ---------- */
html:not(.legacy-kds-view) .admin-shell .topbar,
.platform-shell .platform-topbar {
  box-shadow:var(--ui-topbar-shadow);
}
html:not(.legacy-kds-view) .admin-shell .topbar {
  z-index:40;
  background:rgba(255,255,255,.94);
  border-bottom-color:var(--ui-border,#E2E8F0);
}
@supports (backdrop-filter:blur(14px)) {
  html:not(.legacy-kds-view) .admin-shell .topbar { backdrop-filter:blur(14px) saturate(1.05); }
}
html:not(.legacy-kds-view) .admin-shell .topbar > div:first-of-type { min-width:0; }
html:not(.legacy-kds-view) .admin-shell .topbar > div:first-of-type strong {
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
html:not(.legacy-kds-view) .admin-shell .topbar .eyebrow {
  overflow:hidden;
  max-width:42ch;
  text-overflow:ellipsis;
  white-space:nowrap;
}
html:not(.legacy-kds-view) .admin-shell .topbar-actions { gap:9px; }
html:not(.legacy-kds-view) .admin-shell :where(.branch-switcher,.notification-bell,.user-chip,.locale-chip) {
  flex:0 0 auto;
}
html:not(.legacy-kds-view) .admin-shell .branch-switcher {
  min-height:38px;
  max-width:210px;
  border-radius:10px;
}
html:not(.legacy-kds-view) .admin-shell .notification-bell,
html:not(.legacy-kds-view) .admin-shell .user-chip,
html:not(.legacy-kds-view) .admin-shell .locale-chip button {
  min-height:38px;
}
html:not(.legacy-kds-view) .admin-shell .user-chip {
  padding:4px 8px 4px 4px;
  border:1px solid transparent;
  border-radius:12px;
}
html:not(.legacy-kds-view) .admin-shell .user-chip:hover {
  background:var(--ui-muted-bg,#F1F5F9);
  border-color:var(--ui-border,#E2E8F0);
}

/* ---------- Page heading / action rhythm ---------- */
html:not(.legacy-kds-view) .admin-shell .page-heading,
.platform-shell .platform-heading,
.ui-foundation-page .top {
  scroll-margin-top:86px;
}
html:not(.legacy-kds-view) .admin-shell .page-heading {
  gap:18px;
  padding-bottom:2px;
}
html:not(.legacy-kds-view) .admin-shell .page-heading > div:first-child { min-width:0; }
html:not(.legacy-kds-view) .admin-shell .page-heading h1,
.platform-shell .platform-heading h1,
.ui-foundation-page .top h1 {
  text-wrap:balance;
}
html:not(.legacy-kds-view) .admin-shell .heading-actions,
html:not(.legacy-kds-view) .admin-shell .section-actions,
html:not(.legacy-kds-view) .admin-shell .table-actions,
html:not(.legacy-kds-view) .admin-shell .row-actions,
html:not(.legacy-kds-view) .admin-shell .modal-actions,
.platform-shell :where(.platform-section-head,.platform-modal footer),
.ui-foundation-page :where(.actions,.top) {
  row-gap:8px;
}

/* ---------- Toolbar and long-list action consistency ---------- */
html:not(.legacy-kds-view) .admin-shell :where(.data-toolbar,.menu-toolbar,.qr-selection-toolbar,.booking-nav,.reservation-day-nav) {
  position:relative;
  z-index:3;
}
html:not(.legacy-kds-view) .admin-shell :where(.data-toolbar,.menu-toolbar,.qr-selection-toolbar) :where(button,a,select,input) {
  min-height:var(--ui-action-min);
}
html:not(.legacy-kds-view) .admin-shell :where(.row-actions,.table-actions,.section-actions) :where(button,a) {
  min-height:36px;
  min-width:36px;
}
html:not(.legacy-kds-view) .admin-shell .row-actions > :where(button,a):only-child { min-width:72px; }
html:not(.legacy-kds-view) .admin-shell :where(.row-actions,.table-actions,.section-actions) :where(button,a):focus-visible {
  position:relative;
  z-index:2;
}

/* ---------- Modal / drawer interaction ---------- */
html:not(.legacy-kds-view) .admin-shell :where(.modal-backdrop,.dish-config-backdrop,.inventory-modal,.receipt-backdrop,.notification-backdrop),
.platform-shell .platform-modal {
  overscroll-behavior:contain;
}
html:not(.legacy-kds-view) .admin-shell :where(.modal-card,.wide-modal),
.platform-shell .platform-modal > * {
  scrollbar-width:thin;
  scrollbar-color:#CBD5E1 transparent;
}
html:not(.legacy-kds-view) .admin-shell .modal-actions,
.platform-shell .platform-modal footer {
  border-top:1px solid var(--ui-border,#E2E8F0);
  background:rgba(255,255,255,.96);
}
html:not(.legacy-kds-view) .admin-shell .modal-actions :where(button,a),
.platform-shell .platform-modal footer :where(button,a) {
  min-height:42px;
}
html:not(.legacy-kds-view) .admin-shell .modal-close,
html:not(.legacy-kds-view) .admin-shell .notification-drawer > header button {
  display:inline-grid;
  place-items:center;
  min-width:40px;
  min-height:40px;
  border-radius:10px;
}
html:not(.legacy-kds-view) .admin-shell .notification-drawer {
  background:#FFFFFF;
  border-left:1px solid var(--ui-border,#E2E8F0);
  box-shadow:-18px 0 50px rgba(15,23,42,.15);
}
html:not(.legacy-kds-view) .admin-shell .notification-drawer > header {
  position:sticky;
  top:0;
  z-index:2;
  background:var(--ui-sidebar,#0F172A);
}
html:not(.legacy-kds-view) .admin-shell .notification-tools {
  position:sticky;
  top:94px;
  z-index:2;
  background:#FFFFFF;
  border-bottom-color:var(--ui-border,#E2E8F0);
}
html:not(.legacy-kds-view) .admin-shell .notification-item {
  min-height:72px;
  border-bottom-color:var(--ui-border,#E2E8F0);
}
html:not(.legacy-kds-view) .admin-shell .notification-item:hover,
html:not(.legacy-kds-view) .admin-shell .notification-item:focus-visible { background:#F8FAFC; }
html:not(.legacy-kds-view) .admin-shell .notification-item.unread { background:#F0FDFA; }
html:not(.legacy-kds-view) .admin-shell .notification-item.unread::before { background:var(--ui-primary,#0F766E); }
html:not(.legacy-kds-view) .admin-shell .notification-item.unread .notification-icon { background:var(--ui-primary,#0F766E); }

/* ---------- Platform navigation interaction ---------- */
.platform-shell .platform-topbar {
  position:sticky;
  top:0;
  z-index:40;
  background:var(--ui-sidebar,#0F172A);
}
.platform-shell .platform-brand {
  border-radius:12px;
}
.platform-shell .platform-topbar :where(a,button) { min-height:38px; }
.platform-shell .platform-section-head { gap:14px; }
.platform-shell .tenant-card:focus-within,
.platform-shell .platform-plan-card:focus-within {
  border-color:#99F6E4;
  box-shadow:0 0 0 3px rgba(15,118,110,.08);
}

/* ---------- Standalone employee/admin navigation ---------- */
.ui-foundation-page .wrap { scroll-margin-top:16px; }
.ui-foundation-page .top > a,
.ui-foundation-page :where(.recovery-back,.legacy-kds-back) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:8px 11px;
  border:1px solid var(--ui-border,#E2E8F0);
  border-radius:10px;
  background:#FFFFFF;
  color:var(--ui-text-soft,#334155);
  text-decoration:none;
  font-weight:700;
}
.ui-foundation-page .top > a:hover,
.ui-foundation-page :where(.recovery-back,.legacy-kds-back):hover {
  border-color:#99F6E4;
  background:#F0FDFA;
  color:var(--ui-primary,#0F766E);
}
.ui-foundation-page :where(.card,.doc,.panel):focus-within {
  border-color:#CCFBF1;
}
.ui-foundation-page :where(.actions,.row-actions) :where(button,a) { min-height:40px; }

/* ---------- Mobile touch / drawer ergonomics ---------- */
@media (max-width:767px) {
  :root { --ui-action-min:44px; }
  html:not(.legacy-kds-view) .admin-shell .mobile-menu {
    display:inline-grid;
    place-items:center;
    min-width:44px;
    min-height:44px;
    margin-left:-7px;
    border-radius:11px;
    color:var(--ui-text,#0F172A);
  }
  html:not(.legacy-kds-view) .admin-shell .mobile-menu:hover,
  html:not(.legacy-kds-view) .admin-shell .mobile-menu:focus-visible { background:var(--ui-muted-bg,#F1F5F9); }
  html:not(.legacy-kds-view) .admin-shell .sidebar nav a { min-height:46px; padding:10px 12px; }
  html:not(.legacy-kds-view) .admin-shell .sidebar-foot button { min-height:44px; }
  html:not(.legacy-kds-view) .admin-shell .topbar { min-height:64px; }
  html:not(.legacy-kds-view) .admin-shell .topbar-actions { gap:6px; }
  html:not(.legacy-kds-view) .admin-shell .notification-bell { width:44px; height:44px; }
  html:not(.legacy-kds-view) .admin-shell :where(.row-actions,.table-actions,.section-actions,.modal-actions) :where(button,a) {
    min-height:44px;
    min-width:44px;
  }
  html:not(.legacy-kds-view) .admin-shell .modal-actions,
  .platform-shell .platform-modal footer {
    position:sticky;
    bottom:0;
    z-index:3;
    padding-bottom:max(12px,env(safe-area-inset-bottom));
  }
  html:not(.legacy-kds-view) .admin-shell .notification-drawer { width:min(100vw,430px); }
  html:not(.legacy-kds-view) .admin-shell .notification-tools { top:90px; }
  .ui-foundation-page :where(.actions,.row-actions) :where(button,a) { min-height:44px; }
}

@media (min-width:768px) and (max-width:1099px) {
  html:not(.legacy-kds-view) .admin-shell .sidebar nav a { min-height:44px; }
  html:not(.legacy-kds-view) .admin-shell .mobile-menu { min-width:44px; min-height:44px; }
  html:not(.legacy-kds-view) .admin-shell :where(.row-actions,.table-actions) :where(button,a) { min-height:40px; min-width:40px; }
}
