:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e1e6f0;
  --brand: #2d4fd6;
  --brand-ink: #ffffff;
  --brand-soft: #e8edfd;
  --ok: #12805c;
  --ok-soft: #e4f6ee;
  --warn: #a15c00;
  --warn-soft: #fff3de;
  --bad: #c0362c;
  --bad-soft: #fdeceb;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.5;
}
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: #16204a; color: #fff;
}
.top h1 { margin: 0; font-size: clamp(16px, 3.6vw, 22px); font-weight: 800; letter-spacing: -0.02em; }

main { max-width: 1040px; margin: 0 auto; padding: 16px 16px 48px; }

.btn {
  font: inherit; font-weight: 700; font-size: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9c3dc; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: #efc4c0; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px;
  background: var(--ok-soft); color: var(--ok); font-weight: 700;
}
.banner.wait { background: var(--warn-soft); color: var(--warn); }
.banner.locked { background: var(--bad-soft); color: var(--bad); }
.banner .sub { font-weight: 500; font-size: 13px; opacity: 0.9; }
.banner .count { font-variant-numeric: tabular-nums; font-size: 20px; }

.adminbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius);
  background: #fff7e0; border: 1px solid #f0dca0;
}
.adminbar b { margin-right: 4px; color: var(--warn); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.slot {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 130px;
}
.slot.multi { grid-column: 1 / -1; }
.slot.taken { background: #fafbfe; }
.slot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.slot-no { font-weight: 800; font-size: 18px; }
.slot-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); }
.tag.mine { background: var(--ok-soft); color: var(--ok); }

.slot-body { display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: center; }
.empty { color: var(--muted); font-size: 14px; }
.entries { display: flex; flex-direction: column; gap: 8px; }
.multi .entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.entry.mine { border-color: #8fd3b6; background: #f6fcf9; }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team {
  font: inherit; font-weight: 800; font-size: 17px; color: var(--ink);
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  text-decoration: underline; text-decoration-color: #c4cde6; text-underline-offset: 3px; word-break: break-all;
}
.team:hover { color: var(--brand); text-decoration-color: var(--brand); }
.ts { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reason { font-size: 13px; color: #3a4357; background: #f3f5fa; border-radius: 7px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.help { color: var(--muted); font-size: 13px; margin: 18px 4px 0; padding-left: 18px; }
.help li { margin: 3px 0; }

/* 모달 */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 21, 40, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; overflow-y: auto;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 440px; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); max-height: 100%; overflow-y: auto; }
.modal.wide { max-width: 820px; }
.modal h2 { margin: 0 0 4px; font-size: 19px; }
.modal .lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label { font-size: 13px; font-weight: 700; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=time], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 16px; padding: 10px 11px; border: 1px solid #ccd4e6; border-radius: 9px; width: 100%; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 9px 11px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.okbox { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.okbox .big { font-size: 20px; font-weight: 800; }
.okbox .ms { font-variant-numeric: tabular-nums; font-size: 14px; margin-top: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.actions .spacer { flex: 1; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 6px 6px; text-align: left; vertical-align: middle; }
table.t th { font-size: 12px; color: var(--muted); }
table.t input[type=text], table.t input[type=time] { font-size: 14px; padding: 6px 8px; }
.tablewrap { overflow-x: auto; margin-bottom: 12px; }
.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 100; transition: all 0.2s;
  max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  main { padding: 12px 12px 40px; }
}
