:root {
  --bg: #101014;
  --panel: #181722;
  --panel-soft: #1f1d2b;
  --charcoal: #252432;
  --purple: #7e4dff;
  --purple-soft: #b89dff;
  --text: #f7f3ff;
  --muted: #b9b0cd;
  --border: rgba(184, 157, 255, 0.25);
  --danger: #ffadad;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 10%, #262238 0%, var(--bg) 45%, #09090d 100%);
  min-height: 100vh;
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 78% 25%, rgba(126, 77, 255, 0.2), transparent 40%);
}

.hub {
  width: min(1100px, 92vw);
  margin: 0 auto;
  min-height: calc(100vh - 96px);
  padding: 4rem 0 8rem;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 1.1rem;
}

.hub-header { text-align: center; }
.hub-header h1 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); }
.hub-header p { margin: 0.5rem 0 0.75rem; color: var(--muted); }

.text-link {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--purple-soft);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.quick-action {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 0.8rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.quick-action:hover,
#sendBtn:hover {
  background: #2b2940;
}

.chat-thread {
  border: none;
  border-radius: 0;
  background: none;
  padding: 0.5rem 0;
  overflow-y: auto;
  min-height: 0;
  max-height: 62vh;
  display: grid;
  gap: 1.25rem;
  max-width: min(768px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.empty-thread {
  color: var(--muted);
  margin: auto;
}

.msg {
  border-radius: 0;
  padding: 0.4rem 0;
  border: none;
  background: none;
}
.msg.user {
  margin-left: auto;
  margin-right: 0;
  width: fit-content;
  max-width: min(80%, 560px);
  background: rgba(126, 77, 255, 0.15);
  border: 1px solid rgba(126, 77, 255, 0.25);
  border-radius: 18px 18px 4px 18px;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.93rem;
  text-align: right;
}
.msg.assistant {
  margin-right: auto;
  margin-left: 0;
  width: 100%;
}

.msg p { margin: 0; white-space: pre-wrap; }

/* ── Rich markdown rendering for assistant chat messages ───────────────────── */
.msg-prose { line-height: 1.6; }
.msg-prose p { margin: 0.35rem 0; white-space: normal; }
.msg-prose h2 { font-size: 1.15rem; font-weight: 700; margin: 1rem 0 0.3rem; color: #d4bfff; }
.msg-prose h3 { font-size: 1.05rem; font-weight: 600; margin: 0.8rem 0 0.25rem; color: #c9b0ff; }
.msg-prose h4 { font-size: 0.97rem; font-weight: 600; margin: 0.6rem 0 0.2rem; color: #bfa6f5; }
.msg-prose strong { font-weight: 700; color: #e0d4ff; }
.msg-prose em { font-style: italic; opacity: 0.9; }
.msg-prose ul {
  margin: 0.4rem 0 0.4rem 0.25rem;
  padding-left: 1.2rem;
  list-style: disc;
}
.msg-prose li {
  margin: 0.2rem 0;
  line-height: 1.5;
}
.msg-prose li::marker { color: rgba(126, 77, 255, 0.6); }
.msg-prose br { display: block; content: ''; margin: 0.3rem 0; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.plan-card {
  background: rgba(126, 77, 255, 0.12);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.plan-table th,
.plan-table td {
  border: 1px solid rgba(184, 157, 255, 0.2);
  padding: 0.4rem;
  vertical-align: top;
}

.term-action-cell { vertical-align: middle; text-align: center; }
.check-avail-btn {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--purple-soft);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.15s, border-color 0.15s;
}
.check-avail-btn:hover {
  background: rgba(126, 77, 255, 0.2);
  border-color: var(--purple);
}

.course-link {
  cursor: pointer;
  color: var(--purple-soft);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.course-link:hover {
  color: var(--purple);
  text-decoration-style: solid;
}

.mermaid-container {
  background: rgba(126, 77, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}
.mermaid-container svg {
  max-width: 100%;
  height: auto;
}

.status {
  min-height: 1.1rem;
  text-align: center;
  color: var(--purple-soft);
  margin: 0;
  font-size: 0.78rem;
  padding: 0.15rem 0 0.1rem;
}

.status.error { color: var(--danger); }

.composer-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1rem;
  width: min(768px, 92vw);
  z-index: 2;
  transition: bottom 0.3s ease;
}

/* Profile setup banner — entire pill is clickable */
.profile-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(126, 77, 255, 0.1);
  border: 1px solid rgba(126, 77, 255, 0.3);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--purple-soft);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.profile-banner:hover {
  background: rgba(126, 77, 255, 0.18);
  border-color: var(--purple);
}
.profile-banner[hidden] { display: none; }
.profile-banner-text { pointer-events: none; }
.profile-banner-dismiss {
  color: var(--muted);
  font-size: 1rem;
  padding: 0 0.15rem;
  line-height: 1;
  transition: color 0.15s;
}
.profile-banner-dismiss:hover { color: var(--text); }

/* Sidebar profile glow animation */
@keyframes profile-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(126, 77, 255, 0); }
  50% { box-shadow: 0 0 12px 4px rgba(126, 77, 255, 0.35); }
}
.sidebar-profile-card.profile-glow,
.profile-banner.profile-glow {
  animation: profile-glow 1.5s ease-in-out 3;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(19, 19, 28, 0.95);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.75rem 0.75rem 0.6rem;
  transition: padding 0.3s ease, border-radius 0.3s ease;
}

/* Empty state — composer centered vertically on screen */
.hub:not(.has-messages) .composer-wrap {
  top: 50vh !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
}

/* Empty state — taller/wider composer with greeting inside */
.hub:not(.has-messages) .composer {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  padding: 1.25rem 1.25rem 0.75rem;
  width: min(780px, 92vw);
}

.hub:not(.has-messages) .composer-wrap::before {
  content: 'Where would you like to start?';
  display: block;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.hub:not(.has-messages) .composer > div {
  display: contents;
}

.composer-greeting {
  display: none;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  padding: 0 0.25rem;
  line-height: 1.4;
}

.hub:not(.has-messages) .composer-greeting {
  display: block;
}

.hub:not(.has-messages) .composer-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.composer-input-row {
  display: contents;
}

.composer input,
#sendBtn,
.profile-form input,
.profile-form select,
.profile-form textarea {
  font: inherit;
  color: var(--text);
}

.composer input,
.profile-form input,
.profile-form select,
.profile-form textarea {
  background: #181722;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem;
}

#sendBtn {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  border-radius: 10px;
  padding: 0.62rem 1rem;
  cursor: pointer;
}

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.7);
}

.modal-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(540px, 100vw);
  background: #13131c;
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.profile-form { display: grid; gap: 0.6rem; }
.profile-form label { color: var(--muted); font-size: 0.9rem; }
.toggle-fieldset { border: 0; margin: 0; padding: 0; }

@media (max-width: 760px) {
  .hub { padding-top: 2rem; }
  .quick-actions { grid-template-columns: 1fr; }
  .chat-thread { max-height: 48vh; }
  .profile-banner {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    margin-top: 0.35rem;
  }
}

.plan-section {
  margin-top: 0.7rem;
  border: none;
  border-radius: 0;
  padding: 0.4rem 0;
  background: none;
}
/* Compact requirement summary */
.plan-summary-compact {
  border: 1px solid rgba(184, 157, 255, 0.18);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: rgba(126, 77, 255, 0.05);
}
/* Summary heading */
.summary-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
  color: var(--text);
}
/* Section headings (Questions, What's next) */
.section-heading-lg {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--text);
}
/* Questions intro */
.questions-intro {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.4;
}
.summary-pills {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  width: fit-content;
  background: rgba(255, 170, 50, 0.15);
  color: #d4890a;
  border: 1px solid rgba(255, 170, 50, 0.25);
  font-family: inherit;
}
.summary-pill.met {
  background: rgba(50, 205, 100, 0.12);
  color: #3cc966;
  border-color: rgba(50, 205, 100, 0.22);
}
/* Clickable amber fix pills */
button.summary-pill.fix {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  gap: 0.4rem;
}
button.summary-pill.fix:hover {
  background: rgba(255, 170, 50, 0.28);
  border-color: rgba(255, 170, 50, 0.5);
  box-shadow: 0 0 6px rgba(255, 170, 50, 0.2);
}
.fix-hint {
  font-size: 0.68rem;
  opacity: 0.5;
  transition: opacity 0.15s;
}
button.summary-pill.fix:hover .fix-hint {
  opacity: 1;
}
/* Adjustment toggle — bold, larger */
.plan-summary-compact .adj-toggle summary {
  font-size: 0.95rem;
  font-weight: 700;
}
.plan-summary-compact .plan-details-toggle {
  margin-top: 0.45rem;
}
.plan-summary-compact .plan-details-toggle ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
}
/* Policies nested — smaller than adjustments */
.policies-nested {
  margin-top: 0.3rem;
}
.policies-nested summary {
  font-size: 0.78rem !important;
  font-weight: 400 !important;
}
.policies-nested ul {
  font-size: 0.78rem !important;
}
.policies-nested h4 {
  font-size: 0.8rem;
  margin: 0.2rem 0 0.15rem;
}

