/* UIUX-02 — responsive operations shell (extends app.css) */

.context-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: var(--context-bar-h);
  padding: 6px 16px;
  background: #eef3f9;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-label);
  color: var(--text-secondary);
}
.context-bar strong { color: var(--text-primary); font-weight: 600; }
.context-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 2px 8px;
}
.dirty-pill {
  display: none; align-items: center; gap: 4px;
  background: var(--warning-bg); color: var(--warning);
  border: 1px solid #f3d9b0; border-radius: 999px;
  padding: 2px 8px; font-weight: 600; font-size: var(--fs-meta);
}
.dirty-pill.on { display: inline-flex; }

.nav-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,27,45,.4); z-index: calc(var(--z-nav-drawer) - 1);
}
.btn-menu { display: none; }

.record-cards { display: none; flex-direction: column; gap: 8px; }
.record-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px; cursor: pointer; box-shadow: var(--shadow-sm);
  color: inherit; font: inherit;
}
.record-card:hover, .record-card:focus-visible { border-color: var(--primary); }
.record-card .rc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.record-card .rc-id { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 600; }
.record-card .rc-title { font-weight: 600; margin: 0 0 4px; }
.record-card .rc-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--text-muted); font-size: var(--fs-meta); }

.desktop-only { display: block; }
.mobile-only { display: none; }
.hint-responsive {
  display: none; margin-bottom: 8px; font-size: var(--fs-meta); color: var(--text-muted);
}

.viewport-switch {
  display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden;
}
.viewport-switch button {
  border: 0; background: #fff; padding: 6px 10px; cursor: pointer; font-size: var(--fs-label);
}
.viewport-switch button.active { background: var(--primary); color: #fff; }

.settings-callout {
  border: 1px dashed #9db7e8; background: #f5f9ff; border-radius: var(--radius-md);
  padding: 10px 12px; margin-top: 8px;
}
.settings-callout h4 { margin: 0 0 6px; font-size: var(--fs-h2); }
.override-note { font-size: var(--fs-meta); color: var(--text-muted); margin-top: 6px; }
.shared-place-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: 2px 8px; font-size: var(--fs-meta); font-weight: 600;
}

