/* Shared look for the satellite apps (station, driver, manager, platform).
   Same tokens as the counter page so everything reads as one product. Light theme only. */
/* Colors, type, space, radius and shadows: apps/shared/tokens.css (each page links it first). */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The reset above also removes the automatic centring of native <dialog> windows: put it back so they open in the middle. */
dialog { margin: auto; }
::backdrop { background: var(--overlay); }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.5; min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3 { font-family: var(--font); letter-spacing: -0.01em; line-height: 1.15; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.text-ok { color: var(--ok); font-weight: 600; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.ico { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* App bar */
.sx-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.sx-bar .sx-brand { font-family: var(--font); font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.sx-bar .sx-brand b { color: var(--gold-light); font-weight: 600; }
.sx-bar .sx-sub { font-size: 14px; opacity: 0.8; }
.sx-bar .sx-spacer { flex: 1; }
.sx-bar button { background: rgba(255,255,255,0.12); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; font-weight: 600; }
.sx-bar button:hover { background: rgba(255,255,255,0.2); }
.sx-sandbox { background: var(--gold); color: var(--on-ink); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }

/* Layout */
.sx-main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.sx-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sx-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.sx-card h2 { font-size: 20px; margin-bottom: 8px; color: var(--navy); }
.sx-card h3 { font-size: 20px; margin-bottom: 6px; color: var(--navy); }
.sx-stat .sx-stat-label { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.sx-stat .sx-stat-value { font-family: var(--font); font-size: 36px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.sx-stat .sx-stat-delta { font-size: 14px; font-weight: 600; }
.sx-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sx-stack > * + * { margin-top: 12px; }

/* Controls */
.sx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--white); color: var(--navy); font-size: 14px; font-weight: 600; }
.sx-btn:hover { border-color: var(--navy); }
.sx-btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.sx-btn.primary:hover { background: var(--navy-light); }
.sx-btn.gold { background: var(--gold); color: var(--on-ink); border-color: var(--gold); }
.sx-btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.sx-btn.big { min-height: 64px; font-size: 20px; padding: 14px 22px; border-radius: var(--radius); }
.sx-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sx-input, .sx-select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); color: var(--text); }
.sx-input:focus, .sx-select:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(10,10,10,0.15); }
.sx-field { display: block; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.sx-field > .sx-input, .sx-field > .sx-select { margin-top: 4px; }
.sx-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sx-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.sx-tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.sx-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: rgba(10,10,10,0.08); color: var(--navy); }
.sx-chip.ok { background: rgba(22,163,74,0.12); color: #0f7a36; }
.sx-chip.warn { background: rgba(180,83,9,0.12); color: var(--warn); }
.sx-chip.bad { background: rgba(220,38,38,0.12); color: #b91c1c; }

/* Tables */
.sx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sx-table th { text-align: left; font-size: 12px; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.sx-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sx-table td.num, .sx-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sx-table-wrap { overflow-x: auto; }

/* PIN pad */
.sx-pin { max-width: 320px; margin: 0 auto; text-align: center; }
.sx-pin-dots { display: flex; justify-content: center; gap: 12px; margin: 16px 0 20px; }
.sx-pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--navy); }
.sx-pin-dots span.on { background: var(--navy); }
.sx-pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sx-pin-keys button { min-height: 64px; font-size: 28px; font-weight: 600; border-radius: var(--radius); border: 1px solid var(--border); background: var(--white); color: var(--navy); }
.sx-pin-keys button:active { background: var(--gold-pale); }

/* Toast (same class names as the POS so js/core/dom.js toast() works) */
.pos-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--navy-dark); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 1000; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.pos-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pos-toast.error { background: var(--danger); }
.pos-toast.has-action { display: flex; align-items: center; gap: 14px; padding-right: 10px; }
.toast-action { background: var(--white); color: var(--ink); border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 600; }

/* Full-screen overlays (device locked, pairing) */
.sx-overlay { position: fixed; inset: 0; background: var(--navy-dark); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 500; padding: 24px; text-align: center; }
.sx-overlay h1 { font-size: 36px; margin-bottom: 8px; }
.sx-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.sx-empty h3 { color: var(--navy); font-size: 20px; margin-bottom: 4px; }

/* Language switch (English / Español) in the bar, and screen-reader-only text */
.sx-bar .sx-lang { font-family: var(--font); font-size: 16px; letter-spacing: 0.02em; min-height: 40px; }
.sx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  .sx-main { padding: 14px 12px 40px; }
  .sx-bar .sx-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pos-toast { transition: none; } }

/* Map pins (apps/shared/map.js) */
.sx-pin-wrap { background: none; border: 0; }
.sx-mpin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--navy); color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); font-weight: 600; font-size: 14px; }
.sx-mpin.next { background: var(--gold); color: var(--on-ink); width: 40px; height: 40px; }
.sx-mpin.done { background: var(--ok); }
.sx-mpin.failed { background: var(--danger); }
.sx-mpin.arrived { background: var(--warn); }
.sx-mdrv { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--on-ink); border: 3px solid var(--navy); font-family: var(--font); font-size: 20px; font-weight: 600; box-shadow: 0 0 0 6px rgba(10,10,10,.15); }
.sx-mdrv.stale { background: var(--line-strong); box-shadow: none; }
.sx-mshop { display: block; width: 26px; height: 26px; border-radius: 6px; background: var(--navy-dark); border: 3px solid var(--gold); }
.sx-mpin b { transform: rotate(45deg); }
.sx-mpin.ringed { box-shadow: 0 0 0 3px var(--ring), 0 2px 6px rgba(0,0,0,.35); }

/* Inside the Work app (B2): the page's own title bar is the Work bar */
html.embedded .sx-bar { display: none; }
html.embedded body { padding-top: 0; }
html.embedded .cloud-btn, html.embedded #stxCiBack, html.embedded #stxPinBack { display: none; }   /* the Work app owns cloud status and who is signed in */