.plan-section.has-table {
  border: 1px solid rgba(184, 157, 255, 0.2);
  border-radius: 10px;
  padding: 0.6rem;
  background: rgba(126, 77, 255, 0.06);
}

.plan-section h4,
.plan-card h3 {
  margin: 0 0 0.45rem;
}

.plan-section ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.3rem;
}

.plan-section p,
.plan-card p {
  margin: 0;
}

.replace-panel {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
}

.replace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.replace-grid input {
  width: 100%;
}

/* ── Checklist Modal ─────────────────────────────────────────────────────── */
.checklist-intro {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.checklist-groups {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 5rem;
}

.checklist-group h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--purple-soft);
  margin: 0 0 0.5rem;
}

.checklist-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.checklist-group li label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.checklist-group li input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--purple);
  flex-shrink: 0;
}

.checklist-course-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.checklist-footer {
  position: sticky;
  bottom: 0;
  background: #13131c;
  border-top: 1px solid var(--border);
  padding: 1rem 0 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.checklist-footer .quick-action {
  padding: 0.6rem 1.4rem;
}
.plus-btn {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1.3rem;
  padding: 0.2rem 0.7rem 0.4rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.2s;
}
.plus-btn:hover { background: #2b2940; }
.plus-btn.open { border-color: var(--purple); color: var(--purple-soft); }
.quick-action-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10;
}
.quick-action-popover[hidden] { display: none; }
.popover-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.5rem 0.4rem;
  margin: 0;
}
.popover-action {
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.popover-action:hover {
  background: rgba(126, 77, 255, 0.15);
  border-color: var(--border);
}

/* ── Tool menu popover ──────────────────────────────────────────────────── */
.tool-menu-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10;
}
.tool-menu-popover[hidden] { display: none; }

