/* RX Hub – one website, one tab per app (Orders / Sales / Clients).
   Combined light theme: white + blue + turquoise, simple and easy to read.
   Phone: tabs at the bottom. Computer (900px+): slim rail on the left. */
:root {
  --hub-bg: #f2f7fa;
  --hub-panel: #ffffff;
  --hub-line: #dbe6ee;
  --hub-text: #51667a;
  --hub-ink: #0b2a30;
  --hub-on: #0e7490;
  --hub-nav-h: 58px;
  --hub-rail-w: 40px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--hub-bg);
  color: var(--hub-ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.hub-frames {
  position: fixed;
  inset: 0 0 calc(var(--hub-nav-h) + env(safe-area-inset-bottom)) 0;
}

.hub-frames iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--hub-bg);
}

/* Hidden tabs keep running (chats, live orders) but are not drawn or clickable. */
.hub-frames iframe.is-hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .hub-frames iframe { transition: opacity 0.18s ease; }
}

.hub-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--hub-nav-h) + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom) 0;
  background: var(--hub-panel);
  border-top: 1px solid var(--hub-line);
}

/* Each app keeps its colour: Orders blue, Sales turquoise, Clients cyan, Hiring violet. */
.hub-tab[data-tab="orders"] { --tab-c: #2563eb; }
.hub-tab[data-tab="sales"] { --tab-c: #0d9488; }
.hub-tab[data-tab="clients"] { --tab-c: #06b6d4; }
.hub-tab[data-tab="quotes"] { --tab-c: #0284c7; }
.hub-tab[data-tab="hiring"] { --tab-c: #7c3aed; }
/* v1.96: Report / Production / Design had no colour, so their icons did not show. */
.hub-tab[data-tab="report"] { --tab-c: #0ea5e9; }
.hub-tab[data-tab="production"] { --tab-c: #38bdf8; }
.hub-tab[data-tab="design"] { --tab-c: #6366f1; }

.hub-tab {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 4px;
  border: 0;
  background: color-mix(in srgb, var(--tab-c) 7%, #ffffff);
  color: var(--hub-text);
  font: 750 11.5px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hub-tab + .hub-tab {
  border-left: 1px solid var(--hub-line);
}

.hub-tab svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: var(--tab-c);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-tab[aria-current="page"] {
  color: var(--hub-ink);
  background: color-mix(in srgb, var(--tab-c) 16%, #ffffff);
}

.hub-tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tab-c);
}

.hub-tab:focus-visible {
  outline: 2px solid var(--hub-on);
  outline-offset: -4px;
}

/* Palette button: one theme for all three apps. Globe button: Website admin (Admin / Sales). */
.hub-theme-btn,
.hub-site-btn {
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--hub-line);
  background: var(--hub-panel);
  color: var(--hub-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hub-theme-btn:hover,
.hub-site-btn:hover { color: var(--hub-ink); background: #f1f6fa; }

.hub-site-btn { flex-basis: 44px; }

.hub-theme-btn svg,
.hub-site-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ?open=website-admin: the globe button pulses once logged in (pop-ups need a click). */
.hub-site-btn.hub-attn {
  color: var(--hub-on);
  background: #e6f6fa;
  box-shadow: inset 0 0 0 2px var(--hub-on);
}

@media (prefers-reduced-motion: no-preference) {
  .hub-site-btn.hub-attn { animation: hub-attn 1.4s ease-in-out infinite; }
}

@keyframes hub-attn {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--hub-on); }
  50% { box-shadow: inset 0 0 0 4px var(--hub-on); }
}

#hubSiteHint {
  position: fixed;
  z-index: 41;
  right: 10px;
  bottom: calc(var(--hub-nav-h) + env(safe-area-inset-bottom) + 10px);
  max-width: min(280px, calc(100vw - 20px));
  padding: 10px 12px;
  border: 1px solid var(--hub-on);
  border-radius: 12px;
  background: var(--hub-panel);
  color: var(--hub-ink);
  font: 750 12.5px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  box-shadow: 0 18px 50px rgba(13, 38, 76, 0.18);
  cursor: pointer;
}

#hubSiteHint small {
  display: block;
  margin-top: 3px;
  color: var(--hub-text);
  font-weight: 500;
  font-size: 11.5px;
}

#hubSiteHint[hidden] { display: none; }

#hubThemePop {
  position: fixed;
  z-index: 40;
  right: 10px;
  bottom: calc(var(--hub-nav-h) + env(safe-area-inset-bottom) + 10px);
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--hub-panel);
  border: 1px solid var(--hub-line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(13, 38, 76, 0.18);
}

#hubThemePop[hidden] { display: none; }

#hubThemePop button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 156px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--hub-ink);
  font: 700 12.5px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
}

#hubThemePop button:hover { background: #f1f6fa; }

#hubThemePop button.selected {
  background: #e9f2f8;
  box-shadow: inset 0 0 0 1px var(--hub-line);
}

#hubThemePop #hubInstallBtn {
  margin-top: 4px;
  border-top: 1px solid var(--hub-line);
  border-radius: 0 0 10px 10px;
  padding-top: 11px;
  color: var(--hub-on);
}

#hubThemePop #hubInstallBtn svg {
  width: 18px;
  height: 18px;
  margin: 0 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#hubThemePop #hubInstallBtn[hidden] { display: none; }

#hubThemePop .swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 0 2px 6px rgba(13, 38, 76, 0.22);
}

/* Invisible strip on the left edge: hovering it slides the hidden rail back in. */
#hubEdgeHotspot { display: none; }

/* One app only (production staff, or not logged in) / phone keyboard open: no tab bar. */
body.hub-single .hub-frames,
body.hub-keyboard .hub-frames {
  inset: 0;
}

body.hub-single .hub-nav,
body.hub-keyboard .hub-nav {
  display: none;
}

@media (min-width: 900px) {
  .hub-frames {
    inset: 0 0 0 var(--hub-rail-w);
  }

  /* Thin strip: three equal colour sections, names standing upright.
     Picking a tab slides the strip away; the three-dot button brings it back. */
  .hub-nav {
    top: 0;
    right: auto;
    width: var(--hub-rail-w);
    height: auto;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-top: 0;
    border-right: 1px solid var(--hub-line);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.22s ease;
  }

  body.hub-rail-hidden .hub-nav {
    transform: translateX(-100%);
  }

  body.hub-rail-hidden .hub-frames {
    inset: 0;
  }

  .hub-tab {
    flex: 1 1 0;
    flex-direction: column;
    gap: 11px;
    padding: 0;
    border-left: 0;
    border-bottom: 1px solid var(--hub-line);
    font-size: 11px;
  }

  .hub-tab + .hub-tab {
    border-left: 0;
  }

  .hub-tab:last-child {
    border-bottom: 0;
  }

  .hub-tab svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
  }

  .hub-tab span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-transform: uppercase;
    letter-spacing: 0.26em;
    font-size: 11px;
    font-weight: 800;
    color: var(--hub-ink);
  }

  .hub-tab:hover {
    background: color-mix(in srgb, var(--tab-c) 12%, #ffffff);
  }

  .hub-tab[aria-current="page"] {
    background: color-mix(in srgb, var(--tab-c) 18%, #ffffff);
  }

  .hub-tab[aria-current="page"]::before {
    top: 0;
    bottom: -1px;
    left: 0;
    right: auto;
    width: 3px;
    height: auto;
    background: var(--tab-c);
  }

  .hub-tab:focus-visible {
    outline-offset: -2px;
  }

  .hub-theme-btn,
  .hub-site-btn {
    flex: 0 0 46px;
    border-left: 0;
    border-top: 1px solid var(--hub-line);
  }

  .hub-theme-btn svg,
  .hub-site-btn svg { width: 18px; height: 18px; }

  #hubSiteHint {
    left: calc(var(--hub-rail-w) + 10px);
    right: auto;
    bottom: 52px;
  }

  #hubThemePop {
    left: calc(var(--hub-rail-w) + 10px);
    right: auto;
    bottom: 10px;
  }

  #hubEdgeHotspot {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
    z-index: 29;
  }

  body.hub-rail-hidden:not(.hub-single) #hubEdgeHotspot {
    display: block;
  }

  /* Hover reveal: the rail floats over the page, the page does not move. */
  body.hub-rail-hidden.hub-rail-peek .hub-nav {
    transform: translateX(0);
    box-shadow: 0 10px 40px rgba(13, 38, 76, 0.2);
  }

  body.hub-keyboard .hub-frames { inset: 0 0 0 var(--hub-rail-w); }
  body.hub-keyboard .hub-nav { display: flex; }
}

