/* =====================================================================
   Westville Training Hub — app styles (v2: program tables, editor, chat).
   Builds ONLY on tokens.css vars (Neighborhood Table). Functionality-first;
   the visual polish pass comes later.
   ===================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ---- Stroke icons (Neighborhood Table icon set) ------------------------ */
.i {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.nt-btn .i {
  margin-top: -1px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: 0.01em;
  margin: 0;
}

a {
  color: var(--brand-deep);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: var(--font-sans);
}

:focus-visible {
  outline: 2px solid var(--brand-action);
  outline-offset: 2px;
}

.nt-btn,
.tap {
  min-height: 44px;
}

/* ---- Layout shells ---------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  padding-top: max(0.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.brand-logo {
  height: 21px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-sub {
  color: var(--muted);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8rem;
}

.header-spacer {
  flex: 1;
}

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-deep);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.lang-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-card);
}
.me-chip {
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .brand-sub,
  .me-chip {
    display: none;
  }
  .app-header {
    gap: 0.4rem;
  }
  .app-header .nt-btn--ghost {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }
  .brand-logo {
    height: 18px;
  }
}
.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--brand-action);
  color: #fff;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem);
  padding-bottom: 4rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head h1 {
  font-size: clamp(1.4rem, 1rem + 2vw, 1.9rem);
}
.page-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

/* ---- Gate & who-picker ------------------------------------------------- */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.gate-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: rise var(--dur) var(--ease) both;
}
.gate-logo {
  width: min(180px, 68%);
  height: auto;
  margin: 0 auto 1.4rem;
  display: block;
}
.gate-langrow {
  display: flex;
  justify-content: center;
  margin-bottom: 1.1rem;
}
.gate-kicker {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a8a29e;
  margin-bottom: 1.25rem;
}
.gate-caption {
  font-size: 0.75rem;
  color: #a8a29e;
  margin: 1.4rem 0 0;
}
.gate-card .nt-input {
  min-height: 46px;
}
.gate-card .nt-btn--primary {
  min-height: 46px;
}
.gate-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.gate-card p {
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.gate-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.who-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ---- Program tables ----------------------------------------------------- */
.program-section {
  margin-bottom: 1.5rem;
}
.program-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.program-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--brand-50);
}
.program-head h2 {
  font-size: 1.05rem;
}
.program-head__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.program-head .nt-btn {
  min-height: 38px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}
.program-edit {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.course-cols {
  display: grid;
  grid-template-columns: 1fr 150px 64px 110px 44px;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
}
.course-row {
  display: grid;
  grid-template-columns: 1fr 150px 64px 110px 44px;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--body);
  transition: background var(--dur) var(--ease);
}
.course-row:last-child {
  border-bottom: 0;
}
.course-row:hover {
  background: var(--hover-surface);
}
.course-row .cname {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.course-row .cmodule {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}
.program-empty {
  padding: 1rem;
  color: var(--faint);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .course-cols {
    display: none;
  }
  .course-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name chat"
      "meta chat";
    row-gap: 0.25rem;
  }
  .course-row .cname {
    grid-area: name;
    white-space: normal;
  }
  .course-row .cmeta {
    grid-area: meta;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
  }
  .course-row .cchat {
    grid-area: chat;
  }
}
@media (min-width: 641px) {
  .course-row .cmeta {
    display: contents;
  }
}

.add-program-row {
  margin-top: 0.5rem;
}
.add-program-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  max-width: 420px;
}

/* ---- Status pills (5) --------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  width: fit-content;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}
.status--new {
  background: var(--hover-surface);
  color: var(--muted);
}
.status--ready {
  background: var(--brand-100);
  color: var(--brand-deep);
}
.status--sent {
  background: #e0e7ff;
  color: var(--info);
}
.status--pending {
  background: var(--amber-tint);
  color: #92400e;
}
.status--done {
  background: var(--brand-action);
  color: #fff;
}

/* Status as a dropdown (course page) */
.status-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: #fff;
  padding: 0.35rem 2rem 0.35rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--body);
  box-shadow: var(--shadow-card);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  cursor: pointer;
  min-height: 38px;
}

/* Quinn indicator */
.quinn-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.quinn-chip--sent {
  color: var(--brand-deep);
}
.quinn-chip--not {
  color: var(--faint);
}

