/* =========================================================
   HEYWHEN — CLEAN UI SYSTEM
   Fresh stylesheet. Functional IDs/classes preserved.
   ========================================================= */

:root {
  --coral: #ff7466;
  --coral-strong: #f85f52;
  --coral-soft: #fff0ed;
  --aqua: #bfeceb;
  --aqua-strong: #7dd7d2;
  --aqua-soft: #eefafa;
  --yellow: #f5c84c;
  --blue: #4d7cff;
  --ink: #252a31;
  --text: #353b44;
  --muted: #737d8b;
  --faint: #9ca4ae;
  --line: #e8e9ec;
  --line-strong: #d9dce1;
  --surface: #ffffff;
  --surface-soft: #f8f9fa;
  --page: #f7f7f8;
  --danger: #b42318;
  --success: #267a69;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 32, .04), 0 4px 14px rgba(20, 24, 32, .04);
  --shadow-md: 0 10px 30px rgba(20, 24, 32, .07);
  --shadow-lg: 0 22px 60px rgba(20, 24, 32, .10);
  --header-h: 72px;
  --content-w: 1120px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 116, 102, .12), transparent 34rem),
    radial-gradient(circle at 100% 10%, rgba(125, 215, 210, .08), transparent 30rem),
    var(--page);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden], .hw-hidden { display: none !important; }

/* ---------- APP / AUTH VISIBILITY ---------- */
body:not(.is-authed) #authView { display: flex; }
body:not(.is-authed) #appView { display: none !important; }
body.is-authed #authView { display: none !important; }
body.is-authed #appView { display: block !important; }
body.hw-noscroll { overflow: hidden; }

/* =========================================================
   HEADER
   ========================================================= */
.hw-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 2500;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(31, 41, 55, .07);
  backdrop-filter: blur(16px);
}
.hw-topbar__inner {
  width: min(var(--content-w), calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}
.hw-topbar__zone--left { justify-self: start; min-width: 0; }
.hw-topbar__zone--center { justify-self: center; }
.hw-topbar__zone--right { justify-self: end; }
.hw-brand { display: inline-flex; align-items: center; text-decoration: none; }
.hw-appbar__logo, .hw-logo { display: block; width: auto; height: 34px; }

.hw-tabs, .hw-tabs--topbar {
  display: inline-flex;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.hw-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--pill);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.hw-tab.is-active {
  color: var(--ink);
  background: var(--coral-soft);
  border-color: rgba(255,116,102,.24);
}

.hw-topbar__accountAnchor { position: relative; }
.hw-account {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--pill);
  min-height: 42px;
  padding: 5px 10px 5px 6px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20,24,32,.03);
}
.hw-account:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.hw-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--coral-soft);
  color: var(--ink);
  font-size: 11px; font-weight: 700;
}
.hw-account-meta { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.hw-account-name { font-size: 13px; font-weight: 650; color: var(--ink); }
.hw-account-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.hw-caret { font-size: 10px; color: var(--muted); }

.hw-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  z-index: 3000;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: var(--shadow-lg);
}
.hw-menu-meta { padding: 8px 10px 10px; }
.hw-menu-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.hw-menu-email, #accountEmail { font-size: 13px; font-weight: 600; color: var(--ink); word-break: break-word; }
.hw-menu-divider { height: 1px; background: var(--line); margin: 6px 0; }
.hw-menu-item {
  width: 100%; border: 0; background: transparent; border-radius: 10px;
  padding: 10px; text-align: left; cursor: pointer; font-size: 13px; font-weight: 550;
}
.hw-menu-item:hover { background: var(--surface-soft); }
.hw-menu-item.danger, .danger { color: var(--danger); }

/* =========================================================
   GLOBAL APP LAYOUT
   ========================================================= */
#appView {
  min-height: 100vh;
  padding: calc(var(--header-h) + 30px) 20px 48px;
}
.hw-screen { width: 100%; }
.hw-grid { width: min(900px, 100%); margin: 0 auto; }