body.hub-single #hubSiteHint,
body.hub-keyboard #hubSiteHint { display: none; }

.hub-noscript {
  padding: 24px;
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .hub-tab { transition: color 0.15s ease, background-color 0.15s ease; }
}

/* ---- v1.96 phone (owner's Android app "RX Hub"): Orders · Sales · Clients · Quotes · 🎙️ · More.
   The other tabs, Website admin and Theme open from "More" (hub.js). Wider screens are unchanged. */
.hub-more-btn,
.hub-asst-space { display: none; }
.hub-more-panel[hidden],
.hub-more-shade[hidden] { display: none !important; }

@media (max-width: 599px) {
  .hub-nav .hub-extra,
  .hub-nav .hub-site-btn,
  .hub-nav .hub-theme-btn { display: none; }

  .hub-tab { font-size: 11px; }

  .hub-more-btn {
    flex: 0 0 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-left: 1px solid var(--hub-line);
    background: var(--hub-panel);
    color: var(--hub-text);
    font: 750 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .hub-more-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: none;
  }
  .hub-more-btn[aria-expanded="true"],
  .hub-more-btn.hub-more-on { color: var(--hub-ink); background: #e8f4fb; box-shadow: inset 0 3px 0 var(--hub-on); }
  .hub-more-btn.hub-attn { color: var(--hub-on); box-shadow: inset 0 0 0 2px var(--hub-on); }

  /* the 🎙️ button (assistant.js) sits in this slot instead of floating over the pages */
  body.hub-asst-on .hub-asst-space { display: block; flex: 0 0 56px; border-left: 1px solid var(--hub-line); }
  body.hub-asst-on #rxAsstBtn {
    right: 63px;
    bottom: calc((var(--hub-nav-h) - 46px) / 2 + env(safe-area-inset-bottom));
    z-index: 12;
    width: 46px;
    height: 46px;
    font-size: 21px;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
  }
  body.hub-keyboard #rxAsstBtn { display: none; }

  .hub-more-shade {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(11, 42, 48, 0.28);
  }
  .hub-more-panel {
    position: fixed;
    z-index: 31;
    right: 8px;
    bottom: calc(var(--hub-nav-h) + env(safe-area-inset-bottom) + 8px);
    left: 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    background: var(--hub-panel);
    border: 1px solid var(--hub-line);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(13, 38, 76, 0.22);
  }
  .hub-more-panel .hub-tab,
  .hub-more-panel .hub-more-item {
    min-height: 64px;
    border: 1px solid var(--hub-line);
    border-radius: 12px;
  }
  .hub-more-panel .hub-tab + .hub-tab { border-left: 1px solid var(--hub-line); }
  .hub-more-panel .hub-tab[aria-current="page"]::before { display: none; }
  .hub-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #f6fafc;
    color: var(--hub-text);
    font: 750 11.5px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
  }
  .hub-more-item svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .hub-more-item.hub-attn { color: var(--hub-on); box-shadow: inset 0 0 0 2px var(--hub-on); }
}

