:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #dde1e7;
  --text: #1e232b;
  --muted: #7d8494;
  --accent: #4f46e5;
  --accent-soft: #e8e7ff;
  --danger: #d14343;
  --ok: #2f9e44;
  --lunch: #f59f00;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", sans-serif; }
/* 레이아웃 흔들림 방지: 오른쪽 세로 스크롤바 공간을 항상 확보 */
html {
  overflow-y: scroll;
}
body {
  overflow-y: visible;
  min-height: 100vh;
  line-height: 1.45;
  font-size: 14px;
}
/* Safari(WebKit): 스크롤바를 강제 표기하되 폭은 기본에 가깝게 유지 */
html::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 9px;
}
html::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb {
  background: rgba(90, 100, 120, 0.75);
  border-radius: 7px;
  border: 0;
}

.container {
  max-width: 1200px; margin: 0 auto; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.card h3 { margin: 12px 0 6px; font-size: 0.95rem; color: #3b4252; }

.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 10px; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt-1 { margin-top: 10px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: #475060; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label span { color: var(--muted); }

input[type=text], input[type=number], input[type=time], textarea, select {
  font: inherit; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text);
  min-width: 0; width: 100%;
}
input[type=number] { width: auto; min-width: 5rem; }
input[type=time]   { width: auto; min-width: 7rem; }
label.inline input[type=number] { width: 5rem; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 5px 6px; vertical-align: middle; }
.tbl th { background: #f2f3f6; font-weight: 600; font-size: 0.85rem; }
.tbl-sm th, .tbl-sm td { padding: 3px 4px; font-size: 0.82rem; }
.tbl-tight input { padding: 3px 5px; }
.tbl-scroll { overflow-x: auto; }
.save-row { display: flex; gap: 10px; align-items: center; }
.save-row > input[type="date"] { width: auto; min-width: 11rem; }
.save-row > input[type="text"] { min-width: 16rem; max-width: 24rem; }
@media (max-width: 780px) {
  .save-row { flex-direction: column; align-items: stretch; }
  .save-row > input[type="date"],
  .save-row > input[type="text"] { width: 100%; max-width: none; }
}

.btn, .btn-primary, .btn-ghost {
  font: inherit; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  text-decoration: none;
}
.btn:hover, .btn-ghost:hover { background: #f2f3f6; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { font: inherit; padding: 6px 12px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: #eef3fb; color: #1f4b99; }
.btn-secondary:hover { background: #e3ebf8; }
.btn-ghost { padding: 3px 8px; font-size: 0.85rem; color: var(--muted); }

.lunch-row td { background: rgba(245,159,0,0.08); }
