/* LogisPilot PDA — 현장용 디자인 시스템
   왜: 장갑·햇빛 아래에서도 읽히고, RF 단말기처럼 투박하지 않게 위계만으로 세련되게 만든다. */

:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #d5deea;
  --canvas: #e6edf4;
  --paper: #ffffff;
  --cta: #1d4ed8;
  --cta-press: #1e40af;
  --cta-ink: #ffffff;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-line: #a7f3d0;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-line: #fcd34d;
  --bad: #b91c1c;
  --bad-bg: #fef2f2;
  --bad-line: #fecaca;
  --info: #1e3a8a;
  --info-bg: #eff6ff;
  --info-line: #bfdbfe;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --touch: 56px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #0b1220;
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app {
  min-height: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
@media (min-width: 768px) {
  .app { max-width: 980px; min-height: 100dvh; }
}

.banner-net,
.banner-mock {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}
.banner-net { background: var(--bad); color: #fff; }
.banner-mock { background: #0b1220; color: #93c5fd; font-size: 11px; font-weight: 600; }

.view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.view.is-on { display: flex; }

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 4px;
  font-size: 11px;
  color: var(--muted);
}
.status-row .ok-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  margin-right: 6px;
}

.appbar { padding: 4px 16px 14px; }
.brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cta);
}
.appbar h1 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: -0.045em;
  line-height: 1.15;
}
.appbar .sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.body {
  flex: 1;
  overflow: auto;
  padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
.view--plain .body { padding-bottom: 24px; }

.stack > * + * { margin-top: 12px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

label.lbl {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.field {
  width: 100%;
  height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 16px;
  background: #f8fafc;
  color: var(--ink);
}
.field:focus {
  outline: 3px solid rgba(29, 78, 216, 0.22);
  border-color: var(--cta);
  background: #fff;
}

.btn {
  width: 100%;
  min-height: var(--touch);
  border: 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.btn:disabled { opacity: 0.45; }
.btn-cta { background: var(--cta); color: var(--cta-ink); }
.btn-cta:active { background: var(--cta-press); }
.btn-ghost { background: #e2e8f0; color: var(--ink); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.err {
  color: var(--bad);
  font-size: 13px;
  font-weight: 700;
  min-height: 1.2em;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 11px;
  font-weight: 800;
}

.group-name {
  margin: 16px 0 8px 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.group-name:first-child { margin-top: 0; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (min-width: 768px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
.tile {
  appearance: none;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 88px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.tile b {
  display: block;
  font-size: 15px;
  letter-spacing: -0.03em;
}
.tile span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.tile:active { transform: scale(0.99); }

.wh-card {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.wh-card strong { display: block; font-size: 17px; }
.wh-card span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.wh-card.is-on { border-color: var(--cta); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15); }

.scan-hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
}
.scan-ring {
  width: 76px;
  height: 76px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid #93c5fd;
  box-shadow: 0 0 0 10px rgba(29, 78, 216, 0.08);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 16px rgba(29, 78, 216, 0.04); }
}
.scan-hero strong { font-size: 18px; letter-spacing: -0.03em; }

.list-card {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.list-card .k { font-size: 12px; color: var(--muted); }
.list-card .v { margin-top: 2px; font-size: 15px; font-weight: 700; }

.meta { font-size: 14px; line-height: 1.5; }
.meta b { color: var(--muted); font-weight: 600; }

.banner {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}
.banner.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.banner.info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }

.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; }

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  min-height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
@media (min-width: 768px) {
  .tabbar { max-width: 980px; }
}
.tabbar button {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}
.tabbar button.is-on { color: var(--cta); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.overlay-sheet {
  width: min(520px, 100%);
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(20px + var(--safe-b));
}
.overlay-sheet h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.03em; }

.confirm-box {
  width: min(420px, calc(100% - 32px));
  margin: auto;
  background: var(--paper);
  border-radius: 20px;
  padding: 22px 18px;
}
.confirm-box h2 { margin: 0 0 8px; font-size: 20px; }
.wedge {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.qty-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 8px;
  align-items: center;
}
.qty-row .field { text-align: center; font-size: 22px; font-weight: 800; }
.qty-row .btn { width: 56px; padding: 0; font-size: 22px; }

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pair div {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
}
.pair em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.switch input { width: 20px; height: 20px; }

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--cta);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -0.06em;
  margin-bottom: 10px;
}
