/* ── Theme Variables ── */
:root {
  --bg: #f5f5f4;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #ffffff;
  --accent: #d45d2b;
  --accent-2: #2b6f77;
  --border: #e7e5e4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f131b;
  --ink: #eef3ff;
  --muted: #9aa6bd;
  --card: #161c27;
  --accent: #6b8dff;
  --accent-2: #4fc3ff;
  --border: #232d3f;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="ocean"] {
  --bg: #0c1929;
  --ink: #e0f0ff;
  --muted: #7ea8c9;
  --card: #112240;
  --accent: #64ffda;
  --accent-2: #57cbff;
  --border: #1d3a5c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="forest"] {
  --bg: #0d1a0f;
  --ink: #e5f2e7;
  --muted: #8aab8e;
  --card: #142318;
  --accent: #6fcf7c;
  --accent-2: #a8d86e;
  --border: #264a2d;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="sunset"] {
  --bg: #fef8f3;
  --ink: #2d1f14;
  --muted: #8a6d55;
  --card: #ffffff;
  --accent: #e85d26;
  --accent-2: #d4437a;
  --border: #f0dfd0;
  --shadow: 0 1px 3px rgba(180, 100, 50, 0.06), 0 4px 12px rgba(180, 100, 50, 0.06);
}

[data-theme="rose"] {
  --bg: #1a0f18;
  --ink: #f5e6f0;
  --muted: #b08da6;
  --card: #241a22;
  --accent: #f472b6;
  --accent-2: #c084fc;
  --border: #3d2a3a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="midnight"] {
  --bg: #09090b;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --card: #18181b;
  --accent: #a78bfa;
  --accent-2: #818cf8;
  --border: #27272a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="nord"] {
  --bg: #2e3440;
  --ink: #eceff4;
  --muted: #d8dee9;
  --card: #3b4252;
  --accent: #88c0d0;
  --accent-2: #81a1c1;
  --border: #4c566a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="lavender"] {
  --bg: #1e1b2e;
  --ink: #e8e0f0;
  --muted: #b8a9c9;
  --card: #2a2640;
  --accent: #c4b5fd;
  --accent-2: #a78bfa;
  --border: #3d3654;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="sage"] {
  --bg: #1a2421;
  --ink: #e5ebe8;
  --muted: #9bab9f;
  --card: #24302a;
  --accent: #7cb89a;
  --accent-2: #5d9b7b;
  --border: #2f4038;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="amethyst"] {
  --bg: #1a1625;
  --ink: #ede9f2;
  --muted: #a89bb8;
  --card: #252033;
  --accent: #b794f6;
  --accent-2: #9f7aea;
  --border: #3d3552;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="sand"] {
  --bg: #f5f0e8;
  --ink: #2c2825;
  --muted: #6b635b;
  --card: #ffffff;
  --accent: #c17f59;
  --accent-2: #8b6914;
  --border: #e5ddd2;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "SF Pro Display", -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Page Layout ── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 28px 80px;
}

/* ── Header ── */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand .logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.brand .titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ── */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:visited {
  color: var(--ink);
}

.button:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* ── Links Section ── */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.link-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.link-card:visited {
  color: var(--ink);
}

.link-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.link-card-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.link-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.link-icon-symbol {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  border-radius: 4px;
  background: color-mix(in oklab, var(--card) 70%, var(--accent) 30%);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.link-icon-placeholder {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.5;
}

.link-label {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.link-card:hover .link-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.links.links-icons-only {
  grid-template-columns: repeat(auto-fill, 48px) !important;
  justify-content: start;
  gap: 8px;
}

.links.links-icons-only .link-card {
  width: 48px;
  min-height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 12px;
}

.links.links-icons-only .link-card-inner {
  width: 100%;
  height: 100%;
  justify-content: center;
  gap: 0;
}

.links.links-icons-only .link-label,
.links.links-icons-only .link-arrow {
  display: none;
}

.links.links-icons-only .link-icon,
.links.links-icons-only .link-icon-symbol,
.links.links-icons-only .link-icon-placeholder {
  width: 22px;
  height: 22px;
}

.links.links-icons-only .link-icon-symbol {
  font-size: 18px;
}

.links.links-icons-only .link-icon-placeholder svg {
  width: 16px;
  height: 16px;
}

/* ── Widgets Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.widget {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  align-self: start;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.widget:hover {
  border-color: color-mix(in oklab, var(--border) 60%, var(--accent) 40%);
}

.widget header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.widget h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.widget iframe {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
}

.widget .embed {
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.widget iframe.auto-height,
.widget .embed.auto-height {
  transition: height 0.3s ease;
  min-height: 400px;
  /* Fallback for cross-origin iframes that don't resize */
}

/* ── Collapsible Widgets ── */
.widget-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in oklab, var(--border) 82%, var(--ink) 18%);
  border-radius: 8px;
  background: color-mix(in oklab, var(--card) 95%, var(--bg) 5%);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.widget-collapse-btn:hover {
  border-color: color-mix(in oklab, var(--accent) 48%, var(--border) 52%);
  background: color-mix(in oklab, var(--card) 90%, var(--accent) 10%);
  color: var(--ink);
}

