/* ============================================================
   Wellframe Clinic — Design tokens
   Palette: deep teal (trust) + coral (care/urgency) + warm sand bg
   Type: Fraunces (display, warmth) / Inter (body, clarity) / IBM Plex Mono (data)
   Signature: a continuing pulse-line (ECG trace) used as hero art & divider
   ============================================================ */
:root {
  --teal-900: #0b3d3a;
  --teal-700: #0f5c56;
  --teal-500: #17847a;
  --mint-100: #eef5f1;
  --sand-50: #faf7f1;
  --coral-500: #ff6b53;
  --coral-600: #e85138;
  --ink-900: #142420;
  --ink-600: #435650;
  --line: #dde6e0;
  --white: #ffffff;
  --warn-100: #fff3e0;
  --warn-600: #b5750a;
  --ok-100: #e6f6ee;
  --ok-600: #1a8a53;
  --bad-100: #fdeceb;
  --bad-600: #c8402c;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(11, 61, 58, 0.08);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, Segoe UI, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--sand-50);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .4em; line-height: 1.15; }
p { margin: 0 0 1em; color: var(--ink-600); }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--coral-500); outline-offset: 2px; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.eyebrow { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-500); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 100px; font-weight: 600; font-size: .95rem;
  border: 1.5px solid transparent; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--coral-500); color: #fff; box-shadow: 0 6px 18px rgba(255,107,83,.32); }
.btn-primary:hover { background: var(--coral-600); }
.btn-dark { background: var(--teal-900); color: #fff; }
.btn-dark:hover { background: var(--teal-700); }
.btn-outline { background: transparent; border-color: var(--teal-900); color: var(--teal-900); }
.btn-outline:hover { background: var(--teal-900); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .82rem; border-radius: 8px; }
.btn-danger { background: var(--bad-600); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; background: rgba(250,247,241,.9);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; max-width: 1160px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--teal-900); }
.brand-mark { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 30px; font-size: .92rem; font-weight: 500; }
.nav-links a { color: var(--ink-600); }
.nav-links a:hover { color: var(--teal-900); }
.nav-cta { display: flex; gap: 12px; align-items: center; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; }
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
}

/* ---------- Hero / pulse signature ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); color: var(--teal-900); }
.hero .lead { font-size: 1.1rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.pulse-wrap { background: var(--teal-900); border-radius: 24px; padding: 30px; position: relative; overflow: hidden; }
.pulse-wrap svg { width: 100%; height: auto; }
.pulse-line { stroke: var(--coral-500); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 500; stroke-dashoffset: 500; animation: draw 3.2s ease-in-out infinite; }
@keyframes draw { 0% { stroke-dashoffset: 500; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -500; } }
.pulse-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 18px; }
.pulse-stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 12px; text-align: center; }
.pulse-stat b { display: block; color: #fff; font-family: var(--font-display); font-size: 1.4rem; }
.pulse-stat span { font-size: .72rem; color: rgba(255,255,255,.65); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.divider-pulse { height: 26px; margin: 0 auto; display: block; opacity: .5; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-head { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--teal-900); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 540px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.service-card .icon { width: 46px; height: 46px; border-radius: 12px; background: var(--mint-100); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 14px; }

.doctor-card { text-align: center; }
.doctor-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--mint-100); color: var(--teal-700); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.5rem; margin: 0 auto 14px; }
.doctor-card .role { color: var(--teal-500); font-size: .85rem; font-weight: 600; }
.doctor-card .meta { font-size: .82rem; color: var(--ink-600); margin-top: 6px; }

.testimonial { background: var(--mint-100); }
.testimonial p { color: var(--ink-900); font-style: italic; }
.testimonial .who { font-weight: 600; color: var(--teal-900); font-style: normal; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; color: var(--teal-900); }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink-900);
}
input:focus, select:focus, textarea:focus { border-color: var(--teal-500); outline: none; }
textarea { resize: vertical; min-height: 90px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-card { max-width: 480px; margin: 0 auto; }
.form-card.wide { max-width: 640px; }
.form-msg { padding: 10px 14px; border-radius: 8px; font-size: .88rem; margin-bottom: 14px; }
.form-msg.error { background: var(--bad-100); color: var(--bad-600); }
.form-msg.success { background: var(--ok-100); color: var(--ok-600); }
.auth-shell { min-height: calc(100vh - 76px); display: flex; align-items: center; padding: 50px 0; }
.auth-switch { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--ink-600); }
.auth-switch a { color: var(--coral-600); font-weight: 600; }

/* ---------- Footer ---------- */
.footer { background: var(--teal-900); color: rgba(255,255,255,.75); padding: 52px 0 26px; margin-top: 40px; }
.footer h4 { color: #fff; font-family: var(--font-body); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.footer a { color: rgba(255,255,255,.7); font-size: .9rem; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 34px; padding-top: 20px; font-size: .8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Dashboard shell ---------- */
.dash-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--teal-900); color: rgba(255,255,255,.8); padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; padding: 0 8px 24px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: .9rem; font-weight: 500; margin-bottom: 4px; color: rgba(255,255,255,.75); }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: var(--coral-500); color: #fff; }
.side-section { padding: 18px 14px 6px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.4); }
.main { padding: 26px 32px 60px; max-width: 1280px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 1.5rem; color: var(--teal-900); margin: 0; }
.user-pill { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 100px; padding: 6px 14px 6px 6px; }
.user-pill .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--mint-100); color: var(--teal-700); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .sidebar .brand { padding: 6px 8px; width: 100%; }
}

/* ---------- Stat cards ---------- */
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .n { font-family: var(--font-display); font-size: 2rem; color: var(--teal-900); }
.stat-card .label { font-size: .82rem; color: var(--ink-600); font-weight: 600; }
.stat-card .tag { display: inline-block; margin-top: 8px; font-family: var(--font-mono); font-size: .68rem; padding: 3px 9px; border-radius: 100px; }
.tag-teal { background: var(--mint-100); color: var(--teal-700); }
.tag-coral { background: #ffe9e4; color: var(--coral-600); }

/* ---------- Tables ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th { text-align: left; background: var(--mint-100); color: var(--teal-900); font-weight: 700; padding: 12px 16px; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
tbody td { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-900); vertical-align: middle; }
tbody tr:hover { background: #fbfaf7; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px; gap: 12px; flex-wrap: wrap; }
.table-toolbar input, .table-toolbar select { max-width: 220px; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 100px; font-size: .74rem; font-weight: 700; }
.badge-pending { background: var(--warn-100); color: var(--warn-600); }
.badge-confirmed { background: #e6f0ff; color: #1857b0; }
.badge-completed { background: var(--ok-100); color: var(--ok-600); }
.badge-cancelled { background: var(--bad-100); color: var(--bad-600); }

.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .82rem; }
.icon-btn:hover { border-color: var(--teal-500); color: var(--teal-700); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-600); }
.empty-state .glyph { font-size: 2.4rem; margin-bottom: 10px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(11,61,58,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 28px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--ink-600); }

.toast-host { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--teal-900); color: #fff; padding: 13px 18px; border-radius: 10px; font-size: .88rem; box-shadow: var(--shadow); min-width: 220px; animation: slide-in .2s ease; }
.toast.error { background: var(--bad-600); }
.toast.success { background: var(--ok-600); }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab { padding: 10px 16px; font-size: .88rem; font-weight: 600; color: var(--ink-600); border-bottom: 2px solid transparent; }
.tab.active { color: var(--teal-900); border-color: var(--coral-500); }

.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.slot { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; font-size: .84rem; font-weight: 600; background: #fff; }
.slot.selected { border-color: var(--coral-500); background: #fff1ee; color: var(--coral-600); }
.slot.taken { opacity: .4; text-decoration: line-through; cursor: not-allowed; }

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.muted { color: var(--ink-600); font-size: .85rem; }