.hw-hero { text-align: center; padding: 30px 0 22px; }
.hw-hero-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(29px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -.035em;
  font-weight: 700;
}
.hw-hero-sub {
  max-width: 580px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.hw-hero-cta { margin-top: 20px; }

/* Hide the list hero while plan detail/create/edit is visibly open. */
body:has(#planDetailCard:not([style*="display:none"]):not([style*="display: none"])) .hw-hero,
body:has(#createPlanCard:not([style*="display:none"]):not([style*="display: none"])) .hw-hero,
body:has(#editPlanCard:not([style*="display:none"]):not([style*="display: none"])) .hw-hero {
  display: none;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary, .primary-btn {
  appearance: none;
  border: 1px solid var(--coral);
  background: var(--coral);
  color: #fff;
  border-radius: var(--pill);
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary:hover, .primary-btn:hover { background: var(--coral-strong); border-color: var(--coral-strong); box-shadow: 0 7px 20px rgba(248,95,82,.20); transform: translateY(-1px); }
.btn-primary:active, .primary-btn:active { transform: none; }
.btn-primary:disabled, .primary-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-outline, .btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--pill);
  min-height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn-outline:hover, .btn:hover { background: var(--surface-soft); border-color: #cfd3d9; }
.btn-outline:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.hw-iconbtn {
  appearance: none; width: 34px; height: 34px; padding: 0; border: 0;
  border-radius: 50%; background: transparent; display: grid; place-items: center;
  cursor: pointer; font-size: 18px; color: var(--muted);
}
.hw-iconbtn:hover { background: var(--surface-soft); color: var(--ink); }

/* =========================================================
   GENERIC CARDS / TYPE / FORMS
   ========================================================= */
.card, .hw-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card { padding: 20px; }
.hw-card { padding: 20px; }
.hw-card-header, .hw-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.hw-card-header { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.hw-card-title, .card-title, .hw-title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -.015em;
  font-weight: 680;
}
.info, .hw-sub, .hw-card-sub { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.hw-small { font-size: 11.5px; }
.muted { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label, .ep-label, .hw-prompt-label { font-size: 12px; font-weight: 600; color: var(--text); }
.hw-input, .ep-input, #authForm input, #commentInput, .hw-invite-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.hw-input:focus, .ep-input:focus, #authForm input:focus, #commentInput:focus, .hw-invite-row input:focus {
  border-color: rgba(255,116,102,.75);
  box-shadow: 0 0 0 3px rgba(255,116,102,.12);
}
textarea.hw-input, textarea.ep-input, #commentInput { resize: vertical; line-height: 1.5; }
.row, .hw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.error, .ep-error {
  color: var(--danger); background: #fff5f4; border: 1px solid #ffd7d2;
  border-radius: 12px; padding: 10px 12px; font-size: 12px;
}

/* =========================================================
   PLAN LIST
   ========================================================= */
#plansCard > .card { padding: 8px; border-radius: 22px; box-shadow: var(--shadow-md); }
#activePlansCard .hw-card-header { padding: 14px 14px 16px; }
.plans-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.plans-list > li {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
}
.plans-list > li:hover { background: var(--surface-soft); }
.plans-list > li.is-owned { background: #fffaf9; }
.plan-name, .hw-plan-name { color: var(--ink); font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.plan-meta, .hw-plan-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.plan-actions, .hw-plan-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.hw-plan-left { min-width: 0; flex: 1; }
.plan-badge {
  display: inline-flex; align-items: center; height: 25px; padding: 0 9px;
  border-radius: var(--pill); font-size: 10.5px; font-weight: 650;
}
.badge-locked { background: #eaf8f4; color: var(--success); }
.badge-new { background: var(--coral-soft); color: #b5483f; }
.badge-ready { background: var(--aqua-soft); color: #297b78; }
.badge-waiting { background: #f4f4f5; color: var(--muted); }
.plans-group { margin-top: 14px; }
.plans-group-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; }
.plans-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; color: var(--muted); }
.plans-group-count { font-size: 11px; color: var(--muted); }

/* =========================================================
   CREATE PLAN
   ========================================================= */
#createPlanCard, #privatePlanCard, #editPlanCard {
  width: min(760px, 100%);
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.hw-inline-prompt {
  background: var(--coral-soft); border: 1px solid rgba(255,116,102,.18);
  border-radius: 14px; padding: 14px; margin-bottom: 16px;
}
.hw-prompt-note { color: var(--muted); font-size: 11.5px; margin: 2px 0 10px; }
.hw-prompt-row { display: flex; gap: 8px; align-items: center; }
.hw-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.hw-seg-btn {
  appearance: none; text-align: left; padding: 14px; border: 1px solid var(--line);
  border-radius: 14px; background: #fff; cursor: pointer;
}
.hw-seg-btn:hover { border-color: var(--line-strong); }
.hw-seg-btn.is-selected { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,116,102,.10); background: #fffaf9; }
.hw-seg-title { color: var(--ink); font-size: 13px; font-weight: 650; }
.hw-seg-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.hw-pillrow, .hw-chiprow, .hw-preview__chips { display: flex; gap: 7px; flex-wrap: wrap; }
.hw-pill, .hw-chip, .hw-chip-preview {
  border: 1px solid var(--line-strong); background: #fff; border-radius: var(--pill);
  min-height: 32px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
}
.hw-pill.selected, .hw-pill.is-selected { background: var(--coral-soft); border-color: rgba(255,116,102,.45); }
.hw-chip-x { cursor: pointer; opacity: .65; }
.hw-preview { margin: 18px 0; padding: 14px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--line); }
.hw-preview__title { color: var(--ink); font-size: 14px; font-weight: 650; }
.hw-preview__line { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* =========================================================
   PLAN DETAIL — CORE COMPOSITION
   ========================================================= */
#planDetailCard {
  width: min(var(--content-w), 100%);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
}
#planDetailCard .hw-plan-body {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(290px, .9fr);
  grid-template-areas:
    "overview overview"
    "availability side";
  align-items: start;
  gap: 16px;
}
#planOverviewCard { grid-area: overview; }
#availabilityCard { grid-area: availability; }
.hw-plan-side { grid-area: side; display: grid; gap: 16px; align-content: start; }

#planDetailCard .hw-card {
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow-sm);
}

/* Plan summary */
#planOverviewCard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 24px;
  row-gap: 16px;
}
#planOverviewCard > .hw-card-head { grid-column: 1 / -1; margin: 0; }
#planOverviewCard .hw-card-head-left { min-width: 0; }
#planDetailTitle { font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -.025em; color: var(--ink); }
#planOverviewCard .hw-card-sub { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
#planDetailRange { font-size: 12.5px; color: var(--muted); }
#planDetailNote { margin-top: 10px; font-size: 14px; color: var(--text); }
#planOverviewCard .hw-card-head-right { display: flex; align-items: flex-start; gap: 6px; position: relative; }
#btnReviewAvailability { display: none !important; }

/* Previous date ranges become quiet history text, not pills. */
#planDetailPreviousRanges { margin-top: 1px; }
.prev-range-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.prev-range-list::before {
  content: "Previous:";
  color: var(--faint);
  font-size: 11px;
}
.prev-range-item { margin: 0; padding: 0; }
.prev-range-item::marker { content: ""; }
.prev-range-pill {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 450;
  line-height: 1.4;
  cursor: default;
  text-decoration: none;
}
.prev-range-pill:hover { color: var(--muted); }
.prev-range-tooltip, .bestmatch-tooltip {
  position: fixed; z-index: 4000; max-width: 260px; padding: 8px 10px;
  border-radius: 9px; background: #20242a; color: #fff; font-size: 11px;
  box-shadow: var(--shadow-md); pointer-events: none;
}

/* Confirmed state is a distinct success strip */
#planConfirmedPanel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  grid-template-areas:
    "badge when actions"
    "badge guests actions"
    "badge note actions";
  align-items: center;
  gap: 2px 16px;
  padding: 16px 18px;
  border: 1px solid #dbeee8;
  border-radius: 15px;
  background: linear-gradient(135deg, #f1fbf8, #fbfefd);
}
#planConfirmedPanel[style*="display:none"], #planConfirmedPanel[style*="display: none"] { display: none !important; }
.hw-confirmed-badge {
  grid-area: badge;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-right: 16px;
  border-right: 1px solid #dbeee8;
  color: var(--success);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.hw-confirmed-when { grid-area: when; color: var(--ink); font-size: 16px; font-weight: 680; line-height: 1.25; }
.hw-confirmed-guests { grid-area: guests; color: var(--muted); font-size: 12px; }
.hw-confirmed-note { grid-area: note; margin-top: 3px; color: var(--text); font-size: 12px; }
.hw-confirmed-actions { grid-area: actions; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.hw-confirmed-actions .btn-primary { min-height: 36px; }
.hw-confirmed-actions .btn-outline { min-height: 34px; }

/* =========================================================
   AVAILABILITY
   ========================================================= */
#availabilityCard { min-height: 0; overflow: visible; }
#availabilityCard .hw-card-head { margin-bottom: 16px; }
#availabilityCard .hw-card-title { font-size: 18px; }
#availabilityCard .info { margin-top: 3px; font-size: 12px; color: var(--muted); }
.availability-legend {
  margin-top: 5px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.4;
}
.hw-inline-actions { display: flex; align-items: center; gap: 8px; }
.hw-chatbtn, .hw-chatdock {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: var(--pill); min-height: 34px; padding: 0 11px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.hw-chatbtn:hover, .hw-chatdock:hover { background: var(--surface-soft); }
.hw-chatcount { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; background: var(--coral); color: #fff; font-size: 9px; }

.hw-callout {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid #ffd8d3;
  background: #fff6f4;
  color: #7e4c46;
  font-size: 11.5px;
}

#availabilityGrid { width: 100%; }
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap: 8px;
  margin-bottom: 7px;
  padding: 0 2px;
}
.calendar-header > div {
  text-align: center;
  font-size: 10px;
  font-weight: 650;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.avail-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap: 8px;
}
.avail-cell {
  position: relative;
  min-width: 0;
  min-height: 106px;
}
.avail-cell.empty-cell { background: transparent; }
.avail-cell.avail-day {
  padding: 11px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.avail-cell.avail-day:hover { border-color: #d9dde2; box-shadow: 0 4px 16px rgba(20,24,32,.05); }
.avail-cell.avail-day:has(.avail-slot.is-on) { border-color: rgba(125,215,210,.75); background: #fbffff; }
.avail-cell.avail-day.is-full { background: var(--aqua-soft); border-color: var(--aqua-strong); }
.avail-day-head {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 11px;
  padding: 2px 12px 0 0;
  outline: none;
}
.avail-day-name { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.avail-day-num { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.avail-day-month { font-size: 10.5px; font-weight: 550; color: var(--muted); }
.avail-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.avail-slot {
  appearance: none;
  height: 29px;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 650;
}
.avail-slot:hover { background: #f1f2f4; }
.avail-slot.is-on { background: #fff; border-color: var(--coral); color: var(--coral-strong); box-shadow: inset 0 0 0 1px rgba(255,116,102,.05); }
.avail-cell.is-full .avail-slot.is-on { background: #fff; border-color: rgba(38,122,105,.25); color: var(--success); }
.avail-star {
  appearance: none;
  position: absolute;
  top: 8px; right: 8px;
  width: 20px; height: 20px; padding: 0;
  border: 0; background: transparent;
  color: #d8dadd;
  opacity: 0;
  transform: scale(.85);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: opacity .15s ease, color .15s ease, transform .15s ease;
}
.avail-star.is-visible { opacity: 1; transform: scale(1); }
.avail-star.is-on { color: var(--yellow); }
.new-date-dot {
  position: absolute;
  width: 7px; height: 7px; border-radius: 50%;
  top: 9px; right: 9px;
  background: var(--coral);
  box-shadow: 0 0 0 3px #fff;
}
.avail-cell:has(.avail-star.is-visible) .new-date-dot { right: 31px; }
.hw-primary-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
#availabilitySaveInfo { margin-top: 8px; }

/* =========================================================
   PEOPLE / BEST MATCHES
   ========================================================= */
#peopleCard, #bestMatchesCard { padding: 18px; }
#peopleCard .hw-card-head, #bestMatchesCard .hw-card-head { margin-bottom: 13px; }
.participants-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.participant-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--surface-soft);
}
.participant-name { color: var(--ink); font-size: 12.5px; font-weight: 620; }
.participant-meta { color: var(--muted); font-size: 11.5px; }

#bestMatchesInfo { margin-bottom: 11px; }
.best-match, .best-match-item, #bestMatchesList > li {
  list-style: none;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.best-match-title { color: var(--ink); font-size: 12.5px; font-weight: 650; }
.best-match-meta, .best-match-details { margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.best-match-actions { margin-top: 8px; }
.best-match-choose { min-height: 30px; padding: 0 10px; font-size: 11px; }

/* =========================================================
   CHAT
   ========================================================= */
.hw-chatdock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1800;
  box-shadow: var(--shadow-md);
}
.hw-chatpanel {
  position: fixed;
  right: 18px;
  bottom: 68px;
  width: min(370px, calc(100vw - 36px));
  max-height: 70vh;
  z-index: 2600;
  overflow: hidden;
  box-shadow: var(--shadow-lg) !important;
}
.hw-chatpanel.is-collapsed { display: none !important; }
#hwChatPanel #commentsList { max-height: 330px; overflow: auto; margin-top: 12px; }
.comment-item { padding: 10px 11px; border-radius: 12px; background: var(--surface-soft); }
.comment-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.comment-author { color: var(--ink); font-size: 11.5px; font-weight: 650; }
.comment-time { color: var(--faint); font-size: 10px; }
.comment-body { color: var(--text); font-size: 12.5px; line-height: 1.45; }

/* =========================================================
   SHEETS / MODALS
   ========================================================= */
.hw-sheet, .hw-sheetbackdrop {
  position: fixed;
  inset: 0;
}
.hw-sheet {
  z-index: 2800;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22,27,34,.28);
  backdrop-filter: blur(5px);
}
.hw-sheetbackdrop { z-index: 2550; background: rgba(22,27,34,.22); }
.hw-sheet-card {
  width: min(500px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.65);
}
.hw-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.hw-sheet-title { color: var(--ink); font-size: 16px; font-weight: 680; }
.hw-sheet-body { padding: 18px; }
.hw-sheet-section { display: grid; gap: 8px; }
.hw-sheet-label { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.hw-sheet-divider { height: 1px; background: var(--line); margin: 16px 0; }
.hw-invite-row { display: flex; gap: 8px; }
.hw-linkbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 39px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-soft); text-decoration: none;
  font-size: 12px; font-weight: 600;
}
.hw-confirm-sheet-preview { padding: 13px; border-radius: 13px; background: var(--surface-soft); }
.hw-confirm-sheet-label { color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.hw-confirm-sheet-choice { margin-top: 4px; color: var(--ink); font-size: 15px; font-weight: 650; }
.hw-confirm-sheet-guests { margin-top: 3px; color: var(--muted); font-size: 12px; }
.hw-confirm-sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* =========================================================
   EDIT PLAN
   ========================================================= */
.ep-screen { padding: 0; }
.ep-sheet { background: #fff; border-radius: inherit; overflow: hidden; }
.ep-handle { display: none; }
.ep-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ep-title { color: var(--ink); font-size: 17px; font-weight: 680; }
.ep-close { appearance: none; border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; }
.ep-close:hover { background: var(--surface-soft); }
.ep-body { padding: 20px; }
.ep-field { margin-bottom: 15px; }
.ep-label { display: block; margin-bottom: 6px; }
.ep-optional { color: var(--faint); font-weight: 450; }
.ep-daterow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.ep-datearrow { color: var(--faint); }
.ep-days { display: flex; gap: 7px; flex-wrap: wrap; }
.ep-day { appearance: none; min-width: 45px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--pill); background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; }
.ep-day--on { background: var(--coral-soft); border-color: rgba(255,116,102,.5); color: #a9453c; }
.ep-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* =========================================================
   AUTH
   ========================================================= */
.shell.shell--auth { min-height: 100vh; width: 100%; }
.hw-authSplit {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 480px);
  background: #fff;
}
.panel-visual {
  padding: 70px;
  display: flex;
  align-items: center;
  background: linear-gradient(145deg, #ff7b6d, #ff9a86);
  color: #fff;
}
.visual-copy { max-width: 440px; }
.visual-eyebrow { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.visual-title { margin: 10px 0 12px; font-size: clamp(34px, 5vw, 54px); line-height: 1.05; letter-spacing: -.04em; font-weight: 700; }
.visual-subtitle { margin: 0; font-size: 15px; opacity: .9; }
.panel-form { padding: 54px; display: flex; flex-direction: column; justify-content: center; }
.welcome-title { margin: 0; color: var(--ink); font-size: 28px; letter-spacing: -.025em; font-weight: 700; }
.welcome-subtitle { margin: 6px 0 24px; color: var(--muted); font-size: 13px; }
#authForm { display: grid; gap: 2px; }
.input-shell { border: 0; padding: 0; }
.input-icon { display: none; }
.field-extra { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; }
.remember { display: inline-flex; align-items: center; gap: 6px; }
.field-extra a, .footnote a { color: var(--coral-strong); text-decoration: none; }
.footnote { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 11.5px; }

/* =========================================================
   FOOTER / MISC
   ========================================================= */
.hw-plan-detail-footer { display: flex; justify-content: center; padding: 18px 0 0; }
#btnBackToPlans { min-width: 160px; }
.tag { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: var(--pill); font-size: 10.5px; font-weight: 650; }
.tag-orange { background: var(--coral-soft); color: #a9453c; }
#planArchivedInfo, #inviteRevokedInfo, #planShareInfo { margin-top: 8px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 980px) {
  #planDetailCard .hw-plan-body {
    grid-template-columns: 1fr;
    grid-template-areas: "overview" "availability" "side";
  }
  .hw-plan-side { grid-template-columns: 1fr 1fr; }
  .avail-cell { min-height: 98px; }
}

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .hw-topbar__inner { width: calc(100% - 24px); grid-template-columns: 1fr auto; }
  .hw-topbar__zone--center { display: none; }
  .hw-account-sub { display: none; }
  .hw-account-name { max-width: 90px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hw-appbar__logo, .hw-logo { height: 30px; }
  #appView { padding: calc(var(--header-h) + 18px) 12px 30px; }
  .hw-hero { padding-top: 20px; }
  #planOverviewCard { grid-template-columns: 1fr auto; }
  #planConfirmedPanel {
    grid-template-columns: 1fr;
    grid-template-areas: "badge" "when" "guests" "note" "actions";
    gap: 5px;
  }
  .hw-confirmed-badge { align-self: auto; border-right: 0; padding: 0; }
  .hw-confirmed-actions { justify-content: flex-start; margin-top: 8px; }
  .hw-plan-side { grid-template-columns: 1fr; }

  .calendar-header { display: none; }
  .avail-grid { grid-template-columns: 1fr; gap: 7px; }
  .avail-cell.empty-cell { display: none; }
  .avail-cell.avail-day {
    min-height: 0;
    padding: 11px 12px;
    display: grid;
    grid-template-columns: minmax(105px, 1fr) minmax(145px, 1.2fr);
    align-items: center;
    gap: 12px;
  }
  .avail-day-head { justify-content: flex-start; margin: 0; padding: 0 24px 0 0; }
  .avail-day-name { font-size: 11px; }
  .avail-day-num { font-size: 15px; }
  .avail-day-month { font-size: 11px; }
  .avail-slots { gap: 5px; }
  .avail-star { top: 50%; right: 12px; transform: translateY(-50%) scale(.85); }
  .avail-star.is-visible { transform: translateY(-50%) scale(1); }
  .new-date-dot { top: 10px; right: 10px; }
  .avail-cell:has(.avail-star.is-visible) .new-date-dot { right: 10px; }

  .hw-seg { grid-template-columns: 1fr; }
  .hw-prompt-row, .hw-invite-row { flex-direction: column; align-items: stretch; }
  .hw-authSplit { grid-template-columns: 1fr; }
  .panel-visual { display: none; }
  .panel-form { min-height: 100vh; padding: 34px 24px; }
}

@media (max-width: 520px) {
  .hw-account-meta { display: none; }
  .hw-account { padding-right: 6px; }
  .hw-caret { display: none; }
  #planDetailCard .hw-card, .card { padding: 16px; border-radius: 16px; }
  #planOverviewCard { grid-template-columns: 1fr auto; gap: 12px; }
  #planDetailTitle { font-size: 21px; }
  .hw-confirmed-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .hw-confirmed-actions .btn-primary { grid-column: 1 / -1; }
  .hw-primary-actions { flex-direction: column; align-items: stretch; }
  .hw-primary-actions .btn-primary, .hw-primary-actions .btn-outline { width: 100%; }
  .plans-list > li { align-items: flex-start; }
  .plan-actions { flex-direction: column; align-items: flex-end; }
  .footnote { flex-direction: column; }
}


/* =========================================================
   DYNAMIC AVAILABILITY CARD HEIGHT
   Keep the availability panel only as tall as its rendered
   date range/content. It will naturally grow as more calendar
   rows are generated and shrink when there are fewer dates.
   ========================================================= */

#planDetailCard .hw-plan-body {
  align-items: start;
}

#availabilityCard {
  align-self: start;
  height: fit-content;
  min-height: 0;
}

/* Keep the side column independent so neither column forces
   the other one to match its height. */
#planDetailCard .hw-plan-side {
  align-self: start;
  height: fit-content;
}

/* The grid itself grows only with the calendar rows that exist. */
#availabilityGrid,
#availabilityGrid .avail-grid {
  height: auto;
  min-height: 0;
  align-content: start;
}

/* =========================================================
   CANDIDATE-DATES AVAILABILITY LAYOUT
   The JS now renders only actual selectable dates, so there
   are no blank calendar weeks between dates in a long range.
   ========================================================= */
#availabilityGrid .calendar-header { display: none !important; }

#availabilityGrid .avail-grid--candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(102px, 1fr));
  gap: 8px;
  align-items: start;
  align-content: start;
}

#availabilityGrid .avail-grid--candidates .avail-cell {
  min-height: 106px;
}

@media (max-width: 760px) {
  #availabilityGrid .avail-grid--candidates {
    grid-template-columns: 1fr;
  }

  #availabilityGrid .avail-grid--candidates .avail-cell.avail-day {
    min-height: 0;
  }
}

/* =========================================================
   CANDIDATE DATE ORIENTATION
   Strong weekday labels + week separators make the free-flowing
   candidate view easy to scan without restoring empty calendar cells.
   ========================================================= */

#availabilityGrid .availability-week-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0 1px;
  color: var(--muted);
}

#availabilityGrid .availability-week-divider:first-child {
  margin-top: 0;
}

#availabilityGrid .availability-week-divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: var(--line);
}

#availabilityGrid .availability-week-label {
  flex: 0 0 auto;
  font-size: 10.5px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: .035em;
  color: var(--muted);
}

/* Put the weekday on its own visual line inside every date card. */
#availabilityGrid .avail-grid--candidates .avail-day-head {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "weekday weekday"
    "day month";
  justify-content: start;
  align-items: baseline;
  column-gap: 4px;
  row-gap: 5px;
  margin-bottom: 11px;
  padding: 0 22px 0 0;
  text-align: left;
}