.widget-collapse-btn svg {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.widget.is-collapsed .widget-collapse-btn svg {
  transform: rotate(-90deg);
}

.widget-body {
  display: contents;
}

.widget.is-collapsed .widget-body {
  display: none;
}

.widget.is-collapsed {
  min-height: auto;
  gap: 0;
  order: 999;
}

/* Widget title bar for custom widgets */
.widget-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.widget-title-bar h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Appointments header actions wrapper */
.appointments-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Editable widget title */
body.edit-mode .widget-title-bar h2 {
  cursor: text;
}

.widget-title-bar h2.is-editing {
  outline: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
  border-radius: 0;
}

/* Admin footer link */
.admin-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.admin-footer-link:hover {
  opacity: 1;
  color: var(--accent);
}

.admin-footer-link svg {
  opacity: 0.6;
}

/* Appointments widget */
.appointments-widget {
  min-height: 260px;
}

.appointments-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}

.appointments-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.appointments-heading {
  min-width: 0;
}

.appointments-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.appointments-nav-btn {
  border: 1px solid color-mix(in oklab, var(--border) 82%, var(--ink) 18%);
  border-radius: 8px;
  background: color-mix(in oklab, var(--card) 95%, var(--bg) 5%);
  color: color-mix(in oklab, var(--ink) 92%, var(--accent) 8%);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.appointments-nav-btn:hover {
  border-color: color-mix(in oklab, var(--accent) 48%, var(--border) 52%);
  background: color-mix(in oklab, var(--card) 90%, var(--accent) 10%);
  color: var(--ink);
}

.appointments-nav-btn.is-active {
  border-color: color-mix(in oklab, var(--accent) 56%, var(--border) 44%);
  background: color-mix(in oklab, var(--accent) 14%, var(--card) 86%);
}

.appointments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.appointments-time-group {
  --time-status: #3cb36c;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.appointments-time-group.is-past {
  --time-status: color-mix(in oklab, var(--muted) 88%, #9ca3af 12%);
}

.appointments-time-heading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  padding: 3px 9px;
  background: color-mix(in oklab, var(--time-status) 11%, transparent);
  width: fit-content;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: color-mix(in oklab, var(--time-status) 82%, var(--ink) 18%);
  margin-left: 2px;
}

.appointments-time-heading::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--time-status);
  flex-shrink: 0;
}

.appointments-time-group:not(.is-past) .appointments-time-heading::before {
  animation: appointment-pulse 2.4s ease-in-out infinite;
}