.tool-action {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
}
.tool-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}
.tool-text {
  flex: 1;
  line-height: 1.35;
}
.tool-text strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.tool-text small {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Sections search modal ──────────────────────────────────────────────── */
#sectionsModal .sections-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
#sectionsModal .sections-search-row input,
#sectionsModal .sections-search-row select {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
#sectionsModal .sections-search-row input { flex: 1; }
#sectionsModal .sections-search-btn {
  background: var(--purple);
  border: none;
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}
#sectionsModal .sections-search-btn:hover { background: #6c3de0; }

.sections-results {
  display: grid;
  gap: 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}
.section-card {
  background: rgba(126, 77, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}
.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
}
.section-card-header strong { font-size: 0.92rem; }
.section-card-header .section-crn {
  font-size: 0.78rem;
  color: var(--muted);
}
.section-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.section-seats {
  font-size: 0.82rem;
  margin-top: 0.25rem;
}
.section-seats .seats-open { color: #6ee7b7; }
.section-seats .seats-full { color: var(--danger); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
html, body, .chat-thread, .modal-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 77, 255, 0.5) transparent;
}

body {
  padding-right: 14px;
}

.chat-thread {
  padding-right: 14px;
}

.modal-panel {
  padding-right: 1.5rem;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.chat-thread::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar {
  width: 6px;
  margin-left: 8px;
}

body {
  padding-right: 14px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.chat-thread::-webkit-scrollbar-track,
.modal-panel::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.chat-thread::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb {
  background: rgba(126, 77, 255, 0.45);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.chat-thread::-webkit-scrollbar-thumb:hover,
.modal-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(126, 77, 255, 0.75);
}

html::-webkit-scrollbar-button,
body::-webkit-scrollbar-button,
.chat-thread::-webkit-scrollbar-button,
.modal-panel::-webkit-scrollbar-button {
  display: none;
}

/* ── Composer tool chips ────────────────────────────────────────────────── */
.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem 0;
}
.composer-chips[hidden] { display: none; }
.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(126, 77, 255, 0.18);
  border: 1px solid rgba(126, 77, 255, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  font-size: 0.78rem;
  color: var(--purple-soft);
  animation: chipIn 0.15s ease-out;
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
.chip-icon {
  font-size: 0.85rem;
}
.chip-label {
  font-weight: 600;
}
.chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
  transition: color 0.1s;
}
.chip-remove:hover {
  color: var(--text);
}

/* ── Composer reshaping ──────────────────────────────────────────────────── */
.composer-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.composer-input-row input {
  flex: 1;
  background: transparent;
  border: none !important;
  outline: none;
  padding: 0.3rem 0.25rem;
  font-size: 0.95rem;
  color: var(--text);
}

.plus-btn {
  background: transparent !important;
  border: none !important;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  flex-shrink: 0;
  transition: color 0.2s;
}
.plus-btn:hover { color: var(--text); background: transparent !important; }
.plus-btn.open  { color: var(--purple-soft); }

#sendBtn {
  background: var(--purple) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.2s;
}
#sendBtn:hover { background: #6c3de0 !important; }