#availabilityGrid .avail-grid--candidates .avail-day-name {
  grid-area: weekday;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--aqua-soft);
  color: #347c78;
  font-size: 9.5px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
}

#availabilityGrid .avail-grid--candidates .avail-day-num {
  grid-area: day;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
}

#availabilityGrid .avail-grid--candidates .avail-day-month {
  grid-area: month;
  font-size: 11px;
  line-height: 1;
  font-weight: 550;
  color: var(--muted);
}

@media (max-width: 760px) {
  #availabilityGrid .availability-week-divider {
    margin-top: 12px;
  }

  #availabilityGrid .avail-grid--candidates .avail-day-head {
    margin: 0;
    padding: 0 28px 0 0;
    min-width: 105px;
  }

  #availabilityGrid .avail-grid--candidates .avail-day-name {
    font-size: 9px;
    padding: 3px 6px;
  }

  #availabilityGrid .avail-grid--candidates .avail-day-num {
    font-size: 17px;
  }
}


/* =========================================================
   REPEATING WEEKDAY — COMPACT DESKTOP MODE
   Example: one Friday per week across several weeks.
   Desktop/tablet shows a compact flowing row; phone keeps
   the week-grouped vertical presentation.
   ========================================================= */

#availabilityGrid .availability-pattern-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .01em;
}