@keyframes appointment-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.appointments-time-items {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.appointments-item {
  position: relative;
  overflow: visible;
  border: 1px solid color-mix(in oklab, var(--border) 76%, var(--accent) 24%);
  border-radius: 8px;
  background:
    linear-gradient(150deg,
      color-mix(in oklab, var(--card) 97%, var(--bg) 3%) 0%,
      color-mix(in oklab, var(--card) 92%, var(--accent) 8%) 100%),
    radial-gradient(circle at 100% -20%,
      color-mix(in oklab, var(--accent) 18%, transparent) 0%,
      transparent 62%);
  padding: 10px 12px;
  box-shadow:
    0 5px 14px color-mix(in oklab, var(--accent) 8%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 color-mix(in oklab, #ffffff 38%, transparent);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.appointments-item.is-sms-open {
  z-index: 42;
}

.appointments-item.is-sms-feedback-open {
  z-index: 44;
}

.appointments-item::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg,
      color-mix(in oklab, var(--accent) 58%, var(--border) 42%) 0%,
      color-mix(in oklab, var(--accent) 22%, transparent) 45%,
      transparent 100%);
  opacity: 0.9;
}

.appointments-item::after {
  content: none;
}

.appointments-item:hover {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border) 55%);
  background:
    linear-gradient(150deg,
      color-mix(in oklab, var(--card) 95%, var(--bg) 5%) 0%,
      color-mix(in oklab, var(--card) 89%, var(--accent) 11%) 100%);
  transform: translateY(-1px);
  box-shadow:
    0 9px 20px color-mix(in oklab, var(--accent) 16%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 color-mix(in oklab, #ffffff 40%, transparent);
}

.appointments-item:focus-within {
  border-color: color-mix(in oklab, var(--accent) 52%, var(--border) 48%);
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--accent) 18%, transparent),
    0 9px 20px color-mix(in oklab, var(--accent) 14%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.06);
}

@keyframes appointment-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.appointments-item {
  animation: appointment-enter 0.35s ease-out both;
}

.appointments-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: color-mix(in oklab, var(--ink) 96%, var(--accent) 4%);
}

.appointments-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.appointments-identity {
  min-width: 0;
}

.appointments-group {
  color: color-mix(in oklab, var(--ink) 65%, var(--muted) 35%);
  font-size: 10.5px;
  margin-top: 2px;
  font-weight: 500;
}

.appointments-contact {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 66px;
  align-self: start;
}

.appointments-contact-icon {
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in oklab, var(--border) 62%, var(--ink) 38%);
  border-radius: 7px;
  background: color-mix(in oklab, var(--card) 90%, var(--bg) 10%);
  color: color-mix(in oklab, var(--ink) 97%, var(--accent) 3%);
  text-decoration: none;
  box-shadow: inset 0 1px 0 color-mix(in oklab, #ffffff 35%, transparent);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.appointments-contact-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  stroke-width: 2.15;
}

.appointments-contact-icon:hover {
  color: var(--ink);
  border-color: color-mix(in oklab, var(--accent) 65%, var(--border) 35%);
  background: color-mix(in oklab, var(--card) 82%, var(--accent) 18%);
  box-shadow: 0 1px 5px color-mix(in oklab, var(--accent) 14%, transparent);
  text-decoration: none;
}

.appointments-contact-icon--static {
  cursor: default;
}

.appointments-contact-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid color-mix(in oklab, var(--border) 72%, var(--ink) 28%);
  background: color-mix(in oklab, var(--card) 94%, var(--bg) 6%);
  color: color-mix(in oklab, var(--ink) 94%, var(--accent) 6%);
  font-size: 10.5px;
  font-weight: 600;
  box-shadow: 0 8px 18px color-mix(in oklab, var(--ink) 18%, transparent);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.appointments-contact-icon[data-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(45deg);
  opacity: 0;
  pointer-events: none;
  z-index: 49;
  border-left: 1px solid color-mix(in oklab, var(--border) 72%, var(--ink) 28%);
  border-top: 1px solid color-mix(in oklab, var(--border) 72%, var(--ink) 28%);
  background: color-mix(in oklab, var(--card) 94%, var(--bg) 6%);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.appointments-contact-icon[data-tooltip]:hover::after,
.appointments-contact-icon[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.appointments-contact-icon[data-tooltip]:hover::before,
.appointments-contact-icon[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) rotate(45deg);
}

.appointments-contact-icon.is-tooltip-open::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.appointments-contact-icon.is-tooltip-open::before {
  opacity: 1;
  transform: translateX(-50%) rotate(45deg);
}

.appointments-sms {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.appointments-sms.is-open {
  z-index: 35;
}

.appointments-sms-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 156px;
  max-width: min(188px, 60vw);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, var(--ink) 30%);
  background: color-mix(in oklab, var(--card) 96%, var(--bg) 4%);
  box-shadow:
    0 14px 28px color-mix(in oklab, var(--ink) 22%, transparent),
    0 2px 7px rgba(0, 0, 0, 0.08);
  padding: 6px;
  z-index: 130;
}

