:root {
  --appointment-ink: #15233b;
  --appointment-muted: #63708a;
  --appointment-panel: #ffffff;
  --appointment-canvas: #eef3f9;
  --appointment-border: #dfe7f1;
  --appointment-blue: #2d6bd8;
  --appointment-blue-soft: #eaf2ff;
  --appointment-green: #1f9d78;
  --appointment-green-soft: #e9f8f3;
  --appointment-red: #c7424d;
}

.appointments-page {
  min-height: 100vh;
  color: var(--appointment-ink);
  background:
    radial-gradient(circle at 80% -15%, rgba(76, 142, 230, 0.16), transparent 34rem),
    var(--appointment-canvas);
}

.appointment-topbar {
  padding-block: 14px;
  background: linear-gradient(110deg, #10243e, #1c4e86 62%, #367bd3);
}

.appointment-brand {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 780;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.appointment-brand span {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.appointment-topbar .language-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
}

.appointment-topbar .language-option {
  min-width: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
}

.appointment-topbar .language-option.active {
  color: #24446f;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.appointment-topbar .language-option-en-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.appointment-shell {
  width: min(1600px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.appointment-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.appointment-eyebrow {
  margin: 0 0 9px;
  color: #2b66bd;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.appointment-hero h1,
.appointment-calendar-toolbar h2,
.appointment-side-heading h2,
.appointment-modal-card h2 {
  margin: 0;
  color: var(--appointment-ink);
  letter-spacing: -0.04em;
}

.appointment-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.appointment-hero p:not(.appointment-eyebrow) {
  max-width: 620px;
  margin: 9px 0 0;
  color: var(--appointment-muted);
  line-height: 1.55;
}

.appointment-hero-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid var(--appointment-border);
  border-radius: 999px;
  color: #55647c;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  font-weight: 700;
}

.appointment-note-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--appointment-green);
  box-shadow: 0 0 0 4px rgba(31, 157, 120, 0.12);
}

.appointment-alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 650;
}

.appointment-alert-error { color: #9d2934; background: #fff0f1; border: 1px solid #ffd7da; }
.appointment-alert-success { color: #16715a; background: #ecfbf5; border: 1px solid #c7f0e1; }

.appointment-dashboard {
  display: grid;
  grid-template-columns: minmax(245px, 290px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--appointment-border);
  border-radius: 22px;
  background: var(--appointment-panel);
  box-shadow: 0 18px 45px rgba(34, 58, 91, 0.09);
}

.appointment-sidebar {
  padding: 28px;
  border-right: 1px solid var(--appointment-border);
  background: linear-gradient(180deg, #f7faff, #fff);
}

.appointment-side-heading h2 { font-size: 1.35rem; }
.appointment-side-heading p:not(.appointment-eyebrow) {
  color: var(--appointment-muted);
  font-size: 0.9rem;
  line-height: 1.58;
}

.appointment-date-form,
.appointment-booking-form {
  display: grid;
  gap: 9px;
}

.appointment-date-form { margin-top: 26px; }
.appointment-date-form label,
.appointment-booking-form label {
  color: #42516a;
  font-size: 0.78rem;
  font-weight: 750;
}

.appointment-date-form input,
.appointment-date-form button,
.appointment-booking-form input,
.appointment-booking-form select,
.appointment-booking-form textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 43px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cfdae8;
  border-radius: 9px;
  color: var(--appointment-ink);
  background: #fff;
  font: inherit;
}

.appointment-date-form button,
.appointment-submit-button {
  border: 0;
  color: #fff;
  background: var(--appointment-blue);
  font-weight: 750;
  cursor: pointer;
}

.appointment-date-form button:hover,
.appointment-submit-button:hover { background: #225bb9; }

.appointment-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 28px;
}

.appointment-stats div {
  padding: 12px;
  border: 1px solid var(--appointment-border);
  border-radius: 11px;
  background: #fff;
}

.appointment-stats span,
.appointment-stats strong { display: block; }
.appointment-stats span { color: var(--appointment-muted); font-size: 0.7rem; font-weight: 700; }
.appointment-stats strong { margin-top: 4px; font-size: 1.45rem; letter-spacing: -0.05em; }

.appointment-legend {
  display: grid;
  gap: 9px;
  margin-top: 24px;
  color: #56657d;
  font-size: 0.8rem;
  font-weight: 650;
}

.appointment-legend span { display: inline-flex; align-items: center; gap: 8px; }
.appointment-legend i { width: 10px; height: 10px; border-radius: 4px; }
.legend-available { border: 1px solid #8fd5bf; background: var(--appointment-green-soft); }
.legend-booked { background: #477cd1; }

.appointment-preview-note {
  margin-top: 30px;
  padding: 15px;
  border-radius: 12px;
  color: #4f6180;
  background: var(--appointment-blue-soft);
  font-size: 0.78rem;
  line-height: 1.48;
}

.appointment-preview-note p { margin: 6px 0 0; }

.appointment-calendar-card { min-width: 0; padding: 28px; }

.appointment-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.appointment-calendar-toolbar h2 { font-size: 1.4rem; }

.appointment-day-close-button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #d5a0a0;
  border-radius: 9px;
  color: #8f3030;
  background: #fff7f7;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}
.appointment-day-close-button:hover { background: #ffeded; }
.appointment-day-close-button:disabled { opacity: 0.7; cursor: default; }

.appointment-week-actions { display: flex; gap: 8px; }
.appointment-week-actions a {
  padding: 9px 10px;
  border: 1px solid var(--appointment-border);
  border-radius: 8px;
  color: #3f506c;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}
.appointment-week-actions a:hover { border-color: #9fbee9; color: #1d57ac; background: #f6faff; }
.appointment-week-actions .appointment-today-link { color: #1f5db5; border-color: #b9d1f4; background: #edf5ff; }

.appointment-calendar-scroll {
  max-height: min(760px, calc(100vh - 250px));
  overflow: auto;
  padding-bottom: 4px;
  scrollbar-color: #b6c5d9 transparent;
}
.appointment-calendar-grid {
  display: grid;
  grid-template-columns: 66px repeat(7, minmax(126px, 1fr));
  min-width: 970px;
  border-top: 1px solid var(--appointment-border);
  border-left: 1px solid var(--appointment-border);
}

.appointment-grid-head,
.appointment-day-header {
  min-height: 72px;
  padding: 13px 10px;
  border-right: 1px solid var(--appointment-border);
  border-bottom: 1px solid var(--appointment-border);
  background: #f8fafd;
}

.appointment-grid-head,
.appointment-day-header {
  position: sticky;
  top: 0;
  z-index: 2;
}

.appointment-grid-head {
  display: flex;
  align-items: end;
  color: #8794a9;
  font-size: 0.68rem;
  font-weight: 750;
}

.appointment-grid-head { z-index: 3; }
.appointment-grid-head { min-height: 72px; }

.appointment-day-header { text-align: center; }
.appointment-day-header span,
.appointment-day-header strong,
.appointment-day-header small { display: block; }
.appointment-day-header span { color: #6d7c91; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.appointment-day-header strong { margin: 1px 0; font-size: 1.3rem; letter-spacing: -0.04em; }
.appointment-day-header small { color: #9ba6b6; font-size: 0.65rem; text-transform: capitalize; }
.appointment-day-header.is-today { background: #eaf3ff; box-shadow: inset 0 3px 0 #3976d1; }

.appointment-time-column {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 50px;
  padding-top: 9px;
  border-right: 1px solid var(--appointment-border);
  border-bottom: 1px solid var(--appointment-border);
  color: #8e9bad;
  background: #fbfcfe;
  font-size: 0.68rem;
  font-weight: 730;
}

.appointment-slot {
  min-height: 50px;
  padding: 7px 9px;
  border: 0;
  border-right: 1px solid var(--appointment-border);
  border-bottom: 1px solid var(--appointment-border);
  text-align: left;
  font: inherit;
}

.appointment-slot-available {
  color: #308367;
  background: #fff;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.appointment-slot-available span,
.appointment-slot-available small { display: block; }
.appointment-slot-available span { font-size: 0.72rem; font-weight: 760; }
.appointment-slot-available small { margin-top: 2px; color: #8a9cae; font-size: 0.62rem; }
.appointment-slot-available:hover { z-index: 1; background: var(--appointment-green-soft); box-shadow: inset 0 0 0 1px #7dcdb4, 0 3px 12px rgba(31, 157, 120, 0.12); transform: scale(1.015); }
.appointment-slot-available:focus-visible { outline: 3px solid rgba(45, 107, 216, 0.35); outline-offset: -3px; }

.appointment-slot-booked { color: #fff; background: linear-gradient(135deg, #3c70c2, #28579e); }
.appointment-slot-booked > span,
.appointment-slot-booked > strong { display: block; }
.appointment-slot-time { color: rgba(255,255,255,0.72); font-size: 0.62rem; font-weight: 650; }
.appointment-slot-booked > strong { margin-top: 5px; font-size: 0.76rem; }
.appointment-slot-booked > strong + span { margin-top: 2px; color: rgba(255,255,255,0.8); font-size: 0.65rem; }
.appointment-slot-booked details { margin-top: 6px; }
.appointment-slot-booked summary { cursor: pointer; color: rgba(255,255,255,0.88); font-size: 0.64rem; font-weight: 700; }
.appointment-slot-booked details p { margin: 5px 0; color: #fff; font-size: 0.65rem; line-height: 1.35; overflow-wrap: anywhere; }
.appointment-prescription-link { color: #fff; font-size: 0.65rem; font-weight: 750; }

.appointment-cancel-button {
  width: 100%;
  margin: 4px 0 0;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 6px;
  color: #fff;
  background: rgba(19, 43, 83, 0.42);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
}

.appointment-modal[hidden] { display: none; }
.appointment-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 22px; }
.appointment-modal-backdrop { position: absolute; inset: 0; background: rgba(13, 28, 48, 0.6); backdrop-filter: blur(3px); }
.appointment-modal-card {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 29px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 25px 70px rgba(3, 14, 31, 0.32);
}
.appointment-modal-card h2 { font-size: 1.55rem; }
.appointment-modal-close {
  position: absolute;
  top: 15px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #57657b;
  background: #eef2f7;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.appointment-selected-slot { margin: 12px 0 22px; padding: 11px 12px; border-radius: 9px; color: #22579e; background: #edf5ff; font-size: 0.85rem; font-weight: 750; }
.appointment-booking-form label { display: grid; gap: 7px; }
.appointment-booking-form input[type="radio"] { width: 20px; min-height: 20px; }
.appointment-booking-form fieldset label { display: flex; align-items: center; margin: 10px 0; }
.appointment-slot:disabled { cursor: default; opacity: .65; }
.appointment-slot-blocked { background: #f3f5f8; color: #778499; font-size: .72rem; border: 1px solid #e5eaf0; }
.appointment-slot-toggle { margin: 2px 0 0; }
.appointment-slot-cell { position: relative; min-width: 0; min-height: 30px; padding: 1px 4px; border-right: 1px solid var(--appointment-border); border-bottom: 1px solid var(--appointment-border); }
.appointment-slot-empty { display: block; min-height: 1px; }
.appointment-slot-cell > .appointment-slot { width: 100%; box-sizing: border-box; }
.appointment-slot-cell > .appointment-slot-available { min-height: 30px; padding: 3px 20px 3px 5px; }
.appointment-slot-toggle { position: absolute; z-index: 2; right: 5px; bottom: 3px; margin: 0; background: #fff; border-radius: 4px; }
.appointment-slot-toggle button { width: auto; min-height: 16px; padding: 1px 4px; font-size: .6rem; }
.appointment-slot-toggle button { border: 0; padding: 2px 5px; background: transparent; color: #456b9b; font-size: .66rem; cursor: pointer; }
.appointment-slot-toggle button:hover { text-decoration: underline; }
.appointment-slot-toggle button:disabled { opacity: .55; cursor: wait; }
.appointment-slot-cell.is-open > .appointment-slot-available { background: #e8f7ef; border-color: #b8dfc9; }
#availability-feedback { padding: 9px 13px; color: #385b88; background: #edf5ff; border-radius: 8px; }
.appointment-booking-form label span { color: #94a1b4; font-weight: 550; }
.appointment-booking-form textarea { min-height: 86px; resize: vertical; }
.appointment-booking-form select[size] {
  min-height: 210px;
  padding: 6px;
  line-height: 1.35;
}
.appointment-booking-form select optgroup { color: #2f5f9f; font-size: 0.76rem; font-weight: 800; }
.appointment-booking-form select option { padding: 7px 8px; color: var(--appointment-ink); font-size: 0.82rem; }
.appointment-field-help { font-size: 0.72rem; }
.appointment-prescription-section {
  display: grid;
  gap: 13px;
  margin-top: 4px;
  padding: 15px;
  border: 1px solid #d9e5f2;
  border-radius: 12px;
  background: #f7faff;
}
.appointment-prescription-title {
  margin: 0;
  color: #2f4e76;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.appointment-prescription-copy {
  margin: 5px 0 0;
  color: #66758b;
  font-size: 0.77rem;
  line-height: 1.45;
}
.appointment-upload-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.appointment-upload-choice { min-width: 0; }
.appointment-upload-input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.appointment-upload-choice > label {
  display: block;
  padding: 10px 9px;
  border: 1px dashed #91afd5;
  border-radius: 9px;
  color: #2d609f;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 750;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.appointment-upload-choice > label:hover { border-color: #3974ba; background: #edf5ff; }
.appointment-upload-input:focus-visible + label { outline: 3px solid rgba(45, 107, 216, 0.3); outline-offset: 2px; }
.appointment-upload-status {
  display: block;
  margin-top: 6px;
  color: #79889e;
  font-size: 0.66rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: center;
}
.appointment-submit-button { min-height: 46px; margin-top: 8px; border-radius: 9px; font-size: 0.9rem; }
.appointment-modal-open { overflow: hidden; }

.appointment-compact-week-wrap { margin-top: 24px; overflow-x: auto; }
.appointment-compact-week { width: 100%; min-width: 700px; table-layout: fixed; border-collapse: collapse; }
.appointment-compact-week th { padding: 14px 6px; background: #f8fafd; border: 1px solid var(--appointment-border); }
.appointment-compact-week th span, .appointment-compact-week th strong { display: block; }
.appointment-compact-week th span { font-size: .8rem; color: var(--appointment-muted); margin-bottom: 5px; }
.appointment-compact-week td { padding: 0; height: 44px; border: 1px solid var(--appointment-border); text-align: center; }
.appointment-compact-week .appointment-slot { width: 100%; min-height: 44px; border: 0; text-align: center; padding: 5px; }
.appointment-compact-week .appointment-slot strong { font-size: .8rem; }
.appointment-compact-week .appointment-slot small { display: block; font-size: .65rem; margin-top: 2px; }
.appointment-closed-cell { background: #f3f5f8; }
.appointment-closed-label { color: var(--appointment-muted); font-size: .75rem; }

/* Keep a calendar on touch screens, with readable columns and touch targets. */
.appointment-mobile-closed-days { display: none; }
.appointment-shell, .appointment-booking-form, .appointment-booking-form label { min-width: 0; }
.appointment-calendar-toolbar { flex-wrap: wrap; }
.appointment-week-actions { flex-wrap: wrap; }
.appointment-week-actions a { min-height: 44px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; white-space: normal; }
.appointment-modal-card { max-height: calc(100dvh - 44px); overscroll-behavior: contain; }
.appointment-modal-card h2 { padding-right: 44px; }
.appointment-modal-close { width: 44px; height: 44px; }
.appointment-booking-form fieldset { min-width: 0; border: 1px solid var(--appointment-border); border-radius: 9px; }
.appointment-booking-form fieldset label { min-height: 44px; }
.appointment-booking-form input[type="radio"] { flex-shrink: 0; }
.appointment-booking-form input, .appointment-booking-form select, .appointment-booking-form textarea { max-width: 100%; min-width: 0; }
#selected-exam { margin: 0; overflow-wrap: anywhere; line-height: 1.5; }
@media (max-width: 1024px) {
  .appointment-compact-week { min-width: 0; }
  .appointment-compact-week .appointment-slot { min-height: 48px; }
  .appointment-booking-form input, .appointment-booking-form select, .appointment-booking-form textarea,
  .appointment-date-form input { font-size: 16px; }
  .appointment-booking-form select:not([size]) { min-height: 48px; }
}
@media (max-width: 700px) {
  .appointment-compact-week .appointment-closed-column { display: none; }
  .appointment-mobile-closed-days { display: block; font-size: .8rem; color: var(--appointment-muted); }
  .appointment-compact-week .appointment-slot strong { font-size: .95rem; }
  .appointment-compact-week .appointment-slot small { font-size: .7rem; }
  .appointment-modal { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .appointment-modal-card { max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .appointment-brand span { display: block; margin: 4px 0 0; }
}

@media (max-width: 980px) {
  .appointment-dashboard { grid-template-columns: 1fr; }
  .appointment-sidebar { border-right: 0; border-bottom: 1px solid var(--appointment-border); }
  .appointment-date-form { grid-template-columns: 1fr auto; align-items: end; }
  .appointment-date-form label { grid-column: 1 / -1; }
  .appointment-date-form button { min-width: 118px; }
  .appointment-preview-note { display: none; }
}

@media (max-width: 640px) {
  .appointment-shell { width: min(100% - 24px, 1600px); padding-top: 25px; }
  .appointment-hero, .appointment-calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .appointment-hero-note { font-size: 0.7rem; }
  .appointment-dashboard { border-radius: 16px; }
  .appointment-sidebar, .appointment-calendar-card { padding: 20px 16px; }
  .appointment-calendar-toolbar { gap: 13px; }
  .appointment-week-actions { width: 100%; }
  .appointment-week-actions a { flex: 1; padding-inline: 7px; text-align: center; }
  .appointment-date-form { grid-template-columns: 1fr; }
  .appointment-date-form label { grid-column: auto; }
  .appointment-calendar-grid { min-width: 860px; grid-template-columns: 56px repeat(7, minmax(115px, 1fr)); }
  .appointment-modal-card { padding: 26px 20px; }
  .appointment-calendar-scroll { max-height: 640px; }
  .appointment-upload-options { grid-template-columns: 1fr; }
}