@media (min-width: 761px) {
  #availabilityGrid .availability-candidates.is-repeating-weekday
  .avail-grid--candidates.is-repeating-weekday {
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    gap: 9px;
  }

  /* Week context is redundant when every candidate is the same weekday. */
  #availabilityGrid .availability-candidates.is-repeating-weekday
  .availability-week-divider {
    display: none;
  }

  #availabilityGrid .availability-candidates.is-repeating-weekday
  .avail-cell.avail-day {
    min-height: 112px;
  }
}

@media (max-width: 760px) {
  /* On phones the grouped list already scans well, so suppress
     the desktop-only summary and retain the week separators. */
  #availabilityGrid .availability-candidates.is-repeating-weekday
  .availability-pattern-summary {
    display: none;
  }

  #availabilityGrid .availability-candidates.is-repeating-weekday
  .availability-week-divider {
    display: flex;
  }
}


/* =========================================================
   PLAN LIST — CLEARER CARD SEPARATION
   ========================================================= */

.plans-list {
  gap: 8px;
}

.plans-list > li {
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(37, 42, 49, .065);
  box-shadow: 0 1px 2px rgba(20, 24, 32, .025);
  cursor: pointer;
  transition:
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}

/* Keep owned plans subtly warm without blending into one block. */
.plans-list > li.is-owned {
  background: rgba(255, 250, 249, .88);
  border-color: rgba(255, 116, 102, .08);
}

@media (hover: hover) and (pointer: fine) {
  .plans-list > li:hover {
    background: #fff;
    border-color: rgba(37, 42, 49, .12);
    box-shadow: 0 7px 20px rgba(20, 24, 32, .055);
    transform: translateY(-1px);
  }

  .plans-list > li.is-owned:hover {
    background: #fffdfc;
    border-color: rgba(255, 116, 102, .18);
  }
}

.plans-list > li:focus-visible {
  outline: 3px solid rgba(255, 116, 102, .18);
  outline-offset: 2px;
  border-color: rgba(255, 116, 102, .45);
}

/* The row is now the primary tap target; keep Open visually secondary. */
.plans-list .plan-actions .btn-outline,
.plans-list .hw-plan-right .btn-outline {
  background: rgba(255,255,255,.82);
}

@media (max-width: 760px) {
  .plans-list {
    gap: 7px;
  }

  .plans-list > li {
    min-height: 76px;
    padding: 14px;
  }
}


/* =========================================================
   CREATE PLAN — FINAL POLISH
   ========================================================= */

/* Specific dates: keep the date field + Add action on one line on desktop. */
#planSpecificDatesSection .field > .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
}

#planSpecificDatesSection .field > .row .hw-input {
  min-width: 0;
}

#planSpecificDatesSection #btnAddSpecificDate {
  min-width: 72px;
  align-self: stretch;
}

/* Preview should read as a calm summary, not another set of controls. */
.hw-preview {
  background: rgba(248, 249, 250, .78);
  border-color: rgba(37, 42, 49, .055);
}

.hw-preview__chips {
  margin-top: 9px;
  gap: 6px;
}

.hw-chip-preview {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  background: rgba(37, 42, 49, .045);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 560;
  box-shadow: none;
}

.hw-chip-preview.warm {
  background: rgba(255, 116, 102, .085);
  color: #8f4f49;
}

.hw-chip-preview.good {
  background: rgba(125, 215, 210, .13);
  color: #36736f;
}

@media (max-width: 760px) {
  #planSpecificDatesSection .field > .row {
    grid-template-columns: 1fr;
  }

  #planSpecificDatesSection #btnAddSpecificDate {
    width: fit-content;
    min-width: 72px;
    min-height: 42px;
  }
}


/* =========================================================
   INVITE EXPERIENCE — POLISHED
   Primary = share link. Email-locked invite is secondary.
   ========================================================= */

#inviteSheet .hw-sheet-card {
  width: min(540px, 100%);
}

#inviteSheet .hw-sheet-head {
  padding: 20px 22px 16px;
}

#inviteSheet .hw-sheet-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.015em;
}

#inviteSheet .hw-sheet-body {
  padding: 20px 22px 22px;
}

#inviteSheet .hw-invite-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#inviteSheet .hw-sheet-section {
  gap: 9px;
}

#inviteSheet .hw-sheet-section--share {
  order: 1;
  padding: 16px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--coral-soft), rgba(255,255,255,.85));
  border: 1px solid rgba(255,116,102,.14);
}

#inviteSheet .hw-sheet-section--email {
  order: 3;
}

#inviteSheet .hw-sheet-divider {
  order: 2;
  margin: 17px 0;
  position: relative;
  overflow: visible;
}

#inviteSheet .hw-sheet-divider::after {
  content: "or invite by email";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0 10px;
  background: #fff;
  color: var(--faint);
  font-size: 10.5px;
  white-space: nowrap;
}

#inviteSheet .hw-sheet-section--email .hw-sheet-label {
  display: none;
}

#inviteSheet .hw-sheet-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

#inviteSheet .hw-share-note {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

#inviteSheet .hw-linkbtn {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--coral);
  border-radius: var(--pill);
  background: var(--coral);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

@media (hover: hover) and (pointer: fine) {
  #inviteSheet .hw-linkbtn:hover {
    background: var(--coral-strong);
    border-color: var(--coral-strong);
    box-shadow: 0 7px 20px rgba(248,95,82,.18);
    transform: translateY(-1px);
  }
}

#inviteSheet .hw-linkbtn.is-success {
  background: #eaf8f4;
  border-color: #cfe9e1;
  color: var(--success);
  box-shadow: none;
}

#inviteSheet .hw-invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#inviteSheet .hw-invite-row input {
  min-height: 42px;
}

#inviteSheet .hw-invite-row .btn-outline {
  min-height: 42px;
  padding-inline: 16px;
}

#inviteSheet .hw-invite-feedback {
  min-height: 18px;
  margin-top: 7px;
  color: var(--success);
  font-size: 11.5px;
  line-height: 1.4;
}

#inviteSheet .hw-invite-feedback.is-error {
  color: var(--danger);
}

/* People statuses: clearer scan hierarchy. */
#peopleCard .participant-item {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#peopleCard .participant-name {
  font-size: 12.5px;
  font-weight: 650;
}

#peopleCard .participant-meta {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: var(--pill);
  background: #f1f2f4;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

#peopleCard .participant-item[data-status="responded"] .participant-meta {
  background: #eaf8f4;
  color: var(--success);
}

#peopleCard .participant-item[data-status="review"] .participant-meta {
  background: var(--coral-soft);
  color: #a9453c;
}

#peopleCard .participant-item[data-status="declined"] .participant-meta {
  background: #f4f4f5;
  color: #747b85;
}

@media (max-width: 520px) {
  #inviteSheet .hw-sheet-body {
    padding: 18px;
  }

  #inviteSheet .hw-invite-row {
    grid-template-columns: 1fr;
  }

  #inviteSheet .hw-invite-row .btn-outline {
    width: 100%;
  }
}


/* =========================================================
   INVITE CTA — MORE OBVIOUS
   Make the People-card Invite button stand out more so
   users can immediately spot where to open the share modal.
   ========================================================= */

#btnOpenInviteSheet,
#peopleCard .btn-open-invite,
#peopleCard .btn-invite {
  border-color: var(--coral) !important;
  background: var(--coral-soft) !important;
  color: var(--coral-strong) !important;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(20,24,32,.03);
}

@media (hover: hover) and (pointer: fine) {
  #btnOpenInviteSheet:hover,
  #peopleCard .btn-open-invite:hover,
  #peopleCard .btn-invite:hover {
    background: var(--coral) !important;
    border-color: var(--coral) !important;
    color: #fff !important;
    box-shadow: 0 7px 18px rgba(248,95,82,.18);
    transform: translateY(-1px);
  }
}

/* If the button is just using the generic outline class inside the
   People card, make sure it picks up the same stronger treatment. */
#peopleCard .hw-card-head .btn-outline,
#peopleCard .hw-card-head .btn {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral-strong);
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  #peopleCard .hw-card-head .btn-outline:hover,
  #peopleCard .hw-card-head .btn:hover {
    background: var(--coral);
    border-color: var(--coral);
    color: #fff;
  }
}

/* =========================================================
   AUTH + INVITE LANDING — POLISHED
   ========================================================= */
body.hw-mode-auth .hw-topbar { display:none !important; }

