:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7384; --line: #e3e6ec;
  --accent: #2f6fed; --accent-soft: #e8f0ff; --sun: #d9363e; --sat: #2f6fed; --ok: #1a8f5a; --warn: #c9791a;
  --cancel: #9aa1b0; --radius: 10px;
  color-scheme: light;   /* 항상 라이트 테마 (기기 다크모드 무시) */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 18px; }
.topbar nav { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.topbar nav button, .topbar nav a { border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  width: 34px; height: 34px; display: grid; place-items: center; text-decoration: none; color: var(--text); font-size: 17px; }
.topbar nav a.gomealq { width: auto; height: 38px; padding: 0 16px; font-size: 14px; font-weight: 700; white-space: nowrap;
  background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(47, 111, 237, .35); }
.topbar nav a.gomealq:hover { filter: brightness(1.1); }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .big { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat .big small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.today { border-color: var(--accent); background: var(--accent-soft); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.monthnav { display: flex; align-items: center; gap: 8px; }
.monthnav h2 { margin: 0; font-size: 20px; min-width: 128px; text-align: center; }
.monthnav button, .filter select { border: 1px solid var(--line); background: var(--card); border-radius: 8px; height: 36px; padding: 0 12px; }
.monthnav button:first-child, .monthnav button:nth-child(3) { width: 36px; padding: 0; font-size: 20px; }
.ghost { background: transparent !important; }
.tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.menubtn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 700; font-size: 14px; white-space: nowrap; }
.menubtn:hover { background: var(--accent-soft); }
dialog.wide { width: min(920px, calc(100vw - 24px)); }
.menuitem { margin-bottom: 18px; }
.menuitem h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.menuitem img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.menuitem .mtext { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.menuitem .open { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); }
.filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; background: #fff3e0; color: #8a5300; border: 1px solid #ffd9a0; }
.msg.err { background: #fdecec; color: #a12; border-color: #f5b8b8; }

.calendar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { padding: 8px 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.dow:first-child, .cell.sun .dn { color: var(--sun); }
.dow:last-child, .cell.sat .dn { color: var(--sat); }
.cell { position: relative; min-height: 104px; padding: 6px 7px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--card); text-align: left; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell.sat { border-right: 0; }
.wkbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.wklabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.wkmenu { height: 26px; padding: 0 10px; border-radius: 6px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 700; font-size: 12px; white-space: nowrap; }
.wkmenu:hover { background: var(--accent-soft); }
.wknav { display: flex; justify-content: space-between; margin-bottom: 12px; }
.wknav button { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; }
.cell.out { background: var(--bg); }
.cell.out .dn, .cell.out .names { opacity: .45; }
.cell:hover { background: var(--accent-soft); }
.cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cell .top { display: flex; justify-content: space-between; align-items: baseline; }
.dn { font-size: 13px; font-weight: 600; }
.cnt { font-size: 20px; font-weight: 700; color: var(--accent); line-height: 1; }
.cnt small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.pp { font-size: 11px; color: var(--muted); }
.names { display: flex; flex-wrap: wrap; gap: 3px; }
.chip { font-size: 11px; background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.chip.dept1 { background: #ffe0e6; }   /* casu100번대 */
.chip.dept2 { background: #d4f1e0; }   /* casu200번대 */
.chip.dept3 { background: #ffe8bf; }   /* casu300번대 */
.chip.dept4 { background: #e5dbfb; }   /* casu400번대 */
.chip.more { background: transparent; color: var(--muted); padding-left: 2px; }
.cell.lack, .cell.lack:hover { background: #fff4f4; }
.warn-badge { align-self: flex-start; font-size: 11px; font-weight: 700; color: #b3261e; background: #fde3e1; border: 1px solid #f5b8b4; border-radius: 6px; padding: 0 6px; line-height: 1.5; }
.lack-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: #fde3e1; color: #b3261e; font-size: 13px; font-weight: 600; }
.cell.empty .cnt { color: var(--line); }

dialog { width: min(640px, calc(100vw - 24px)); max-height: 86vh; border: 0; border-radius: 14px; padding: 0; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.dlg-head h3 { margin: 0; font-size: 17px; }
.dlg-head button { border: 0; background: transparent; font-size: 18px; }
#dBody, #mBody { padding: 14px 18px 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { background: var(--accent-soft); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.pill b { font-size: 17px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.q { text-align: right; font-weight: 600; }
tr.cancelled td { color: var(--cancel); text-decoration: line-through; }
.st { font-size: 11px; border-radius: 999px; padding: 1px 8px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.st.PLACED { color: var(--warn); } .st.CONFIRMED, .st.DELIVERED { color: var(--ok); }
.toggle { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* 로그인/설정 */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 20px; text-align: center; }
.login-card p { margin: 0; text-align: center; }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--bg); width: 100%; }
.login-card button { height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; width: 100%; }
.login-card button.ghost { background: transparent !important; color: var(--text); border: 1px solid var(--line); }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card a { color: var(--accent); }
.error { color: var(--sun); font-size: 13px; } .okmsg { color: var(--ok); font-size: 13px; }

@media (max-width: 640px) {
  main { padding: 10px; }
  .topbar #updated { display: none; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar nav { gap: 6px; }
  .topbar nav a.gomealq { padding: 0 11px; font-size: 13px; }
  .cell { min-height: 66px; padding: 4px; align-items: center; }
  .cell .top { flex-direction: column; align-items: center; gap: 2px; }
  .cnt { font-size: 18px; }
  .names, .pp { display: none; }
  .warn-badge { align-self: center; font-size: 10px; padding: 0 4px; white-space: nowrap; }
  .warn-badge .need { display: none; }
  .dn { font-size: 12px; }
  .monthnav h2 { min-width: 100px; font-size: 17px; }
  .tools { width: 100%; justify-content: space-between; }
  .menubtn { flex: 1; }
  .stat .big { font-size: 24px; }
}

.login-card .extra-row { flex-direction: row; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; font-size: 14px; }
.login-card .extra-row button { width: auto; height: 34px; padding: 0 14px; }
