/* 시프트군 - 화면 모양 (조용하고, 글자·버튼은 크게) */
:root {
  --ink: #1f2328;
  --sub: #6b7280;
  --line: #dfe3e8;
  --soft: #f3f5f7;
  --accent: #2b6cb0;
  --danger: #b42318;
  --font: "BIZ UDPGothic", "IBM Plex Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}
button, select, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
body.dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* ---- 공통 ---- */
.page { max-width: 1200px; margin: 0 auto; padding: 0 14px 40px; }
.head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 4px; gap: 12px; }
.hl { display: flex; align-items: baseline; gap: 14px; min-width: 0; flex-wrap: wrap; }
.hr { display: flex; align-items: center; gap: 4px; flex: none; }
.pill.sm { min-height: 36px; padding: 0 14px; font-size: 15px; }
.hr .linkbtn { min-height: 36px; font-size: 15px; }
.head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.status { font-size: 14px; color: var(--sub); }
.status.dirty { color: var(--accent); font-weight: 700; }
.status.bad { color: var(--danger); font-weight: 700; }

.btn {
  min-height: 50px; padding: 0 20px; border-radius: 12px;
  border: 1px solid #c4cad2; background: #fff; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #e7b9b3; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 20px; min-height: 40px; padding: 0 16px; }
.linkbtn { border: 0; background: none; color: var(--sub); text-decoration: underline; padding: 10px 6px; min-height: 44px; }
.dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; flex: none; }

