:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --ink: #1b2420;
  --muted: #6b766f;
  --line: #e3e8e4;
  --brand: #1f8a4c;
  --brand-dark: #166a39;
  --brand-soft: #e6f4ec;
  --accent: #c6e94a;

  --pending: #b7791f;   --pending-bg: #fff6e0;
  --running: #2563eb;   --running-bg: #e8f0ff;
  --success: #1f8a4c;   --success-bg: #e3f5ea;
  --used: #4b5d72;      --used-bg: #eaeef3;
  --failed: #c53030;    --failed-bg: #fdeaea;
  --canceled: #8a948e;  --canceled-bg: #f0f2f1;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 24, .06), 0 4px 16px rgba(16, 40, 24, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #12341f; color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topbar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; }
.logo img { width: 30px; height: 30px; }
.logo small { font-weight: 500; opacity: .7; font-size: 12px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #cfe3d6; padding: 7px 12px; border-radius: 9px; white-space: nowrap; font-weight: 600; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: var(--accent); color: #12341f; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfe3d6; white-space: nowrap; }
.who button { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
@media (max-width: 960px) {
  .logo small { display: none; }
  .nav a { padding: 7px 9px; }
  .who span { display: none; }
}
@media (max-width: 700px) {
  .topbar-in { flex-wrap: wrap; height: auto; padding: 8px 16px 0; gap: 8px; }
  .who { margin-left: auto; }
  .who span { display: none; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
}
.mockbar { background: #7c2d12; color: #fff; text-align: center; font-size: 13px; padding: 4px; }
.mockbar.imp { background: #312e81; padding: 7px 12px; }
.mockbar.imp button { margin-left: 8px; background: #fff; color: #312e81; border: 0; border-radius: 7px; padding: 3px 10px; font-weight: 800; cursor: pointer; }
.nav a.admin { color: #fde68a; }
.nav a.admin.on { background: #fde68a; color: #12341f; }
pre.log { background: #0f1a14; color: #cfe3d6; border-radius: 12px; padding: 12px 14px; font: 12px/1.5 Consolas, "D2Coding", monospace; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
pre.log .e { color: #fca5a5; }
.code-big { font: 800 28px/1.2 Consolas, monospace; letter-spacing: 4px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 10px 18px; display: inline-block; }
tr.sub td { background: #fafcfa; font-weight: 700; }
tr.detail td { background: #fbfcfb; white-space: normal; }

main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.4px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -.3px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin: 0; }

/* ---------- 카드 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.k2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .grid.k4 { grid-template-columns: 1fr 1fr; } .grid.k2 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .lab { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.stat .val small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.hero { background: linear-gradient(135deg, #12341f, #1f8a4c); color: #fff; border: 0; }
.stat.hero .lab, .stat.hero .hint, .stat.hero .val small { color: #d5ecdc; }

/* ---------- 버튼/폼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6f8f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--failed); border-color: #f1c4c4; }
.btn.danger:hover { background: var(--failed-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input { width: 100%; border: 1px solid #d3dbd5; border-radius: 10px; padding: 9px 12px; background: #fff; }
.input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 110px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { margin-left: auto; }

/* ---------- 상태 배지 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending  { color: var(--pending);  background: var(--pending-bg); }
.st-running  { color: var(--running);  background: var(--running-bg); }
.st-success  { color: var(--success);  background: var(--success-bg); }
.st-used     { color: var(--used);     background: var(--used-bg); }
.st-failed   { color: var(--failed);   background: var(--failed-bg); }
.st-canceled { color: var(--canceled); background: var(--canceled-bg); }
.st-running::before { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eef2ef; color: #3b4a41; }
.dday { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: #12341f; }
.dday.today { background: #12341f; color: var(--accent); }

/* ---------- 탭 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.tab .n { margin-left: 4px; font-size: 12px; opacity: .8; }
.tab.on { background: #12341f; border-color: #12341f; color: #fff; }

/* ---------- 날짜 카드 (예약 목록) ---------- */
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fafcfa; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.day-head .date { font-weight: 800; font-size: 16px; letter-spacing: -.3px; }
.day-head .sum { display: flex; gap: 6px; flex-wrap: wrap; }
.day-body { padding: 12px 16px; }
.blocks { display: grid; gap: 8px; }
.block { display: grid; grid-template-columns: 6px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 0; }
.block .bar { align-self: stretch; border-radius: 0 4px 4px 0; }
.block .acc { font-weight: 800; }
.block .meta { font-size: 13px; color: var(--muted); }
.block .hrs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.hr { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 3px 8px; font-size: 13px; font-weight: 700; }
.hr .t { font-variant-numeric: tabular-nums; }
.hr.st-canceled .t { text-decoration: line-through; }
.block .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.msg { font-size: 12px; color: var(--failed); margin-top: 3px; }
@media (max-width: 640px) { .block { grid-template-columns: 6px 1fr; } .block .acts { grid-column: 2; justify-content: flex-start; } }

/* ---------- 코트 보드 (코트 × 시간) ---------- */
.board-wrap { overflow-x: auto; }
.board { display: grid; gap: 3px; }
.board .h { font-size: 11px; color: var(--muted); text-align: center; font-weight: 700; }
.board .c { font-size: 12px; font-weight: 800; color: var(--muted); display: flex; align-items: center; }
.cell { height: 34px; border-radius: 6px; background: #f1f4f2; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; overflow: hidden; white-space: nowrap; padding: 0 2px; }
.cell.off { background: repeating-linear-gradient(45deg, #f4f5f4, #f4f5f4 4px, #ebedeb 4px, #ebedeb 8px); }
.cell.st-pending { border: 1.5px dashed var(--pending); }
.cell.st-canceled { text-decoration: line-through; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- 예약 만들기 ---------- */
.steps { display: grid; gap: 16px; }
.step-n { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: #12341f; color: var(--accent); font-size: 13px; font-weight: 800; align-items: center; justify-content: center; margin-right: 8px; }
.datechips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.dc { flex: 0 0 auto; width: 62px; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 0; text-align: center; cursor: pointer; }
.dc .w { font-size: 12px; color: var(--muted); font-weight: 700; }
.dc .d { font-size: 18px; font-weight: 800; }
.dc.we .w { color: #c2410c; }
.dc.on { border-color: var(--brand); background: var(--brand-soft); }
.dc .tag { font-size: 10px; font-weight: 800; color: var(--brand); }
.toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.tg { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 18px; cursor: pointer; font-weight: 800; }
.tg small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.tg.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.hours { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
@media (max-width: 640px) { .hours { grid-template-columns: repeat(4, 1fr); } }
.hb { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 0; cursor: pointer; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; position: relative; }
.hb small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.hb.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.hb.sel small { color: #d5ecdc; }
.hb.edge { box-shadow: 0 0 0 3px var(--accent); }
.hb.taken::after { content: "예약됨"; position: absolute; top: -7px; right: -4px; font-size: 9.5px; background: var(--pending); color: #fff; border-radius: 6px; padding: 0 4px; }
.hb:disabled { opacity: .35; cursor: not-allowed; }
.plan { display: grid; gap: 8px; }
.plan-row { display: grid; grid-template-columns: 40px 1fr 1fr 1.4fr; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.plan-row .no { font-weight: 800; color: var(--muted); }
.plan-row.bad { border-color: #f1c4c4; background: #fff8f8; }
@media (max-width: 640px) { .plan-row { grid-template-columns: 30px 1fr; } .plan-row > :nth-child(n+3) { grid-column: 2; } }
.summary { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; background: #12341f; color: #fff; border-radius: var(--radius); padding: 14px 18px; }
.summary b { font-size: 20px; color: var(--accent); }
.summary .btn.primary { background: var(--accent); color: #12341f; border-color: var(--accent); margin-left: auto; }

/* ---------- 표 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 700; background: #fafcfa; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 800; background: #fafcfa; }
.tbl-wrap { overflow-x: auto; }
.costbar { height: 8px; border-radius: 4px; background: #eef2ef; overflow: hidden; min-width: 80px; }
.costbar span { display: block; height: 100%; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- 기타 ---------- */
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }
.empty .big { font-size: 34px; }
.notice { background: #fffbea; border: 1px solid #f3e3a1; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; color: #6b5512; }
.notice.info { background: var(--brand-soft); border-color: #bfe3cc; color: #1d5a35; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #12341f; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; z-index: 100; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: #9b1c1c; }
.countdown { font-variant-numeric: tabular-nums; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 25, 15, .45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 14px; }

/* ---------- 로그인 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(1200px 600px at 20% -10%, #2a7a4b 0%, #12341f 55%, #0c2215 100%); }
.auth { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 28px 24px; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.auth .brand { text-align: center; margin-bottom: 18px; }
.auth .brand img { width: 58px; height: 58px; }
.auth .brand h1 { margin-top: 8px; }
.auth .switch { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
