:root {
  --ink: #18202a;
  --muted: #697482;
  --line: #dce2e8;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --accent: #176b5b;
  --accent-dark: #0f5145;
  --accent-soft: #e5f3ef;
  --warning: #a86308;
  --danger: #b4232d;
  --danger-soft: #fdebed;
  --shadow: 0 12px 30px rgba(24, 32, 42, 0.08);
}

* { box-sizing: border-box; }
html { font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-dark); }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  min-height: 74px;
  padding: 0 5vw;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 6px; font-size: 13px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.admin-nav { display: flex; align-items: center; gap: 20px; font-size: 13px; font-weight: 700; }
.admin-nav a { text-decoration: none; color: var(--muted); }
.admin-nav a:hover { color: var(--ink); }
.admin-nav form { margin: 0; }

.page { width: min(1120px, 90vw); margin: 0 auto; padding: 54px 0 72px; flex: 1; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.page-heading h1, .form-page h1, .booking-layout h1, .legal-page h1, .login-panel h1, .result-state h1 { margin: 5px 0 10px; font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: 0; }
.page-heading p, .booking-layout p, .login-panel > p, .result-state > p { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 !important; color: var(--accent) !important; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.legend { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.legend span { width: 9px; height: 9px; border-radius: 50%; background: #39a27d; }

.slot-list { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.slot-row { min-height: 126px; display: grid; grid-template-columns: 78px minmax(0, 1fr) 100px 120px; align-items: center; gap: 24px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.slot-row:last-child { border-bottom: 0; }
.slot-row.full { background: #fafbfc; }
.date-tile { width: 62px; height: 68px; border: 1px solid var(--line); border-top: 4px solid var(--accent); display: grid; align-content: center; text-align: center; border-radius: 6px; background: #fff; }
.date-tile strong { font-size: 24px; }
.date-tile span { font-size: 10px; color: var(--muted); }
.slot-main h2 { margin: 0 0 7px; font-size: 18px; }
.slot-main p { margin: 0; color: var(--muted); font-size: 13px; }
.slot-main .slot-note { margin-top: 7px; color: var(--ink); }
.availability { text-align: center; }
.availability strong, .availability span { display: block; }
.availability strong { color: var(--accent); font-size: 27px; }
.availability span { color: var(--muted); font-size: 11px; }

.button { min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; font-weight: 800; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.button.secondary:hover { border-color: #aeb7c1; }
.button.danger { background: var(--danger); color: #fff; }
.button.disabled { background: #e8ebee; color: #7c8793; cursor: default; }
.button.wide { width: 100%; }
.button.compact { min-height: 34px; padding: 0 12px; }
.text-button { border: 0; padding: 0; background: none; color: var(--accent-dark); font-size: 13px; font-weight: 800; cursor: pointer; }
.danger-text { color: var(--danger); }

.notice { margin-bottom: 20px; padding: 14px 16px; border-left: 4px solid #82909e; background: #eef1f4; line-height: 1.45; }
.notice.success { border-color: var(--accent); background: var(--accent-soft); }
.notice.error { border-color: var(--danger); background: var(--danger-soft); color: #7c1820; }
.empty-state { padding: 70px 30px; text-align: center; border: 1px dashed #bfc7cf; background: rgba(255,255,255,.55); }
.empty-state h2 { margin: 10px 0 8px; font-size: 21px; }
.empty-state p { color: var(--muted); }
.empty-calendar { margin: auto; width: 50px; height: 50px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 24px; }
.compact-empty { padding: 36px; }

.back-link { display: inline-block; margin-bottom: 26px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 70px; align-items: start; }
.appointment-facts { border-top: 1px solid var(--line); }
.appointment-facts div { display: grid; grid-template-columns: 100px 1fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.appointment-facts dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.appointment-facts dd { margin: 0; font-weight: 700; }
.form-panel, .login-panel, .form-page { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 30px; }
.form-panel h2 { margin-top: 0; }
.form-stack { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; }
label > span { color: var(--danger); }
label small { color: var(--muted); font-weight: 400; }
input, textarea { width: 100%; border: 1px solid #bfc7cf; border-radius: 4px; background: #fff; color: var(--ink); padding: 11px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,107,91,.13); }
textarea { resize: vertical; }
.checkbox { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; font-weight: 400; line-height: 1.4; }
.checkbox input { width: 17px; height: 17px; margin: 1px 0 0; }
.checkbox span { color: var(--ink); }
.info-box { padding: 16px; border: 1px solid #bddbd2; background: var(--accent-soft); color: var(--ink) !important; }

.result-state { width: min(620px, 100%); margin: 30px auto; text-align: center; }
.result-icon { width: 58px; height: 58px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 28px; font-weight: 800; }
.result-icon.muted { background: #798693; }
.result-state .info-box { margin: 25px 0; text-align: left; }
.result-state form { display: flex; justify-content: center; gap: 10px; }
.login-panel { width: min(440px, 100%); margin: 30px auto; }
.login-panel h1 { font-size: 34px; }
.access-help { margin: 20px 0 0; font-size: 12px; text-align: center; }

.form-page { width: min(760px, 100%); margin: auto; }
.form-page h1 { font-size: 34px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; margin: -8px 0 32px; background: #fff; border: 1px solid var(--line); }
.toolbar form { margin: 0; }
.section-title { margin: 0 0 14px; font-size: 18px; }

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 16px; background: #f0f3f5; color: var(--muted); text-align: left; font-size: 10px; text-transform: uppercase; }
td { padding: 16px; border-top: 1px solid var(--line); vertical-align: middle; }
td small { display: block; margin-top: 5px; color: var(--muted); }
.status { display: inline-flex; padding: 4px 8px; border-radius: 4px; background: #edf0f2; color: #56616d; font-size: 11px; font-weight: 800; }
.status.active, .status.confirmed { background: var(--accent-soft); color: var(--accent-dark); }
.status.closed, .status.cancelled { background: #f1f2f4; color: #66717c; }
.progress { width: 90px; height: 4px; margin-top: 7px; background: #e2e6e9; }
.progress span { display: block; height: 100%; background: var(--accent); }

.legal-page { width: min(760px, 100%); margin: auto; line-height: 1.65; }
.legal-page h2 { margin: 30px 0 8px; font-size: 18px; }
.legal-page p { color: #46515d; }
footer { min-height: 70px; padding: 0 5vw; display: flex; justify-content: center; align-items: center; gap: 24px; border-top: 1px solid var(--line); background: #fff; font-size: 12px; }
footer a { color: var(--muted); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .topbar { padding: 13px 5vw; align-items: flex-start; }
  .brand small { display: none; }
  .admin-nav { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .admin-nav a:nth-child(3) { display: none; }
  .page { width: 92vw; padding: 34px 0 50px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1, .booking-layout h1 { font-size: 32px; }
  .legend { display: none; }
  .slot-row { grid-template-columns: 62px 1fr; gap: 14px; padding: 18px; }
  .slot-main { min-width: 0; }
  .availability { text-align: left; grid-column: 2; display: flex; align-items: baseline; gap: 7px; }
  .availability strong { font-size: 20px; }
  .slot-row > .button { grid-column: 1 / -1; width: 100%; }
  .booking-layout { grid-template-columns: 1fr; gap: 35px; }
  .form-panel, .login-panel, .form-page { padding: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-actions { flex-direction: column; }
  .detail-heading .actions { width: 100%; }
  .detail-heading .actions .button { flex: 1; }
  .toolbar { align-items: flex-start; gap: 15px; }
  .admin-table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { margin-bottom: 12px; padding: 14px; background: #fff; border: 1px solid var(--line); }
  td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 9px 0; border: 0; border-top: 1px solid #edf0f2; overflow-wrap: anywhere; }
  td:first-child { border-top: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
  td:last-child { display: block; }
  td:last-child::before { display: none; }
  td .button { width: 100%; }
}