.appointments-sms-menu[hidden] {
  display: none;
}

.appointments-sms.is-open .appointments-sms-menu {
  display: flex;
}

.appointments-sms-option {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 520;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 7px 8px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.appointments-sms-option:hover,
.appointments-sms-option:focus-visible {
  outline: none;
  border-color: color-mix(in oklab, var(--accent) 46%, var(--border) 54%);
  background: color-mix(in oklab, var(--accent) 10%, var(--card) 90%);
}

.appointments-sms-feedback {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--border) 72%, var(--ink) 28%);
  background: color-mix(in oklab, var(--card) 96%, var(--bg) 4%);
  padding: 6px 8px;
  min-width: 140px;
  max-width: 220px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  color: color-mix(in oklab, var(--muted) 35%, var(--ink) 65%);
  box-shadow: 0 8px 18px color-mix(in oklab, var(--ink) 16%, transparent);
  z-index: 45;
  pointer-events: none;
}

.appointments-sms-feedback:not(:empty) {
  display: block;
}

.appointments-sms-feedback.is-success {
  border-color: color-mix(in oklab, #10b981 65%, var(--border) 35%);
  color: color-mix(in oklab, #10b981 72%, var(--ink) 28%);
}

.appointments-sms-feedback.is-error {
  border-color: color-mix(in oklab, #ef4444 65%, var(--border) 35%);
  color: color-mix(in oklab, #ef4444 72%, var(--ink) 28%);
}

.appointments-contact-na {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: color-mix(in oklab, var(--muted) 86%, var(--ink) 14%);
  border: 1px solid color-mix(in oklab, var(--border) 82%, var(--muted) 18%);
  border-radius: 8px;
  background: color-mix(in oklab, var(--card) 94%, var(--bg) 6%);
  padding: 4px 8px;
  line-height: 1;
  text-transform: uppercase;
}

.appointments-location {
  color: var(--muted);
  font-size: 11px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid color-mix(in oklab, var(--border) 52%, transparent);
  font-weight: 500;
}

.appointments-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in oklab, var(--border) 46%, transparent);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.appointments-pill {
  border: 1px solid color-mix(in oklab, var(--border) 75%, var(--accent) 25%);
  border-radius: 8px;
  background: color-mix(in oklab, var(--card) 92%, var(--bg) 8%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  min-width: 0;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.appointments-pill:hover {
  border-color: color-mix(in oklab, var(--border) 60%, var(--accent) 40%);
  background: color-mix(in oklab, var(--card) 88%, var(--accent) 12%);
}

.appointments-pill-label {
  color: color-mix(in oklab, var(--muted) 80%, var(--accent) 20%);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.appointments-pill-value,
.appointments-pill-link {
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.appointments-pill-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.appointments-pill-value,
.appointments-pill-link {
  word-break: break-word;
}

.appointments-empty {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  padding: 12px 0;
  text-align: center;
  font-style: italic;
}

.appointments-empty-detail {
  font-size: 11px;
  opacity: 0.85;
  padding-top: 0;
  font-style: normal;
}

@media (max-width: 640px) {
  .appointments-header {
    gap: 8px;
  }

  .appointments-nav {
    gap: 4px;
  }

  .appointments-nav-btn {
    padding: 6px 7px;
    font-size: 10px;
  }

  .appointments-contact-icon {
    width: 30px;
    height: 30px;
  }

  .appointments-contact-icon[data-tooltip]::after {
    max-width: 170px;
  }
}

@media (max-width: 900px),
(hover: none) and (pointer: coarse) {
  .appointments-sms-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    min-width: 0;
    max-width: none;
    max-height: 46vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 8px;
    gap: 6px;
    z-index: 210;
  }

  .appointments-sms-option {
    font-size: 12px;
    padding: 9px 10px;
  }

  .appointments-sms-feedback {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    min-width: 0;
    max-width: none;
    text-align: center;
    z-index: 220;
  }
}

@media (prefers-reduced-motion: reduce) {
  .appointments-item {
    animation: none;
  }

  .appointments-item,
  .appointments-contact-icon,
  .appointments-contact-na,
  .appointments-pill,
  .appointments-sms-option,
  .appointments-contact-icon[data-tooltip]::after,
  .appointments-contact-icon[data-tooltip]::before {
    transition: none;
  }
}

/* ── Footer ── */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ── Bottom Toolbar (fixed to bottom of page) ── */
.bottom-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  user-select: none;
  backdrop-filter: blur(12px);
  overflow: visible;
}

.bottom-toolbar .divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

/* ── Theme Picker (dropdown) ── */
.theme-picker-dropdown {
  position: relative;
  overflow: visible;
}

.theme-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-trigger:hover {
  border-color: var(--muted);
}

.theme-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 40%, transparent);
}

.theme-trigger-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.theme-trigger-label {
  min-width: 4ch;
}

.theme-trigger-chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.theme-picker-dropdown.is-open .theme-trigger-chevron {
  transform: rotate(180deg);
}

.theme-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  max-height: min(320px, 55vh);
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  color: #1c1917;
  border: 1px solid #e7e5e4;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 99999;
  pointer-events: none;
}

.theme-picker-dropdown.is-open .theme-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #1c1917;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.theme-option:hover {
  background: #f5f5f4;
}

.theme-option.active {
  background: #fef3c7;
  color: #1c1917;
}

.theme-option-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.theme-option-label {
  flex: 1;
}

/* ── Edit Mode ── */
.edit-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.edit-toggle-btn:hover {
  background: var(--border);
}

.edit-toggle-btn svg {
  width: 14px;
  height: 14px;
}

body.edit-mode .edit-toggle-btn {
  background: var(--accent);
  color: #fff;
}

/* Admin link in toolbar */
.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-link:hover {
  background: var(--border);
  color: var(--ink);
}

.admin-link svg {
  width: 12px;
  height: 12px;
}

/* Drag & drop states */
body.edit-mode .link-card,
body.edit-mode .widget {
  cursor: grab;
  position: relative;
}

body.edit-mode .link-card::before,
body.edit-mode .widget::before {
  content: "\2630";
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.5;
  pointer-events: none;
  z-index: 2;
}

body.edit-mode .link-card {
  pointer-events: auto;
}

body.edit-mode .link-card:hover {
  transform: none;
}

.dragging {
  opacity: 0.4;
  transform: scale(0.97) !important;
}

.drag-over {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 30%, transparent) !important;
}