#authView.hw-authSplit{
  min-height:100vh;
  display:grid !important;
  grid-template-columns:minmax(360px,.92fr) minmax(430px,1.08fr);
  background:#fff;
}
#authView .panel-visual{
  position:relative;
  overflow:hidden;
  padding:clamp(54px,7vw,92px);
  display:flex;
  align-items:center;
  background:
    radial-gradient(circle at 14% 16%,rgba(255,255,255,.22),transparent 17rem),
    linear-gradient(145deg,#ff7466,#ff9582);
  color:#fff;
}
#authView .visual-copy{position:relative;z-index:1;max-width:540px}
#authView .visual-eyebrow{margin-bottom:14px;font-size:11px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;opacity:.9}
#authView .visual-title{margin:0;font-size:clamp(42px,6vw,68px);line-height:1.01;letter-spacing:-.045em;font-weight:720}
#authView .visual-subtitle{max-width:470px;margin:18px 0 0;font-size:16px;line-height:1.55;opacity:.92}
#authView .panel-form{padding:clamp(46px,7vw,82px);display:flex;flex-direction:column;justify-content:center;background:#fff}
#authView .hw-auth-kicker{margin-bottom:9px;color:var(--coral-strong);font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase}
#authView .welcome-title{margin:0;color:var(--ink);font-size:clamp(30px,4vw,40px);line-height:1.08;letter-spacing:-.035em;font-weight:720}
#authView .welcome-subtitle{max-width:500px;margin:9px 0 24px;color:var(--muted);font-size:14px;line-height:1.55}
#authView .hw-invite-context{display:none;margin:0 0 22px;padding:15px 16px;border:1px solid #dbeee8;border-radius:15px;background:linear-gradient(135deg,#f1fbf8,#fbfefd)}
#authView.is-invite-mode .hw-invite-context{display:block}
#authView .hw-invite-context-label{color:var(--success);font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.07em}
#authView .hw-invite-context-title{margin-top:3px;color:var(--ink);font-size:16px;font-weight:680}
#authView .hw-invite-context-note{margin-top:4px;color:var(--muted);font-size:12px;line-height:1.45}
#authView #authForm{display:grid;gap:14px;margin:0}
#authView #authForm .field{margin:0}
#authView .input-shell{padding:0;border:0;background:transparent}
#authView #authForm input[type="text"],
#authView #authForm input[type="email"],
#authView #authForm input[type="password"]{
  width:100%;min-height:48px;padding:0 14px;border:1px solid var(--line-strong);
  border-radius:13px;background:#fff;color:var(--ink);font-size:14px;outline:none
}
#authView #authForm input:focus{border-color:rgba(255,116,102,.72);box-shadow:0 0 0 3px rgba(255,116,102,.11)}
#authView #btnSignIn{min-width:175px;min-height:46px}
#authView .hw-auth-back{display:none;width:fit-content;padding:3px 0;border:0;background:transparent;color:var(--muted);font-size:12px;cursor:pointer}
#authView.is-create-mode .hw-auth-back{display:inline-flex}
#authView.is-create-mode .field-extra{display:none}
#authView .footnote{margin-top:20px;padding-top:17px;border-top:1px solid var(--line);color:var(--muted)}
#authView .footnote a{color:var(--coral-strong);font-weight:600}
@media(max-width:860px){
  #authView.hw-authSplit{grid-template-columns:1fr}
  #authView .panel-visual{min-height:250px;padding:42px 26px}
  #authView .visual-title{font-size:clamp(34px,9vw,48px)}
  #authView .panel-form{padding:34px 24px 42px}
}
@media(max-width:520px){
  #authView .panel-visual{min-height:215px}
  #authView .panel-form{padding:28px 18px 34px}
  #authView #btnSignIn{width:100%}
}


/* =========================================================
   MOBILE PLAN DETAIL — PEOPLE BEFORE AVAILABILITY
   Desktop/tablet stays unchanged.
   ========================================================= */

@media (max-width: 760px) {
  #planDetailCard .hw-plan-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "overview"
      "people"
      "availability"
      "best";
  }

  /* Flatten the side wrapper so its children can participate
     directly in the mobile plan-detail grid. */
  #planDetailCard .hw-plan-side {
    display: contents;
  }

  #peopleCard { grid-area: people; }
  #availabilityCard { grid-area: availability; }
  #bestMatchesCard { grid-area: best; }
}


/* =========================================================
   AVAILABILITY SELECTION — CLEARER INTERACTION STATES
   ========================================================= */

/* Replace the old legend-style helper with a clearer instruction block. */
#availabilityCard .availability-legend {
  margin-top: 6px;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

#availabilityCard .availability-legend::before {
  content: "Tap a date for all day, or choose M / A / E for part of the day.";
  color: var(--text);
  font-weight: 560;
}

#availabilityCard .availability-legend::after {
  content: "⭐ Mark a preferred day";
  color: var(--faint);
}

#availabilityCard .availability-legend {
  font-size: 0;
}

/* Neutral state */
#availabilityCard .avail-cell.avail-day {
  background: #fff;
  border-color: var(--line);
}

/* Partial-day selection: keep card mostly white, but make chosen slots obvious. */
#availabilityCard .avail-cell.avail-day:has(.avail-slot.is-on):not(.is-full) {
  background: #fbffff;
  border-color: rgba(125, 215, 210, .72);
  box-shadow: 0 0 0 1px rgba(125, 215, 210, .08);
}

#availabilityCard .avail-cell.avail-day:has(.avail-slot.is-on):not(.is-full)::after {
  content: "Part day";
  position: absolute;
  left: 10px;
  bottom: 7px;
  color: #4a7774;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .02em;
}

/* Full-day selection: strong enough to read instantly. */
#availabilityCard .avail-cell.avail-day.is-full {
  background: linear-gradient(180deg, #e5f8f6, #effbf9);
  border-color: var(--aqua-strong);
  box-shadow:
    0 0 0 1px rgba(125, 215, 210, .18),
    0 6px 18px rgba(38, 122, 105, .06);
}

#availabilityCard .avail-cell.avail-day.is-full::after {
  content: "All day";
  position: absolute;
  left: 10px;
  bottom: 7px;
  color: var(--success);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Make the time buttons communicate state more clearly. */
#availabilityCard .avail-slot {
  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease,
    transform .15s ease;
}

#availabilityCard .avail-slot.is-on {
  background: #fff;
  border-color: var(--coral);
  color: var(--coral-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 116, 102, .06);
}

#availabilityCard .avail-cell.is-full .avail-slot {
  background: rgba(255,255,255,.92);
  border-color: rgba(38,122,105,.26);
  color: var(--success);
}

#availabilityCard .avail-cell.is-full .avail-slot.is-on {
  background: #fff;
  border-color: rgba(38,122,105,.42);
  color: var(--success);
  font-weight: 700;
}

/* Give labels a touch more room so "All day" / "Part day" don't collide. */
#availabilityCard .avail-cell.avail-day {
  padding-bottom: 24px;
}

/* On the compact mobile row layout, keep labels tucked to the left. */
@media (max-width: 760px) {
  #availabilityCard .avail-cell.avail-day {
    padding-bottom: 18px;
  }

  #availabilityCard .avail-cell.avail-day.is-full::after,
  #availabilityCard .avail-cell.avail-day:has(.avail-slot.is-on):not(.is-full)::after {
    left: 12px;
    bottom: 5px;
    font-size: 9px;
  }
}


/* =========================================================
   AVAILABILITY HELPER COPY — VISIBILITY FIX
   The parent legend is font-size:0 to hide the old HTML text,
   so the generated helper lines need explicit font sizes.
   ========================================================= */

#availabilityCard .availability-legend::before {
  display: block;
  font-size: 11px;
  line-height: 1.45;
}

#availabilityCard .availability-legend::after {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.4;
}


/* =========================================================
   PLAN LIST — LOCKED-IN DETAIL
   ========================================================= */

.plans-list .plan-meta-secondary {
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
}

.plans-list > li:has(.badge-locked) .plan-meta {
  color: var(--success);
  font-weight: 620;
}


/* =========================================================
   PLAN LIST — STRONGER LOCKED-IN STATE
   ========================================================= */

.plans-list > li:has(.tag-green),
.plans-list > li:has(.badge-locked),
.plans-list > li:has(.plan-locked-eyebrow) {
  background: linear-gradient(135deg, rgba(238, 250, 247, .96), rgba(248, 253, 252, .96));
  border-color: rgba(70, 162, 145, .28);
  box-shadow: 0 4px 14px rgba(38, 122, 105, .055);
}

.plans-list > li:has(.plan-locked-eyebrow) .plan-name {
  color: var(--ink);
}

.plans-list .plan-locked-eyebrow {
  margin-top: 5px;
  color: var(--success);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.plans-list .plan-locked-when {
  margin-top: 1px;
  color: #155f55;
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 720;
}

.plans-list .plan-meta-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.8px;
}