/* ── Status / loading indicator ─────────────────────────────────────────── */
.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 1.5rem;
}

.status-spinner {
  display: inline-flex;
  align-items: center;
}

.status-spinner[hidden] { display: none; }

.spinner-ring {
  width: 18px;
  height: 18px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Site disclaimer ─────────────────────────────────────────────────────── */
.site-disclaimer {
  position: fixed;
  bottom: 0.3rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.5;
  margin: 0;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

/* ── Social media links ─────────────────────────────────────────────────── */
.social-links {
  position: fixed;
  bottom: 0.3rem;
  right: 1rem;
  display: flex;
  gap: 0.6rem;
  z-index: 2;
}
.social-links a {
  color: var(--muted);
  opacity: 0.45;
  transition: opacity 0.15s, color 0.15s;
  display: flex;
  align-items: center;
}
.social-links a:hover {
  opacity: 1;
  color: var(--purple);
}

/* ── Plan details toggle ─────────────────────────────────────────────────── */
.plan-details-toggle {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.plan-details-toggle summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.3rem 0;
  user-select: none;
  list-style: none;
}
.plan-details-toggle summary::-webkit-details-marker { display: none; }
.plan-details-toggle summary::before {
  content: '▸ ';
  display: inline;
}
.plan-details-toggle[open] summary::before {
  content: '▾ ';
}
.plan-details-toggle summary:hover { color: var(--text); }
.plan-details-toggle[open] summary { color: var(--text); }

/* ── What's next ─────────────────────────────────────────────────────────── */
.next-steps { margin-top: 1.25rem; }
.next-steps-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.next-step-btn {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.next-step-btn:hover {
  background: rgba(126, 77, 255, 0.2);
  border-color: var(--purple);
}

/* ── Profile redesign ────────────────────────────────────────────────────── */
.profile-completion {
  margin-bottom: 1.25rem;
  padding: 0 0.25rem;
}
.profile-completion-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.profile-completion-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}
.profile-completion-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 0.85rem;
  background: rgba(126, 77, 255, 0.03);
}
.profile-section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--purple-soft);
  margin: 0 0 0.75rem;
  font-weight: 600;
}
.profile-section-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: -0.25rem 0 0.75rem;
  line-height: 1.4;
}
.profile-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}
.profile-field[hidden] { display: none; }
.profile-field:last-child { margin-bottom: 0; }
.profile-field label {
  font-size: 0.82rem;
  color: var(--muted);
}
.profile-field input,
.profile-field select,
.profile-field textarea {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  width: 100%;
}
.profile-field input:focus,
.profile-field select:focus,
.profile-field textarea:focus {
  outline: none;
  border-color: var(--purple);
}
.profile-field textarea { resize: vertical; }
.profile-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  align-items: end;
}
.profile-field-row .profile-field {
  min-width: 0;
  margin-bottom: 0;
}
.profile-field input:-webkit-autofill,
.profile-field input:-webkit-autofill:hover,
.profile-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--panel-soft) inset;
  -webkit-text-fill-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}
