:root {
  --primary: #3E5C50;
  --primary-dark: #2C4339;
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --user-bubble: #E2EAE5;
  --bot-bubble: #FFFFFF;
  --text: #2C3A33;
  --muted: #8C9A92;
  --accent: #C49A6C;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app { height: 100%; display: flex; flex-direction: column; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.screen.center { align-items: center; justify-content: center; text-align: center; gap: 18px; }

.muted { color: var(--muted); }

/* --- login --- */
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-mark {
  font-size: 56px; line-height: 1; color: var(--primary);
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,.08); margin-bottom: 8px;
}
.brand h1 { margin: 8px 0 0; font-size: 26px; font-weight: 650; }
.tagline { margin: 0; color: var(--muted); }

/* --- buttons --- */
.btn-primary {
  border: none; background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 600; padding: 14px 32px; border-radius: 999px;
  cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
/* secondary landing CTA (e.g. "Request access" on faculty portals) */
.btn-outline {
  border: 2px solid var(--primary); background: transparent; color: var(--primary);
  font-size: 16px; font-weight: 600; padding: 12px 32px; border-radius: 999px;
  cursor: pointer; transition: background .15s, color .15s; margin-top: 10px;
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* --- native in-app login form (EU backend) ------------------------------- */
.auth-brand { margin-bottom: 4px; }
.auth-form {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 320px;
}
.auth-form input {
  width: 100%; box-sizing: border-box;
  padding: 13px 16px; font-size: 16px;
  border: 1px solid #d8d2c8; border-radius: 12px;
  background: var(--surface); color: var(--text);
}
.auth-form input:focus { outline: none; border-color: var(--primary); }
.auth-form .btn-primary { width: 100%; margin-top: 2px; }
.auth-note { margin: 0 0 2px; color: var(--muted); font-size: 14px; text-align: left; }
.auth-error { margin: 2px 0 0; color: #c0392b; font-size: 14px; }
.auth-link {
  border: none; background: transparent; color: var(--primary);
  font-size: 14px; cursor: pointer; padding: 4px;
}
.auth-link:hover { text-decoration: underline; }
.auth-cancel { color: var(--muted); margin-top: 4px; }
.btn-ghost {
  border: none; background: transparent; color: var(--primary);
  font-size: 15px; padding: 6px 10px; cursor: pointer; border-radius: 8px;
}
.btn-ghost:hover { background: rgba(0,0,0,.04); }

/* --- top bar --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--surface);
  border-bottom: 1px solid rgba(0,0,0,.06); flex: 0 0 auto;
}
.topbar-title { font-weight: 650; font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

/* --- modal (account / change password) --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 14px; padding: 22px;
  width: 100%; max-width: 360px; box-shadow: 0 14px 44px rgba(0,0,0,.28);
  /* The account modal grew taller than a laptop viewport (name + email +
     phone + data export + password): cap it and scroll inside, so the top
     and bottom are always reachable. */
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal h2 { margin: 0 0 16px; font-size: 18px; color: var(--text); }
.modal label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; color: var(--muted); margin-bottom: 12px;
}
.modal input {
  padding: 10px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: 9px;
  font-size: 15px; color: var(--text); background: var(--bg);
}
.modal input:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-msg { min-height: 18px; font-size: 13px; margin: 2px 0 8px; }
.modal-msg.error { color: #C0392B; }
.modal-msg.ok { color: #2E7D32; }
.manual-details { margin-bottom: 16px; font-size: 14px; }
.manual-details summary { cursor: pointer; font-weight: 600; color: var(--text); }
.manual-details p, .manual-details ul { margin: 8px 0; color: var(--muted); }
.manual-details li { margin-left: 18px; }

/* --- persona picker --- */
.picker-hint { color: var(--muted); margin: 8px 0 18px; }
.persona-grid { display: flex; flex-direction: column; gap: 14px; max-width: 480px; width: 100%; margin: 0 auto; }
.persona-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  border: 1px solid rgba(0,0,0,.08); border-left: 5px solid var(--card-accent, var(--primary));
  background: var(--surface); border-radius: 16px; padding: 18px 20px;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.persona-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.persona-name { font-size: 18px; font-weight: 650; }
.persona-tagline { color: var(--muted); font-size: 14px; }
.signed-as { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }

/* --- chat --- */
.messages {
  flex: 1; overflow-y: auto; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 18px;
  font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.bubble.user { align-self: flex-end; background: var(--user-bubble); border-bottom-right-radius: 5px; }
.bubble.bot { align-self: flex-start; background: var(--bot-bubble); border-bottom-left-radius: 5px; }

/* Image bubble (e.g. the first-contact welcome infographic) — let the picture
   fill the bubble edge-to-edge rather than sit in text padding. */
.bubble.has-image { padding: 4px; max-width: 85%; }
.bubble-image { display: block; width: 100%; height: auto; border-radius: 14px; }

.bubble.typing { display: flex; gap: 4px; align-items: center; }
.bubble.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite both;
}
.bubble.typing span:nth-child(2) { animation-delay: .2s; }
.bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.system-line { align-self: center; color: var(--muted); font-size: 13px; text-align: center; max-width: 90%; padding: 4px 0; }
.system-line.error { color: #C0392B; }
.error-msg { color: #C0392B; max-width: 420px; }

/* --- composer --- */
.composer {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid rgba(0,0,0,.06);
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid rgba(0,0,0,.12); border-radius: 20px;
  padding: 10px 14px; font-size: 15px; font-family: inherit; line-height: 1.35;
  max-height: 140px; outline: none; background: var(--bg); color: var(--text);
}
.composer textarea:focus { border-color: var(--primary); }
.btn-send {
  flex: 0 0 auto; width: 40px; height: 40px; border: none; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 18px; cursor: pointer;
}
.btn-send:disabled { opacity: .5; cursor: default; }

/* --- spinner --- */
.spinner {
  width: 38px; height: 38px; border: 3px solid rgba(0,0,0,.1);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- persona-site landing (branded single-persona front door) --- */
.landing {
  flex: 1; display: flex; flex-direction: column;
  align-items: center;
  padding: 32px 24px; overflow-y: auto; position: relative; width: 100%;
}
.landing-inner {
  max-width: 380px; width: 100%; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  /* Vertical centering via auto margins, NOT justify-content:center on the
     parent — flex centering in a scroll container makes overflowing content
     unreachable above the scroll origin (the top of the page gets cut off).
     Auto margins center when there is room and collapse to 0 when there is
     not, so tall content starts at the top and scrolls normally. */
  margin-top: auto; margin-bottom: auto;
}
.landing-copy, .landing-bullets { width: 100%; overflow-wrap: break-word; }
.landing .brand h1 { font-size: 34px; }
.landing-copy { color: var(--text); line-height: 1.55; }
.landing-copy p { margin: 0 0 12px; }
.landing-bullets {
  list-style: none; padding: 0; margin: 0; text-align: left;
  display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px;
}
.landing-bullets li { position: relative; padding-left: 22px; color: var(--text); }
.landing-bullets li::before {
  content: "◐"; position: absolute; left: 0; top: 0; color: var(--primary);
}
.flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: 90%; padding: 12px 18px; border-radius: 10px; z-index: 1000;
  font-size: 14px; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); cursor: pointer;
}
.flash-ok { background: #2e7d5b; }
.flash-warn { background: #b5562e; }
.landing-infographic-link { width: 100%; display: block; }
.landing-infographic {
  width: 100%; height: auto; display: block; border-radius: 12px;
  border: 1px solid var(--border, rgba(0,0,0,.08));
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.landing-footer { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.lang-toggle {
  position: absolute; top: 16px; right: 16px; display: flex; gap: 2px;
  background: var(--surface); border-radius: 999px; padding: 3px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.lang-opt {
  border: none; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.lang-opt.active { background: var(--primary); color: #fff; }
.landing-org {
  margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-top: 18px; border-top: 1px solid rgba(0,0,0,.08); width: 100%;
}
.landing-logo { height: 52px; width: auto; opacity: .92; }
.landing-org-caption { margin: 0; font-size: 12px; color: var(--muted); }

/* --- course hub (logged-in: intro video + curriculum) --- */
.lang-toggle.inline { position: static; box-shadow: none; background: transparent; padding: 0; }
.course-scroll { flex: 1; overflow-y: auto; padding: 24px 18px calc(28px + env(safe-area-inset-bottom)); }
.course-inner { max-width: 720px; margin: 0 auto; width: 100%; }
.course-intro { color: var(--text); line-height: 1.55; margin: 0 0 20px; }
.course-video {
  border-radius: 14px; overflow: hidden; background: #000;
  box-shadow: 0 8px 28px rgba(0,0,0,.12); margin: 0 0 16px;
}
.course-video.portrait { max-width: 360px; margin-left: auto; margin-right: auto; }
.course-video video { display: block; width: 100%; height: auto; background: #000; }
.course-video-label {
  margin: 0; padding: 10px 14px; font-size: 13px; color: var(--muted);
  background: var(--surface);
}
.course-talk {
  display: block; width: 100%; max-width: 320px; margin: 22px auto 8px; text-align: center;
}
.course-modules-h { font-size: 16px; font-weight: 650; color: var(--text); margin: 28px 0 12px; }
.course-modules { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.course-module {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid rgba(0,0,0,.07); border-radius: 12px;
  padding: 12px 14px;
}
.cm-num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); color: var(--primary); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cm-title { flex: 1; font-size: 14px; color: var(--text); line-height: 1.35; }
.cm-soon { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-style: italic; }

/* --- access flow (register / pending / approved) + admin panel ----------- */
.screen.access { align-items: center; }
.access-card {
  width: 100%; max-width: 440px; background: var(--surface);
  border-radius: 14px; padding: 24px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.access-card h2 { margin: 0 0 12px; font-size: 20px; color: var(--text); }
.access-intro { color: var(--text); line-height: 1.55; margin: 0 0 18px; font-size: 14px; }
.access-card form { display: flex; flex-direction: column; gap: 14px; }
.access-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--muted);
}
.access-card input, .access-card textarea {
  padding: 10px 12px; border: 1px solid #d9d2c7; border-radius: 9px;
  font: inherit; color: var(--text); background: var(--bg); resize: vertical;
}
.access-card input:focus, .access-card textarea:focus {
  outline: none; border-color: var(--primary); background: var(--surface);
}
.access-card .btn-primary { margin-top: 4px; }

/* structured access form (channels.web.access_form — faculty portals) */
.access-card select {
  padding: 10px 12px; border: 1px solid #d9d2c7; border-radius: 9px;
  font: inherit; color: var(--text); background: var(--bg);
}
.access-card select:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.af-note { font-size: 12px; color: var(--muted); font-style: italic; }
.af-other.af-hidden { display: none; }
.af-group { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.af-group-label { margin-bottom: 2px; }
.af-radio, .af-check {
  display: flex; flex-direction: row; align-items: flex-start; gap: 8px;
  font-size: 14px; color: var(--text); cursor: pointer;
}
.af-radio input, .af-check input { margin-top: 3px; flex: none; width: auto; }

/* structured answers in the admin requests queue */
.admin-answers {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg); border-radius: 9px; padding: 10px 12px; font-size: 13px;
}
.admin-answer { display: flex; gap: 8px; line-height: 1.4; }
.admin-answer span:first-child { color: var(--muted); flex: 0 0 44%; }

/* trial expiry badge on member rows */
.member-expiry {
  font-size: 12px; color: var(--muted); background: var(--bg);
  border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.member-expired { color: #b3402a; font-weight: 600; }

.admin-scroll { overflow-y: auto; padding: 16px; }
.admin-list { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.admin-item {
  background: var(--surface); border-radius: 12px; padding: 16px 16px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); display: flex; flex-direction: column; gap: 8px;
}
.admin-who { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.admin-name { font-weight: 600; color: var(--text); }
.admin-persona { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.admin-meta { font-size: 13px; color: var(--muted); }
.admin-why { font-size: 13px; color: var(--text); line-height: 1.5; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.admin-phone-l { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.admin-phone { padding: 8px 10px; border: 1px solid #d9d2c7; border-radius: 8px; font: inherit; color: var(--text); background: var(--bg); }
.admin-phone:focus { outline: none; border-color: var(--primary); }
.admin-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; align-items: center; }
.admin-done { color: #2E7D32; font-size: 14px; text-align: center; padding: 6px 0; }

/* --- admin hub: tabs + persona switcher --- */
.admin-tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.admin-tab {
  border: none; background: transparent; color: var(--muted); font: inherit; font-size: 14px;
  padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.admin-persona-sel {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--text);
  border: none; background: transparent; max-width: 60vw;
}
.center-p { text-align: center; padding: 24px 0; }

/* --- members --- */
/* Member rows: stacked cards on mobile; single-line grid + wider container on
   desktop (the admin hub is a management view, not the phone-width chat). */
.member-item {
  width: 100%; max-width: 560px; margin: 0 auto; background: var(--surface);
  border: 1px solid rgba(0,0,0,.08); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.member-item.removed { opacity: .55; }
.member-name { font-weight: 600; color: var(--text); }
.member-email { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.member-email-none { color: var(--muted); font-style: italic; }
.member-phone { font-size: 13px; color: var(--muted); }
.member-last { font-size: 13px; color: var(--muted); }
.member-msgs { font-size: 13px; color: var(--muted); }
.member-section {
  max-width: 560px; margin: 20px auto 8px; font-size: 14px; font-weight: 650; color: var(--text);
}
.member-count { color: var(--muted); font-weight: 400; }
.member-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.member-tier { display: flex; align-items: center; gap: 4px; }
.member-controls { display: flex; align-items: center; gap: 8px; }
.member-msg { min-height: 0; }
.role-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted);
}
.role-badge.role-admin { background: #E2EAE5; color: var(--primary-dark); }
.role-badge.role-superadmin { background: var(--accent); color: #fff; }
.role-badge.role-circle_host { background: #E6DFF3; color: #5B4B8A; }
.member-reset-ok { color: var(--text); }
.member-temp {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--bg); border: 1px solid rgba(0,0,0,.12); border-radius: 6px;
  padding: 1px 6px; user-select: all;
}
.member-temp-copy { font-size: 12px; padding: 2px 8px; }
.member-fixed { font-size: 10px; color: var(--muted); font-style: italic; }
.member-role { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid #d9d2c7;
  border-radius: 8px; background: var(--bg); color: var(--text); }

/* Add-member panel (Members tab). Sticky so it stays reachable above a long
   member list (admin-body is the scroll container) — without this it scrolls
   out of view for personas with many members. */
.add-member {
  position: sticky; top: -16px; z-index: 2;
  flex: none;  /* admin-body is a flex column with bounded height; without this
                  the closed <details> gets shrunk to ~0 when the member list
                  overflows (it has the least intrinsic content). */
  max-width: 560px; margin: 0 auto 18px; border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px; background: var(--card, #fff); overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.add-member-summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  font-size: 14px; font-weight: 650; color: var(--primary-dark);
}
.add-member-summary::-webkit-details-marker { display: none; }
.add-member[open] .add-member-summary { border-bottom: 1px solid rgba(0,0,0,.08); }
.add-member-form { padding: 14px 16px 16px; }
.add-member-form label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; color: var(--muted); margin-bottom: 12px;
}
.add-member-form input {
  padding: 10px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: 9px;
  font-size: 15px; color: var(--text); background: var(--bg);
}
.add-member-form input:focus { outline: none; border-color: var(--primary); }
.add-member-actions { display: flex; justify-content: flex-end; }
.add-member-result { margin-top: 8px; }
.am-ok {
  border: 1px solid #cfe3d6; background: #f0f7f2; border-radius: 10px;
  padding: 12px 14px; font-size: 14px; color: var(--text);
}
.am-ok p { margin: 0 0 6px; }
.am-wa { font-size: 13px; }
.am-copy { margin-top: 6px; }
/* Circle host: seat counter + the backend-rendered share message block. */
.circle-seats {
  max-width: 560px; margin: 16px auto 4px; font-size: 14px; color: var(--text);
}
.circle-seats-n { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.add-member-full { margin: 0 0 12px; color: var(--accent); }
.am-share {
  margin: 8px 0; padding: 10px 12px; background: var(--bg);
  border: 1px solid rgba(0,0,0,.10); border-radius: 9px;
}
.am-share-label { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.am-share-text { font-size: 13px; color: var(--text); white-space: pre-wrap; margin: 0; }
/* Forget me / delete account (#648): the danger list in the account modal. */
.danger-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 14px; color: var(--text);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.danger-btn { color: #C0392B; }
.danger-btn:disabled { color: var(--muted); }

/* Roster upload (#646): parsed-CSV preview + per-row results. */
.roster-table-wrap { overflow-x: auto; margin: 4px 0 12px; }
.roster-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.roster-table th, .roster-table td {
  padding: 6px 10px; text-align: left; border-bottom: 1px solid rgba(0,0,0,.08);
  white-space: nowrap;
}
.roster-table th { font-size: 12px; color: var(--muted); font-weight: 650; }
tr.roster-bad td { color: #a33; background: #fbf1f1; }
.roster-results { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; }
.roster-results li { margin: 2px 0; }
.roster-results li.roster-bad { color: #a33; }

@media (min-width: 768px) {
  .add-member { max-width: 1080px; }
}

@media (min-width: 768px) {
  /* Widen the whole admin hub on a real screen. */
  .admin-list, .member-section { max-width: 1080px; }
  .member-item {
    max-width: 1080px;
    display: grid;
    grid-template-columns: minmax(140px, 1.4fr) minmax(170px, 1.6fr) minmax(120px, 1fr) max-content max-content max-content;
    align-items: center; column-gap: 18px; row-gap: 2px;
    padding: 10px 18px;
  }
  .member-email, .member-phone, .member-last, .member-msgs { font-size: 14px; }
  .member-controls { justify-self: end; }
  /* status line drops to its own row under the cells, only when populated */
  .member-msg { grid-column: 1 / -1; }
  .member-msg:empty { display: none; }
}

/* --- usage dashboard --- */
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 560px; margin: 0 auto 8px; }
.tile { background: var(--surface); border: 1px solid rgba(0,0,0,.08); border-radius: 12px; padding: 14px; text-align: center; }
.tile-val { font-size: 24px; font-weight: 700; color: var(--primary); }
.tile-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.usage-h { max-width: 560px; margin: 18px auto 6px; font-size: 14px; color: var(--text); }
.barchart { width: 100%; max-width: 560px; display: block; margin: 0 auto; height: 90px; }
.barchart .bar { fill: var(--primary); }
.channel-mix { max-width: 560px; margin: 0 auto; }
.splitbar { height: 14px; border-radius: 7px; overflow: hidden; background: var(--accent); }
.splitbar .seg-web { display: block; height: 100%; background: var(--primary); }
.channel-legend { font-size: 13px; color: var(--muted); margin-top: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 3px; }
.dot-web { background: var(--primary); }
.dot-wa { background: var(--accent); }
.usage-note { max-width: 560px; margin: 16px auto 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* --- create-a-class wizard ------------------------------------------------- */
.cc-scroll { overflow-y: auto; padding: 16px; }
.cc-steps {
  display: flex; flex-wrap: wrap; gap: 6px; max-width: 560px;
  margin: 0 auto 18px; justify-content: center;
}
.cc-dot {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: rgba(0,0,0,.05); color: var(--muted); white-space: nowrap;
}
.cc-dot.active { background: var(--primary); color: #fff; }
.cc-dot.done { background: rgba(0,0,0,.10); color: var(--text); }
.cc-body { max-width: 560px; margin: 0 auto; }
.cc-body label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; color: var(--muted); margin-bottom: 14px;
}
.cc-body input[type="text"], .cc-body input[type="email"], .cc-body input[type="tel"],
.cc-body textarea {
  padding: 10px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: 9px;
  font-size: 15px; color: var(--text); background: var(--bg);
  font-family: inherit; width: 100%; box-sizing: border-box;
}
.cc-body input:focus, .cc-body textarea:focus { outline: none; border-color: var(--primary); }
.cc-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.cc-host { font-size: 13px; min-height: 18px; margin: -8px 0 12px; }
.cc-host.ok { color: #2E7D32; }
.cc-host.err { color: #C0392B; }
.cc-color-row { display: flex; align-items: center; gap: 10px; }
.cc-color-row input[type="color"] {
  width: 44px; height: 32px; padding: 0; border: 1px solid rgba(0,0,0,.14);
  border-radius: 8px; background: none; cursor: pointer;
}
.cc-color-hex { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.cc-filebtn { cursor: pointer; }
.cc-filebtn .btn-ghost { display: inline-block; }
.cc-files { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.cc-files li { padding: 4px 0; color: var(--text); }
.cc-rev {
  display: flex; justify-content: space-between; gap: 16px; padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.06); font-size: 14px;
}
.cc-rev span { color: var(--muted); }
.cc-rev strong { color: var(--text); text-align: right; word-break: break-word; }
.cc-progress { margin-top: 16px; font-size: 13px; color: var(--text); }
.cc-progress div { padding: 3px 0; }
.cc-progress .cc-open, .cc-progress .cc-done { margin-top: 12px; margin-right: 8px; }
.cc-nav {
  display: flex; justify-content: space-between; gap: 12px;
  max-width: 560px; margin: 18px auto 0;
}

@media (min-width: 768px) {
  .cc-steps, .cc-body, .cc-nav { max-width: 680px; }
}

/* Documents (corpus admin) tab */
.docs-head, .docs-upload { max-width: 560px; margin: 0 auto; }
.docs-summary { font-size: 13px; color: var(--text); margin: 8px 0; }
.docs-state { margin-left: 6px; font-size: 12px; color: var(--muted); }
.docs-state.docs-failed { color: #b00; }
.docs-state.docs-running, .docs-state.docs-queued { color: var(--primary); }
.docs-list { list-style: none; margin: 8px auto 16px; padding: 0; max-width: 560px; }
.docs-item {
  padding: 6px 10px; border: 1px solid rgba(0,0,0,.08); border-radius: 6px;
  margin-bottom: 4px; font-size: 13px; word-break: break-all;
}
.docs-upload { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 12px; }
.docs-input { display: none; }
.docs-pick { display: inline-block; cursor: pointer; }
.docs-chosen { font-size: 12px; word-break: break-all; }
.docs-hint { font-size: 12px; margin: 2px 0; }
#docs-progress { white-space: pre-line; align-self: stretch; }
.cc-prompt-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.cc-reset { font-size: 12px; padding: 4px 8px; flex: none; }

/* Prompt editor (admin hub) */
.prompt-editor { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
.prompt-editor .prompt-text { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.4; padding: 10px; }
.prompt-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.prompt-section-l { margin: 10px 0 2px; }
.prompt-actions { margin-top: 4px; }
.prompt-history { margin-top: 8px; }
.prompt-vers { list-style: none; padding: 0; margin: 6px 0 0; }
.prompt-ver { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.prompt-ver-meta { font-size: 12px; color: var(--muted); }

/* ---- booking ------------------------------------------------------------ */
.booking-card { max-width: 440px; position: relative; }
.bk-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
.bk-person { margin-bottom: 18px; }
.bk-person h3 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.bk-muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.bk-service {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 8px; border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px; background: var(--bg); cursor: pointer;
}
.bk-service:hover:not(:disabled) { border-color: var(--primary); }
.bk-service:disabled { opacity: .5; cursor: default; }
.bk-svc-title { font-size: 15px; color: var(--text); font-weight: 600; }
.bk-svc-meta { font-size: 13px; color: var(--muted); }
.bk-svc-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bk-crumb { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.bk-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-slot {
  padding: 8px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: 9px;
  background: var(--bg); font-size: 14px; color: var(--text); cursor: pointer;
}
.bk-slot:hover { border-color: var(--primary); background: var(--user-bubble); }
.bk-tz { font-size: 12px; color: var(--muted); margin-top: 10px; }
.bk-when { font-size: 15px; color: var(--text); font-weight: 600; margin: 4px 0 12px; }
.bk-pay-note { font-size: 13px; color: var(--text); background: var(--user-bubble);
  padding: 8px 10px; border-radius: 8px; }
.bk-done { text-align: center; padding: 8px 0 4px; }
.bk-done-head { font-size: 17px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.bk-mine-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.08);
}
.bk-mine-link { margin-top: 14px; text-align: center; }

/* ---- bookable console --------------------------------------------------- */
.cn-row { display: flex; gap: 10px; }
.cn-row label { flex: 1; }
.cn-check { flex-direction: row !important; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.cn-check input { width: auto; }
#cn-hours { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
#cn-preview-out { margin-top: 12px; }

/* --- Talks catalog tab --------------------------------------------------- */
.cat-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cat-tools { display: flex; align-items: center; gap: 6px; }
.cat-search { padding: 6px 10px; border: 1px solid rgba(0,0,0,.14); border-radius: 8px; font-size: 13px; min-width: 180px; }
.cat-wrap { overflow-x: auto; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; }
.cat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cat-table th, .cat-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(0,0,0,.05); vertical-align: top; }
.cat-table thead th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; white-space: nowrap; z-index: 1; }
.cat-th[data-sort] { cursor: pointer; user-select: none; }
.cat-th[data-sort]:hover { color: var(--primary); }
.cat-table tbody tr:hover { background: rgba(0,0,0,.02); }
.cat-title { max-width: 380px; color: var(--text); }
.cat-c { white-space: nowrap; text-align: center; }
.cat-c a { text-decoration: none; color: var(--primary); font-size: 15px; }
.cat-foot { margin-top: 8px; font-size: 12px; }

/* --- Events (public schedule) -------------------------------------------- */
.landing-events { margin: 18px 0 6px; text-align: left; }
.ev-h { font-size: 15px; color: var(--primary); margin: 0 0 10px; }
.ev-list { display: flex; flex-direction: column; gap: 10px; }
.ev-card { background: var(--surface); border: 1px solid rgba(0,0,0,.08); border-radius: 12px; padding: 12px 14px; }
.ev-title { font-weight: 600; color: var(--text); font-size: 14px; }
.ev-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ev-link { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--primary); text-decoration: none; }
.ev-link:hover { text-decoration: underline; }
.ev-synced { margin-top: 10px; font-size: 12px; text-align: center; }

/* --- Bookable console: upcoming sessions --------------------------------- */
#cn-sessions { margin: 10px 0 16px; }
.cn-sess-h { font-size: 14px; color: var(--primary); margin: 0 0 8px; }
.cn-sess-list { display: flex; flex-direction: column; gap: 8px; }
.cn-sess { background: var(--surface); border: 1px solid rgba(0,0,0,.08); border-radius: 10px; padding: 10px 12px; }
.cn-sess-prov { opacity: .65; border-style: dashed; }
.cn-sess-when { font-weight: 600; font-size: 13.5px; color: var(--text); }
.cn-sess-who { font-size: 13px; color: var(--text); margin-top: 2px; }
.cn-sess-svc { color: var(--muted); }
.cn-sess-badge { margin-left: 6px; font-size: 11px; background: rgba(0,0,0,.07); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.cn-sess-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-style: italic; }
.cn-sess-none, .cn-sess-tz { font-size: 12px; }

/* --- Mailing-list signup + subscribers ------------------------------------ */
.ml-box { margin-top: 14px; text-align: left; }
.ml-lead { font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.ml-form { display: flex; gap: 8px; }
.ml-form input[type="email"] { flex: 1; padding: 8px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: 8px; font-size: 14px; }
.ml-msg { font-size: 13px; color: var(--primary); margin: 6px 0 0; }
.ml-unsub { opacity: .5; }
