:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e0e8;
  --paper: #fbfcfe;
  --panel: #ffffff;
  --brand: #176b87;
  --brand-dark: #0e4f63;
  --free: #e8f6ef;
  --free-strong: #2c8f5f;
  --booked: #f2f4f7;
  --mine: #fff2cc;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef6f8 0%, #fbfcfe 42%);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover,
.ghost-link:hover {
  background: #f3f7fa;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  text-decoration: none;
}

.danger {
  background: #fff;
  border: 1px solid #f0b8b4;
  color: var(--danger);
}

.danger:hover {
  background: #fff5f5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 18px 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(25px, 4vw, 38px);
}

h2 {
  font-size: 21px;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px 36px;
}

.notice {
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #fff7e6;
  border: 1px solid #ffd591;
}

.response-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  border: 2px solid #f7cf62;
  border-radius: 8px;
  background: #fff8db;
  padding: 16px 18px;
  box-shadow: 0 12px 28px rgba(122, 84, 0, 0.12);
}

.response-actions strong {
  display: block;
  color: #7a5400;
  font-size: 18px;
}

.response-actions span {
  display: block;
  margin-top: 4px;
  color: #6f5a21;
}

.response-actions button {
  flex: 0 0 auto;
  min-height: 50px;
  background: #b45309;
  font-weight: 800;
  padding: 0 22px;
}

.response-actions button:hover {
  background: #92400e;
}

.schedule-wrap,
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #ffe58f;
  color: #241a00;
  font-weight: 800;
}

th,
td {
  border: 1px solid var(--line);
  padding: 11px 12px;
  text-align: center;
  vertical-align: middle;
}

.date-cell {
  min-width: 82px;
  font-size: 18px;
  font-weight: 800;
}

.time-cell {
  min-width: 190px;
}

.name-cell {
  min-width: 170px;
  padding: 6px;
}

.period-morning .time-cell {
  background: #f8fbff;
}

.period-afternoon .time-cell {
  background: #fff9f0;
}

.period-evening .time-cell {
  background: #f4f2ff;
}

.slot-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
}

.slot-button.free {
  background: var(--free);
  border-color: #bfe5d0;
  color: var(--free-strong);
}

.slot-button.booked {
  background: var(--booked);
  color: #7a8392;
}

.slot-button.mine {
  background: var(--mine);
  border-color: #f7cf62;
  color: #7a5400;
}

.admin-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.admin-login,
.admin-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}

.admin-login label {
  min-width: min(100%, 320px);
}

.admin-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
  color: var(--muted);
}

.admin-stats span {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: #f7fafc;
}

.admin-section-title {
  margin: 18px 0 10px;
  font-size: 18px;
}

.admin-table {
  min-width: 860px;
  box-shadow: none;
}

.nonparticipant-table {
  min-width: 720px;
}

.admin-table th {
  background: #e6f4f1;
}

.admin-table input {
  min-width: 110px;
}

.admin-table textarea {
  min-width: 150px;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

#bookingForm {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  background: #f2f4f7;
  color: var(--ink);
  font-size: 24px;
}

.icon-button:hover {
  background: #e4e7ec;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    padding-top: 20px;
  }

  .response-actions {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
    gap: 12px;
    padding: 14px;
  }

  .response-actions button {
    width: 100%;
  }

  th,
  td {
    padding: 9px 7px;
  }

  .date-cell {
    min-width: 64px;
    font-size: 16px;
  }

  .time-cell {
    min-width: 136px;
    font-size: 14px;
  }

  .name-cell {
    min-width: 122px;
  }

  .slot-button {
    padding: 0 8px;
    font-size: 14px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}