/* Hide native number input spinners */
.profile-field input[type="number"]::-webkit-inner-spin-button,
.profile-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.profile-field input[type="number"] {
  -moz-appearance: textfield;
}
.profile-upload-btn {
  background: var(--panel-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  color: var(--purple);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  margin-top: 0.4rem;
}
.profile-upload-btn:hover {
  border-color: var(--purple);
  background: rgba(116, 78, 205, 0.08);
}
.completed-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.profile-action-btn {
  flex: 1;
  background: var(--panel-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.4rem;
  color: var(--purple);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.profile-action-btn:hover {
  border-color: var(--purple);
  background: rgba(116, 78, 205, 0.08);
}
.profile-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.profile-field--inline label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
}
.profile-field--inline input[type="checkbox"] {
  accent-color: var(--purple);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.profile-save-bar {
  position: sticky;
  bottom: 0;
  background: #13131c;
  border-top: 1px solid var(--border);
  padding: 0.85rem 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.profile-save-btn {
  background: var(--purple);
  border: none;
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.profile-save-btn:hover { background: #6c3de0; }
.profile-save-status {
  font-size: 0.82rem;
  color: var(--purple-soft);
  opacity: 0;
  transition: opacity 0.3s;
}
.profile-save-status.visible { opacity: 1; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 220px;
  background: #0e0d16;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 15;
  padding: 1rem 0.75rem;
  gap: 0.5rem;
  overflow-y: auto;
}

.sidebar-top { padding-bottom: 0.5rem; }

.sidebar-new-chat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--purple);
  border: none;
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.sidebar-new-chat:hover { background: #6c3de0; }

.sidebar-section { padding: 0.25rem 0; }

.sidebar-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.4rem 0.25rem;
  opacity: 0.7;
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 0.15rem;
}
.sidebar-action:hover {
  background: rgba(126, 77, 255, 0.12);
  border-color: var(--border);
}
.sidebar-action-icon { font-size: 0.9rem; flex-shrink: 0; }
.sidebar-action-text { flex: 1; }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-profile-card {
  width: 100%;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
  font: inherit;
  color: var(--text);
}
.sidebar-profile-card:hover {
  border-color: var(--purple);
  background: rgba(126, 77, 255, 0.08);
}

.sidebar-profile-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.sidebar-profile-icon { font-size: 0.9rem; }
.sidebar-profile-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.sidebar-profile-edit {
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.6;
}

.sidebar-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
  min-height: 1.2rem;
}
.sidebar-profile-chip {
  font-size: 0.72rem;
  background: rgba(126, 77, 255, 0.15);
  border: 1px solid rgba(126, 77, 255, 0.25);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--purple-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.sidebar-profile-chip--career {
  background: rgba(126, 77, 255, 0.08);
  color: var(--muted);
}

.sidebar-profile-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sidebar-profile-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.sidebar-profile-bar-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}
.sidebar-profile-bar-label {
  font-size: 0.67rem;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0.7;
}

/* ── Layout shift for sidebar ────────────────────────────────────────────── */
.hub {
  margin-left: 220px;
  width: calc(100vw - 220px);
}
.composer-wrap {
  left: calc(220px + (100vw - 220px) / 2);
  transform: translateX(-50%);
  width: min(768px, calc(100vw - 220px - 2rem));
}
.site-disclaimer {
  left: calc(220px + (100vw - 220px) / 2);
  transform: translateX(-50%);
}
@media (max-width: 760px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }
  .hub { margin-left: 0; }
  .composer-wrap { left: 50%; }
  .sidebar-bottom { display: none; }
  .sidebar-section { display: none; }
}
