:root {
  --navy: #12324f; --teal: #1f6f8b; --green: #1f8b5f; --red: #c8553d; --purple: #6b5b95;
  --bg: #f3f6f8; --card: #fff; --line: #d6dfe6; --text: #1d2733; --muted: #6b7a88;
  --warn-bg: #fdf3dc; --warn: #8a6410; --out-bg: #fbe3de; --out: #a0321d;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* 로그인 */
.auth { width: 100%; max-width: 380px; background: var(--card); border-radius: 14px; padding: 24px 20px; box-shadow: 0 4px 20px rgba(18,50,79,.08); }
.auth h1 { margin: 0 0 16px; font-size: 22px; color: var(--navy); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
label.f { display: block; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.in, select.in, textarea.in {
  width: 100%; margin-top: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 16px;
}
.in:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
.pw { display: flex; gap: 6px; align-items: stretch; margin-top: 4px; }
.pw .in { margin-top: 0; flex: 1; min-width: 0; }
.pw .btn { min-width: 64px; min-height: 44px; }
.btn { border: 0; border-radius: 9px; padding: 11px 16px; background: var(--teal); color: #fff; font-weight: 600; min-height: 44px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.ghost { background: #fff; color: var(--teal); border: 1px solid var(--line); }
.btn.green { background: var(--green); } .btn.red { background: var(--red); } .btn.purple { background: var(--purple); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 14px; font-weight: 500; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--teal); padding: 12px 0 0; width: 100%; text-align: center; }
.lang { background: #fff; color: var(--navy); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-size: 14px; font-weight: 600; min-height: 34px; white-space: nowrap; }

/* 레이아웃 */
.top { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
.top .title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who { font-size: 13px; opacity: .85; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .lang { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.main { padding: 14px; padding-bottom: 96px; max-width: 1000px; margin: 0 auto; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-top: 1px solid var(--line); display: flex; overflow-x: auto; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1 0 auto; min-width: 64px; text-align: center; padding: 10px 8px; font-size: 13px; color: var(--muted); text-decoration: none; border-top: 3px solid transparent; white-space: nowrap; }
.nav a.on { color: var(--teal); font-weight: 700; border-top-color: var(--teal); }
@media (min-width: 900px) {
  .nav { top: 54px; bottom: 0; right: auto; width: 170px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); overflow: visible; }
  .nav a { flex: none; text-align: left; padding: 13px 20px; font-size: 15px; border-top: 0; border-left: 4px solid transparent; }
  .nav a.on { border-left-color: var(--teal); background: #eef5f8; }
  .main { margin-left: 170px; padding: 22px 26px; max-width: 1100px; }
}

h2 { font-size: 19px; margin: 4px 0 12px; color: var(--navy); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 150px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 24px; color: var(--navy); }
.stat span { font-size: 13px; color: var(--muted); }
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.big a { display: block; text-align: center; text-decoration: none; color: #fff; font-weight: 700; font-size: 19px; padding: 24px 8px; border-radius: 14px; }
@media (min-width: 700px) { .big { grid-template-columns: repeat(4, 1fr); } }

.item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1f4; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.thumb { width: 52px; height: 52px; border-radius: 8px; background: #e6ecf0 center/cover no-repeat; flex: none; }
.item .info { flex: 1; min-width: 0; }
.item .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .num { font-weight: 700; font-size: 18px; color: var(--navy); white-space: nowrap; }
.tag { display: inline-block; border-radius: 5px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.tag.low { background: var(--warn-bg); color: var(--warn); } .tag.zero { background: var(--out-bg); color: var(--out); }
.tag.in { background: #d9efe4; color: #12683f; } .tag.out { background: var(--out-bg); color: var(--out); } .tag.adjust { background: #e7e3f2; color: #4b3d78; }
.tag.off { background: #e6ecf0; color: var(--muted); }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; white-space: nowrap; }
th { background: #eaf2f6; color: var(--navy); }
td.c, th.c { text-align: center; }
td.low { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
td.zero { background: var(--out-bg); color: var(--out); font-weight: 700; }

.vrow { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid #edf1f4; }
.vrow:last-child { border-bottom: 0; }
.vrow .vname { flex: 1; min-width: 0; }
.vrow .vname small { color: var(--muted); display: block; }
.step { display: flex; align-items: center; gap: 4px; }
.step button { width: 42px; height: 42px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 22px; line-height: 1; }
.step input { width: 64px; height: 42px; text-align: center; border: 1px solid var(--line); border-radius: 9px; font-size: 17px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 20; max-width: 90vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }
