/* Wendwell Health Advisors brand colors (from the logo) */
:root {
  --brand: #0b4f5c;       /* deep teal */
  --brand-dark: #073b45;
  --accent: #217a3c;      /* leaf green */
  --gold: #f2ae1c;        /* flame gold */
  --gold-dark: #8a6514;   /* "Health Advisors" gold-brown */
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1c2a2e;
  --muted: #5c6b6f;
  --border: #dde4e2;
  --danger: #c0392b;
  --radius: 12px;
  --serif: "Cinzel", "Trajan Pro", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------- Brand pieces ---------- */
/* The logo's emblem (tree + flame), cropped out of the full logo image. Set the width with --w. */
.emblem {
  --w: 48px;
  display: inline-block; flex: none;
  width: var(--w); height: calc(var(--w) * 0.73);
  background: url("../img/logo.webp") no-repeat;
  background-size: calc(var(--w) * 1.709) auto;
  background-position: calc(var(--w) * -0.35) calc(var(--w) * -0.046);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: .04em; color: var(--brand); }
.brand-sub { font-family: var(--serif); font-weight: 600; font-size: 10.5px; letter-spacing: .32em; color: var(--gold-dark); }
.gold-rule { height: 3px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--gold) 70% 100%); }
a { color: var(--brand); }
.hidden { display: none !important; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 8px; cursor: pointer;
  padding: 10px 16px; font-size: 15px; font-weight: 600;
  background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: transparent; color: var(--brand); border: 1px solid var(--border); }
.btn.secondary:hover { background: #eef3f8; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-size: 14px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=text], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.msg { margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.msg.error { background: #fdecea; color: var(--danger); }
.msg.ok { background: #e8f6ef; color: #1e7a52; }

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(circle at 85% 10%, rgba(242, 174, 28, .35), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(33, 122, 60, .35), transparent 45%),
    linear-gradient(160deg, #0b4f5c, #062f37);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 16px;
  padding: 26px 28px 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); border-top: 5px solid var(--gold);
}
.auth-logo { display: block; width: 100%; max-width: 300px; margin: 0 auto; }
.auth-tag { text-align: center; font-family: var(--serif); font-weight: 700; letter-spacing: .3em; color: var(--brand); font-size: 14px; margin-top: 2px; }
.auth-card h1 { font-size: 21px; margin: 22px 0 4px; color: var(--brand-dark); }
.auth-card p.sub { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.auth-foot { margin-top: 16px; text-align: center; }
.demo-banner {
  background: #fff7e6; color: #8a5a00; font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-top: 16px;
}

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.tab {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px;
  font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--gold); }
.topbar { box-shadow: 0 2px 10px rgba(11, 79, 92, .06); }

/* ---------- Home welcome banner ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 16px; margin-bottom: 20px;
  background:
    radial-gradient(circle at 92% 0%, rgba(242, 174, 28, .45), transparent 38%),
    radial-gradient(circle at 70% 130%, rgba(33, 122, 60, .5), transparent 45%),
    linear-gradient(120deg, #0b4f5c 0%, #0a4450 60%, #073b45 100%);
  color: #fff; display: flex; align-items: center; gap: 22px; padding: 22px 26px;
  border-bottom: 4px solid var(--gold);
}
.hero-badge { background: #fff; border-radius: 50%; width: 104px; height: 104px; display: grid; place-items: center; flex: none; box-shadow: 0 0 0 4px rgba(242, 174, 28, .6); }
.hero-badge .emblem { --w: 84px; }
.hero h1 { font-family: var(--serif); font-size: 26px; margin: 0; letter-spacing: .02em; }
.hero .hero-sub { color: #f7d27a; font-size: 15px; margin: 4px 0 0; }
.hero .hero-kicker { font-family: var(--serif); letter-spacing: .3em; font-size: 11px; color: #cfe3e6; margin-bottom: 4px; }
@media (max-width: 600px) {
  .hero { padding: 18px; gap: 14px; }
  .hero-badge { width: 72px; height: 72px; }
  .hero-badge .emblem { --w: 58px; }
  .hero h1 { font-size: 20px; }
}

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.page-title { font-size: 24px; margin: 0 0 4px; color: var(--brand-dark); }
.page-sub { color: var(--muted); margin: 0 0 20px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stat { font-size: 30px; font-weight: 700; color: var(--brand-dark); }
.stat-label { color: var(--muted); font-size: 14px; }

.lesson-card { cursor: pointer; transition: box-shadow .15s; }
.lesson-card:hover { box-shadow: 0 4px 16px rgba(20, 40, 70, .1); }
.lesson-num { font-size: 13px; color: var(--muted); font-weight: 600; }
.lesson-card h3 { margin: 4px 0 6px; font-size: 17px; }
.lesson-card p { margin: 0; color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: #e8f6ef; color: #1e7a52; margin-top: 10px;
}
.badge.todo { background: #eef1f6; color: var(--muted); }

.video-box { position: relative; padding-top: 56.25%; background: #0f1724; border-radius: var(--radius); overflow: hidden; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #c9d3e0; text-align: center; padding: 16px; }

.coming { text-align: center; padding: 48px 18px; color: var(--muted); }
.coming .big { font-size: 40px; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.list th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

.section-title { font-size: 17px; margin: 26px 0 10px; }
.card-title { margin: 0 0 8px; font-size: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }

/* Quiz */
fieldset.q { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.q legend { font-weight: 600; margin-bottom: 6px; }
label.choice {
  display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
label.choice:hover { background: #f3f7fb; }
ol.q-list { margin: 6px 0 0 18px; padding: 0; font-size: 14px; }
ol.q-list li { margin: 4px 0; }

/* Appointments */
.appt { margin-bottom: 12px; }
.appt-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.appt-head .badge { margin-top: 0; }
.appt-when { font-size: 13px; font-weight: 600; color: var(--brand); }
.appt-title { font-weight: 600; font-size: 16px; }
.appt-meta { font-size: 13px; color: var(--muted); }
.appt-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: flex-end; }
.appt-form label.mini { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.appt-form .f-notes-wrap { flex: 1 1 220px; }
.appt-form select, .appt-form input { min-width: 150px; }
.f-save { display: flex; align-items: center; gap: 8px; }
.appt-saved { font-size: 13px; color: #1e7a52; }
.appt-saved.bad { color: var(--danger); font-weight: 600; }
.appt.overdue { border-left: 4px solid var(--danger); }
.badge.blue { background: #e7f0fb; color: var(--brand); }
.badge.amber { background: #fff4e0; color: #9a6200; }

/* Teamup notes on an appointment */
.tu-info { margin-top: 10px; background: #f6f8fb; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.tu-head { font-weight: 600; font-size: 13px; color: var(--brand-dark); }
.tu-fields { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 14px; }
.tu-fields dt { color: var(--muted); font-weight: 600; }
.tu-fields dd { margin: 0; overflow-wrap: anywhere; }
.tu-notes { margin-top: 6px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Add-your-own deal */
.new-deal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0 8px; }
.appt.new-deal { border: 2px solid var(--brand); }
.del-deal { font-size: 13px; color: var(--danger); }
.del-deal.armed { font-weight: 700; }

/* Tracker charts */
.fn-row { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 10px; margin: 10px 0; font-size: 14px; }
.fn-label { color: var(--muted); }
.fn-track { background: #eef1f6; border-radius: 6px; height: 22px; overflow: hidden; }
.fn-bar { height: 100%; border-radius: 6px; min-width: 2px; background: var(--brand); }
.fn-bar.follow { background: #e0a020; }
.fn-bar.agree { background: #4d8fd6; }
.fn-bar.closed { background: var(--accent); }
.fn-val { text-align: right; }
.wk-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 6px; }
.wk { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.wk-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.wk-bar { width: 40%; max-width: 16px; min-height: 2px; border-radius: 3px 3px 0 0; }
.wk-bar.logged, .wk-legend i.logged { background: #b9cde3; }
.wk-bar.closed, .wk-legend i.closed { background: var(--accent); }
.wk-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.wk-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.wk-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 600px) { .fn-row { grid-template-columns: 110px 1fr 30px; font-size: 13px; } }

/* Admin Home: reps with appointments to update */
.needs-updates { margin-bottom: 16px; }
.nu-rep { padding: 10px 0; border-top: 1px solid var(--border); }
.nu-rep:first-of-type { border-top: 0; }
.nu-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nu-head .badge { margin-top: 0; }
.nu-list { margin: 6px 0 0 18px; padding: 0; font-size: 13px; color: var(--muted); }

/* Appointments: list / week / month */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.cal-toolbar select { width: auto; min-width: 170px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--brand); color: #fff; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .btn { padding: 6px 12px; }
.cal-title { font-weight: 700; margin-left: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cal-legend .chip { cursor: default; width: auto; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.cal-h { padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; background: #f3f6fa; border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 110px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal.week .cal-cell { min-height: 260px; }
.cal-cell.other { background: #fafbfc; }
.cal-cell.other .cal-date { color: #b3bbc8; }
.cal-cell.today { background: #f0f6fc; }
.cal-cell.today .cal-date { color: var(--brand); font-weight: 800; }
.cal-date { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.cal-dow { display: none; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 6px; font-size: 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--brand);
}
.chip.late { background: var(--danger); }
.chip.done { background: var(--accent); }
.chip.upcoming { background: var(--brand); }
.chip:hover { filter: brightness(1.1); }
.chip-time { font-weight: 700; }
.chip-rep {
  display: inline-block; background: rgba(255, 255, 255, .25); border-radius: 4px; padding: 0 4px; margin-right: 4px;
  font-weight: 700; font-size: 11px;
}
.assigned {
  display: inline-block; margin-top: 4px; font-size: 13px; color: var(--brand-dark);
  background: #fff6df; border: 1px solid #f3dc9c; border-radius: 99px; padding: 1px 10px;
}
.cal-more { border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; padding: 2px 4px; }
.cal.week .chip { white-space: normal; }

@media (max-width: 700px) {
  /* Week view stacks days on phones */
  .cal.week { grid-template-columns: 1fr; }
  .cal.week .cal-h { display: none; }
  .cal.week .cal-cell { min-height: 0; border-right: 0; }
  .cal.week .cal-dow { display: inline; }
  /* Month view shows colored bars without text on phones */
  .cal.month .cal-cell { min-height: 64px; padding: 3px; }
  .cal.month .chip { padding: 0; height: 8px; font-size: 0; }
  .cal-h { padding: 6px 2px; }
}

/* "You have appointments to update" banner */
.pending-banner { background: #fdecea; border-bottom: 1px solid #f5c6c0; }
.pending-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px; color: #8e2a1f; font-size: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.pending-inner .btn { padding: 6px 12px; font-size: 14px; background: var(--danger); }
.late { color: var(--danger) !important; }

/* Tracker */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters select { width: auto; min-width: 160px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid.stats .stat { font-size: 24px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 12px; }
.pill {
  border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 99px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.link-cell { min-width: 280px; }
.link-cell input { width: 170px; padding: 6px 8px; font-size: 13px; }
.link-cell .btn { padding: 6px 10px; font-size: 13px; }

@media (max-width: 700px) {
  .appt-form label.mini, .appt-form select, .appt-form input { width: 100%; }
}

.card { box-shadow: 0 1px 3px rgba(11, 79, 92, .05); }
.stat { color: var(--brand); }

@media (max-width: 600px) {
  .user-name { display: none; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 9px; }
  .page-title { font-size: 20px; }
  .auth-card { padding: 26px 18px; }
}