/* Mobile Bottom Navigation (§52AS concept) — system-fixed slots */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-bottom-nav);
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
}
.bottom-nav-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: 0; background: transparent; color: var(--text-muted);
  text-decoration: none; font-size: 0.65rem; font-weight: 600; cursor: pointer;
  min-height: var(--touch-min); padding: 4px 2px;
  min-width: 0; overflow: hidden;
}
.bottom-nav-slot > span:last-child {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.15;
  max-height: 2.3em;
  text-align: center;
  word-break: break-word;
  width: 100%;
}
.bottom-nav-slot .bn-ico { font-size: 1.05rem; line-height: 1; }
.bottom-nav-slot.active { color: var(--primary); }
.bottom-nav-slot.is-blocked { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.bottom-nav-slot:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.bn-template-bar {
  display: none; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 6px 12px; background: #eef3f9; border-bottom: 1px solid var(--border);
  font-size: var(--fs-meta);
}
.bn-template-bar select {
  height: 28px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; font-size: var(--fs-meta); max-width: 160px;
}
.kbd-hint {
  display: inline-block; padding: 0 5px; border: 1px solid var(--border-strong);
  border-radius: 4px; background: var(--neutral-bg); font-family: var(--font-mono);
  font-size: 0.7rem; color: var(--text-secondary);
}
.combo-hint { margin-top: 8px; font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.5; }
.appearance-stub {
  display: inline-flex; gap: 4px; align-items: center; font-size: var(--fs-meta); color: var(--text-muted);
}
.appearance-stub select { height: 28px; font-size: var(--fs-meta); border-radius: 4px; border: 1px solid var(--border-strong); }

/* Shared mobile behaviors: real viewport OR Desktop/Mobile preview toggle */
html.force-mobile .app-sidebar,
@media (max-width: 767.98px) {
  /* placeholder — rules duplicated below for both selectors */
}

html.force-mobile .app-sidebar {
  position: fixed; transform: translateX(-100%); width: min(86vw, 300px);
  transition: transform .2s ease; z-index: var(--z-nav-drawer);
}
html.force-mobile.nav-open .app-sidebar { transform: none; }
html.force-mobile.nav-open .nav-backdrop,
html.force-mobile .nav-backdrop.open { display: block; }
html.force-mobile .btn-menu { display: inline-flex; }
html.force-mobile #btnRail { display: none; }
html.force-mobile .topbar-meta .hide-compact { display: none; }
html.force-mobile .desktop-only { display: none !important; }
html.force-mobile .mobile-only { display: block !important; }
html.force-mobile .record-cards { display: flex; }
html.force-mobile .hint-responsive { display: block; }
html.force-mobile .booking-split,
html.force-mobile .voucher-split,
html.force-mobile .split-master,
html.force-mobile .excursion-cols,
html.force-mobile .form-grid { grid-template-columns: 1fr !important; }
html.force-mobile .span-2,
html.force-mobile .span-3,
html.force-mobile .span-4,
html.force-mobile .span-6,
html.force-mobile .span-8 { grid-column: span 12 !important; }
html.force-mobile .kv-grid { grid-template-columns: 1fr !important; }
html.force-mobile .guest-dense .guest-name-span,
html.force-mobile .guest-dense .pax-counts-span {
  grid-column: span 1 !important;
}
html.force-mobile .pax-row {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
html.force-mobile .control-guest-name {
  min-height: 3em;
  max-height: 4.2em;
}
html.force-mobile .drawer { width: 100%; max-width: 100%; inset: 0; border-radius: 0; }
html.force-mobile .modal,
html.force-mobile .modal.lg,
html.force-mobile .modal.xl,
html.force-mobile .modal.sm {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  top: 0; left: 0; transform: none; border-radius: 0;
}
html.force-mobile .workspace { padding: 10px 12px 20px; }
html.force-mobile .control,
html.force-mobile .field input,
html.force-mobile .field select,
html.force-mobile .btn { min-height: var(--touch-min); }
html.force-mobile .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
html.force-mobile .tab { white-space: nowrap; padding: 10px 12px; }
html.force-mobile .bottom-nav { display: grid; }
html.force-mobile .bn-template-bar { display: none !important; }
html.force-mobile .proto-desktop-slot { display: none !important; }
html.force-mobile .topbar {
  height: auto; min-height: 48px; padding: 6px 10px; gap: 8px;
}
html.force-mobile .topbar-title { display: none; }
html.force-mobile .topbar-work { display: block; }
html.force-mobile .topbar-identity { flex: 1; min-width: 0; }
html.force-mobile .chip-env {
  font-size: 10px; padding: 2px 6px; flex-shrink: 0;
}
html.force-mobile .context-bar {
  padding: 4px 10px; min-height: 0; flex-wrap: wrap;
}
html.force-mobile .ctx-compact { display: flex; }
html.force-mobile .ctx-detail { display: none; width: 100%; margin-top: 4px; }
html.force-mobile .ctx-detail.is-open { display: flex; }
html.force-mobile .hint-responsive { display: none !important; }
html.force-mobile .fast-entry-note { display: none !important; }
html.force-mobile .ops-kbd-hint { display: none !important; }
html.force-mobile .guest-primary { grid-template-columns: 1fr; }
html.force-mobile .guest-id-status { grid-template-columns: 1fr 1fr; }
html.force-mobile .guest-panel .panel-hd { display: none; }
html.force-mobile .booking-split { margin-bottom: 0; gap: 8px; }
html.force-mobile .ops-bar-booking {
  gap: 6px; padding: 6px; align-items: stretch;
}
html.force-mobile .ops-seg {
  flex: 1; min-width: 0; overflow-x: auto; display: flex;
}
html.force-mobile .ops-seg button {
  flex: 1 1 auto; white-space: nowrap; min-height: 40px;
  font-size: 11px; padding: 6px 8px; line-height: 1.15;
}
html.force-mobile .tabs-services {
  margin-bottom: 8px;
}
html.force-mobile .tab {
  white-space: normal; max-width: none; flex: 0 0 auto;
  min-height: 40px; max-height: 48px;
}
html.force-mobile .actionbar-booking {
  position: static;
  bottom: auto;
  z-index: auto;
  gap: 8px;
  box-shadow: none;
}
html.force-mobile .actionbar-booking .btn-primary {
  min-width: 7.5rem;
  flex: 1 1 auto;
}
html.force-mobile .modal.xl.xfer-onescreen-modal .modal-ft {
  position: sticky; bottom: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
html.force-mobile .workspace { padding: 8px 10px 16px; }
html.force-mobile .app-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
html.force-mobile .workspace,
html.force-mobile #workspace {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 767.98px) {
  .bn-template-bar { display: none !important; }
  .proto-desktop-slot { display: none !important; }
  .topbar { height: auto; min-height: 48px; padding: 6px 10px; gap: 8px; }
  .topbar-title { display: none; }
  .topbar-work { display: block; }
  .topbar-identity { flex: 1; min-width: 0; }
  .context-bar { padding: 4px 10px; min-height: 0; }
  .ctx-compact { display: flex; }
  .ctx-detail { display: none; width: 100%; margin-top: 4px; }
  .ctx-detail.is-open { display: flex; }
  .hint-responsive { display: none !important; }
  .fast-entry-note { display: none !important; }
  .guest-primary { grid-template-columns: 1fr; }
  .guest-id-status { grid-template-columns: 1fr 1fr; }
  .guest-panel .panel-hd { display: none; }
  .booking-split { margin-bottom: 0; gap: 8px; }
  .ops-seg { flex: 1; overflow-x: auto; display: flex; }
  .ops-seg button { flex: 1 1 auto; min-height: 40px; font-size: 11px; }
  .actionbar-booking {
    position: static;
    bottom: auto;
    z-index: auto;
    box-shadow: none;
  }
  .actionbar-booking .btn-primary { flex: 1 1 auto; min-width: 7.5rem; }
  .pax-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .guest-dense .guest-name-span,
  .guest-dense .pax-counts-span { grid-column: span 1 !important; }
}
/* Page SAVE/CONFIRM sits above system Bottom Nav — no overlap */
html.force-mobile .voucher-split.sticky-price .price-rail { position: static; }
html.force-mobile .price-compact-mobile { display: block; }
html.force-mobile .desktop-price-rail { display: none !important; }
html.force-mobile .section-block.mobile-collapse > summary { cursor: pointer; }
html.force-mobile .section-block.mobile-collapse:not([open]) > .section-bd { display: none; }

@media (max-width: 767.98px) {
  .voucher-split.sticky-price .price-rail { position: static; }
  .price-compact-mobile { display: block; }
  .desktop-price-rail { display: none !important; }
}

@media (max-width: 767.98px) {
  .app-sidebar {
    position: fixed; transform: translateX(-100%); width: min(86vw, 300px);
    transition: transform .2s ease; z-index: var(--z-nav-drawer);
  }
  html.nav-open .app-sidebar { transform: none; }
  .nav-backdrop.open { display: block; }
  .btn-menu { display: inline-flex; }
  #btnRail { display: none; }
  .topbar-meta .hide-compact { display: none; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .record-cards { display: flex; }
  .hint-responsive { display: block; }
  .booking-split,
  .voucher-split,
  .split-master,
  .excursion-cols { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .span-6, .span-8, .span-12 { grid-column: span 1; }
  .kv-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; max-width: 100%; inset: 0; border-radius: 0; }
  .modal, .modal.lg, .modal.xl, .modal.sm {
    width: 100%; max-width: 100%; height: 100%; max-height: 100%;
    top: 0; left: 0; transform: none; border-radius: 0;
  }
  .workspace { padding: 10px 12px 20px; }
  .control, .field input, .field select, .btn { min-height: var(--touch-min); }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
  .context-bar { padding: 6px 12px; }
  .bottom-nav { display: grid; }
  .bn-template-bar { display: none !important; }
  .app-main {
    padding-bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .workspace,
  #workspace {
    min-width: 0;
    max-width: 100%;
  }
  .actionbar:not(.actionbar-booking),
  .page-actionbar {
    position: sticky;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 30;
    background: var(--surface);
    margin-bottom: 4px;
  }
}
