:root {
  --bg: #ffffff;
  --fg: #1c2430;
  --muted: #6b7785;
  --line: #e4e8ee;
  --brand: #1f6feb;
  --brand-dark: #1858c4;
  --ok-bg: #e8f6ee;
  --ok-fg: #176a3a;
  --warn-bg: #fff4e0;
  --warn-fg: #8a5a00;
  --err-bg: #fdecec;
  --err-fg: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 45, 0.08), 0 6px 20px rgba(20, 30, 45, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: transparent;
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.widget {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.widget__header h1 { font-size: 20px; margin: 0 0 4px; }

.banner {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.step { padding: 18px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step__title { font-size: 16px; display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.step__num {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 600;
}
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.muted { color: var(--muted); }

.options { display: flex; flex-wrap: wrap; gap: 8px; }
.options--compact { flex-direction: column; max-height: 230px; overflow-y: auto; }

.option {
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--fg);
  border-radius: var(--radius); padding: 10px 14px; font-size: 14px;
  transition: border-color .12s, background .12s;
}
.option:hover { border-color: var(--brand); }
.option.is-active { border-color: var(--brand); background: #eef4ff; }
.option__name { font-weight: 600; }
.option__meta { color: var(--muted); font-size: 12px; }

.slot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 520px) { .slot-grid { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; background: #f1f4f8; padding: 4px; border-radius: var(--radius); margin-bottom: 14px; }
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 8px; border-radius: 7px; font-size: 14px; color: var(--muted);
}
.tab.is-active { background: #fff; color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.search-row { display: flex; gap: 8px; }
.results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.result-item {
  text-align: left; cursor: pointer; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius); padding: 8px 12px; font-size: 14px;
}
.result-item:hover { border-color: var(--brand); background: #f7faff; }

.form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.form__row { display: flex; gap: 12px; }
.form__row > label { flex: 1; }
@media (max-width: 520px) { .form__row { flex-direction: column; } }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, textarea {
  font: inherit; color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }

.btn {
  border: 0; cursor: pointer; background: var(--brand); color: #fff;
  border-radius: var(--radius); padding: 11px 18px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--ghost { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn--ghost:hover { background: #f5f8ff; border-color: var(--brand); }
.link-btn { background: 0; border: 0; color: var(--muted); cursor: pointer; padding: 6px 0; font-size: 13px; }
.link-btn:hover { color: var(--brand); }

.result-card { padding: 18px; border-radius: var(--radius); margin-bottom: 14px; }
.result-card--ok { background: var(--ok-bg); color: var(--ok-fg); }
.result-card--queued { background: var(--warn-bg); color: var(--warn-fg); }
.result-card h3 { margin: 0 0 6px; }
.result-card p { margin: 4px 0; }

.error-bar {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--err-bg); color: var(--err-fg); font-size: 13px;
}

/* ── Practitioner select ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--muted); }
.select {
  font: inherit; color: var(--fg); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px;
}
.select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.actions--end { justify-content: flex-end; margin-top: 16px; }

/* ── Option buttons: type cards (stacked) + time chips (centred) ──────── */
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.option--time { align-items: center; min-width: 84px; }

/* ── Calendar ────────────────────────────────────────────────────────── */
.cal { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal__month { font-weight: 600; font-size: 15px; }
.cal__nav {
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--fg);
  width: 32px; height: 32px; border-radius: 8px; font-size: 18px; line-height: 1;
}
.cal__nav:hover { border-color: var(--brand); color: var(--brand); }
.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal__dow { margin-bottom: 4px; }
.cal__dow span { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cal__cell {
  min-height: 48px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; font: inherit;
}
.cal__cell--empty { border: 0; }
.cal__day { font-size: 13px; color: var(--fg); }
.cal__cell--closed { cursor: default; }
.cal__cell--closed .cal__day { color: #c4cbd4; }
.cal__cell--open { cursor: pointer; border-color: var(--line); background: #fff; }
.cal__cell--open:hover { border-color: var(--brand); background: #f4f8ff; }
.cal__cell.is-active { border-color: var(--brand); background: #eef4ff; }
.cal__glyphs { display: flex; gap: 1px; font-size: 12px; line-height: 1; }
.cal__legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.time-panel { margin-top: 16px; }
.time-panel .sub { margin-bottom: 10px; }

/* ── Details: search row + lockable fieldset ─────────────────────────── */
.search-row { flex-wrap: wrap; }
.search-row #search-input { flex: 1 1 180px; }
.fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; min-inline-size: 0; }
.fieldset:disabled { opacity: .5; }
.link-inline { background: 0; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
