/* ==========================================================================
   SmartMill365 — temporary sign-in gate, view chooser and the top-bar account menu (js/auth.js,
   ARCHITECTURE.md 9.14). Selectors: #gate (full-stage overlay), #acct-btn / #acct-menu (top bar).
   Screen text ≥ 13.5 px.
   ========================================================================== */

/* until the gate lets the app boot, nothing but the gate is visible (the static top bar included) */
html.sm-locked #stage > :not(#gate) { visibility: hidden !important; }

#gate { position: absolute; inset: 0; z-index: 100; display: none; color: var(--text);
  background:
    radial-gradient(1100px 640px at 50% 52%, rgba(18, 60, 130, 0.40), transparent 70%),
    radial-gradient(900px 500px at 85% 100%, rgba(0, 140, 200, 0.12), transparent 70%),
    linear-gradient(180deg, var(--bg1), var(--bg0)); }
#gate.on { display: block; }
#gate::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(80, 140, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(80, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px; }
#gate input { user-select: text; font: inherit; color: inherit; }
#gate button:focus-visible, #gate input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* header: same look as the top bar */
#gate .gt-bar { position: absolute; left: 0; right: 0; top: 0; height: var(--tb-h); display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: linear-gradient(180deg, rgba(6, 20, 44, 0.96), rgba(4, 14, 32, 0.88)); border-bottom: 1px solid var(--border); box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35); }
#gate .gt-bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0.55; }
#gate .gt-brand { display: flex; align-items: center; gap: 10px; flex: none; }
#gate .gt-brand svg { width: 42px; height: 42px; filter: drop-shadow(0 0 8px rgba(47, 212, 255, 0.45)); }
#gate .word { font-family: var(--num); font-size: 28px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
#gate .word i { font-style: normal; color: #9fd2ff; }
#gate .word b { color: var(--brand-green); font-weight: 700; }
#gate .gt-sep { width: 1px; height: 36px; background: var(--border); flex: none; }
#gate .gt-ttl { display: flex; flex-direction: column; line-height: 1.2; }
#gate .gt-ttl .t1 { font-family: var(--num); font-weight: 700; font-size: 19px; letter-spacing: 1.4px; color: #7cc4ff; text-transform: uppercase; white-space: nowrap; }
#gate .gt-ttl .t2 { font-size: 14px; color: var(--text-mute); letter-spacing: 0.4px; white-space: nowrap; }
#gate .gt-sp { flex: 1; }

#gate .gt-body { position: absolute; left: 0; right: 0; top: var(--tb-h); bottom: 56px; display: flex; flex-direction: column; align-items: center; }
#gate .gt-foot { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; letter-spacing: 0.4px; color: var(--text-mute); }
#gate .gt-foot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); margin-right: 9px; box-shadow: 0 0 8px rgba(255, 178, 36, 0.6); }

/* ------------------------------------------------------------------ login */
#gate .gt-lb { justify-content: center; gap: 34px; padding-bottom: 40px; }
#gate .gt-hero { display: flex; align-items: center; gap: 22px; }
#gate .gt-hero > svg { width: 96px; height: 96px; filter: drop-shadow(0 0 16px rgba(47, 212, 255, 0.45)); }
#gate .gt-hero .word { font-size: 60px; line-height: 1; }
#gate .gt-hs { margin-top: 8px; font-size: 18px; color: var(--text-dim); letter-spacing: 0.6px; }

