/* The app's sign-in look (inventory static/style.css), trimmed to what the hub uses. Keep the two in step. */
:root {
  --bg: #edeff2; --panel: #ffffff; --ink: #231f20; --text: #4d4d4d; --muted: #808080; --line-strong: #cccccc;
  --brand: #ff5000; --brand-hover: #e64800; --brand-ink: #ffffff; --brand-soft: #fff0e8;
  --blue: #3d5199; --bad: #e02500; --bad-soft: #fde7e6; --ok: #1f8a4c; --ok-soft: #e3f6ea;
  --radius: 10px; --btn-radius: 4px;
  --head-font: Montserrat, Inter, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417; --panel: #1d1e22; --ink: #f2f2f3; --text: #c8c9cc; --muted: #8c8e94; --line-strong: #3a3d43;
    --brand: #ff6a26; --brand-hover: #ff7f45; --brand-soft: #3a2418;
    --blue: #93a6ea; --bad: #f87171; --bad-soft: #3d1c1c; --ok: #4ccf86; --ok-soft: #163322;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); font: 15px/1.55 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.field > span, .btn { font-family: var(--head-font); }

/* Flat Crewtility navy, darkening a little toward the edges (no color glow): the tools grid on top (hub.js) carries it. */
html.signin { background-color: #1b2142; overscroll-behavior: none; }
html.signin::before { content: ""; position: fixed; left: 0; right: 0; top: -30vh; bottom: -30vh; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 75% 60% at 50% 45%, #1e2549 0%, #1b2142 55%, #11152c 100%); }
body.signin { background: transparent; }
#grid { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
/* The code box sits dead center on the screen with the logo above it. The middle row is the box's resting height
   (--card-h, measured by hub.js), so when the box grows (lookup, button) it grows downward and the field never moves. */
main { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: 1fr var(--card-h, auto) 1fr;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(16px + env(safe-area-inset-bottom)); }
main > .authbrand { align-self: end; }
main > .auth { align-self: start; width: 100%; }
.card { background: var(--panel); border-radius: var(--radius); }
.auth { max-width: 380px; margin: 0 auto; padding: 1.6rem; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.authbrand { display: flex; flex-direction: column; align-items: center; gap: .8rem; margin-bottom: 1.8rem; color: #fff; font-weight: 800;
  font-size: 2.4rem; letter-spacing: -.01em; font-family: var(--head-font); text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.authbrand img { width: 168px; height: 168px; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .45)); }
@media (max-width: 640px) { .authbrand { font-size: 2rem; } .authbrand img { width: 128px; height: 128px; } }
@media (max-height: 760px) {
  .authbrand { font-size: 1.7rem; gap: .5rem; margin-bottom: 1.1rem; } .authbrand img { width: 88px; height: 88px; }
  .auth { padding: 1.2rem 1.3rem; }
}
@media (max-height: 620px) {
  .authbrand { flex-direction: row; justify-content: center; gap: .6rem; margin-bottom: .9rem; font-size: 1.6rem; }
  .authbrand img { width: 48px; height: 48px; }
}
body.signin, body.signin img { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

.field { display: block; margin-bottom: .8rem; }
.codelabel::before { content: "Enter Your Company Code:"; }   /* in CSS, not the page: keeps Safari AutoFill off */
.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink); margin-bottom: .65rem; }
input { font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: .5rem .7rem; min-height: 42px; width: 100%; letter-spacing: .04em; -webkit-user-select: text; user-select: text; }
#hubForm input { font-family: var(--head-font); font-size: 1.6rem; font-weight: 600; text-align: center; letter-spacing: .35em; text-indent: .35em; min-height: 56px; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn { font: inherit; font-family: var(--head-font); text-decoration: none; border: 1px solid var(--brand); border-radius: var(--btn-radius); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s; }
a.btn.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
a.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.big { font-size: 1.1rem; padding: .9rem 1.4rem; min-height: 54px; width: 100%; }
/* Continue only appears once the code checks out */
.go { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .45s cubic-bezier(.2, .8, .3, 1), opacity .3s ease-out .1s; }
.go > div { overflow: hidden; min-height: 0; padding: 0 3px 3px; margin: 0 -3px -3px; }
.go .btn { margin-top: .9rem; }
.go.show { grid-template-rows: 1fr; opacity: 1; }

/* the company lookup under the code field (spinner -> drawn check or X) */
.lookup { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .4s cubic-bezier(.2, .8, .3, 1), opacity .3s; }
.lookup > div { overflow: hidden; min-height: 0; display: flex; align-items: center; justify-content: center; gap: .65rem; }
.lookup.busy { grid-template-rows: 1fr; opacity: 1; }
.auth .field { margin-bottom: 0; }
.lookup .spin { position: relative; flex: none; width: 26px; height: 26px; margin: 1.4rem 0 .3rem; }
.lookup .spin::before { content: ''; position: absolute; inset: 0; transition: opacity .2s, scale .3s;   /* Crewtility's mark, turning */
  background: url("/static/spin.svg") center / contain no-repeat; animation: markspin 2.4s linear infinite; }
.lookup .spin svg { opacity: 0; position: absolute; inset: -2px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 22; stroke-dashoffset: 22; }
.lookup.done .spin::before, .lookup.bad .spin::before { opacity: 0; scale: 1.6; }
.lookup.done .spin .ck, .lookup.bad .spin .x { opacity: 1; animation: lookcheck .35s cubic-bezier(.3, 1.4, .5, 1) forwards, lookpop .45s cubic-bezier(.3, 1.6, .5, 1); }
.lookup .looktext { margin-top: 1.1rem; font-size: .85rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; white-space: nowrap; overflow: hidden; max-width: 22rem;
  transition: opacity .25s, max-width .4s cubic-bezier(.2, .8, .3, 1), margin .4s cubic-bezier(.2, .8, .3, 1);
  background: linear-gradient(90deg, var(--muted) 30%, var(--ink) 50%, var(--muted) 70%) 0 0 / 250% 100%; -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; animation: lookshine 1.4s linear infinite; }
.lookup.done .looktext { opacity: 0; max-width: 0; margin-left: -.65rem; }   /* the check slides to the middle */
.lookup .spin .x { stroke: var(--bad); stroke-dasharray: 15; stroke-dashoffset: 15; }
.lookup.bad .looktext { animation: none; background: none; -webkit-text-fill-color: var(--bad); color: var(--bad);
  white-space: normal; max-width: 100%; text-align: center; }      /* a longer message wraps instead of being cut off */
input.notfound { border-color: var(--bad) !important; box-shadow: 0 0 0 4px var(--bad-soft) !important; animation: lookshake .45s; }
input.looking { border-color: var(--brand) !important; animation: lookglow 1.1s ease-in-out infinite; }
input.found { border-color: var(--ok) !important; box-shadow: 0 0 0 4px var(--ok-soft) !important; transition: border-color .3s, box-shadow .6s; }
@keyframes markspin {   /* wrenched: a quick 60° turn (one flat of the nut), a slight give back, a pause; six to go round */
  0.00% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  8.33% { transform: rotate(64deg); animation-timing-function: ease-out; }
  11.33% { transform: rotate(60deg); }
  16.67% { transform: rotate(60deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  25.00% { transform: rotate(124deg); animation-timing-function: ease-out; }
  28.00% { transform: rotate(120deg); }
  33.33% { transform: rotate(120deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  41.67% { transform: rotate(184deg); animation-timing-function: ease-out; }
  44.67% { transform: rotate(180deg); }
  50.00% { transform: rotate(180deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  58.33% { transform: rotate(244deg); animation-timing-function: ease-out; }
  61.33% { transform: rotate(240deg); }
  66.67% { transform: rotate(240deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  75.00% { transform: rotate(304deg); animation-timing-function: ease-out; }
  78.00% { transform: rotate(300deg); }
  83.33% { transform: rotate(300deg); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  91.67% { transform: rotate(364deg); animation-timing-function: ease-out; }
  94.67% { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}
@keyframes lookcheck { to { stroke-dashoffset: 0; } }
@keyframes lookpop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } }
@keyframes lookshine { to { background-position: -250% 0; } }
@keyframes lookshake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes lookglow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 22%, transparent); } }
/* the spinner only spins while it's showing */
.lookup:not(.busy) .spin::before, .lookup:not(.busy) .looktext { animation: none; }

/* Arriving: the logo drops in and settles, the name rises, then the card slides up with its field a beat behind.
   Leaving (body.leaving): everything lifts away and the grid fades. Handing off to a company (body.handoff): only the
   card drops away. */
.authbrand img { animation: logoin 1s cubic-bezier(.2, .9, .3, 1.15) .1s both; }
.authbrand span { display: block; animation: risein .7s cubic-bezier(.2, .8, .3, 1) .45s both; }
.auth { animation: cardin .8s cubic-bezier(.2, .85, .25, 1) .6s both; }
.auth .field { animation: risein .6s cubic-bezier(.2, .8, .3, 1) .85s both; }
@keyframes logoin { 0% { opacity: 0; transform: translateY(-28px) scale(.55) rotate(-14deg); }
  60% { opacity: 1; transform: translateY(3px) scale(1.05) rotate(3deg); } 100% { transform: none; } }
@keyframes risein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes cardin { from { opacity: 0; transform: translateY(48px) scale(.96); } to { opacity: 1; transform: none; } }
body.leaving .authbrand, body.leaving .auth { animation: leaveup .5s cubic-bezier(.5, 0, .75, .3) forwards; }
body.leaving .auth { animation-delay: .06s; }
body.leaving #grid { transition: opacity .5s; opacity: 0; }
body.handoff .auth { animation: handout .38s cubic-bezier(.5, 0, .75, .3) forwards; }   /* logo + grid stay for the next page */
@keyframes handout { to { opacity: 0; transform: translateY(26px) scale(.98); } }
@keyframes leaveup { to { opacity: 0; transform: translateY(-36px) scale(.97); } }
/* the button lifts under the pointer and presses in */
.btn { transition: background .12s, border-color .12s, transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn:active { transform: translateY(1px) scale(.99); box-shadow: none; }
/* the field's border warms in rather than snapping */
input { transition: border-color .25s, box-shadow .25s; }
@media (prefers-reduced-motion: reduce) {
  .lookup, .go, input.notfound, .authbrand img, .authbrand span, .auth, .auth .field, .btn { transition: none; animation: none; }
}
