:root {
  --green: #244e40;
  --green-2: #3e705c;
  --sage: #e7efe8;
  --ivory: #fafbf8;
  --ink: #25312b;
  --muted: #6f7c73;
  --line: #dce5dd;
  --danger: #a14227;
  --shadow: 0 14px 36px rgba(36, 78, 64, .08);
}

* { box-sizing: border-box; }
html { background: var(--ivory); color: var(--ink); font-family: Inter, "Noto Sans KR", "Malgun Gothic", sans-serif; letter-spacing: -.025em; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }

.admin-header {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand { display: flex; align-items: center; color: var(--green); text-decoration: none; }
.brand-logo { display: block; width: 112px; height: auto; }
.admin-tabs { display: flex; align-items: stretch; justify-self: center; gap: 8px; min-width: 0; }
.admin-tab {
  position: relative;
  height: 100%;
  border: 0;
  padding: 13px 16px;
  background: transparent;
  color: var(--muted);
  font: 600 14px inherit;
  white-space: nowrap;
  cursor: pointer;
}
.admin-tab:hover, .admin-tab.active { color: var(--green); }
.admin-tab.active::after { content: ""; position: absolute; right: 16px; bottom: 0; left: 16px; height: 2px; background: var(--green); }
.account-actions { display: flex; align-items: center; gap: 10px; }
.account-label { color: var(--muted); font-size: 12px; white-space: nowrap; }

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 12px 16px;
  background: transparent;
  color: var(--ink);
  font: 600 13px inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover:not(:disabled) { background: #19392f; }
.button.ghost { border-color: var(--line); background: #fff; color: var(--green); }
.button.ghost:hover:not(:disabled) { border-color: var(--green-2); background: var(--sage); }

.admin-main { max-width: 1280px; margin: 0 auto; padding: 32px clamp(20px, 5vw, 72px) 64px; }
.state-card { max-width: 620px; margin: 8vh auto 0; padding: 42px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.state-card h1, .panel-heading h2 { margin: 4px 0 14px; color: var(--green); font: 500 25px/1.3 inherit; letter-spacing: -.025em; }
.state-card h1 { font-size: clamp(30px, 4vw, 48px); }
.state-card p:not(.eyebrow):not(.notice) { margin: 0 0 24px; color: var(--muted); line-height: 1.8; }
.eyebrow { margin: 0 0 10px; color: var(--green-2); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.muted { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.notice { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 12px; line-height: 1.6; }
.notice.error { border-color: #e6c8bd; background: #fff9f6; color: var(--danger); }
.bootstrap-box { margin: 25px 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--sage); }
.bootstrap-box p { margin: 0 0 10px !important; color: var(--muted); font-size: 12px; }
.bootstrap-box code { display: block; margin-bottom: 10px; padding: 13px; overflow-wrap: anywhere; overflow: auto; border: 1px solid var(--line); background: #fff; font: 12px/1.65 Consolas, monospace; white-space: pre-wrap; }

.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { margin-bottom: 10px; }
.panel-heading h2 { margin: 0; }
.schedule-panel > .muted { margin: -2px 0 14px; font-size: 11px; line-height: 1.6; }
.schedule-picker-layout { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(440px, 1.1fr); align-items: start; gap: 30px; }
.schedule-calendar-column, .schedule-time-column { min-width: 0; }
.calendar-ranges { margin-top: 18px; }

.calendar-toolbar { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 2px 0 15px; }
.calendar-toolbar strong { min-width: 130px; color: var(--green); font-size: 17px; font-weight: 600; text-align: center; }
.month-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--green); font-size: 20px; line-height: 1; cursor: pointer; }
.month-button:hover:not(:disabled) { background: var(--sage); }
.month-button:disabled { opacity: .35; cursor: not-allowed; }
.admin-calendar-weekdays, .admin-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.admin-calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 10px; text-align: center; }
.admin-calendar-day { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: 12px inherit; cursor: pointer; }
.admin-calendar-day:hover:not(:disabled) { border-color: var(--green-2); background: var(--sage); }
.admin-calendar-day:disabled { border-color: #edf0eb; background: #f5f7f3; color: #b6beb7; cursor: not-allowed; }
.admin-calendar-day.today strong { color: var(--green-2); text-decoration: underline; text-underline-offset: 3px; }
.admin-calendar-day.has-slots:not(.selected), .reservation-calendar .admin-calendar-day.has-reservations:not(.selected) { border-color: #a9c8b0; box-shadow: inset 0 -3px 0 var(--green-2); }
.admin-calendar-day.has-reservations:not(.selected) { background: #edf6ef; color: var(--green); }
.admin-calendar-day small { min-height: 11px; color: var(--muted); font-size: 9px; }
.admin-calendar-day.has-reservations small { color: var(--green-2); font-weight: 700; }
.admin-calendar-day.selected { border-color: var(--green); background: var(--green); color: #fff; box-shadow: none; }
.admin-calendar-day.selected strong, .admin-calendar-day.selected small { color: #fff; }
.selected-date-label { margin: 0 0 10px; padding: 9px 12px; border-radius: 6px; background: var(--sage); color: var(--green); font-size: 12px; font-weight: 700; }

.slot-form { display: grid; gap: 14px; margin: 0; }
.slot-settings { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.slot-settings input[type="number"] { width: 78px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: 14px inherit; }
.slot-settings input:focus { outline: 3px solid #cfe0d3; border-color: var(--green-2); }
.slot-settings fieldset { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 14px; min-height: 48px; margin: 0; padding: 0; border: 0; }
.slot-settings legend { width: 100%; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--green); }
.plan-setting { display: flex; align-items: center; gap: 10px; }
.one-side-capacity { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.admin-time-grid { margin: 0; }
.time-grid-empty { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.time-grid-hint { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.time-choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.time-choice { min-height: 52px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--green); font: 600 13px inherit; cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.time-choice:hover { border-color: var(--green-2); background: var(--sage); }
.time-choice.registered { border-color: #b8d2bd; background: #edf6ef; }
.time-choice.closed, .time-choice.reserved { border-color: #e2cbc2; background: #f7f2ef; color: #9e553f; }
.time-choice.selected { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 0 0 2px #cfe0d3; }
.time-choice.endpoint { font-weight: 700; }
.time-choice:focus-visible, .range-action:focus-visible, .text-button:focus-visible { outline: 3px solid #c6d8c9; outline-offset: 2px; }

.schedule-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; }
.schedule-actions .button { min-width: 88px; }
.text-button { appearance: none; border: 0; padding: 9px 4px; background: transparent; color: var(--green); font: 600 12px inherit; cursor: pointer; }
.text-button:disabled { opacity: .45; cursor: not-allowed; }
.registered-ranges { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fbfcf9; }
.registered-ranges-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.registered-ranges-heading h3 { margin: 0; color: var(--green); font-size: 13px; }
.registered-ranges-heading span { color: var(--muted); font-size: 11px; }
.range-list { margin: 0; padding: 0; list-style: none; }
.range-list-empty { padding: 16px 14px; color: var(--muted); font-size: 12px; }
.range-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid #edf0eb; }
.range-item:first-child { border-top: 0; }
.range-item.pending { background: #f4faf4; }
.range-item.locked { background: #f7f2ef; }
.range-item strong, .range-item small { display: block; }
.range-item strong { color: var(--ink); font-size: 13px; }
.range-item small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.range-item-actions { display: flex; flex-shrink: 0; gap: 6px; }
.range-action { appearance: none; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; background: #fff; color: var(--green); font: 600 11px inherit; cursor: pointer; }
.range-action:hover:not(:disabled) { border-color: var(--green); background: var(--sage); }
.range-action.danger { color: var(--danger); }
.range-action:disabled { opacity: .42; cursor: not-allowed; }

.reservations-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.45fr); align-items: start; gap: 24px; }
.reservation-calendar-panel .selected-date-label { margin: 20px 0 0; }
.table-wrap { margin: 22px -8px -8px; padding: 0 8px 8px; overflow: hidden; }
table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
caption { margin-bottom: 10px; color: var(--muted); font-size: 11px; text-align: left; }
th, td { padding: 10px 6px; overflow-wrap: anywhere; border-bottom: 1px solid #edf0eb; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
td { line-height: 1.55; }
td small { display: block; color: var(--muted); font-size: 10px; }
.reservation-table { min-width: 0; }
.reservation-table th:nth-child(1) { width: 12%; }.reservation-table th:nth-child(2) { width: 23%; }.reservation-table th:nth-child(3) { width: 24%; }.reservation-table th:nth-child(4) { width: 18%; }.reservation-table th:nth-child(5) { width: 23%; }
.inline-select { width: 100%; min-width: 0; margin: 2px 0; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font-size: 10px; }

@media (max-width: 1050px) {
  .admin-header { grid-template-columns: auto 1fr; padding-top: 12px; padding-bottom: 12px; }
  .admin-tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: center; min-height: 48px; border-top: 1px solid var(--line); }
  .admin-tab { height: 48px; }
  .schedule-picker-layout { grid-template-columns: minmax(280px, .85fr) minmax(360px, 1.15fr); }
}
@media (max-width: 900px) {
  .admin-main { padding-top: 26px; }
  .admin-tabs { justify-content: flex-start; overflow-x: auto; }
  .schedule-picker-layout, .reservations-layout { grid-template-columns: 1fr; }
  .schedule-time-column { max-width: 680px; }
}
@media (max-width: 700px) {
  .slot-settings { display: grid; gap: 12px; }
  .schedule-actions { flex-wrap: wrap; justify-content: flex-start; }
  .time-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .time-choice { min-height: 50px; }
  .registered-ranges-heading, .range-item { padding-right: 12px; padding-left: 12px; }
  .range-action { padding: 8px; }
}
@media (max-width: 600px) {
  .admin-header { min-height: 72px; gap: 16px; padding-right: 18px; padding-left: 18px; }
  .brand-logo { width: 96px; }
  .account-label { display: none; }
  .admin-main { padding: 26px 16px 54px; }
  .state-card { margin-top: 5vh; padding: 28px 20px; }
  .panel { padding: 20px 16px; }
  .admin-tabs { margin: 0 -8px; }
  .admin-tab { padding-right: 12px; padding-left: 12px; font-size: 13px; }
  .admin-calendar-day { min-height: 48px; }
  .table-wrap { margin-right: -4px; margin-left: -4px; padding-right: 4px; padding-left: 4px; }
}
@media (max-width: 380px) {
  .time-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-item { flex-direction: column; align-items: flex-start; }
  .range-item-actions { width: 100%; }
  .range-action { flex: 1; }
}