@media (hover: hover) and (pointer: fine) {
  .plans-list > li:has(.plan-locked-eyebrow):hover {
    background: linear-gradient(135deg, #edf9f6, #fbfefd);
    border-color: rgba(70, 162, 145, .42);
    box-shadow: 0 8px 22px rgba(38, 122, 105, .09);
  }
}


/* =========================================================
   LOCKED-IN LABEL — FINAL MICRO POLISH
   Keep the confirmed date/time as the strongest line.
   ========================================================= */

.plans-list .plan-locked-eyebrow {
  font-size: 8.75px;
  font-weight: 650;
  letter-spacing: .075em;
  opacity: .88;
}


/* =========================================================
   PLAN DETAIL — TOP BACK NAVIGATION
   ========================================================= */

#btnBackToPlansTop.hw-back-top {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: rgba(255,255,255,.88);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

@media (hover: hover) and (pointer: fine) {
  #btnBackToPlansTop.hw-back-top:hover {
    background: #fff;
    border-color: rgba(37,42,49,.16);
    color: var(--ink);
  }
}

/* Bottom back button is redundant once top navigation is present. */
#planDetailCard .hw-plan-detail-footer {
  display: none;
}

@media (max-width: 760px) {
  #btnBackToPlansTop.hw-back-top {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  #planDetailCard .hw-card-head,
  #planDetailCard .hw-card-header {
    align-items: flex-start;
  }
}


/* =========================================================
   BEST MATCHING TIMES — DECISION-FIRST UX
   ========================================================= */

#bestMatchesCard #bestMatchesInfo {
  margin-bottom: 12px;
}

#bestMatchesList {
  display: grid;
  gap: 9px;
}

#bestMatchesList .best-match-card {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

#bestMatchesList .best-match-card.is-best-match {
  border-color: rgba(70, 162, 145, .28);
  background: linear-gradient(135deg, #edf9f6, #f8fdfc);
  box-shadow: 0 5px 16px rgba(38, 122, 105, .06);
}

#bestMatchesList .best-match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

#bestMatchesList .best-match-datetime {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 720;
}

#bestMatchesList .best-match-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--pill);
  background: #dff5ef;
  color: var(--success);
  font-size: 8.5px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: .075em;
}

#bestMatchesList .best-match-summary {
  margin-top: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

#bestMatchesList .best-match-preferred {
  margin-top: 4px;
  color: #7d6c2d;
  font-size: 10.8px;
  line-height: 1.4;
}

#bestMatchesList .best-match-details-toggle {
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.8px;
  font-weight: 620;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

#bestMatchesList .best-match-details-toggle:hover {
  color: var(--ink);
}

#bestMatchesList .best-match-details-panel {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

#bestMatchesList .best-match-people-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

#bestMatchesList .best-match-people-line + .best-match-people-line {
  margin-top: 5px;
}

#bestMatchesList .best-match-people-line strong {
  color: var(--success);
  font-weight: 650;
}

#bestMatchesList .best-match-people-line.is-unavailable strong {
  color: var(--faint);
}

#bestMatchesList .best-match-people-line.is-unavailable span {
  color: var(--faint);
}

#bestMatchesList .best-match-actions {
  margin-top: 11px;
}

#bestMatchesList .best-match-choose {
  min-height: 36px;
  padding-inline: 13px;
}

#bestMatchesList .best-match-more-wrap {
  list-style: none;
  margin: 1px 0 0;
  padding: 0;
  text-align: center;
}

#bestMatchesList .best-match-more {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.8px;
  font-weight: 620;
  cursor: pointer;
}

#bestMatchesList .best-match-more:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 760px) {
  #bestMatchesList .best-match-card {
    padding: 13px;
  }

  #bestMatchesList .best-match-people-line {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  #bestMatchesList .best-match-choose {
    width: 100%;
  }
}


/* =========================================================
   BEST MATCHING TIMES — MOBILE COMPACT PASS
   Desktop remains unchanged.
   ========================================================= */

@media (max-width: 760px) {
  #bestMatchesCard {
    margin-top: 10px;
  }

  #bestMatchesCard #bestMatchesInfo {
    margin-bottom: 9px;
    font-size: 11px;
    line-height: 1.4;
  }

  #bestMatchesList {
    gap: 7px;
  }

  #bestMatchesList .best-match-card {
    padding: 11px 12px;
    border-radius: 13px;
  }

  #bestMatchesList .best-match-top {
    gap: 6px;
    flex-wrap: nowrap;
  }

  #bestMatchesList .best-match-datetime {
    min-width: 0;
    font-size: 12px;
    line-height: 1.25;
  }

  #bestMatchesList .best-match-badge {
    flex: 0 0 auto;
    min-height: 19px;
    padding: 0 7px;
    font-size: 7.75px;
  }

  #bestMatchesList .best-match-summary {
    margin-top: 3px;
    font-size: 11.2px;
  }

  #bestMatchesList .best-match-preferred {
    margin-top: 2px;
    font-size: 9.8px;
  }

  #bestMatchesList .best-match-details-toggle {
    margin-top: 6px;
    font-size: 10px;
  }

  #bestMatchesList .best-match-details-panel {
    margin-top: 7px;
    padding-top: 7px;
  }

  #bestMatchesList .best-match-people-line {
    grid-template-columns: 1fr;
    gap: 1px;
    font-size: 9.8px;
    line-height: 1.35;
  }

  #bestMatchesList .best-match-actions {
    margin-top: 8px;
  }

  #bestMatchesList .best-match-choose {
    width: 100%;
    min-height: 36px;
    padding-inline: 12px;
    font-size: 10.5px;
  }

  /* Only the top decision gets the strong coral treatment. */
  #bestMatchesList .best-match-card:not(.is-best-match) .best-match-choose {
    background: #fff;
    border: 1px solid var(--line-strong);
    color: var(--ink);
    box-shadow: none;
  }

  #bestMatchesList .best-match-more-wrap {
    margin-top: 0;
  }

  #bestMatchesList .best-match-more {
    min-height: 30px;
    font-size: 9.8px;
  }
}


/* =========================================================
   MOBILE AVAILABILITY STAR — CORRECT SELECTOR
   The real star class is .avail-star.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityCard .avail-cell.avail-day {
    position: relative;
  }

  #availabilityCard .avail-cell.avail-day .avail-star {
    position: absolute !important;
    top: 8px !important;
    right: 9px !important;
    left: auto !important;
    bottom: auto !important;
    transform: scale(.9) !important;
    z-index: 4;
  }

  #availabilityCard .avail-cell.avail-day .avail-star.is-visible {
    transform: scale(1) !important;
  }

  /* Keep the date text clear of the star. */
  #availabilityCard .avail-day-head {
    padding-right: 26px;
  }
}


/* =========================================================
   MOBILE AVAILABILITY — PROGRESSIVE DISCLOSURE
   Show first 3 weeks + any selected weeks by default.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityGrid .availability-week-group.is-collapsed-mobile {
    display: none !important;
  }

  #availabilityGrid .availability-more-control {
    display: flex;
    justify-content: center;
    padding: 10px 0 2px;
  }

  #availabilityGrid .availability-more-btn {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--pill);
    background: #fff;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 650;
    cursor: pointer;
  }

  #availabilityGrid .availability-more-btn:active {
    transform: translateY(1px);
  }
}


/* =========================================================
   WEEK GROUP WRAPPER — REQUIRED FOR MOBILE COLLAPSE
   Desktop uses display:contents so the existing grid layout
   is unchanged. Mobile turns each week into a real block.
   ========================================================= */

#availabilityGrid .availability-week-group {
  display: contents;
}

@media (max-width: 760px) {
  #availabilityGrid .availability-week-group {
    display: block;
  }

  #availabilityGrid .availability-week-group .availability-week-divider {
    margin-top: 8px;
  }

  #availabilityGrid .availability-week-group.is-collapsed-mobile {
    display: none !important;
  }
}


/* =========================================================
   MOBILE AVAILABILITY — WEEK CARD LAYOUT
   Group each week into one soft container to reduce visual
   fragmentation and make long date ranges feel calmer.
   Desktop remains unchanged.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityGrid .availability-week-group {
    display: block;
    margin: 0 0 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(250, 251, 252, .84);
  }

  #availabilityGrid .availability-week-group .availability-week-divider {
    margin: 0 0 7px;
    padding: 0;
    border: 0;
  }

  #availabilityGrid .availability-week-group .availability-week-label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
  }

  /* Date rows sit inside the week card without their own large outer gaps. */
  #availabilityGrid .availability-week-group .avail-cell.avail-day {
    margin: 0;
    min-height: 64px;
    padding: 10px 10px 18px;
    border-radius: 12px;
    background: #fff;
  }

  #availabilityGrid .availability-week-group .avail-cell.avail-day + .avail-cell.avail-day {
    margin-top: 7px;
  }

  /* Compact date header inside each row. */
  #availabilityGrid .availability-week-group .avail-day-head {
    min-width: 92px;
    padding-right: 22px;
  }

  #availabilityGrid .availability-week-group .avail-weekday {
    min-height: 18px;
    padding: 0 6px;
    font-size: 8.25px;
  }

  #availabilityGrid .availability-week-group .avail-date {
    font-size: 17px;
    line-height: 1.05;
  }

  #availabilityGrid .availability-week-group .avail-month {
    font-size: 10px;
  }

  /* Calm, readable M/A/E controls with a little more breathing room. */
  #availabilityGrid .availability-week-group .avail-slots {
    gap: 6px;
  }

  #availabilityGrid .availability-week-group .avail-slot {
    min-width: 42px;
    min-height: 34px;
    border-radius: 10px;
    font-size: 10px;
  }

  /* Keep selected states visually strong within the softer week card. */
  #availabilityGrid .availability-week-group .avail-cell.avail-day.is-full {
    background: linear-gradient(180deg, #e8f9f7, #f0fbfa);
    border-color: rgba(70, 162, 145, .42);
  }

  #availabilityGrid .availability-week-group .avail-cell.avail-day:has(.avail-slot.is-on):not(.is-full) {
    background: #fbffff;
    border-color: rgba(125, 215, 210, .8);
  }

  /* Keep labels tucked in without making the row feel busy. */
  #availabilityGrid .availability-week-group .avail-cell.avail-day.is-full::after,
  #availabilityGrid .availability-week-group .avail-cell.avail-day:has(.avail-slot.is-on):not(.is-full)::after {
    left: 11px;
    bottom: 4px;
    font-size: 8.75px;
  }

  /* Preferred-day star remains in the top-right of the date row. */
  #availabilityGrid .availability-week-group .avail-star {
    top: 8px !important;
    right: 9px !important;
  }

  /* Show-more control belongs to the section, not inside a week card. */
  #availabilityGrid .availability-more-control {
    padding: 6px 0 4px;
  }

  #availabilityGrid .availability-more-btn {
    min-height: 38px;
    padding: 0 16px;
    background: rgba(255,255,255,.96);
  }
}


