/* ===== 객실 출동 (모바일 전용) ===== */
:root {
  --bg: #0f1522;
  --panel: #182234;
  --panel2: #1f2b3f;
  --ink: #eef2f8;
  --muted: #93a1b8;
  --line: #2a3750;
  --go: #2f6bff;
  --back: #22a06b;
  --warn: #e0913a;
  --danger: #e0574c;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

/* ---------- 게이트 ---------- */
.gate { position: fixed; inset: 0; z-index: 100; background: linear-gradient(165deg, #16203a, #0e1420);
  display: flex; align-items: center; justify-content: center; padding: 22px; }
.gate-card { width: 100%; max-width: 380px; text-align: center; }
.gate-emoji { font-size: 46px; }
.gate-card h1 { font-size: 26px; margin: 10px 0 0; letter-spacing: -.6px; }
.gate-sub { color: var(--muted); font-size: 14px; margin: 6px 0 30px; }
.gate-hint { color: var(--muted); font-size: 12px; margin-top: 14px; line-height: 1.6; }
.gate-msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.gate-msg.err { color: #ff9a90; }
.denied { font-size: 14px; line-height: 1.7; margin: 10px 0; }
.denied-email { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.big-btn {
  width: 100%; border: 0; border-radius: var(--radius); background: var(--go); color: #fff;
  font-family: inherit; font-size: 17px; font-weight: 700; padding: 16px; cursor: pointer;
}
.big-btn:active { transform: scale(.985); }
.ghost-btn {
  width: 100%; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--muted); font-family: inherit; font-size: 14px; padding: 13px; cursor: pointer;
}

/* ---------- 상단 ---------- */
.app { min-height: 100%; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.branch-sel {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 700; padding: 8px 10px; max-width: 62vw;
}
.me-name { color: var(--muted); font-size: 13px; white-space: nowrap; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 6px; cursor: pointer; }

.net-banner { background: #4a2020; color: #ffb9b2; font-size: 13px; padding: 10px 14px; line-height: 1.5; }

.main { padding: 14px 14px 30px; max-width: 560px; margin: 0 auto; }

/* ---------- 호실 ---------- */
.room-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; }
.room-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.room-input {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  font-family: inherit; font-size: 30px; font-weight: 800; letter-spacing: 1px; padding: 12px 14px; text-align: center;
}
.room-input::placeholder { color: #4d5b74; font-weight: 600; letter-spacing: 0; }
.room-input.shake { animation: shake .35s; border-color: var(--danger); }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-7px)} 40%{transform:translateX(7px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.common-toggle {
  margin-top: 10px; width: 100%; background: transparent; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 10px; font-family: inherit; font-size: 13px; padding: 9px; cursor: pointer;
}
.common-toggle.on { background: rgba(224,145,58,.14); border-style: solid; border-color: var(--warn); color: #f2c98a; font-weight: 700; }
.room-recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.room-recent button {
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  font-family: inherit; font-size: 13px; padding: 6px 11px; cursor: pointer;
}

.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 0 8px; }
.hint b { color: var(--ink); }

/* ---------- 사유 ---------- */
.reasons { display: flex; flex-direction: column; gap: 12px; }
.rcat { font-size: 12px; color: var(--muted); font-weight: 700; margin: 4px 0 2px; letter-spacing: .3px; }
.rgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.rbtn {
  display: flex; align-items: center; gap: 9px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.35; padding: 14px 12px; min-height: 62px; cursor: pointer;
}
.rbtn:active { background: var(--go); border-color: var(--go); }
.rbtn .ico { font-size: 21px; flex: 0 0 auto; }

/* ---------- 오늘 기록 ---------- */
.today { margin-top: 26px; }
.today-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.today-head h2 { font-size: 14px; margin: 0; }
.today-sum { font-size: 12px; color: var(--muted); }
.today-list { display: flex; flex-direction: column; gap: 6px; }
.trow {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.trow .t-room { font-weight: 800; min-width: 52px; }
.trow .t-reason { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-dur { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; }
.trow .t-dur.open { color: var(--warn); }
.trow .t-who { color: #6f7d95; font-size: 11px; }
.today-empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }

.foot { margin-top: 26px; display: flex; justify-content: space-between; color: #5d6b83; font-size: 11px; }
.foot-link { color: #5d6b83; text-decoration: none; }

/* ---------- 출동 중 ---------- */
.active { position: fixed; inset: 0; z-index: 60; background: linear-gradient(170deg, #123020, #0d1a18);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.active-inner { width: 100%; max-width: 420px; text-align: center; }
.active-tag {
  display: inline-block; background: rgba(34,160,107,.18); color: #6fe0ab; border: 1px solid rgba(34,160,107,.45);
  border-radius: 999px; font-size: 12px; font-weight: 800; padding: 5px 14px; letter-spacing: .5px;
}
.act-room { font-size: 42px; font-weight: 800; margin-top: 16px; letter-spacing: -1px; }
.act-reason { color: #9dd8bd; font-size: 15px; margin-top: 6px; }
.act-timer { font-size: 62px; font-weight: 300; font-variant-numeric: tabular-nums; margin: 22px 0 2px; letter-spacing: -2px; }
.act-since { color: var(--muted); font-size: 12px; margin-bottom: 30px; }
.back-btn {
  width: 100%; border: 0; border-radius: 20px; background: var(--back); color: #fff; font-family: inherit;
  font-size: 24px; font-weight: 800; padding: 30px 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 10px 30px rgba(34,160,107,.35);
}
.back-btn:active { transform: scale(.98); }
.back-emoji { font-size: 30px; }
.cancel-btn { margin-top: 18px; background: none; border: 0; color: #7f8ea6; font-family: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* ---------- 시트 ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(6,10,18,.7);
  display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 520px; background: var(--panel); border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px); border-top: 1px solid var(--line);
  max-height: 92vh; overflow-y: auto;
}
.sheet-done { font-size: 15px; font-weight: 700; color: #6fe0ab; text-align: center; }
.sheet-dur { font-size: 40px; font-weight: 800; text-align: center; margin-top: 4px; font-variant-numeric: tabular-nums; }
.sheet-sub { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 20px; }
.sheet-label { font-size: 12px; color: var(--muted); font-weight: 700; margin: 14px 0 7px; }
.result-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.res-btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 700; padding: 14px 6px; line-height: 1.25; cursor: pointer;
}
.res-btn.on { background: var(--go); border-color: var(--go); color: #fff; }
.sheet-note, .etc-input, .fix-min {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  font-family: inherit; font-size: 15px; padding: 12px; resize: none;
}
.etc-input { font-size: 17px; margin-bottom: 16px; }
.fix-wrap { margin-top: 4px; }
#sheet-save { margin-top: 18px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translateX(-50%); z-index: 90;
  background: #2b3a55; color: #fff; font-size: 14px; padding: 12px 18px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 88vw; text-align: center;
}
.toast.err { background: #6d2b25; }

.followup-hint { margin-top: 14px; background: rgba(224,145,58,.13); border: 1px solid rgba(224,145,58,.4);
  color: #f2c98a; border-radius: 12px; font-size: 13px; line-height: 1.55; padding: 11px 13px; }
.followup-hint b { color: #ffd9a0; }

/* ---------- 사용법 ---------- */
.top-r { display: flex; align-items: center; gap: 2px; }
.help-wrap { position: fixed; inset: 0; z-index: 95; background: #0f1522; overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 26px) 20px calc(env(safe-area-inset-bottom) + 30px); }
.help { max-width: 460px; margin: 0 auto; }
.help-emoji { font-size: 42px; text-align: center; }
.help h2 { font-size: 22px; text-align: center; margin: 12px 0 0; letter-spacing: -.5px; line-height: 1.35; }
.help-sub { color: var(--muted); font-size: 14px; text-align: center; margin: 8px 0 24px; line-height: 1.6; }
.help-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 9px; font-size: 14px; line-height: 1.65; }
.hs-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--go); color: #fff; font-weight: 800; font-size: 14px; }
.help-step b { color: #fff; }
.help-tips { margin-top: 18px; display: flex; flex-direction: column; gap: 10px;
  color: var(--muted); font-size: 13px; line-height: 1.65; }
.help-tips b { color: var(--ink); }
.tip-sub { font-size: 12px; color: #7f8ea6; }
#help-close { margin-top: 24px; }

/* 호실 없이도 눌리는 사유 (입구·길안내 등) */
.rbtn-noroom { border-style: dashed; }

/* 선택 삭제 */
.today-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chk-all { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.chk-all input, .t-chk { width: 20px; height: 20px; accent-color: var(--go); flex: 0 0 auto; margin: 0; }
.del-sel { background: rgba(224,87,76,.14); border: 1px solid rgba(224,87,76,.5); color: #ff9d94;
  border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 700; padding: 9px 14px; cursor: pointer; }
.del-sel:disabled { opacity: .38; border-color: var(--line); color: var(--muted); background: transparent; }
.del-sel b { margin-left: 3px; }
.trow.selectable { padding-left: 10px; }
.t-chk-sp { width: 20px; flex: 0 0 auto; }

.trow .t-dur.forced { color: #8e9bb2; font-weight: 600; font-size: 12px; }

/* ===== 급출동 딸깍 (2026-09-01) =====
   급할 때는 호실·사유 없이 버튼 하나로 바로 출발. 비운 값은 나중에 채운다. */
.quick { margin-bottom: 14px; }
.quick-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  border: 0; border-radius: 18px; padding: 18px 16px; font-family: inherit; color: #fff;
  background: linear-gradient(135deg, #f0873a, #e0574c);
  box-shadow: 0 8px 22px rgba(224, 87, 76, .32);
}
.quick-btn:active { transform: scale(.985); }
.quick-btn:disabled { opacity: .6; }
.q-emoji { font-size: 30px; flex: 0 0 auto; }
.q-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.q-txt b { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.q-txt em { font-style: normal; font-size: 12.5px; color: rgba(255, 255, 255, .88); line-height: 1.4; }

.or-line { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: #5d6b83; font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 출동 중 — 미입력 표시 + 수정 버튼 */
.act-room.blank, .act-reason.blank { color: #8fb6a5; font-weight: 600; }
.act-room.blank { font-size: 28px; }
.act-edit {
  width: 100%; margin-bottom: 14px; background: rgba(255, 255, 255, .06); color: #cfe8dc;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px;
  font-family: inherit; font-size: 14px; font-weight: 700; padding: 13px; cursor: pointer;
}
.act-edit.nudge { border-color: rgba(240, 135, 58, .6); color: #ffcf9c; background: rgba(240, 135, 58, .14); }

/* 장소 세그 · 사유 칩 (시트 공용) */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-b {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; color: var(--muted);
  font-family: inherit; font-size: 13px; font-weight: 700; padding: 11px 4px; cursor: pointer;
}
.seg-b.on { background: var(--go); border-color: var(--go); color: #fff; }
.fill-room {
  width: 100%; margin-top: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font-family: inherit; font-size: 20px; font-weight: 800; letter-spacing: .5px;
  padding: 11px 12px; text-align: center;
}
.fill-room::placeholder { font-size: 15px; font-weight: 600; letter-spacing: 0; color: #4d5b74; }
.chip-grid {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  max-height: 176px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 12px; cursor: pointer;
}
.chip.on { background: var(--go); border-color: var(--go); color: #fff; }
.chip-ico { font-size: 15px; }
.fill-note {
  width: 100%; margin-top: 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font-family: inherit; font-size: 15px; padding: 12px;
}
.fill { border: 1px solid rgba(240, 135, 58, .45); background: rgba(240, 135, 58, .07);
  border-radius: 14px; padding: 4px 12px 14px; margin-bottom: 6px; }
.lb-opt { color: #7f8ea6; font-weight: 600; }

/* 기록 수정 시트 */
.sheet-title { font-size: 17px; font-weight: 800; text-align: center; }
.sheet-sub2 { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.in-t {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  font-family: inherit; font-size: 17px; font-weight: 700; padding: 11px 12px; text-align: center;
}
#edit-save { margin-top: 18px; }
.danger-btn { border-color: rgba(224, 87, 76, .45); color: #ff9d94; }

/* 오늘 목록 — 수정 버튼 · 사유 미입력 */
.t-edit { background: none; border: 0; color: #6f7d95; font-size: 15px; padding: 2px 0 2px 4px; cursor: pointer; flex: 0 0 auto; }
.t-edit-sp { width: 19px; flex: 0 0 auto; }
.trow .t-reason.blank { color: #b78447; }

.help-step.urgent { border-color: rgba(240, 135, 58, .5); background: rgba(240, 135, 58, .08); }
.help-step.urgent .hs-n { background: linear-gradient(135deg, #f0873a, #e0574c); }

/* ===== 일 추가(연장) · 프론트 응대 (2026-09-01) ===== */
.act-more {
  width: 100%; margin-bottom: 14px; background: transparent; color: #cfe8dc;
  border: 1px dashed rgba(255, 255, 255, .3); border-radius: 14px;
  font-family: inherit; font-size: 14px; font-weight: 700; padding: 13px; cursor: pointer;
}
.act-more:active { background: rgba(255, 255, 255, .07); }
.act-leg {
  display: inline-block; margin-bottom: 12px; background: rgba(255, 255, 255, .08);
  border-radius: 999px; color: #cfe8dc; font-size: 12px; font-weight: 700; padding: 5px 13px;
}
/* 프론트 응대 중 — 자리비움과 구분되게 파란 계열 */
.active.front { background: linear-gradient(170deg, #14243c, #0d1622); }
.active.front .active-tag { background: rgba(47, 107, 255, .18); color: #9fc0ff; border-color: rgba(47, 107, 255, .5); }
.active.front .act-reason, .active.front .act-leg, .active.front .act-more, .active.front .act-edit { color: #c9d8f5; }
.active.front .back-btn { background: var(--go); box-shadow: 0 10px 30px rgba(47, 107, 255, .35); }
.chip.front { border-color: rgba(47, 107, 255, .45); }
.chip.front.on { background: var(--go); border-color: var(--go); }
.seg { grid-template-columns: repeat(2, 1fr); }

.leg-note {
  background: rgba(47, 107, 255, .12); border: 1px solid rgba(47, 107, 255, .38); color: #b9cdf7;
  border-radius: 12px; font-size: 12.5px; line-height: 1.55; padding: 10px 12px; margin-bottom: 4px;
}
.leg-mark { color: #7f8ea6; margin-right: 3px; font-weight: 700; }
.trow.front { border-left: 3px solid rgba(47, 107, 255, .6); }
#more-go { margin-top: 18px; }

/* 편의점 업무 (2026-09-01) — 자리비움에는 포함, 장소만 구분 */
.chip.kind-front { border-color: rgba(47, 107, 255, .45); }
.chip.kind-front.on { background: var(--go); border-color: var(--go); }
.chip.kind-store { border-color: rgba(224, 145, 58, .5); }
.chip.kind-store.on { background: var(--warn); border-color: var(--warn); color: #241505; }