#gate .gt-card { position: relative; width: 500px; padding: 26px 30px 30px; border-radius: 12px; background: rgba(8, 22, 46, 0.9); border: 1px solid var(--border-hi);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(47, 160, 255, 0.10), inset 0 1px 0 rgba(120, 180, 255, 0.08); }
#gate .gt-card::before, #gate .gt-card::after { content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none; }
#gate .gt-card::before { left: -1px; top: -1px; border-left: 2px solid var(--cyan); border-top: 2px solid var(--cyan); border-top-left-radius: 12px; }
#gate .gt-card::after { right: -1px; bottom: -1px; border-right: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); border-bottom-right-radius: 12px; opacity: 0.6; }
#gate .gt-ch { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
#gate .gt-ch .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--cyan); background: rgba(47, 212, 255, 0.10); border: 1px solid rgba(47, 212, 255, 0.35); flex: none; }
#gate .gt-ch .ico svg { width: 22px; height: 22px; }
#gate .gt-ch b { display: block; font-family: var(--num); font-size: 24px; font-weight: 700; letter-spacing: 0.3px; }
#gate .gt-ch small { display: block; font-size: 14px; color: var(--text-mute); margin-top: 1px; }
#gate .gt-f { display: block; margin-bottom: 14px; }
#gate .gt-f > span:first-child { display: block; font-size: 14px; font-weight: 600; letter-spacing: 0.4px; color: var(--text-dim); margin-bottom: 6px; }
#gate .gt-f input, #gate .gt-lh input { width: 100%; height: 44px; padding: 0 14px; font-size: 16px; border-radius: 7px; border: 1px solid var(--border); background: rgba(2, 10, 26, 0.75); outline: none; transition: border-color .15s, box-shadow .15s; }
#gate .gt-f input:focus, #gate .gt-lh input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(47, 212, 255, 0.15); outline: none; }
#gate .gt-pw { position: relative; display: block; }
#gate .gt-pw input { padding-right: 48px; }
#gate .gt-eye { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; color: var(--text-mute); }
#gate .gt-eye svg { width: 19px; height: 19px; }
#gate .gt-eye:hover, #gate .gt-eye.on { color: var(--cyan); background: rgba(47, 212, 255, 0.08); }
#gate .gt-err { min-height: 22px; margin: -2px 0 10px; font-size: 14.5px; font-weight: 600; color: var(--red); }
#gate .gt-err:not(:empty)::before { content: '!'; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13.5px; margin-right: 7px; vertical-align: -2px; }
#gate .bad .gt-f input { border-color: rgba(255, 75, 92, 0.75); }
#gate .gt-go { width: 100%; height: 46px; border-radius: 7px; font-size: 16px; font-weight: 600; letter-spacing: 0.4px; color: #fff;
  background: linear-gradient(180deg, #1e6fe0, #1553b5); box-shadow: 0 0 16px rgba(30, 111, 224, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
#gate .gt-go:hover { filter: brightness(1.12); }
#gate .gt-go:disabled { opacity: 0.7; cursor: progress; }

/* ---------------------------------------------------------------- chooser */
#gate .gt-cb { justify-content: center; padding-bottom: 40px; }
#gate .gt-cb.gt-listed { justify-content: flex-start; padding-top: 34px; }
#gate .gt-chh { text-align: center; margin-bottom: 34px; }
#gate .gt-chh h2 { font-family: var(--num); font-size: 38px; font-weight: 700; letter-spacing: 0.4px; }
#gate .gt-who { margin-top: 8px; font-size: 15px; color: var(--text-mute); display: flex; align-items: center; justify-content: center; gap: 8px; }
#gate .gt-who b { color: var(--text-dim); font-weight: 600; }
#gate .gt-who .dot { color: var(--text-mute); }
#gate .gt-link { color: var(--cyan); font-size: 15px; padding: 2px 2px; border-radius: 4px; }
#gate .gt-link:hover { text-decoration: underline; }
#gate .gt-link kbd { font-family: var(--num); font-size: 13.5px; color: var(--text-mute); border: 1px solid var(--border); border-radius: 3px; padding: 0 5px; margin-left: 4px; }
#gate .gt-cards { display: grid; grid-template-columns: repeat(2, 674px); gap: 28px; }   /* 2 × 674 + 28 = list width 1376 */
#gate .gt-opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; height: 290px; padding: 28px 28px 24px; border-radius: 12px;
  background: rgba(8, 22, 46, 0.86); border: 1px solid var(--border); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(120, 180, 255, 0.07);
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
#gate .gt-listed .gt-opt { height: 236px; padding-top: 22px; }
#gate .gt-opt:hover { border-color: var(--border-hi); background: rgba(14, 36, 72, 0.9); transform: translateY(-2px); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), 0 0 24px rgba(47, 160, 255, 0.15); }
#gate .gt-opt.open { border-color: var(--cyan); background: rgba(14, 40, 80, 0.92); }
#gate .gt-opt .gi { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; color: var(--cyan); background: rgba(47, 212, 255, 0.10); border: 1px solid rgba(47, 212, 255, 0.30); margin-bottom: 18px; flex: none; }
#gate .gt-listed .gt-opt .gi { width: 46px; height: 46px; margin-bottom: 12px; }
#gate .gt-opt .gi svg { width: 28px; height: 28px; }
#gate .gt-opt b { font-family: var(--num); font-size: 26px; font-weight: 700; letter-spacing: 0.3px; }
#gate .gt-opt .gd { margin-top: 8px; font-size: 15.5px; line-height: 1.45; color: var(--text-dim); }
#gate .gt-opt .gm { margin-top: auto; font-style: normal; font-size: 14.5px; color: #8cc8ff; letter-spacing: 0.3px; }
#gate .gt-opt .gt-tgl { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border: 1px solid var(--border-hi); border-radius: 6px; color: var(--cyan); font-weight: 600; }
#gate .gt-opt .gt-tgl .chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
#gate .gt-opt.open .gt-tgl .chev { transform: translateY(2px) rotate(-135deg); }
#gate .gt-cur { position: absolute; right: 18px; top: 18px; font-style: normal; font-size: 13.5px; font-weight: 600; color: var(--green); border: 1px solid rgba(34, 217, 130, 0.5); border-radius: 10px; padding: 1px 9px; }

#gate .gt-list { width: 1376px; margin-top: 22px; padding: 16px 20px 18px; border-radius: 12px; background: rgba(6, 18, 40, 0.92); border: 1px solid var(--border-hi);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4); }
#gate .gt-list[hidden] { display: none; }
#gate .gt-lh { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
#gate .gt-lh .gi { width: 22px; height: 22px; color: var(--text-mute); flex: none; }
#gate .gt-lh .gi svg { width: 22px; height: 22px; }
#gate .gt-lh input { width: 420px; height: 40px; font-size: 15px; }
#gate .gt-n { font-size: 14px; color: var(--text-mute); margin-left: 4px; }
#gate .gt-lh .gt-link { margin-left: auto; }
#gate .gt-lh .gt-warn { margin-left: auto; font-size: 13.5px; color: var(--amber); white-space: nowrap; }
#gate .gt-lh .gt-warn + .gt-link { margin-left: 18px; }
/* customer list (chooser "Customer" card): one button per customer, its mills underneath */
#gate .gt-cs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; max-height: 452px; overflow-y: auto; align-content: start; }
#gate .gt-ci { display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: rgba(10, 28, 58, 0.55); }
#gate .gt-ci[hidden] { display: none; }
#gate .gt-ci:hover, #gate .gt-ci:focus-visible { border-color: var(--border-hi); background: rgba(47, 212, 255, 0.08); }
#gate .gt-ci.cur { border-color: rgba(34, 217, 130, 0.55); }
#gate .gt-ci .ch { display: flex; align-items: baseline; gap: 10px; }
#gate .gt-ci .ch b { font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#gate .gt-ci .ch i { margin-left: auto; font-style: normal; font-size: 13.5px; color: var(--text-mute); white-space: nowrap; }
#gate .gt-ci .ch em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--green); border: 1px solid rgba(34, 217, 130, 0.5); border-radius: 9px; padding: 0 7px; white-space: nowrap; }
#gate .gt-ci .cm { font-size: 13.5px; line-height: 1.4; color: #8cc8ff; }
#gate .gt-none { font-size: 15px; color: var(--text-mute); padding: 8px; }

/* ------------------------------------------------------- top-bar account */
#acct-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-left: -6px; color: var(--text-mute);
  border: 1px solid var(--border); background: rgba(4, 14, 34, 0.7); transition: color .15s, border-color .15s; }