/* =========================================================
   CONFIRMED PLAN SHARING — BUTTON POLISH
   ========================================================= */

.hw-confirmed-actions button:disabled {
  opacity: 1;
  cursor: default;
}

.hw-confirmed-actions #btnSmsConfirmedPlan,
.hw-confirmed-actions #btnCopyConfirmedPlan {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .hw-confirmed-actions {
    gap: 7px;
  }

  .hw-confirmed-actions button {
    min-height: 38px;
  }
}


/* =========================================================
   CHAT — CONVERSATIONAL POLISH + UNREAD COUNT
   ========================================================= */

#hwChatPanel {
  width: min(420px, calc(100vw - 28px));
}

#hwChatPanel #commentsList {
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

#hwChatPanel #commentsList > li {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8f9fa;
}

#hwChatPanel #commentsList > li.is-own-message {
  margin-left: 34px;
  border-color: rgba(255,116,102,.14);
  background: rgba(255,116,102,.075);
}

#hwChatPanel #commentsList > li:not(.is-own-message) {
  margin-right: 34px;
}

#hwChatPanel textarea#commentInput {
  min-height: 86px;
  border-radius: 13px;
}

#hwChatPanel #btnPostComment {
  min-height: 36px;
  padding-inline: 15px;
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
  font-weight: 650;
}

#hwChatPanel #btnPostComment:hover {
  border-color: var(--coral-strong);
  background: var(--coral-strong);
}

/* Unread badge */
#chatCount {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 9px;
  line-height: 1;
  font-weight: 750;
}

#hwChatOpenBtn.has-unread,
#hwChatDock.has-unread {
  border-color: rgba(255,116,102,.36);
  background: var(--coral-soft);
  color: var(--coral-strong);
  font-weight: 700;
}

#hwChatDock.has-unread::after {
  content: attr(data-unread);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
}

/* Reduce duplicate chat affordance on desktop: floating dock is enough. */
@media (min-width: 761px) {
  #availabilityCard #hwChatOpenBtn {
    display: none;
  }
}

@media (max-width: 760px) {
  #hwChatPanel {
    width: calc(100vw - 24px);
  }

  #hwChatPanel #commentsList {
    max-height: 260px;
  }

  #hwChatPanel #commentsList > li.is-own-message {
    margin-left: 24px;
  }

  #hwChatPanel #commentsList > li:not(.is-own-message) {
    margin-right: 24px;
  }

  #hwChatPanel #btnPostComment {
    width: 100%;
  }
}


/* =========================================================
   CHAT — OWN MESSAGE VISUAL DISTINCTION FIX
   The message elements use .comment-item, not generic li styles.
   ========================================================= */

#hwChatPanel #commentsList .comment-item {
  margin: 0 34px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8f9fa;
}

#hwChatPanel #commentsList .comment-item.is-own-message {
  margin: 0 0 0 34px;
  border-color: rgba(255,116,102,.18);
  background: rgba(255,116,102,.10);
}

#hwChatPanel #commentsList .comment-item.is-own-message .comment-author {
  color: var(--coral-strong);
}

#hwChatPanel #commentsList .comment-item.is-own-message .comment-time {
  color: #a77972;
}

@media (max-width: 760px) {
  #hwChatPanel #commentsList .comment-item {
    margin-right: 24px;
  }

  #hwChatPanel #commentsList .comment-item.is-own-message {
    margin-right: 0;
    margin-left: 24px;
  }
}


/* =========================================================
   AVAILABILITY HELPER COPY — EXPLAIN M / A / E
   ========================================================= */

#availabilityCard .availability-legend::before {
  content: "Tap a date for all day, or choose a time:";
}

#availabilityCard .availability-legend::after {
  content: "M = Morning · A = Afternoon · E = Evening\A⭐ Mark a preferred day";
  white-space: pre-line;
}

#availabilityCard .availability-legend::before {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 560;
}

#availabilityCard .availability-legend::after {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--faint);
}


/* =========================================================
   MOBILE AVAILABILITY STAR — FINAL ALIGNMENT
   Give the preferred-day star its own space in the top-right
   corner instead of letting it float over the E button.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityGrid .availability-week-group .avail-cell.avail-day {
    position: relative;
  }

  /* Reserve a small right-hand gutter for the star. */
  #availabilityGrid .availability-week-group .avail-slots {
    padding-right: 22px;
  }

  #availabilityGrid .availability-week-group .avail-star {
    position: absolute !important;
    top: 7px !important;
    right: 8px !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: 5;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  /* Keep the E control clear of the star on narrow phones. */
  #availabilityGrid .availability-week-group .avail-slot:last-child {
    margin-right: 0;
  }
}


/* =========================================================
   MOBILE AVAILABILITY STAR — OWN COLUMN
   Put the preference star in a dedicated column so it never
   floats over the E control.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityGrid .availability-week-group .avail-cell.avail-day {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) minmax(132px, 1.45fr) 22px;
    grid-template-areas: "date slots star";
    align-items: center;
    column-gap: 8px;
    position: relative;
  }

  #availabilityGrid .availability-week-group .avail-day-head {
    grid-area: date;
    min-width: 0;
    padding-right: 0;
  }

  #availabilityGrid .availability-week-group .avail-slots {
    grid-area: slots;
    padding-right: 0;
    min-width: 0;
  }

  #availabilityGrid .availability-week-group .avail-star,
  #availabilityCard .avail-cell.avail-day .avail-star {
    grid-area: star;
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 22px;
    height: 22px;
    margin: 0;
    align-self: center;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: auto;
  }

  #availabilityGrid .availability-week-group .avail-star.is-visible,
  #availabilityCard .avail-cell.avail-day .avail-star.is-visible {
    transform: none !important;
  }
}


/* =========================================================
   MOBILE MICRO-POLISH — PLAN LIST + AVAILABILITY LEGEND
   ========================================================= */

@media (max-width: 760px) {

  /* Keep the back button compact and on one line. */
  #btnBackToPlansTop.hw-back-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 0;
    max-width: none;
    min-height: 34px;
    padding: 0 11px;
    white-space: nowrap;
    line-height: 1;
    font-size: 10.5px;
    border-radius: 999px;
  }

  /* Give the plan header enough room so the button doesn't get squeezed. */
  #planDetailCard .hw-card-head,
  #planDetailCard .hw-card-header {
    gap: 10px;
  }

  #planDetailCard .hw-card-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  /* Keep the M/A/E explanation on one clean line. */
  #availabilityCard .availability-legend::after {
    content: "M = Morning · A = Afternoon · E = Evening\A⭐ Mark a preferred day";
    white-space: pre-line;
    display: block;
    max-width: none;
    font-size: 10px;
    line-height: 1.45;
  }

  /* Prevent the Evening label from being stranded on a second line. */
  #availabilityCard .availability-legend {
    overflow: visible;
  }
}


/* =========================================================
   MOBILE AVAILABILITY LEGEND — FINAL COMPACT VERSION
   Keep all three time meanings together on one intentional line.
   ========================================================= */

@media (max-width: 760px) {
  #availabilityCard .availability-legend::after {
    content: "M Morning  ·  A Afternoon  ·  E Evening\A⭐ Mark a preferred day";
    white-space: pre;
    display: block;
    width: max-content;
    max-width: 100%;
    font-size: 9.25px;
    line-height: 1.5;
    letter-spacing: -.01em;
    color: var(--faint);
  }
}


/* =========================================================
   ARCHIVED PLANS — READ-ONLY + HISTORY POLISH
   ========================================================= */

.archived-plan-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 20px 14px;
  padding: 10px 12px;
  border: 1px solid #dfe3e7;
  border-radius: 12px;
  background: #f7f8f9;
}

.archived-plan-banner-label {
  color: #69727d;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: .08em;
}

.archived-plan-banner-copy {
  color: var(--muted);
  font-size: 11px;
}

#planDetailCard.is-archived-plan #availabilityCard,
#planDetailCard.is-archived-plan #bestMatchesCard,
#planDetailCard.is-archived-plan #peopleCard {
  opacity: .92;
}

#planDetailCard.is-archived-plan .avail-cell,
#planDetailCard.is-archived-plan .avail-slot,
#planDetailCard.is-archived-plan .avail-star {
  cursor: default !important;
}