/* ---- 이름 카드 ---- */
.cards { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px -14px 6px; padding: 8px 14px; align-items: center; position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.pcard {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 24px;
  border: 1px solid #c4cad2; background: #fff; font-weight: 500; font-size: 17px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.pcard:hover { border-color: #8b95a1; }
.pcard.add { border-style: dashed; color: var(--sub); cursor: pointer; touch-action: manipulation; }
.empty { color: var(--sub); margin: 6px 4px; }
.tablebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.hint { color: var(--sub); font-size: 14px; margin: 0; flex: 1; min-width: 0; }
.tools { display: flex; gap: 8px; flex: none; }
.tools .btn { min-height: 44px; min-width: 0; padding: 0 16px; font-size: 15px; }
.nameinput.short { height: 46px; font-size: 17px; font-weight: 400; margin-top: 10px; }
.linkbtn.danger { color: var(--danger); }
.delrow { text-align: center; margin-top: 4px; }
.namehint { color: var(--sub); font-size: 13px; margin: 6px 2px 0; }

@media (max-width: 700px) {
  .pcard { min-height: 40px; padding: 0 12px; font-size: 15px; gap: 6px; }
  .cards { gap: 6px; padding: 6px 14px; }
  .dot { width: 13px; height: 13px; }
  .hint { font-size: 13px; }
  .tablebar { flex-direction: column-reverse; align-items: stretch; gap: 6px; }
  .tools { justify-content: flex-end; }
}

/* ---- 표 (화면용) ---- */
.ehead { overflow: hidden; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #fff; position: sticky; top: var(--cardsH, 0px); z-index: 9; }
.scroller { overflow-x: auto; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: #fff; }
.etbl { position: relative; }
.ehdr { display: flex; }
.ecorner { flex: none; position: sticky; left: 0; z-index: 3; background: #fff; border-bottom: 1px solid #c9ccd1; display: flex; align-items: center; justify-content: flex-start; padding-left: 6px; font-size: 12px; color: var(--sub); }
.ehours { display: flex; flex: none; }
.ehours span { flex: none; display: flex; align-items: center; justify-content: center; height: 30px; font-size: 14px; font-weight: 700; border-right: 1px solid #e3e1da; border-bottom: 1px solid #c9ccd1; }
.erow { display: flex; border-bottom: 1px solid #c9ccd1; }
.elabels { flex: none; position: sticky; left: 0; z-index: 3; display: flex; }
.edate { display: flex; align-items: center; justify-content: center; background: #fff; color: #b4b2a9; font-size: 22px; border-right: 1px solid #c9ccd1; }
.elabel { display: flex; align-items: center; justify-content: center; background: #f1efe8; font-size: 22px; font-weight: 700; border-right: 1px solid #c9ccd1; }
.egrid {
  position: relative; flex: none;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(var(--hw) - 1px), #e8e6df calc(var(--hw) - 1px), #e8e6df var(--hw));
}
.bl { position: absolute; top: 0; bottom: 0; width: 1px; background: #a8a69e; z-index: 0; }
.hlcell { position: absolute; z-index: 1; border-radius: 6px; border: 2px dashed var(--c); pointer-events: none; }
.hlcell.strong { border-style: solid; }
.ea { position: absolute; z-index: 2; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ea svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.ea i { position: absolute; top: 0; bottom: 0; display: block; }
.ea .hl { left: 0; cursor: ew-resize; }
.ea .hr { right: 0; cursor: ew-resize; }
.ea .hm { cursor: grab; }
.ea { transition: opacity 0.12s, transform 0.12s; }
.ea.drag { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); z-index: 4; }
.ea.dim { opacity: 0.22; }
.ea.emph { outline: 2px solid var(--c); outline-offset: 1px; border-radius: 8px; }
.ea.lift { transform: scale(1.06); filter: drop-shadow(0 5px 9px rgba(0,0,0,0.45)); z-index: 6; outline: 3px solid var(--c); outline-offset: 2px; border-radius: 8px; opacity: 1; }
@media (hover: hover) { .ea:hover { outline: 2px solid var(--c); outline-offset: 1px; border-radius: 8px; } }
.pcard { transition: transform 0.12s, box-shadow 0.12s; }
.pcard.lift { transform: scale(1.1); box-shadow: 0 7px 16px rgba(0,0,0,0.3); border: 2px solid var(--c, var(--accent)); z-index: 12; }
.pehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pehead h2 { margin: 0 !important; }
.pehead .linkbtn { min-height: 36px; padding: 4px 0 4px 8px; font-size: 15px; }

.ghost {
  position: fixed; z-index: 50; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 22px;
  background: #fff; border: 2px solid var(--accent); font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.ghost.bad { border-color: #d92d20; color: #d92d20; background: #fff1f0; }
.foot { display: flex; justify-content: space-between; margin-top: 22px; }

/* ---- 팝업 ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.dlgbox { background: #fff; border-radius: 16px; padding: 22px 20px 16px; width: 100%; max-width: 380px; }
.dlgbox h2 { margin: 0 0 8px; font-size: 19px; }
.dlgbox p { margin: 0 0 18px; color: var(--sub); white-space: pre-line; }
.dlgbtns { display: flex; gap: 10px; margin-top: 16px; }
.dlgbtns .btn { flex: 1; padding: 0 10px; }
.nameinput { width: 100%; height: 54px; border: 1px solid #c4cad2; border-radius: 10px; padding: 0 12px; font-size: 20px; font-weight: 500; margin-top: 8px; }
.palette { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #c4cad2; }
.sw.on { box-shadow: 0 0 0 3px var(--ink); }

/* ---- 폰(터치)에서는 끌기 대신 스크롤·누르기 ---- */
@media (pointer: coarse) {
  .pcard, .ea { touch-action: manipulation; }
  .pcard { cursor: pointer; }
  .ea .hm { cursor: pointer; }
}
/* 태블릿(화면 짧은 쪽 600px 이상)은 카드·화살표 위에서 스크롤을 아예 막아서, 꾹 눌러 잡은 뒤 움직여도 화면이 밀리지 않게 한다 */
@media (pointer: coarse) and (min-device-width: 600px) and (min-device-height: 600px) {
  .pcard, .ea { touch-action: none; }
}
.ea .hm, .ea .hl, .ea .hr { -webkit-tap-highlight-color: transparent; }

/* ---- 화살표 하나 고치는 창 ---- */
#aedit .dlgbox { max-width: 420px; }
.aetitle { display: flex; align-items: center; gap: 10px; margin: 0 0 12px !important; font-size: 20px !important; }

/* ---- 사람 설정 팝업의 근무 줄 ---- */
#pedit .dlgbox { max-width: 460px; max-height: 90vh; overflow-y: auto; }
.shiftrow { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.srhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.srhead span { font-size: 14px; color: var(--sub); }
.days { display: flex; gap: 6px; margin-bottom: 10px; }
.daybtn { flex: 1; min-height: 46px; border-radius: 10px; border: 0; background: var(--soft); color: #9aa1ab; font-size: 17px; }
.daybtn.on { background: #e3eefb; color: #164f96; font-weight: 700; }
.times { display: flex; align-items: center; gap: 10px; }
.times select { flex: 1; min-width: 0; height: 50px; border: 1px solid #c4cad2; border-radius: 10px; padding: 0 8px; background: #fff; font-size: 17px; }
.tilde { color: var(--sub); }
.addrow { margin-top: 12px; }
.addshift { text-decoration: none; font-size: 17px; color: var(--accent); }

/* ---- 로그인 화면 ---- */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.box { width: 100%; max-width: 340px; text-align: center; }
.brand { font-size: 30px; margin: 0 0 6px; }
.lead { color: var(--sub); margin: 0 0 24px; }
.err { color: var(--danger); margin: 0 0 16px; }
.box .btn { width: 100%; margin-bottom: 16px; }

/* ---- 인쇄 (A4 가로 한 장) ---- */
#printArea { display: none; }
@media print {
  @page { size: 297mm 210mm; margin: 0; }
  html, body { background: #fff; }
  .noprint, .overlay, .ghost { display: none !important; }
  #printArea { display: block; }
  #printArea svg { display: block; width: 297mm; height: 210mm; font-family: "BIZ UDPGothic", "Noto Sans CJK JP", "Noto Sans JP", sans-serif; }
}

/* 확인창은 팝업 위에 뜬다 */
#dlg { z-index: 40; }
