/* ===== QC Tracker design system: "aurora glass" ===== */

@font-face { font-family: 'Hind Siliguri'; font-weight: 400; font-display: swap; src: url(../vendor/fonts/hind-siliguri-bengali-400-normal.woff2) format('woff2'); unicode-range: U+0951-0952,U+0964-0965,U+0980-09FE,U+200C-200D,U+25CC; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 500; font-display: swap; src: url(../vendor/fonts/hind-siliguri-bengali-500-normal.woff2) format('woff2'); unicode-range: U+0951-0952,U+0964-0965,U+0980-09FE,U+200C-200D,U+25CC; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 600; font-display: swap; src: url(../vendor/fonts/hind-siliguri-bengali-600-normal.woff2) format('woff2'); unicode-range: U+0951-0952,U+0964-0965,U+0980-09FE,U+200C-200D,U+25CC; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 700; font-display: swap; src: url(../vendor/fonts/hind-siliguri-bengali-700-normal.woff2) format('woff2'); unicode-range: U+0951-0952,U+0964-0965,U+0980-09FE,U+200C-200D,U+25CC; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 400; font-display: swap; src: url(../vendor/fonts/hind-siliguri-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+2212; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 500; font-display: swap; src: url(../vendor/fonts/hind-siliguri-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+2212; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 600; font-display: swap; src: url(../vendor/fonts/hind-siliguri-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+2212; }
@font-face { font-family: 'Hind Siliguri'; font-weight: 700; font-display: swap; src: url(../vendor/fonts/hind-siliguri-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+2212; }

:root {
  --bg: #060914;
  --bg-2: #0b1022;
  --ink: #eef1fb;
  --ink-2: #b6bdd6;
  --muted: #7d86a6;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --glass: linear-gradient(150deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .025));
  --glass-solid: #121831;
  --violet: #8b5cf6;
  --indigo: #6366f1;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --teal: #14b8a6;
  /* data colours: status set (always shown with an icon + label) and one sequential blue */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --series: #3987e5;
  --grid: #2c2f3d;
  --radius: 22px;
  --shadow: 0 24px 48px -18px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .3);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 rgba(0, 0, 0, .25);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }

/* ===== aurora background ===== */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(99, 102, 241, .22), transparent 60%),
    linear-gradient(180deg, transparent 60%, rgba(6, 9, 20, .9));
}
.aurora i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 46vmax; height: 46vmax; left: -12vmax; top: -10vmax; background: #4f46e5; }
.aurora i:nth-child(2) { width: 38vmax; height: 38vmax; right: -14vmax; top: 18vh; background: #0891b2; animation-duration: 28s; opacity: .4; }
.aurora i:nth-child(3) { width: 34vmax; height: 34vmax; left: 20vw; bottom: -18vmax; background: #9333ea; animation-duration: 32s; opacity: .38; }
.aurora .grid3d {
  position: absolute; left: -50%; right: -50%; bottom: -10vh; height: 55vh;
  background-image: linear-gradient(rgba(139, 92, 246, .22) 1px, transparent 1px), linear-gradient(90deg, rgba(139, 92, 246, .22) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, .7), transparent 75%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, .7), transparent 75%);
  animation: gridmove 6s linear infinite;
  opacity: .0; transition: opacity .6s;
}
body.auth .aurora .grid3d { opacity: 1; }
@keyframes drift { to { transform: translate(6vw, 5vh) scale(1.12); } }
@keyframes gridmove { to { background-position: 0 56px, 0 0; } }

/* ===== layout ===== */
#root { position: relative; z-index: 1; min-height: 100vh; }
.shell { max-width: 1240px; margin: 0 auto; padding: calc(14px + var(--safe-top)) 16px calc(110px + var(--safe-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(145deg, #a78bfa, #6366f1 45%, #0ea5e9); box-shadow: 0 10px 22px -6px rgba(99, 102, 241, .8), var(--inner); }
.brand-mark svg { width: 22px; height: 22px; stroke: #fff; }
.grad-text { background: linear-gradient(90deg, #fff, #c4b5fd 45%, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 2px 12px; }
.section-title h2 { display: flex; align-items: center; gap: 8px; }

/* ===== glass cards with 3D tilt ===== */
.card {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow), var(--inner);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.card.pad-lg { padding: 22px; }
.tilt { transform-style: preserve-3d; transition: transform .25s ease, box-shadow .25s ease; will-change: transform; }
.tilt::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .10), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.tilt:hover::after, .tilt.touching::after { opacity: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.dash-split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.visit-split { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 860px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .dash-split { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .visit-split { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g2.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2:not(.keep) { grid-template-columns: 1fr; } }

/* ===== KPI tiles ===== */
.kpi { overflow: hidden; }
.kpi .ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px;
  box-shadow: 0 10px 20px -8px currentColor, var(--inner); }
.kpi .ico svg { stroke: #fff; }
.kpi .val { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi .lbl { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.kpi .orb-bg { position: absolute; width: 140px; height: 140px; right: -40px; top: -40px; border-radius: 50%; filter: blur(30px); opacity: .35; }
.c-violet { background: linear-gradient(145deg, #a78bfa, #7c3aed); color: #7c3aed; }
.c-cyan { background: linear-gradient(145deg, #67e8f9, #0891b2); color: #0891b2; }
.c-teal { background: linear-gradient(145deg, #5eead4, #0d9488); color: #0d9488; }
.c-pink { background: linear-gradient(145deg, #f9a8d4, #db2777); color: #db2777; }
.c-amber { background: linear-gradient(145deg, #fcd34d, #d97706); color: #d97706; }
.bar-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 10px; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--series); transition: width .8s cubic-bezier(.2, .8, .2, 1); }

/* ===== buttons & inputs ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; color: #fff;
  background: linear-gradient(145deg, #8b5cf6, #6366f1 55%, #4f46e5);
  box-shadow: 0 12px 24px -10px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -2px 0 rgba(0, 0, 0, .2);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; padding: 15px; font-size: 16px; }
.btn.ghost { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); }
.btn.danger { background: linear-gradient(145deg, #fb7185, #e11d48 60%, #be123c); box-shadow: 0 12px 24px -10px rgba(225, 29, 72, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.success { background: linear-gradient(145deg, #34d399, #059669 60%, #047857); box-shadow: 0 12px 24px -10px rgba(5, 150, 105, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.excel { background: linear-gradient(145deg, #4ade80, #16a34a 55%, #166534); box-shadow: 0 12px 26px -10px rgba(22, 163, 74, .95), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 11px; }
.icon-btn { width: 42px; height: 42px; padding: 0; border-radius: 13px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 6px 2px; }
.input, select.input, textarea.input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line-2); outline: none;
  background: rgba(5, 8, 20, .55); color: var(--ink); font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139, 92, 246, .22); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9aa3c7 50%), linear-gradient(135deg, #9aa3c7 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
select.input option { background: #121831; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 2px 0; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch b { position: absolute; inset: 0; border-radius: 30px; background: rgba(255, 255, 255, .12); transition: .25s; box-shadow: inset 0 0 0 1px var(--line-2); }
.switch b::before { content: ''; position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .25s; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.switch input:checked + b { background: linear-gradient(145deg, #34d399, #059669); }
.switch input:checked + b::before { transform: translateX(20px); }
input[type=range].input { padding: 0; height: 30px; background: transparent; border: 0; accent-color: #8b5cf6; }

/* chips & segmented control */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04);
  color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 500; transition: .2s; white-space: nowrap; }
.chip.on { color: #fff; border-color: transparent; background: linear-gradient(145deg, #8b5cf6, #6366f1); box-shadow: 0 8px 18px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .25); }
.seg { display: inline-flex; padding: 4px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); gap: 4px; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: linear-gradient(145deg, rgba(139, 92, 246, .9), rgba(99, 102, 241, .9)); color: #fff; box-shadow: 0 8px 16px -8px rgba(99, 102, 241, .9); }

/* status pills: colour + icon + label, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, .06); color: var(--ink); border: 1px solid var(--line-2); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.pill.good .dot { background: var(--good); box-shadow: 0 0 10px var(--good); }
.pill.warning .dot { background: var(--warning); box-shadow: 0 0 10px var(--warning); }
.pill.serious .dot { background: var(--serious); box-shadow: 0 0 10px var(--serious); }
.pill.critical .dot { background: var(--critical); box-shadow: 0 0 10px var(--critical); }
.pill.live .dot { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.role-badge { font-size: 12px; padding: 2px 9px; border-radius: 8px; font-weight: 600; background: rgba(139, 92, 246, .18); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, .35); }
.role-badge.admin { background: rgba(236, 72, 153, .16); color: #f9a8d4; border-color: rgba(236, 72, 153, .35); }
.role-badge.manager { background: rgba(34, 211, 238, .14); color: #67e8f9; border-color: rgba(34, 211, 238, .35); }
.role-badge.qc { background: rgba(20, 184, 166, .15); color: #5eead4; border-color: rgba(20, 184, 166, .35); }

/* avatars */
.avatar { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 16px;
  box-shadow: 0 8px 16px -8px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(0, 0, 0, .2); }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 20px; }
.avatar.xl { width: 96px; height: 96px; border-radius: 28px; font-size: 32px; }
.avatar.photo { padding: 0; overflow: hidden; background: #1e1b4b; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* plan chips */
.plan-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2); max-width: 100%; }
.pchip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.pchip.good .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.pchip.critical .dot { background: var(--critical); box-shadow: 0 0 8px var(--critical); }
.pchip.serious .dot { background: var(--serious); box-shadow: 0 0 8px var(--serious); }
.pchip .x { cursor: pointer; opacity: .6; margin-left: 2px; }
.pchip .x:hover { opacity: 1; }
.pchip .ellipsis { max-width: 210px; }
.plan-card .add { border-style: dashed; cursor: pointer; color: var(--ink-2); background: transparent; }
.plan-card.dirty { border-color: rgba(250, 178, 25, .55); }
.dirty-bar { position: sticky; top: calc(8px + var(--safe-top)); z-index: 20; margin-bottom: 14px; padding: 10px 14px; border-radius: 16px;
  background: linear-gradient(145deg, rgba(250, 178, 25, .2), rgba(217, 119, 6, .14)); border: 1px solid rgba(250, 178, 25, .45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* import wizard */
.drop { border: 2px dashed var(--line-2); border-radius: 18px; padding: 26px 14px; text-align: center; cursor: pointer; transition: .2s; background: rgba(255, 255, 255, .02); }
.drop:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, .08); }
.drop svg { width: 40px; height: 40px; stroke: #a78bfa; margin-bottom: 6px; }
tr.bad td { background: rgba(208, 59, 59, .1); }
.err-text { color: #fda4af; font-size: 12.5px; white-space: normal; }
.sugg { color: #fcd34d; font-size: 12.5px; cursor: pointer; text-decoration: underline; white-space: normal; }
.photo-thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; display: block; }
.photo-pick { display: flex; align-items: center; gap: 14px; }

/* ===== bottom nav (phones) / side nav (desktop) ===== */
.nav {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-bottom));
  display: flex; gap: 4px; padding: 7px; border-radius: 24px; width: min(520px, calc(100% - 24px));
  background: rgba(14, 18, 38, .72); border: 1px solid var(--line-2); box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .9), var(--inner);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
}
.nav button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 4px 6px; border-radius: 18px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; transition: .25s; }
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: #fff; background: linear-gradient(145deg, rgba(139, 92, 246, .95), rgba(79, 70, 229, .95));
  box-shadow: 0 10px 20px -8px rgba(99, 102, 241, 1), inset 0 1px 0 rgba(255, 255, 255, .3); }
@media (min-width: 1024px) {
  .with-nav .shell { padding-left: 250px; padding-bottom: 40px; max-width: 1480px; }
  .nav { left: 18px; top: 18px; bottom: 18px; transform: none; width: 208px; flex-direction: column; padding: 14px 10px; border-radius: 26px; gap: 6px; }
  .nav .nav-brand { display: flex !important; }
  .nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 15px; border-radius: 15px; }
  .nav .spacer { flex: 1; }
}
.nav .nav-brand { display: none; align-items: center; gap: 10px; padding: 6px 8px 16px; font-weight: 700; font-size: 17px; }

/* ===== login ===== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 16px 24px; }
.auth-card { width: min(420px, 100%); }
.logo3d { width: 128px; height: 128px; margin: 0 auto 18px; perspective: 600px; }
.logo3d .cube { width: 100%; height: 100%; border-radius: 34px; position: relative; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 22%, #c4b5fd, #7c3aed 38%, #3730a3 72%, #1e1b4b);
  box-shadow: 0 30px 60px -16px rgba(124, 58, 237, .9), inset -10px -14px 30px rgba(0, 0, 0, .45), inset 10px 12px 26px rgba(255, 255, 255, .28);
  animation: float3d 6s ease-in-out infinite; transform-style: preserve-3d; }
.logo3d .cube::before { content: ''; position: absolute; left: 18%; top: 10%; width: 46%; height: 26%; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, .55), transparent 70%); filter: blur(2px); }
.logo3d svg { width: 62px; height: 62px; stroke: #fff; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); transform: translateZ(30px); }
@keyframes float3d { 0%, 100% { transform: rotateX(10deg) rotateY(-14deg) translateY(0); } 50% { transform: rotateX(-6deg) rotateY(14deg) translateY(-10px); } }

/* ===== 3D orb (check-in / on duty) ===== */
.orb-stage { position: relative; display: grid; place-items: center; height: 300px; margin: 6px 0 4px; perspective: 900px; }
.orb {
  position: relative; width: 210px; height: 210px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; z-index: 2;
  background: radial-gradient(circle at 32% 26%, #ddd6fe 0%, #8b5cf6 30%, #5b21b6 62%, #1e1b4b 100%);
  box-shadow: 0 40px 70px -18px rgba(124, 58, 237, .85), 0 0 0 10px rgba(139, 92, 246, .08), inset -16px -22px 46px rgba(0, 0, 0, .5), inset 14px 18px 36px rgba(255, 255, 255, .3);
  display: grid; place-items: center; text-align: center; transition: transform .2s cubic-bezier(.3, .7, .4, 1.4), box-shadow .3s, filter .3s;
  animation: hover 5s ease-in-out infinite;
}
.orb::before { content: ''; position: absolute; left: 20%; top: 9%; width: 46%; height: 26%; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, .7), transparent 70%); filter: blur(3px); }
.orb:active { transform: scale(.94) translateY(6px); }
.orb:disabled { filter: grayscale(.8) brightness(.6); cursor: default; animation: none; }
.orb .orb-label { position: relative; font-size: 26px; font-weight: 700; text-shadow: 0 3px 10px rgba(0, 0, 0, .45); line-height: 1.2; }
.orb .orb-sub { position: relative; display: block; font-size: 13px; font-weight: 500; opacity: .85; margin-top: 2px; }
.orb.on-duty { background: radial-gradient(circle at 32% 26%, #ccfbf1 0%, #2dd4bf 30%, #0f766e 64%, #042f2e 100%);
  box-shadow: 0 40px 70px -18px rgba(20, 184, 166, .85), 0 0 0 10px rgba(45, 212, 191, .08), inset -16px -22px 46px rgba(0, 0, 0, .5), inset 14px 18px 36px rgba(255, 255, 255, .3); cursor: default; }
.orb.on-duty.outside { background: radial-gradient(circle at 32% 26%, #ffedd5 0%, #fb923c 30%, #c2410c 64%, #431407 100%);
  box-shadow: 0 40px 70px -18px rgba(234, 88, 12, .85), inset -16px -22px 46px rgba(0, 0, 0, .5), inset 14px 18px 36px rgba(255, 255, 255, .3); }
.orb .timer { font-size: 38px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; position: relative; text-shadow: 0 3px 12px rgba(0, 0, 0, .5); }
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.orbit { position: absolute; width: 290px; height: 290px; border-radius: 50%; border: 1.5px dashed rgba(167, 139, 250, .45);
  transform: rotateX(72deg); animation: spin 14s linear infinite; z-index: 1; }
.orbit.o2 { width: 250px; height: 250px; border-style: solid; border-color: rgba(103, 232, 249, .25); animation-duration: 9s; animation-direction: reverse; }
.orbit::after { content: ''; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; border-radius: 50%; background: #c4b5fd; box-shadow: 0 0 16px #a78bfa; }
@keyframes spin { to { transform: rotateX(72deg) rotateZ(360deg); } }
.radar { position: absolute; width: 210px; height: 210px; border-radius: 50%; border: 2px solid rgba(45, 212, 191, .6); animation: radar 2.6s ease-out infinite; z-index: 1; }
.radar.r2 { animation-delay: .85s; }
.radar.r3 { animation-delay: 1.7s; }
.outside-glow .radar { border-color: rgba(251, 146, 60, .6); }
@keyframes radar { from { transform: scale(1); opacity: .9; } to { transform: scale(1.75); opacity: 0; } }
.orb-shadow { position: absolute; bottom: 18px; width: 170px; height: 26px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, .65), transparent 70%); animation: shadow 5s ease-in-out infinite; }
@keyframes shadow { 50% { transform: scale(.85); opacity: .7; } }

/* factory picker */
.factory-opt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); cursor: pointer; transition: .2s; }
.factory-opt + .factory-opt { margin-top: 8px; }
.factory-opt.on { border-color: rgba(139, 92, 246, .8); background: linear-gradient(145deg, rgba(139, 92, 246, .22), rgba(99, 102, 241, .1)); box-shadow: 0 10px 24px -14px rgba(139, 92, 246, 1); }
.factory-opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.factory-opt.on .radio { border-color: #a78bfa; }
.factory-opt.on .radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #a78bfa; box-shadow: 0 0 8px #a78bfa; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 7px; background: rgba(255, 255, 255, .08); color: var(--ink-2); font-weight: 600; }
.tag.here { background: rgba(12, 163, 12, .2); color: #86efac; }
.tag.assigned { background: rgba(139, 92, 246, .2); color: #c4b5fd; }

/* ===== lists & tables ===== */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 11px 12px; background: rgba(255, 255, 255, .04); position: sticky; top: 0; white-space: nowrap; font-size: 13px; }
table.t td { padding: 11px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: rgba(139, 92, 246, .08); }
.num-r { text-align: right !important; font-variant-numeric: tabular-nums; }

/* leaderboard */
.lb-row { display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; cursor: pointer; transition: background .2s; }
.lb-row:hover { background: rgba(255, 255, 255, .04); }
.lb-row + .lb-row { border-top: 1px solid var(--line); }
.rank { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); background: rgba(255, 255, 255, .06); }
.rank.r1 { color: #422006; background: radial-gradient(circle at 30% 25%, #fef9c3, #facc15 45%, #a16207); box-shadow: 0 6px 14px -4px rgba(250, 204, 21, .8), inset 0 -2px 3px rgba(0, 0, 0, .25); }
.rank.r2 { color: #1f2937; background: radial-gradient(circle at 30% 25%, #ffffff, #cbd5e1 45%, #64748b); box-shadow: 0 6px 14px -4px rgba(203, 213, 225, .6), inset 0 -2px 3px rgba(0, 0, 0, .25); }
.rank.r3 { color: #431407; background: radial-gradient(circle at 30% 25%, #fed7aa, #f97316 45%, #9a3412); box-shadow: 0 6px 14px -4px rgba(249, 115, 22, .7), inset 0 -2px 3px rgba(0, 0, 0, .25); }
.mini-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.mini-stats b { color: var(--ink); font-weight: 600; }

/* score ring */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); overflow: visible; }
.ring .ring-val { position: absolute; text-align: center; line-height: 1.05; }
.ring .ring-val b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring.xl .ring-val b { font-size: 46px; }
.ring .ring-val span { font-size: 12px; color: var(--muted); }
.ring circle.prog { transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1); }
.hero-score { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
@media (max-width: 640px) { .hero-score { grid-template-columns: 1fr; justify-items: center; text-align: center; } .hero-score .parts { justify-content: center; } }

/* bar chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--series); transition: opacity .15s; }
.chart .bar.dim { opacity: .45; }
.chart .hit { fill: transparent; cursor: pointer; }
.tooltip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 11px; border-radius: 12px; font-size: 13px; background: rgba(10, 14, 30, .95);
  border: 1px solid var(--line-2); box-shadow: 0 12px 24px -10px #000; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s; }
.tooltip.show { opacity: 1; }

/* ===== modal / sheet ===== */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(3, 5, 14, .65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@media (min-width: 720px) { .modal-back { align-items: center; } }
.modal { width: min(640px, 100%); max-height: 92vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom));
  background: linear-gradient(160deg, #161c3a, #0c1124); border: 1px solid var(--line-2); box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, .9), var(--inner); animation: up .28s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(900px, 100%); }
@media (min-width: 720px) { .modal { border-radius: 26px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* toast */
.toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-top)); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 16px; background: rgba(16, 21, 44, .95); border: 1px solid var(--line-2); box-shadow: 0 16px 34px -12px #000; display: flex; gap: 10px; align-items: flex-start; animation: drop .3s cubic-bezier(.2, .8, .2, 1.3); font-size: 14.5px; }
.toast.good svg { stroke: #4ade80; } .toast.bad svg { stroke: #fb7185; } .toast.info svg { stroke: #67e8f9; }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }

/* step overlay during check-in */
.steps { list-style: none; padding: 0; margin: 10px 0 0; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: var(--muted); }
.steps li .s-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); flex: none; }
.steps li.active { color: var(--ink); }
.steps li.active .s-ico { border-color: #a78bfa; border-top-color: transparent; animation: spin2 .8s linear infinite; }
.steps li.done { color: var(--ink); }
.steps li.done .s-ico { border-color: transparent; background: linear-gradient(145deg, #34d399, #059669); }
.steps li.fail .s-ico { border-color: transparent; background: linear-gradient(145deg, #fb7185, #e11d48); }
@keyframes spin2 { to { transform: rotate(360deg); } }

/* success burst */
.burst { position: fixed; inset: 0; z-index: 80; pointer-events: none; display: grid; place-items: center; }
.burst .check { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 32% 26%, #d1fae5, #34d399 35%, #047857 75%);
  box-shadow: 0 30px 60px -10px rgba(16, 185, 129, .9), inset -10px -14px 30px rgba(0, 0, 0, .35), inset 10px 12px 24px rgba(255, 255, 255, .35); animation: pop .6s cubic-bezier(.2, .9, .3, 1.5), out .4s 1.4s forwards; }
.burst .check svg { width: 70px; height: 70px; stroke: #fff; stroke-width: 3; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .25s forwards; }
.burst i { position: absolute; width: 10px; height: 10px; border-radius: 3px; animation: confetti 1.2s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }
@keyframes out { to { transform: scale(.6); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes confetti { to { transform: translate(var(--x), var(--y)) rotate(540deg); opacity: 0; } }

/* maps */
.map { height: 380px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #0b0f1f; }
.map.tall { height: 520px; }
.leaflet-container { background: #0b0f1f; font-family: inherit; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.92) saturate(.55); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #141a35; color: var(--ink); box-shadow: 0 12px 30px -8px #000; }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-control-attribution { background: rgba(10, 14, 30, .7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-bar a { background: #141a35 !important; color: var(--ink) !important; border-color: var(--line) !important; }
.qc-marker { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  border: 3px solid var(--good); box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .8); position: relative; }
.qc-marker::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: radar 2.2s ease-out infinite; }
.fac-label { color: #e0e7ff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px #000, 0 0 8px #000; white-space: nowrap; }

/* misc */
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; stroke: var(--muted); margin-bottom: 8px; }
.alert-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .06); }
.alert-ico.critical { color: var(--critical); background: rgba(208, 59, 59, .14); }
.alert-ico.serious { color: var(--serious); background: rgba(236, 131, 90, .14); }
.alert-ico.warning { color: var(--warning); background: rgba(250, 178, 25, .12); }
.selfie { width: 100%; max-width: 260px; border-radius: 18px; display: block; box-shadow: var(--shadow); }
.offline-bar { position: fixed; z-index: 40; top: 0; left: 0; right: 0; padding: calc(6px + var(--safe-top)) 12px 6px; text-align: center; font-size: 13px; font-weight: 600;
  background: linear-gradient(90deg, #b45309, #d97706); color: #fff; }
.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .09), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.fade-in > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.fade-in > *:nth-child(2) { animation-delay: .05s; } .fade-in > *:nth-child(3) { animation-delay: .1s; } .fade-in > *:nth-child(4) { animation-delay: .15s; }
.fade-in > *:nth-child(5) { animation-delay: .2s; } .fade-in > *:nth-child(6) { animation-delay: .25s; } .fade-in > *:nth-child(n+7) { animation-delay: .3s; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
details.explain summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
details.explain p, details.explain li { color: var(--ink-2); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===== brand, language switch, credit ===== */
.brand-title { text-align: center; font-size: 34px; letter-spacing: .5px; }
.tagline { text-align: center; margin: 4px 0 22px; font-size: 14px; }
.auth-card { position: relative; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2); gap: 2px; }
.lang-switch button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lang-switch button.on { background: linear-gradient(145deg, #8b5cf6, #6366f1); color: #fff; box-shadow: 0 6px 14px -6px rgba(99, 102, 241, .9); }
.lang-switch.corner { display: flex; width: max-content; margin: 0 0 18px auto; }
.credit { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; letter-spacing: .2px; }
.credit b { background: linear-gradient(90deg, #c4b5fd, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.credit-foot { margin-top: 26px; }
.nav-extra { display: none; }
.nav-tag { font-size: 10.5px; font-weight: 500; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.about .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
@media (min-width: 1024px) {
  .nav .nav-extra { display: block; padding: 4px 8px; }
  .nav .nav-extra .credit { text-align: left; margin-top: 6px; }
  .credit-foot { display: none; }
}

/* factory checklist (several factories per QC) */
.checklist-box { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; padding: 4px; background: rgba(5, 8, 20, .35); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.check-row:hover { background: rgba(255, 255, 255, .05); }
.check-row input { width: 18px; height: 18px; accent-color: #8b5cf6; flex: none; }
