/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
/* Keyboard focus everywhere else: solid 2px brand ring (3:1+ on white). */
a:focus-visible, button:focus-visible:not(.btn), [tabindex]:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary, .btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger, .btn-bad { background: var(--surface); border-color: #f1c4c4; color: var(--bad); }
.btn-danger:hover:not(:disabled), .btn-bad:hover:not(:disabled) { background: var(--bad-soft); }
.btn-good { background: var(--surface); border-color: #b8e0c4; color: var(--good); }
.btn-good:hover:not(:disabled) { background: var(--good-soft); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 13px; color: var(--mute); margin-top: 2px; font-weight: 400; }
.card-body { padding: 20px; }
.card-body.tight { padding: 8px 20px; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== BADGES & CHIPS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-confirmed { background: var(--good-soft); color: var(--good); border-color: #cdebd6; }
.badge-pending { background: var(--warn-soft); color: var(--warn); border-color: #f7dfb6; }
.badge-completed { background: #f1f5f9; color: #475569; border-color: var(--line); }
.badge-cancelled { background: var(--bad-soft); color: var(--bad); border-color: #f5cfcf; }
.badge.plain::before { display: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--faint); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip .count { color: inherit; opacity: .6; font-weight: 500; }

/* Segmented control */
.segmented { display: inline-flex; background: #eef0f3; border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented button {
  height: 30px; padding: 0 12px; border-radius: 6px;
  font-size: 13px; font-weight: 550; color: var(--mute);
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ===== AVATAR ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; border-radius: 14px; }
.avatar-xl { width: 64px; height: 64px; font-size: 21px; border-radius: 16px; }
.tint-teal { background: var(--brand-soft); color: var(--brand); }
.tint-blue { background: #e3edfb; color: #1d4ed8; }
.tint-amber { background: #fcefd9; color: #a35a06; }
.tint-rose { background: #fbe4ea; color: #be185d; }
.tint-violet { background: #ece7fb; color: #6d28d9; }
.tint-slate { background: #e8ecf1; color: #334155; }
.tint-green { background: #e2f4e6; color: #15803d; }

/* ===== LISTS ===== */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row.clickable { cursor: pointer; transition: background .12s; }
.list-row.clickable:hover { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 13px; color: var(--mute); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.list-meta span { display: inline-flex; align-items: center; gap: 5px; }
.list-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--mute); }
.kv .v { font-weight: 550; text-align: right; }

/* ===== STATES ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--mute); }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-text { font-size: 13px; max-width: 360px; margin: 0 auto 14px; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 20px; color: var(--mute); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
/* kept for older call sites */
.empty { text-align: center; padding: 32px 16px; color: var(--mute); font-size: 13px; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--info-soft); color: #3730a3; font-size: 13px;
}
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.good { background: var(--good-soft); color: var(--good); }

/* ===== STAT TILES ===== */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--mute); font-size: 13px; font-weight: 500; }
.stat-top .ico { color: var(--faint); }
.stat-val { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--mute); margin-top: 2px; }

/* ===== MODAL ===== */
.modal-bg {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: rise .2s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--good-soft); color: var(--good);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.modal-text { color: var(--mute); margin-bottom: 18px; }
.modal .kv-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; margin-bottom: 18px; }
.manage-link { margin-bottom: 18px; }
.manage-link .l { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.manage-link .row { display: flex; gap: 8px; }
.manage-link input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--surface-2); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--text); color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: rise .2s ease-out;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.toast.success .dot { background: #4ade80; }
.toast.error .dot { background: #f87171; }
.toast.info .dot { background: #60a5fa; }

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(255, 255, 255, .6);
  display: flex; align-items: center; justify-content: center;
}

/* ===== MISC ===== */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.link-box {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
.link-box .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--text-2); }

/* ===== DATE PICKER / TIME INPUT (European formats) ===== */
.dp { position: relative; display: inline-block; width: 100%; }
.date-other .dp, .reschedule-form .dp, .hours-row .dp { width: 150px; }
.dp-pop {
  position: absolute; z-index: 120; top: calc(100% + 6px); left: 0;
  width: 272px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: rise .12s ease-out;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 600; text-transform: capitalize; }
.dp-head button { width: 30px; height: 30px; border-radius: var(--radius-sm); font-size: 18px; color: var(--text-2); }
.dp-head button:hover { background: var(--surface-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { font-size: 11px; color: var(--faint); text-align: center; padding: 4px 0; font-weight: 600; }
.dp-grid button { height: 34px; border-radius: var(--radius-sm); font-size: 13px; font-variant-numeric: tabular-nums; }
.dp-grid button:hover:not(:disabled) { background: var(--surface-2); }
.dp-grid button.today { font-weight: 700; }
.dp-grid button.today:not(.sel):not(:disabled) { background: var(--accent); color: var(--accent-text); }
.dp-grid button.sel { background: var(--brand); color: #fff; }
.dp-grid button:disabled { color: var(--line-strong); }
.time-input { width: 90px; font-variant-numeric: tabular-nums; text-align: center; }
.field .time-input { width: 100%; text-align: left; }
.warn-text { color: var(--warn); font-weight: 550; }
.change-box { margin-bottom: 16px; }
.change-box .notice { flex-direction: column; gap: 12px; }
.change-box .form-actions { gap: 8px; }
.reschedule-form .time-input, .hours-intervals .time-input { width: 84px; }
.reschedule-form .dp-text { width: 150px; }

/* Checkbox rendered as a toggle pill (multi-select lists, e.g. staff services) */
.check-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.check-pill { position: relative; cursor: pointer; }
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 13.5px; font-weight: 550; background: var(--surface);
  transition: border-color .12s, background .12s;
}
.check-pill:hover span { border-color: var(--text); }
.check-pill input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); }
.check-pill input:focus-visible + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.list-row.is-off .list-title, .list-row.is-off .avatar { opacity: .55; }
.stat.clickable { cursor: pointer; transition: border-color .12s; }
.stat.clickable:hover { border-color: var(--line-strong); }

.toggle-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; line-height: 1.45; }
.toggle-row input { margin-top: 3px; flex-shrink: 0; }
.toggle-row:hover { border-color: var(--line-strong); }