/* v1.99.29 JARVIS palette (owner's pick): dark command bar, cyan / electric-blue lights */
html[data-rx-theme="jarvis"] {
  --hub-bg: #060B14;
  --hub-panel: #0B1624;
  --hub-line: rgba(67, 217, 255, 0.22);
  --hub-text: #9FB2C8;
  --hub-ink: #EAF6FF;
  --hub-on: #43D9FF;
  color-scheme: dark;
}
html[data-rx-theme="jarvis"] .hub-nav {
  background: linear-gradient(180deg, #0B1624, #060B14);
  border-color: rgba(67, 217, 255, 0.35);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(67, 217, 255, 0.08);
}
html[data-rx-theme="jarvis"] .hub-tab { background: transparent; color: #9FB2C8; }
html[data-rx-theme="jarvis"] .hub-tab svg { stroke: #43D9FF; }
html[data-rx-theme="jarvis"] .hub-tab + .hub-tab { border-color: rgba(67, 217, 255, 0.12); }
html[data-rx-theme="jarvis"] .hub-tab[aria-current="page"] { background: rgba(67, 217, 255, 0.1); color: #EAF6FF; }
html[data-rx-theme="jarvis"] .hub-tab[aria-current="page"]::before { background: linear-gradient(90deg, #43D9FF, #4D7CFF); box-shadow: 0 0 10px rgba(67, 217, 255, 0.7); }
html[data-rx-theme="jarvis"] #hubThemePop { background: #0B1624; color: #EAF6FF; border-color: rgba(67, 217, 255, 0.3); }