/* Chat dot */
.chat-ind {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--faint);
}
.chat-ind .bubble-count {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ---- Course page --------------------------------------------------------- */
.course-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.course-title-block h1 {
  font-size: clamp(1.2rem, 1rem + 1.5vw, 1.6rem);
}
.course-crumb {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.course-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.course-links {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 600;
}
.save-note {
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---- Editor --------------------------------------------------------------- */
.editor-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.editor-toolbar {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 58px;
  z-index: 10;
}
.editor-toolbar button {
  border: 0;
  background: transparent;
  border-radius: var(--radius-control);
  min-width: 38px;
  min-height: 38px;
  padding: 0.25rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.editor-toolbar button:hover {
  background: var(--hover-surface);
  color: var(--ink);
}
.editor-toolbar .sep {
  width: 1px;
  background: var(--border);
  margin: 0.25rem 0.25rem;
}

.editor {
  min-height: 46vh;
  padding: 1.1rem 1.25rem;
  outline: none;
  font-family: var(--font-sans);
  line-height: 1.65;
  color: var(--body);
}
.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
}
.editor h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 1.1rem 0 0.4rem;
}
.editor h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--brand-deep);
  margin: 1rem 0 0.35rem;
}
.editor h3 {
  font-size: 0.95rem;
  margin: 0.8rem 0 0.3rem;
}
.editor p {
  margin: 0.4rem 0;
}
.editor ul,
.editor ol {
  margin: 0.3rem 0;
  padding-left: 1.4rem;
}
.editor li {
  margin: 0.2rem 0;
}
.editor hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.editor img {
  max-width: 100%;
}
.editor table {
  border-collapse: collapse;
}
.editor td,
.editor th {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
}

/* ---- Flags --------------------------------------------------------------- */
.flags-panel {
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.flags-panel--blocker {
  background: var(--danger-tint);
}
.flags-panel--warning {
  background: var(--amber-tint);
}
.flags-panel h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.flags-panel ul {
  margin: 0;
  padding-left: 1.1rem;
}
.flags-panel li {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ---- Chat ------------------------------------------------------------------ */
.chat-card {
  margin-top: 1.25rem;
}
.chat-card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.chat-msg {
  max-width: 85%;
  border-radius: var(--radius-callout);
  padding: 0.55rem 0.8rem;
  background: var(--hover-surface);
  font-size: 0.88rem;
  line-height: 1.5;
}
.chat-msg--mine {
  align-self: flex-end;
  background: var(--brand-100);
}
.chat-msg .meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.chat-msg .meta .author {
  color: var(--brand-deep);
}
.chat-empty {
  color: var(--faint);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 130px;
  resize: vertical;
}

/* ---- Forms / intake (kept from v1) ---------------------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field label.nt-label {
  margin-bottom: 0.35rem;
}
textarea.nt-input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
.big-textarea {
  min-height: 40vh;
  font-size: 1rem;
}

.dropzone {
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone.drag {
  border-color: var(--brand);
  background: var(--brand-50);
}
.dropzone strong {
  color: var(--body);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 0.4rem 0.6rem;
  box-shadow: var(--shadow-card);
  font-size: 0.82rem;
}
.file-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--body);
}
.file-row .size {
  color: var(--faint);
  font-size: 0.75rem;
}
.file-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
}

.disclosure summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-deep);
  font-size: 0.85rem;
  list-style: none;
  padding: 0.25rem 0;
}
.disclosure summary::-webkit-details-marker {
  display: none;
}
.disclosure summary::before {
  content: "▸ ";
}
.disclosure[open] summary::before {
  content: "▾ ";
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
select.nt-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.match-note {
  background: var(--brand-50);
  border-radius: var(--radius-callout);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: var(--brand-800);
}
.warn-note {
  background: var(--amber-tint);
  border-radius: var(--radius-callout);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: #7c4a03;
}
.rationale {
  color: var(--muted);
  font-style: italic;
  margin: 0.75rem 0 0;
}

/* ---- Action bar ------------------------------------------------------------ */
.action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem 0;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  margin-top: 1rem;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
}
.action-bar .grow {
  margin-right: auto;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---- Empty / loading / error / toast ---------------------------------------- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty .big {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1rem + 3vw, 2.2rem);
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand-action);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: -4px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  padding: 2rem 0;
  justify-content: center;
}

.error-banner {
  background: var(--danger-tint);
  color: #991b1b;
  border-radius: var(--radius-callout);
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.config-hint {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: #7f1d1d;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-raised);
  z-index: 60;
  max-width: 90vw;
  animation: rise var(--dur) var(--ease) both;
}
.toast.err {
  background: var(--danger);
}

.muted {
  color: var(--muted);
}
.mt {
  margin-top: 1rem;
}

/* =====================================================================
   Design pass (Neighborhood Table hifi) — meta pill, guide nesting,
   bell avatars, mail disc, empty state.
   ===================================================================== */

/* ---- Course meta info-pill ------------------------------------------------ */
/* Section headings that carry a leading icon (Attachments, Comments, Manual editor…) */
.card-h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1rem;
}
.card-h2 .i {
  color: var(--brand-deep);
}
.chat-card h2 {
  margin-bottom: 0.75rem;
}

