/* BUILD_ADDON_242: Station 2 whole-site calm monochrome and 360px to 1440px geometry layer.
   Loaded last on every page so it wins over older theme layers without editing them.
   Palette: Deep Charcoal #111317, Gunmetal Slate #242933 cards, Smoked-Graphite #262A33 buttons,
   1px #4B5563 borders, #F3F4F6 text. Muted warm amber #D99B26 appears only when
   html[data-amber-trim="on"]. */

:root,
html[data-theme="dark"] {
  --bsp-bg-charcoal: #111317;
  --bsp-card-slate: #242933;
  --bsp-btn-graphite: #262A33;
  --bsp-btn-hover: #323844;
  --bsp-border-slate: #4B5563;
  --bsp-text-primary: #F3F4F6;
  --bsp-text-muted: #9CA3AF;
  --bsp-accent-trim: #525B6B;
  --bsp-link-calm: #E5E7EB;
  /* Retire the amber CTA slab and emerald accents of the older theme layer. */
  --bsp-cta-amber: #262A33;
  --bsp-cta-text: #F3F4F6;
  --bsp-inline-accent: #CBD5E1;
  --bsp-profit-emerald: #CBD5E1;
  --bsp-success-emerald: #CBD5E1;
  --accent-green: #CBD5E1;
  --bsp-overlay-fog: rgba(17, 19, 23, 0.55);
  --bsp-dock-clearance: calc(260px + env(safe-area-inset-bottom, 0px));
}

html[data-theme="light"] {
  --bsp-cta-amber: #262A33;
  --bsp-cta-text: #F3F4F6;
  --bsp-inline-accent: #374151;
  --bsp-profit-emerald: #374151;
  --bsp-link-calm: #1F2937;
}

html[data-amber-trim="on"] {
  --bsp-accent-trim: #D99B26;
}

