:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #8a90a0;
  --line: #e6e8ee;
  --brand: #2f6df6;
  --brand-d: #2256d6;
  --ok-bg: #e7f6ec; --ok-ink: #1d7a43;
  --err-bg: #fdeaea; --err-ink: #c0392b;
  --sun: #d64545; --sat: #2f6df6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: var(--brand); }
.container { max-width: 980px; margin: 22px auto; padding: 0 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 1px 2px rgba(20,30,60,.04);
}
.layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }

h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 10px; }
.muted { color: var(--muted); }

/* calendar */
.cal-head {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; margin-bottom: 14px;
}
.cal-head h2 { margin: 0; min-width: 120px; text-align: center; white-space: nowrap; }
.cal-center { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: nowrap; }
.cal-side { display: flex; }
.cal-right { justify-content: flex-end; }
.todaybtn {
  text-decoration: none; color: var(--brand); font-size: 13px; font-weight: 700;
  height: 34px; padding: 0 18px; display: inline-grid; place-items: center;
  border: 1px solid var(--brand); border-radius: 9px; background: #fff;
  white-space: nowrap;
}
.todaybtn:hover { background: var(--brand); color: #fff; }

/* 모바일: 헤더 좁을 때 가운데 그룹 축소 → '오늘' 버튼 줄바꿈/밀림 방지 */
@media (max-width: 480px) {
  .cal-head { gap: 2px; }
  .cal-center { gap: 4px; }
  .cal-head h2 { min-width: auto; font-size: 15px; }
  .navbtn { width: 30px; height: 30px; font-size: 18px; }
  .todaybtn { padding: 0 11px; font-size: 12px; height: 32px; }
  .up-table th, .up-table td { padding: 8px 5px; font-size: 13px; }
}
.navbtn {
  text-decoration: none; color: var(--ink); font-size: 20px; line-height: 1;
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
}
.navbtn:hover { background: var(--bg); }
.cal-section { display: flex; flex-direction: column; }
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; flex: 1; height: 100%; }
.calendar th { font-size: 12px; color: var(--muted); padding: 6px 0 10px; font-weight: 600; }
.calendar th.sun { color: var(--sun); } .calendar th.sat { color: var(--sat); }
.calendar td { vertical-align: top; padding: 3px; }
.calendar td a {
  display: flex; flex-direction: column; align-items: center; height: 100%;
  min-height: 54px; border-radius: 9px; text-decoration: none; color: var(--ink);
  padding-top: 8px; border: 1px solid transparent;
}
.calendar td a:hover { background: var(--bg); }
.calendar td.other a { color: #c4c8d4; }
.calendar td.today a { border-color: var(--brand); }
.calendar td.selected a { background: var(--brand); color: #fff; }
.dnum { font-size: 13px; font-weight: 600; }
.badge {
  margin-top: 4px; font-size: 11px; min-width: 18px; padding: 1px 6px;
  background: var(--brand); color: #fff; border-radius: 999px;
}
.calendar td.selected .badge { background: #fff; color: var(--brand); }

/* day section */
.slot-list { list-style: none; margin: 0 0 8px; padding: 0; }
.slot-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px;
}
.slot-list .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-list .who { font-weight: 600; }
.slot-list .purpose { color: var(--muted); font-size: 13px; }
.cancel-form { margin-left: auto; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select {
  width: 100%; margin-top: 4px; padding: 9px 11px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--brand); }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button.primary {
  width: 100%; margin-top: 6px; padding: 11px; font-size: 15px; font-weight: 700;
  color: #fff; background: var(--brand); border: none; border-radius: 10px; cursor: pointer;
}
button.primary:hover { background: var(--brand-d); }
.link-btn {
  background: none; border: none; color: var(--err-ink); cursor: pointer;
  font-size: 13px; padding: 4px 6px;
}
.link-btn:hover { text-decoration: underline; }

/* gate */
.gate-card {
  max-width: 360px; margin: 8vh auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; text-align: center;
}
.gate-card h1 { font-size: 22px; margin: 0 0 6px; }
.gate-form { margin-top: 18px; }
.gate-form input { text-align: center; }
.gate-form .primary { margin-top: 14px; }

/* upcoming table */
.upcoming { margin-top: 18px; }
.up-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.up-table th, .up-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.up-table td:nth-child(3) { width: 100%; }  /* 이름 칸이 남는 폭을 차지 */
.up-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.up-table td { font-variant-numeric: tabular-nums; }

/* flash */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.err { background: var(--err-bg); color: var(--err-ink); }