#acct-btn:empty { display: none; }
#topbar.tb-mill #acct-btn { display: none; }              /* mill / station / report pages have no room: the chip opens the menu */
#topbar .nv-chip[title] { cursor: pointer; }
#acct-btn svg { width: 17px; height: 17px; }
#acct-btn:hover, #acct-btn.on { color: var(--cyan); border-color: var(--border-hi); }
#acct-menu { position: absolute; top: 68px; right: 14px; z-index: 46; width: 310px; display: none; padding: 12px; border-radius: 10px;
  background: rgba(6, 18, 40, 0.97); border: 1px solid var(--border-hi); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
#acct-menu.on { display: block; }
#acct-menu .am-h { font-family: var(--num); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: #8cc8ff; margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; }
#acct-menu .am-h small { font-family: var(--ui); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
#acct-menu .am-i { display: grid; grid-template-columns: 20px 1fr; column-gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 9px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; }
#acct-menu .am-i:hover { border-color: var(--border-hi); background: rgba(47, 212, 255, 0.07); }
#acct-menu .am-i svg { width: 18px; height: 18px; color: var(--cyan); grid-row: span 2; }
#acct-menu .am-i b { font-weight: 600; }
#acct-menu .am-i i { font-style: normal; font-size: 13.5px; color: var(--text-mute); grid-column: 2; }
#acct-menu .am-note { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-mute); }

@media print { #gate, #acct-menu, #acct-btn { display: none !important; } }