/* Course-page "open Quinn doc" style link */
.course-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-deep);
  white-space: nowrap;
}
.file-ic {
  color: var(--faint);
}
.chat-ind {
  color: #a8a29e;
}
.chat-ind--active {
  color: var(--muted);
}

.import-block {
  margin-bottom: 1rem;
}

/* Activity log list */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem;
}
.activity-list .bell-item {
  padding: 0.65rem 0.6rem;
  border-radius: var(--radius-callout);
}
.activity-list .bell-item + .bell-item {
  border-top: 1px solid var(--border);
}
.import-expand {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding-left: 0.1rem;
  animation: rise var(--dur) var(--ease) both;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.375rem 0.875rem;
  box-shadow: var(--shadow-card);
}
.info-pill__seg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
}
.info-pill__seg .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.info-pill__div {
  width: 1px;
  height: 15px;
  background: var(--border);
  flex-shrink: 0;
}
.auto-hint {
  font-size: 0.72rem;
  color: #a8a29e;
}

/* ---- Bell dropdown items: avatar disc + unread dot ------------------------ */
.bell-item {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}
.bell-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.bell-avatar--green {
  background: var(--brand-100);
  color: var(--brand-deep);
}
.bell-avatar--blue {
  background: #e0e7ff;
  color: var(--info);
}
.bell-avatar--stone {
  background: var(--hover-surface);
  color: var(--muted);
}
.bell-item__body {
  flex: 1;
  min-width: 0;
}
.bell-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ---- Mail-prompt disc ----------------------------------------------------- */
.mail-prompt {
  border: 1px solid #d7ecda;
}
.mail-disc {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  color: var(--brand-deep);
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
}

/* ---- Warm empty board state ---------------------------------------------- */
.empty-card {
  text-align: center;
  max-width: 420px;
  margin: 2.5rem auto;
  padding: 2.5rem 1.5rem;
  animation: rise var(--dur) var(--ease) both;
}
.empty-disc {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-action);
  margin-bottom: 0.85rem;
}
.empty-card .big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.empty-card .sub {
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---- Guide: nested hierarchy --------------------------------------------- */
.guide-nest {
  display: block;
}
.guide-level {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  border-radius: var(--radius-callout);
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
}
.guide-level--1 {
  background: var(--surface);
}
.guide-level--2,
.guide-level--3 {
  background: #fff;
}
.guide-nest__child {
  margin: 0.75rem 0 0 1.05rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--brand-200);
}
.guide-nest__child .guide-nest__child {
  border-left-color: var(--brand-100);
}
.guide-disc {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.guide-disc--1 {
  background: var(--brand-action);
}
.guide-disc--2 {
  background: var(--brand);
}
.guide-disc--3 {
  background: var(--brand-400);
}
.guide-kicker {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a8a29e;
}
.guide-level h3 {
  font-size: 1rem;
  margin: 0.05rem 0 0.15rem;
}
.guide-level p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}
.guide-example {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--brand-50);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.85rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-deep);
}
.guide-example .chev {
  color: var(--brand-300);
}

@media (max-width: 560px) {
  .guide-nest__child {
    margin-left: 0.5rem;
    padding-left: 0.9rem;
  }
  .info-pill {
    flex-wrap: wrap;
  }
}

/* ---- Notification bell ------------------------------------------------------ */
.bell-wrap {
  position: relative;
  flex-shrink: 0;
}
.bell-btn {
  position: relative;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: var(--shadow-card);
}
.bell-btn .bubble-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.bell-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(340px, 90vw);
  max-height: 60vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
  z-index: 50;
  padding: 0.5rem;
}
.bell-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}
.bell-menu__head h3 {
  font-size: 0.95rem;
}
.bell-menu__head button {
  border: 0;
  background: none;
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.bell-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: var(--radius-callout);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--body);
  line-height: 1.45;
}
.bell-item:hover {
  background: var(--hover-surface);
}
.bell-item .who {
  font-weight: 700;
  color: var(--brand-deep);
}
.bell-item .course {
  font-weight: 600;
}
.bell-item .when {
  color: var(--faint);
  font-size: 0.72rem;
}
.bell-empty {
  padding: 1rem 0.6rem;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- Archive (red trash, far right of the row) --------------------------------- */
.row-arch {
  border: 0;
  background: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-control);
  min-height: 34px;
  min-width: 34px;
  display: inline-grid;
  place-items: center;
  justify-self: end;
  margin-left: auto;
}
.row-arch svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}
.row-arch:hover {
  background: var(--danger-tint);
}
.row-arch--restore {
  color: var(--muted);
  font-size: 1rem;
}
.row-arch--restore:hover {
  background: var(--hover-surface);
  color: var(--body);
}
.archived-section .program-head {
  background: var(--hover-surface);
}
.archived-section .course-row {
  opacity: 0.72;
}

