:root {
  --navy: #0b1f3a;
  --navy-700: #13294f;
  --blue: #2563eb;
  --blue-600: #1d4ed8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* The hidden attribute must always win over component display rules
   (e.g. .form-success/.modal-overlay set display, which would otherwise
   override the browser default of [hidden] { display: none }). */
[hidden] { display: none !important; }

/* Accessible keyboard focus for all interactive elements. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .cal-type:focus-visible,
.role-card:focus-visible, .rsvp-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--navy); color: #fff; font-weight: 800; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topnav { display: flex; gap: 22px; margin-left: 8px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.topnav a:hover { color: var(--ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.poc-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--blue-600); background: #e0ebff; padding: 5px 10px; border-radius: 999px;
}
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 13px;
}

main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-700));
  color: #fff; border-radius: 20px; padding: 40px; margin-bottom: 36px;
  box-shadow: var(--shadow);
}
.hero-text h1 { font-size: 32px; line-height: 1.15; margin: 0 0 14px; font-weight: 800; }
.hero-text p { color: #c7d3e6; margin: 0 0 24px; font-size: 15px; max-width: 46ch; }
.hero-text strong { color: #fff; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-card { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 22px; }
.hero-card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot-green { background: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.hero-date { display: flex; flex-direction: column; align-items: flex-start; margin: 14px 0 18px; }
.hero-day { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.hero-num { font-size: 54px; font-weight: 800; line-height: 1; color: var(--navy); }
.hero-month { font-size: 14px; color: var(--muted); }
.hero-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.hero-meta span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.hero-meta strong { font-size: 14px; }
.fit-good { color: var(--green); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  text-decoration: none; transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .2); }
.btn-block { width: 100%; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; margin-bottom: 28px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.panel-head h2 { margin: 0 0 6px; font-size: 21px; }
.panel-head p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* Calendars */
.calendar-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cal-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.cal-card.connected { background: #f8fbf8; border-color: #cfe9d6; }
.cal-logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: #fff; font-weight: 800; font-size: 18px; }
.cal-logo.google { background: #ea4335; }
.cal-logo.outlook { background: #0078d4; }
.cal-logo.apple { background: #111; }
.cal-logo.caldav { background: #7c3aed; }
.cal-info { display: flex; flex-direction: column; }
.cal-info small { color: var(--muted); font-size: 12px; }
.status { margin-left: auto; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: none; cursor: default; }
.status-on { background: #dcfce7; color: var(--green); }
.status-add { background: #eef2f7; color: var(--blue-600); cursor: pointer; }
.status-add:hover { background: #e0ebff; }

/* Finder controls */
.finder-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 22px; }
.finder-controls label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); gap: 6px; }
.finder-controls select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); min-width: 180px; }
.finder-controls .btn { margin-left: auto; }

/* Suggestions */
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sug-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: border-color .15s ease, box-shadow .15s ease; }
.sug-card.top { border-color: var(--blue); box-shadow: 0 0 0 3px #e0ebff; }
.sug-rank { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--blue-600); }
.sug-rank.gold { color: var(--amber); }
.sug-date { font-size: 20px; font-weight: 800; }
.sug-date small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.sug-bar { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.sug-bar > span { display: block; height: 100%; border-radius: 999px; }
.bar-green { background: var(--green); }
.bar-amber { background: var(--amber); }
.bar-red { background: var(--red); }
.sug-stat { display: flex; justify-content: space-between; font-size: 13px; }
.sug-stat .muted { color: var(--muted); }
.sug-card .btn { margin-top: auto; }
.sug-note { font-size: 12px; color: var(--muted); }
.sug-rsvp { font-size: 12px; font-weight: 600; color: var(--ink); margin: -4px 0 0; }
.sug-card.chosen { border-color: var(--green); box-shadow: 0 0 0 3px #dcfce7; }
.sug-card.chosen .sug-rank { color: var(--green); }

/* Members */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.member .m-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; }
.member .m-info { display: flex; flex-direction: column; line-height: 1.2; }
.member .m-info small { font-size: 12px; }
.m-free small { color: var(--green); }
.m-busy small { color: var(--red); }
.m-maybe small { color: var(--amber); }
.m-flag { margin-left: auto; font-size: 16px; }

/* Footer + toast */
.footer { max-width: 1080px; margin: 0 auto; padding: 24px 20px 50px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.footer a { color: var(--blue-600); text-decoration: none; font-weight: 500; }
.footer a:hover { text-decoration: underline; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.topnav a.active { color: var(--ink); position: relative; }
.topnav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 2px; background: var(--blue); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-dark { background: #eef2f7; color: var(--blue-600); border-color: var(--line); }
.btn-dark:hover { background: #e0ebff; }

/* Overview: plain hero card + how-to */
.hero-card-plain { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .18); }
.hero-card-plain .hero-card-head { color: #c7d3e6; }
.howto { list-style: none; counter-reset: step; margin: 14px 0 0; padding: 0; }
.howto li { counter-increment: step; position: relative; padding: 12px 0 12px 42px; border-top: 1px solid rgba(255, 255, 255, .12); }
.howto li:first-child { border-top: none; }
.howto li::before { content: counter(step); position: absolute; left: 0; top: 12px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: 13px; }
.howto strong { display: block; font-size: 15px; }
.howto span { color: #c7d3e6; font-size: 13px; }

/* Overview: role cards */
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.role-card { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.role-card:hover { border-color: var(--blue); box-shadow: 0 0 0 3px #e0ebff; }
.role-card strong { font-size: 17px; }
.role-card small { color: var(--muted); font-size: 13px; }
.role-card .role-link { margin-top: 6px; color: var(--blue-600); font-weight: 600; font-size: 14px; }
.role-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 20px; color: #fff; margin-bottom: 4px; }
.role-icon.mod { background: var(--navy); }
.role-icon.mem { background: var(--blue); }

/* Overview: onboarding steps + contact callout */
.onboard-steps { display: grid; gap: 6px; margin-bottom: 22px; }
.onboard-step { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.onboard-step:first-child { border-top: none; }
.onboard-step .step-num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; }
.onboard-step strong { font-size: 15px; }
.onboard-step p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.onboard-step a { color: var(--blue-600); font-weight: 600; }
.contact-callout { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: #f1f5ff; border: 1px solid #d6e2ff; border-radius: var(--radius); padding: 18px 20px; }
.contact-callout strong { display: block; }
.contact-callout span { color: var(--muted); font-size: 14px; }
.contact-callout .btn { margin-left: auto; }

/* Member: invite banner + RSVP + privacy */
.invite-banner { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--navy), var(--navy-700)); color: #fff; border-radius: 18px; padding: 22px 26px; margin-bottom: 28px; box-shadow: var(--shadow); }
.invite-banner strong { font-size: 18px; }
.invite-banner p { margin: 2px 0 0; color: #c7d3e6; font-size: 14px; }
.invite-banner .btn { margin-left: auto; }
.invite-from { width: 46px; height: 46px; font-size: 15px; flex: none; }
.m-avatar { display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; }
.privacy-note { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.privacy-note a { color: var(--blue-600); font-weight: 600; }

.rsvp-list { display: grid; gap: 10px; }
.rsvp-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.rsvp-date strong { display: block; }
.rsvp-date small { color: var(--muted); font-size: 12px; }
.rsvp-actions { margin-left: auto; display: flex; gap: 8px; }
.rsvp-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.rsvp-btn:hover { border-color: var(--blue); }
.rsvp-btn.yes.selected { background: #dcfce7; color: var(--green); border-color: #bbf7d0; }
.rsvp-btn.maybe.selected { background: #fef3c7; color: var(--amber); border-color: #fde68a; }
.rsvp-btn.no.selected { background: #fee2e2; color: var(--red); border-color: #fecaca; }

.member-done { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.member-done strong { display: block; font-size: 16px; }
.member-done p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
.member-done .btn { margin-left: auto; }

/* Moderator: invite controls */
.invite-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.invite-input { flex: 1; min-width: 220px; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.invite-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #e0ebff; }

/* Panel head with an action button on the right */
.panel-head.between { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-head.between > div { flex: 1; }
.panel-head.between .btn { flex: none; }

/* Member: connected calendar list */
.connected-list { display: grid; gap: 12px; }
.empty-cals { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.status-remove { background: #fef2f2; color: var(--red); cursor: pointer; }
.status-remove:hover { background: #fee2e2; }

/* Add-calendar modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; padding: 24px; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head strong { font-size: 18px; }
.modal-close { border: none; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-sub { margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.cal-type-grid { display: grid; gap: 10px; }
.cal-type { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; text-align: left; font: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
.cal-type:hover { border-color: var(--blue); box-shadow: 0 0 0 3px #e0ebff; }
.cal-type-text { display: flex; flex-direction: column; }
.cal-type-text strong { font-size: 15px; }
.cal-type-text small { color: var(--muted); font-size: 12px; }
.cal-type-plus { margin-left: auto; font-size: 22px; color: var(--blue-600); font-weight: 700; }

/* Finder hint */
.finder-hint { font-size: 12px; color: var(--muted); }

/* Signup form */
.main-narrow { max-width: 720px; }
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field span em { color: var(--red); font-style: normal; }
.field input, .field textarea { font: inherit; font-weight: 400; color: var(--ink); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #e0ebff; }
.form-actions { display: flex; align-items: center; gap: 14px; }
.form-error { color: var(--red); font-size: 14px; font-weight: 500; }
.form-success { display: flex; align-items: flex-start; gap: 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 18px 20px; }
.form-success strong { display: block; font-size: 16px; }
.form-success p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.success-mark { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .calendar-grid, .suggestions, .role-grid { grid-template-columns: 1fr; }
  .panel-head.between { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .invite-banner, .member-done, .contact-callout { flex-direction: column; align-items: flex-start; }
  .invite-banner .btn, .member-done .btn, .contact-callout .btn { margin-left: 0; }
  .rsvp-actions { margin-left: 0; width: 100%; }
}