/* Base canvas: sans-serif everywhere a page has not chosen its own font. */
:where(body) {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:where(h1, h2, h3, h4, h5, h6, button, input, select, textarea, label) {
  font-family: inherit;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}
body {
  padding-bottom: var(--bsp-dock-clearance) !important;
  scroll-padding-bottom: var(--bsp-dock-clearance);
}
html {
  scroll-padding-bottom: var(--bsp-dock-clearance);
}

/* Links: no light-blue bleed on plain text links. */
:where(main, article, section, footer, .bsp-bento-tile, .bsp-cmd-shell, .legal-shell) a:not([class]):not([style*="color"]) {
  color: var(--bsp-link-calm);
  text-decoration: underline;
  text-decoration-color: #6B7280;
  text-underline-offset: 3px;
}
html[data-amber-trim="on"] :where(main, article, section, footer, .bsp-bento-tile, .bsp-cmd-shell, .legal-shell) a:not([class]):not([style*="color"]) {
  text-decoration-color: #D99B26;
}

/* Smoked-Graphite buttons (#F3F4F6 on #262A33 is 11.8:1, WCAG AAA). */
:root .bsp-cta-amber,
.btn-primary,
.cta-btn,
.hero-cta,
button.bsp-cta,
a.bsp-cta,
.bsp-btn-primary-graphite {
  background: #262A33 !important;
  color: #F3F4F6 !important;
  border: 1px solid #4B5563 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  forced-color-adjust: none;
  border-radius: 10px;
  min-height: 44px;
  box-sizing: border-box;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.bsp-cta-amber:hover,
.btn-primary:hover,
.cta-btn:hover,
.hero-cta:hover,
.bsp-btn-primary-graphite:hover {
  background: #323844 !important;
}
html[data-amber-trim="on"] .bsp-cta-amber,
html[data-amber-trim="on"] .btn-primary,
html[data-amber-trim="on"] .cta-btn,
html[data-amber-trim="on"] .hero-cta,
html[data-amber-trim="on"] .bsp-btn-primary-graphite {
  border-color: #D99B26 !important;
}
.bsp-profit-badge {
  background: #242933 !important;
  color: #E5E7EB !important;
  border: 1px solid #4B5563 !important;
}
html[data-amber-trim="on"] .bsp-profit-badge {
  border-color: #D99B26 !important;
}
.bsp-bento-tile {
  background: #242933;
  border: 1px solid #4B5563;
}
html[data-amber-trim="on"] .bsp-bento-tile {
  border-color: rgba(217, 155, 38, 0.55);
}

/* Amber Trim toggle (Settings Hub on index.html, header on standalone portals). */
.bsp-amber-trim-toggle,
[data-bsp-amber-toggle] {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #262A33;
  color: #F3F4F6;
  border: 1px solid #4B5563;
  font: 600 14px/1.2 Inter, system-ui, -apple-system, sans-serif;
  cursor: pointer;
  forced-color-adjust: none;
  white-space: nowrap;
}
[data-bsp-amber-toggle][aria-pressed="true"] {
  border-color: #D99B26;
  box-shadow: inset 0 -2px 0 #D99B26;
}
.bsp-portal-trim-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #111317;
  border-bottom: 1px solid #242933;
  box-sizing: border-box;
  width: 100%;
}

/* Hero: bottom-weighted gradient keeps the Full Moon, Lighthouse 37 and Shoreline clear. */
.hero-pill {
  background: linear-gradient(180deg, rgba(17, 19, 23, 0.10) 0%, rgba(17, 19, 23, 0.30) 50%, rgba(17, 19, 23, 0.72) 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.hero-overlay,
#hero-backdrop-veil,
.bsp-hero-scrim {
  background: linear-gradient(180deg, rgba(17, 19, 23, 0) 0%, rgba(17, 19, 23, 0.18) 45%, rgba(17, 19, 23, 0.78) 85%, rgba(17, 19, 23, 0.94) 100%) !important;
}

/* Form fields: 16px floor stops iOS zoom; labels sit above their inputs. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  font-size: 16px !important;
  max-width: 100%;
  box-sizing: border-box;
}
label[for] {
  overflow-wrap: anywhere;
}

/* Touch targets: 44x44 on touch screens. */
@media (pointer: coarse) {
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  a.btn-modern,
  a.bsp-btn-graphite-sm,
  a.bsp-btn-secondary-slate {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Blocking One-Push Admin Modal (z-index 100550). */
#bsp-admin-onepush-modal,
.bsp-onepush-backdrop {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  z-index: 100550;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
#bsp-admin-onepush-modal *,
.bsp-onepush-card * {
  box-sizing: border-box;
  max-width: 100%;
}
.bsp-onepush-card {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overflow-x: hidden;
}
.bsp-onepush-select-bar,
.bsp-onepush-actions {
  flex-wrap: wrap;
}
.bsp-onepush-select-bar > *,
.bsp-onepush-actions > * {
  flex: 1 1 160px;
  min-height: 44px;
}

/* Morning Store Arrival card: Have Michael call Tamer to unlock the alarm. */
#bsp-tamer-alarm-unlock-card {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
#bsp-tamer-alarm-unlock-card > div,
#bsp-tamer-alarm-unlock-card > div > div {
  flex-wrap: wrap;
  min-width: 0;
}
#bsp-tamer-alarm-unlock-card button {
  min-height: 46px;
  max-width: 100%;
  white-space: normal;
}
#bsp-tamer-alarm-unlock-card label {
  display: block;
}
html[data-amber-trim="on"] #bsp-tamer-alarm-unlock-card {
  border-color: #D99B26 !important;
}

/* Chat and problem-report composer: calm 40x40 plus button, no oversized overlap. */
#bsp-problem-plus-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  min-height: 40px !important;
  font-size: 22px !important;
  background: #262A33 !important;
  border: 1px solid #4B5563 !important;
  color: #F3F4F6 !important;
  box-shadow: none !important;
}
html[data-amber-trim="on"] #bsp-problem-plus-btn {
  border-color: #D99B26 !important;
}

/* 360px floor: everything wraps instead of pushing the page sideways. */
@media (max-width: 480px) {
  .bsp-modal-wrapper,
  .modal-backdrop,
  #loginModal {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  main,
  section,
  .bsp-bento-tile,
  .bsp-cmd-shell,
  #bsp-tamer-alarm-unlock-card {
    max-width: 100%;
    box-sizing: border-box;
  }
  #bsp-tamer-alarm-unlock-card {
    padding: 14px !important;
  }
  #bsp-tamer-alarm-unlock-card h4 {
    font-size: 1.02em !important;
    line-height: 1.3;
  }
  #bsp-tamer-alarm-unlock-card button,
  .bsp-onepush-select-bar > *,
  .bsp-onepush-actions > * {
    flex: 1 1 100%;
    width: 100%;
  }
  .bsp-top-control-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  img,
  video,
  iframe,
  canvas,
  svg {
    max-width: 100%;
  }
  pre,
  code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

@media (forced-colors: active) {
  .bsp-cta-amber,
  .bsp-btn-primary-graphite,
  [data-bsp-amber-toggle] {
    forced-color-adjust: none;
  }
}