/* ---- Westville AI Course Writer panel (always visible, clearly marked as AI) --- */
.ai-panel {
  border: 1.5px dashed var(--brand);
  border-radius: var(--radius-card);
  background: var(--brand-50);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.ai-panel h3 {
  color: var(--brand-deep);
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.ai-panel .ai-disclaimer {
  font-size: 0.78rem;
  color: var(--brand-800);
  margin: 0 0 0.6rem;
}
.ai-panel textarea {
  background: #fff;
}
/* AI mode segmented control */
.chip-toggle {
  border: 1px solid var(--brand-200);
  background: #fff;
  color: var(--brand-deep);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip-toggle:hover {
  background: var(--brand-50);
}
.chip-toggle[aria-pressed="true"] {
  background: var(--brand-action);
  border-color: var(--brand-action);
  color: #fff;
}
.ai-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.ai-preview {
  border: 1.5px dashed var(--brand);
  border-radius: var(--radius-callout);
  background: #fff;
  padding: 0.9rem 1rem;
  margin-top: 0.75rem;
  max-height: 45vh;
  overflow-y: auto;
}
.ai-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--brand-action);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 0.1rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Manual editor title bar + action footer (Save / Send to Quinn live inside) */
.editor-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.editor-head h3 {
  font-size: 0.95rem;
}
.editor-head .hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.editor-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.editor-foot .grow {
  margin-right: auto;
  font-size: 0.78rem;
  color: var(--muted);
}
/* Rendered doc preview (AI proposal) — mirrors the editor's typography */
.doc {
  font-family: var(--font-sans);
  color: var(--body);
  line-height: 1.6;
  font-size: 0.9rem;
}
.doc h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0.9rem 0 0.35rem;
}
.doc h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--brand-deep);
  margin: 0.8rem 0 0.3rem;
}
.doc p {
  margin: 0.35rem 0;
}
.doc ul,
.doc ol {
  margin: 0.3rem 0;
  padding-left: 1.3rem;
}
.doc em {
  color: var(--muted);
}

.ai-notes {
  background: var(--amber-tint);
  border-radius: var(--radius-callout);
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  color: #7c4a03;
  margin-top: 0.6rem;
}

/* ---- Guide / index -------------------------------------------------------------- */
.guide-hier {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.guide-level {
  border: 1px solid var(--border);
  border-radius: var(--radius-callout);
  background: #fff;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
}
.guide-level + .guide-level {
  margin-left: 1.5rem;
}
.guide-level h3 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.guide-level p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.guide-example {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-deep);
  margin-top: 0.75rem;
}
.list-manage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.list-manage .col h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.list-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--hover-surface);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.4rem 0.25rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0 0.3rem 0.35rem 0;
}
.list-chip button {
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.15rem;
}
.list-chip button:hover {
  color: var(--danger);
}
.list-add {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.list-add input {
  min-height: 38px;
}
.list-add .nt-btn {
  min-height: 38px;
  padding: 0.3rem 0.7rem;
}

/* ---- Course tabs (Content | Quinn) ------------------------------------------------ */
.course-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.course-tab {
  white-space: nowrap;
}

/* Kitchen-phone ergonomics: full-width primary actions, calmer meta row. */
@media (max-width: 560px) {
  .course-meta-row {
    gap: 0.5rem;
  }
  .editor-foot {
    justify-content: stretch;
  }
  .editor-foot .grow {
    flex-basis: 100%;
    margin-right: 0;
  }
  .editor-foot .nt-btn {
    flex: 1;
  }
  .chat-msg {
    max-width: 94%;
  }
  .editor-toolbar {
    top: 52px;
  }
}
.course-tab {
  border: none;
  background: none;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  padding: 0.55rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
}
.course-tab:hover {
  color: var(--body);
  background: var(--hover-surface);
}
.course-tab[aria-selected="true"] {
  color: var(--brand-deep);
  border-bottom-color: var(--brand-action);
}
.course-tab .bubble-count {
  position: static;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.quinn-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.quinn-link-row input {
  flex: 1;
  min-width: 220px;
}

/* ---- Notify-by-email prompt ------------------------------------------------------ */
.mail-prompt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: var(--brand-50);
  border-radius: var(--radius-callout);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: var(--brand-800);
  margin-top: 0.6rem;
}
.mail-prompt .grow2 {
  flex: 1;
  min-width: 160px;
}