#planDetailCard.is-archived-plan .avail-cell:hover,
#planDetailCard.is-archived-plan .avail-slot:hover {
  transform: none !important;
}

/* Archived list outcome hierarchy */
#archivedPlansList .archive-state-label,
.archived-plans-list .archive-state-label {
  margin-top: 5px;
  color: #7a838d;
  font-size: 8.75px;
  font-weight: 740;
  letter-spacing: .075em;
}

#archivedPlansList .archive-state-detail,
.archived-plans-list .archive-state-detail {
  margin-top: 2px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 680;
}

#archivedPlansList .plan-meta-secondary,
.archived-plans-list .plan-meta-secondary {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10.5px;
}

@media (max-width: 760px) {
  .archived-plan-banner {
    margin: 0 12px 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}
\n\n/* =========================================================\n   ARCHIVED PLAN — AUTHORITATIVE READ-ONLY OVERRIDES\n   ========================================================= */\n\n#planDetailCard.is-archived-plan #btnOpenInviteSheet,\n#planDetailCard.is-archived-plan #btnSaveAvailability,\n#planDetailCard.is-archived-plan #btnUnavailableAll,\n#planDetailCard.is-archived-plan #hwChatOpenBtn,\n#planDetailCard.is-archived-plan .hw-confirmed-actions,\n#planDetailCard.is-archived-plan #btnShareConfirmedPlan,\n#planDetailCard.is-archived-plan #btnSmsConfirmedPlan,\n#planDetailCard.is-archived-plan #btnCopyConfirmedPlan,\n#planDetailCard.is-archived-plan #btnChangeConfirmedPlan,\n#planDetailCard.is-archived-plan .best-match-choose,\n#planDetailCard.is-archived-plan #btnEditPlan,\n#planDetailCard.is-archived-plan [data-action="edit-plan"] {\n  display: none !important;\n}\n\nbody:has(#planDetailCard.is-archived-plan) #hwChatDock {\n  display: none !important;\n}\n\n#planDetailCard.is-archived-plan #availabilityCard .avail-cell,\n#planDetailCard.is-archived-plan #availabilityCard .avail-slot,\n#planDetailCard.is-archived-plan #availabilityCard .avail-star {\n  pointer-events: none !important;\n  cursor: default !important;\n}\n\n#planDetailCard.is-archived-plan #availabilityCard .avail-slot {\n  opacity: .78;\n}\n\n#planDetailCard.is-archived-plan #bestMatchesCard .best-match-details-toggle {\n  pointer-events: auto;\n}\n

/* =========================================================
   ARCHIVED DETAIL — ARCHIVE LIST BACK BUTTON
   ========================================================= */
#planDetailCard.is-archived-plan #btnBackToPlansTop {
  white-space: nowrap;
}


/* =========================================================
   ACCOUNT MENU — FINAL POLISH
   ========================================================= */

/* Signed-in metadata stays visually quiet. */
#topAccountMenu {
  overflow: hidden;
}

#topAccountMenu #accountEmail {
  color: var(--ink);
  font-weight: 620;
}

/* Main account actions read as navigation, not plain text. */
#topAccountMenu #btnEditName,
#topAccountMenu #btnArchivedPlans,
#topAccountMenu #btnSignOut,
#topAccountMenu button,
#topAccountMenu a {
  transition:
    background .15s ease,
    color .15s ease,
    transform .15s ease;
}

@media (hover: hover) and (pointer: fine) {
  #topAccountMenu #btnEditName:hover,
  #topAccountMenu #btnArchivedPlans:hover {
    background: rgba(255, 116, 102, .07);
    color: var(--ink);
  }
}

/* Sign out is deliberately separated from account navigation. */
#topAccountMenu #btnSignOut {
  position: relative;
  margin-top: 8px;
  padding-top: 16px;
}

#topAccountMenu #btnSignOut::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

@media (hover: hover) and (pointer: fine) {
  #topAccountMenu #btnSignOut:hover {
    color: var(--coral-strong);
    background: rgba(255, 116, 102, .045);
  }
}

/* =========================================================
   EDIT YOUR NAME — COMPACT ACCOUNT SETTINGS CARD
   ========================================================= */

#namePrompt.is-account-name-edit {
  max-width: 760px;
  margin: 22px auto 0;
  padding: 20px;
  border: 1px solid rgba(255, 116, 102, .18);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30, 34, 40, .075);
}

#namePrompt.is-account-name-edit .account-name-edit-title {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 720;
}

/* De-emphasise the older generic heading if the prompt already contains one. */
#namePrompt.is-account-name-edit > label:first-of-type {
  margin-top: 8px;
}

#namePrompt.is-account-name-edit #displayNameInput {
  min-height: 48px;
  border-radius: 12px;
}

#namePrompt.is-account-name-edit #btnSaveDisplayName,
#namePrompt.is-account-name-edit #btnCancelDisplayName {
  min-height: 42px;
}

#namePrompt.is-account-name-edit #btnSaveDisplayName {
  padding-inline: 18px;
}

#namePrompt.is-account-name-edit #btnCancelDisplayName {
  padding-inline: 16px;
}

#namePrompt .name-update-success {
  margin-top: 10px;
  color: var(--success);
  font-size: 11px;
  font-weight: 680;
}

/* Keep the editor visually tighter than the full plans container. */
#namePrompt.is-account-name-edit form,
#namePrompt.is-account-name-edit .name-prompt-inner,
#namePrompt.is-account-name-edit .name-prompt-row {
  max-width: 100%;
}

@media (max-width: 760px) {
  #topAccountMenu {
    width: min(290px, calc(100vw - 24px));
  }

  #namePrompt.is-account-name-edit {
    margin: 14px 12px 0;
    padding: 16px;
    border-radius: 16px;
  }

  #namePrompt.is-account-name-edit .account-name-edit-title {
    font-size: 17px;
  }

  #namePrompt.is-account-name-edit #displayNameInput {
    width: 100%;
  }

  /* Stack account edit actions cleanly on phone. */
  #namePrompt.is-account-name-edit #btnSaveDisplayName,
  #namePrompt.is-account-name-edit #btnCancelDisplayName {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
  }

  #namePrompt.is-account-name-edit #btnSaveDisplayName {
    margin-top: 10px;
  }

  #namePrompt.is-account-name-edit #btnCancelDisplayName {
    margin-top: 7px;
  }
}


/* =========================================================
   MOBILE — PEOPLE / AVAILABILITY SHOW-MORE CONTROLS
   ========================================================= */

@media (max-width: 760px) {
  /* Make the People control a proper full-width continuation row. */
  #peopleCard .people-more-control {
    width: 100%;
    margin-top: 10px;
  }

  #peopleCard .people-more-btn {
    appearance: none;
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(255, 116, 102, .24);
    border-radius: 12px;
    background: var(--coral-soft);
    color: var(--coral-strong);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20,24,32,.025);
  }

  #peopleCard .people-more-btn:active {
    transform: translateY(1px);
  }

  /* The hidden state is explicit; when JS removes this class the row
     returns to its normal participant-card layout. */
  #peopleCard .participant-item.is-people-collapsed {
    display: none !important;
  }

  /* Availability show-more should look like part of HeyWhen,
     not a native browser button. */
  #availabilityGrid .availability-more-control {
    width: 100%;
    padding: 10px 0 2px;
  }

  #availabilityGrid .availability-more-btn {
    appearance: none;
    width: 100%;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 116, 102, .20);
    border-radius: 12px;
    background: var(--coral-soft);
    color: var(--coral-strong);
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20,24,32,.025);
  }

  #availabilityGrid .availability-more-btn span {
    display: block;
  }

  #availabilityGrid .availability-more-btn small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
  }

  #availabilityGrid .availability-more-btn:active {
    transform: translateY(1px);
  }
}


/* Host participant management */
.participant-remove-btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #d84f4f;
  cursor: pointer;
  padding: 6px 4px;
  margin-left: 4px;
}

.participant-remove-btn:hover {
  text-decoration: underline;
}

.participant-remove-btn:disabled {
  opacity: .55;
  cursor: default;
  text-decoration: none;
}


/* Locked-plan RSVP for guests, including people invited after lock-in */
.hw-confirmed-rsvp {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(45, 126, 116, .22);
  border-radius: 14px;
  background: rgba(224, 247, 243, .58);
}

.hw-confirmed-rsvp-title {
  font-weight: 800;
  font-size: 14px;
}

.hw-confirmed-rsvp-sub {
  margin-top: 3px;
  font-size: 12px;
  opacity: .72;
}

.hw-confirmed-rsvp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.hw-confirmed-rsvp-info {
  min-height: 16px;
  margin-top: 6px;
  font-size: 12px;
  opacity: .72;
}

@media (max-width: 600px) {
  .hw-confirmed-rsvp-actions > button {
    flex: 1 1 150px;
  }
}


/* Compact RSVP status after response */
.hw-confirmed-rsvp-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hw-rsvp-change,
.hw-rsvp-cancel {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 2px;
}

.hw-rsvp-change {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hw-rsvp-cancel {
  opacity: .65;
}

@media (max-width: 600px) {
  .hw-confirmed-rsvp-status {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* Email-confirmation success state */
#authError.is-success {
  color: #17685d;
  background: #effaf7;
  border-color: #c8ebe4;
  line-height: 1.5;
}