body.edit-mode .widget iframe,
body.edit-mode .widget .embed {
  pointer-events: none;
}

body.edit-mode .appointments-widget {
  cursor: default;
}

body.edit-mode .appointments-widget::before {
  display: none;
}

/* Widget column spans */
.widget.span-2 {
  grid-column: span 2;
}

/* Resize handles - only visible in edit mode */
.resize-handle {
  display: none;
}

body.edit-mode .resize-handle {
  display: block;
  position: absolute;
}

body.edit-mode .resize-handle-bottom {
  bottom: 0;
  left: 0;
  right: 20px;
  height: 12px;
  background: linear-gradient(to bottom, transparent 0%, color-mix(in oklab, var(--accent) 20%, transparent) 100%);
  cursor: ns-resize;
  border-radius: 0 0 0 var(--radius);
}

body.edit-mode .resize-handle-corner {
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: color-mix(in oklab, var(--accent) 25%, transparent);
  cursor: nwse-resize;
  border-radius: 0 0 var(--radius) 0;
}

body.edit-mode .resize-handle-corner::after {
  content: "";
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid color-mix(in oklab, var(--accent) 60%, transparent);
  border-bottom: 2px solid color-mix(in oklab, var(--accent) 60%, transparent);
}

body.edit-mode .resize-handle:hover,
body.edit-mode .widget.resizing .resize-handle {
  background: color-mix(in oklab, var(--accent) 40%, transparent);
}

body.edit-mode .widget.resizing {
  user-select: none;
}

body.edit-mode .widget.resizing iframe,
body.edit-mode .widget.resizing .embed {
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .page {
    padding: 20px 16px 72px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand .logo {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }

  .links {
    grid-template-columns: 1fr;
  }

  .links.links-icons-only {
    grid-template-columns: repeat(auto-fill, 44px) !important;
    gap: 7px;
  }

  .links.links-icons-only .link-card {
    width: 44px;
    min-height: 44px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .bottom-toolbar {
    padding: 8px 12px;
  }

  .edit-bar {
    right: 8px;
    bottom: 8px;
  }
}