/* Bottom nav + theme — add to your app or link as /css/shell.css */
 
/* Staff page body — clears the fixed topbar. */
.staff-main {
  padding-top: calc(var(--topbar-h) + var(--safe-top));
}

/* Update banner. pwa.js creates .jekkascan-update-banner and prepends it to
   <body>, outside #app — so it needs its own placement, otherwise it renders
   unstyled above the app or hides under the fixed topbar. */
.jekkascan-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--info-bg);
  color: var(--info-text);
  border-bottom: 1px solid var(--info-border);
  font-size: 0.9rem;
  box-sizing: border-box;
}
/* Staff pages have a topbar to sit under; guest pages do not. */
body:has(#app .topbar) .jekkascan-update-banner {
  top: calc(var(--topbar-h) + var(--safe-top));
}
.jekkascan-update-banner.hidden { display: none !important; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.4rem 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bn-item .bn-icon { font-size: 1.15rem; line-height: 1; }
.bn-item.active { color: var(--primary-text); }
body.has-bottom-nav { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)); }
 
.theme-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
 
/* Theme tokens live only in app.css */
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .topbar,
[data-theme="dark"] .card,
[data-theme="dark"] .bottom-nav { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .muted { color: var(--muted); }
[data-theme="dark"] input, [data-theme="dark"] textarea {
  background: var(--bg); color: var(--text); border-color: var(--border);
}
 
/* Prevent iOS zoom on focus (needs >= 16px) */
input, textarea, select {
  font-size: 16px !important;
  max-width: 100%;
}
 
 
/* Tag editor (Manage → Edit item) */
.tag-editor { margin-top: 0.25rem; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; min-height: 0.25rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.8rem; font-weight: 600;
  color: var(--primary-text);
  background: var(--chip-bg); border: 1px solid var(--chip-border);
  border-radius: 999px; padding: 0.2rem 0.45rem 0.2rem 0.55rem;
}
.tag-chip-x {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.15rem;
}
.tag-chip-x:hover { color: var(--danger); }
.tag-input-row { display: flex; gap: 0.4rem; align-items: center; }
.tag-input-row .tag-input {
  flex: 1; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 16px; min-width: 0;
}
 
/* Visiting hours editor — stack options, no horizontal blowout */
.hours-editor {
  max-width: 100%;
  overflow-x: hidden;
}
.hours-type-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.5rem 0 0.75rem;
  max-width: 100%;
}
.hours-type-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
}
.hours-type-option:has(input:checked) {
  background: var(--chip-bg);
}
.hours-type-option input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.hours-type-option span {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  word-break: break-word;
}
.hours-days-panel {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  max-width: 100%;
}
.hours-day-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.55rem 0;
  max-width: 100%;
}
.hours-day-label {
  font-weight: 600;
  font-size: 0.9rem;
}
.hours-day-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}
.hours-select {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}
.hours-to {
  flex: 0 0 auto;
}
@media (min-width: 480px) {
  .hours-day-row {
    flex-direction: row;
    align-items: center;
  }
  .hours-day-label {
    width: 5.5rem;
    flex-shrink: 0;
  }
  .hours-day-controls {
    flex: 1;
  }
  .hours-select {
    flex: 0 1 auto;
  }
}
 
 
/* Form controls follow tokens in both themes */
select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.hours-type-option, .pay-option, label.hours-type-option {
  color: var(--text);
}
table { color: var(--text); }
h1, h2, h3 { color: var(--text); }
 
.mq-update-banner {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--info-bg); color: var(--info-text);
  border-bottom: 1px solid var(--info-border);
  font-size: 0.9rem;
}
.mq-update-banner.hidden { display: none !important; }
 
.bn-item { position: relative; }
.bn-badge {
  position: absolute;
  top: 0.15rem;
  right: 50%;
  margin-right: -1.6rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  pointer-events: none;
}
.bn-badge.hidden { display: none !important; }
 

/* User-action busy feedback (not used for silent polls) */
@keyframes jekkascan-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
body.jekkascan-busy .logo-img {
  animation: jekkascan-pulse 1.6s ease-in-out infinite;
}
/* Guest menu / any page without logo: slim top bar */
body.jekkascan-busy::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  background: var(--primary);
  opacity: 0.85;
  pointer-events: none;
  animation: jekkascan-pulse 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  body.jekkascan-busy .logo-img {
    animation: none;
    opacity: 0.55;
  }
  body.jekkascan-busy::before {
    animation: none;
    opacity: 0.5;
  }
}

/* —— Staff sidebar (sibling of #app; push via margin, not transform) —— */
:root {
  --sidebar-w: min(85vw, 420px);
}
@media (min-width: 768px) {
  :root {
    --sidebar-w: max(320px, 50vw);
  }
}

.staff-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: var(--sidebar-w);
  height: 100%;
  height: 100dvh;
  background: var(--surface, #fff);
  color: var(--text, #111);
  border-right: 1px solid var(--border, #e5e7eb);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) 0 calc(5rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
body.sidebar-open .staff-sidebar {
  transform: translateX(0);
}

.staff-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
}
.staff-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: var(--text, #111);
  text-decoration: none;
  font-weight: 600;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 1rem;
  box-sizing: border-box;
}
.staff-sidebar-item:hover,
.staff-sidebar-item:focus-visible {
  background: var(--soft-bg, #f3f4f6);
  outline: none;
}
.staff-sidebar-item.active {
  background: var(--chip-bg, #e8f3ec);
  color: var(--primary-text, #175D31);
}
.staff-sidebar-item .sb-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--danger, #b91c1c);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.staff-sidebar-item .sb-badge.hidden { display: none; }

/* Push page with margin (no transform on #app — keeps fixed bottom-nav / alerts put) */
#app {
  transition: margin-left 0.25s ease;
  margin-left: 0;
}
body.sidebar-open #app {
  margin-left: var(--sidebar-w);
}
body.sidebar-open {
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .staff-sidebar,
  #app {
    transition: none !important;
  }
}


/* Topbar actions: logo + bell */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
button.logo {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}
button.logo:focus-visible {
  outline: 2px solid var(--primary-text, #175D31);
  outline-offset: 2px;
}
/* Header mark = business photo (round) or its first letter. */
.topbar-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
.topbar-avatar-ph { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; background: var(--soft-bg, #f0eee6); color: var(--muted, #6f6b63); font-weight: 700; font-size: 1.1rem; line-height: 1; }
.alerts-bell {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text, #111);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}
.alerts-bell:focus-visible {
  outline: 2px solid var(--primary-text, #175D31);
  outline-offset: 2px;
}
.alerts-bell-dot {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger, #b91c1c);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.alerts-bell-dot.hidden { display: none; }

.alerts-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  right: 0.75rem;
  z-index: 210;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: min(70vh, 420px);
  overflow: auto;
  background: var(--surface, #fff);
  color: var(--text, #111);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
  padding: 0.75rem;
}
.alerts-panel.hidden { display: none !important; }
.alerts-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.alerts-row {
  display: block;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text, #111);
  border-bottom: 1px solid var(--border, #eee);
}
.alerts-row:last-child { border-bottom: none; }
.alerts-row:hover { background: var(--soft-bg, #f3f4f6); }
