@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap");

:root {
  --cream: #fff9f0;
  --sky: #5baaff;
  --coral: #ff8c69;
  --mint: #6bcb9a;
  --ink: #2d3436;
  --bubble-assist: #f0f2f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(91, 170, 255, 0.2);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--sky), var(--coral));
  box-shadow: 0 4px 12px rgba(91, 170, 255, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
}

.brand p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.6;
}

nav.tabs {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

nav.tabs button {
  border: none;
  background: rgba(91, 170, 255, 0.1);
  color: rgba(45, 52, 54, 0.75);
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

nav.tabs button.active {
  background: var(--sky);
  color: white;
  box-shadow: 0 4px 12px rgba(91, 170, 255, 0.35);
}

.student-id-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.student-id-wrap input {
  width: 120px;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(91, 170, 255, 0.3);
  border-radius: 8px;
  font-family: inherit;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  background: white;
  border: 1px solid rgba(91, 170, 255, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.page-subtitle {
  margin: 0 0 1.5rem;
  opacity: 0.7;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--sky);
  color: white;
}

.btn-accent {
  background: var(--coral);
  color: white;
}

.btn-soft {
  background: rgba(91, 170, 255, 0.12);
  color: var(--sky);
}

.input,
.select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(91, 170, 255, 0.3);
  border-radius: 12px;
  font-family: inherit;
  background: white;
}

.label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.8;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Chat */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
}

.chat-card {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(91, 170, 255, 0.1);
  margin-bottom: 1rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.msg-row {
  display: flex;
}

.msg-row.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.bubble.user {
  background: var(--sky);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  background: var(--bubble-assist);
  border-bottom-left-radius: 4px;
}

.bubble a.resource-link {
  color: #1a6bb5;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-word;
}

.attachment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(91, 170, 255, 0.1);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 220px;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  background: rgba(91, 170, 255, 0.1);
  border: 1px solid rgba(91, 170, 255, 0.25);
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.attachment-chip.uploading {
  opacity: 0.7;
  animation: pulse 1.5s infinite;
}

.attachment-chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: white;
}

.attachment-chip-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: white;
  color: var(--sky);
}

.attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.attachment-chip-remove {
  border: none;
  background: transparent;
  color: rgba(45, 52, 54, 0.5);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  flex-shrink: 0;
}

.attachment-chip-remove:hover {
  color: var(--coral);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(91, 170, 255, 0.1);
}

.chat-form .input {
  flex: 1;
}

.btn-icon svg,
.message-play svg,
.attachment-chip-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.icon-spin {
  animation: icon-spin 0.9s linear infinite;
}

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

.btn-attach {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(91, 170, 255, 0.12);
  color: var(--sky);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.btn-attach:hover:not(:disabled) {
  background: rgba(91, 170, 255, 0.22);
}

.btn-attach:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-mic,
.btn-pronounce,
.btn-tts-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(91, 170, 255, 0.12);
  color: var(--sky);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.btn-mic:hover:not(:disabled),
.btn-pronounce:hover:not(:disabled),
.btn-tts-toggle:hover:not(:disabled) {
  background: rgba(91, 170, 255, 0.22);
}

.btn-mic[aria-disabled="true"],
.btn-pronounce[aria-disabled="true"],
.btn-tts-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-mic--recording,
.btn-pronounce--recording {
  background: rgba(255, 99, 132, 0.2);
  color: #ff6384;
  animation: mic-pulse 1.2s ease-in-out infinite;
}

.btn-pronounce {
  background: rgba(46, 196, 182, 0.14);
  color: #2ec4b6;
}

.btn-pronounce:hover:not(:disabled) {
  background: rgba(46, 196, 182, 0.24);
}

.btn-pronounce--recording {
  background: rgba(46, 196, 182, 0.28);
  color: #1a9f94;
}

.btn-tts-toggle.active {
  background: rgba(91, 170, 255, 0.28);
  color: var(--sky);
}

@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 99, 132, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 99, 132, 0);
  }
}

.bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  max-width: 85%;
}

.message-play {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(91, 170, 255, 0.12);
  color: var(--sky);
  flex-shrink: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.message-play:hover:not(:disabled) {
  background: rgba(91, 170, 255, 0.22);
}

.message-play:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vb-aside {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.vb-aside .avatar-lg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--sky), var(--coral));
  box-shadow: 0 8px 20px rgba(91, 170, 255, 0.35);
  margin-bottom: 1rem;
}

.chat-history-card {
  align-self: start;
  max-height: 620px;
  overflow: hidden;
}

.chat-history-head,
.chat-history-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.chat-history-head h3 {
  margin: 0;
  font-size: 1rem;
}

.chat-history-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(91, 170, 255, 0.18), rgba(255, 140, 105, 0.2));
}

.chat-history-head button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(91, 170, 255, 0.1);
  color: #397dbb;
  cursor: pointer;
  font-size: 1rem;
}

.chat-history-help {
  margin: 0.65rem 0 0.9rem;
  font-size: 0.78rem;
  opacity: 0.65;
}

.chat-history-list {
  display: grid;
  gap: 0.55rem;
  max-height: 480px;
  overflow-y: auto;
}

.chat-history-item {
  width: 100%;
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(91, 170, 255, 0.14);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.chat-history-item:hover,
.chat-history-item.active {
  border-color: var(--sky);
  background: rgba(91, 170, 255, 0.07);
}

.chat-history-item strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-item span,
.chat-history-empty {
  font-size: 0.7rem;
  opacity: 0.6;
}

.chat-history-empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
}

/* News */
.news-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.news-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.history-picker {
  display: grid;
  gap: 0.3rem;
  min-width: 210px;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(45, 52, 54, 0.68);
}

.history-picker .select {
  min-height: 38px;
  padding: 0.5rem 0.7rem;
}

.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

.news-card h3 {
  margin: 0 0 0.5rem;
}

.news-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.85;
}

.news-card .news-description {
  margin-top: 0.5rem;
  opacity: 0.9;
}

.news-card .news-article-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.news-card .news-article-link:hover {
  text-decoration: underline;
}

.news-card .news-questions {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: 12px;
  font-size: 0.85rem;
}

.news-card .news-questions-title {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--coral);
}

.news-card .news-questions ol {
  margin: 0;
  padding-left: 1.25rem;
}

.news-card .news-questions li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.news-card .news-questions li:last-child {
  margin-bottom: 0;
}

.news-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge {
  display: inline-block;
  background: rgba(107, 203, 154, 0.2);
  color: #3d9a6e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.hobby-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hobby-chips button {
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(91, 170, 255, 0.12);
  color: var(--ink);
}

.hobby-chips button.selected {
  background: var(--coral);
  color: white;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(255, 140, 105, 0.15);
  border: 1px solid rgba(255, 140, 105, 0.3);
}

.alert-success {
  background: rgba(107, 203, 154, 0.15);
  border: 1px solid rgba(107, 203, 154, 0.3);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state .emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.ai-profile-card {
  margin-top: 1.25rem;
}

.ai-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.ai-profile-title {
  margin: 0;
  font-size: 1.15rem;
}

.ai-profile-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  opacity: 0.7;
}

.ai-profile-meta {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  opacity: 0.65;
}

.ai-profile-sections {
  display: grid;
  gap: 1rem;
}

.ai-profile-section {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(91, 170, 255, 0.06);
  border: 1px solid rgba(91, 170, 255, 0.12);
}

.ai-profile-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.ai-profile-section ul {
  margin: 0;
  padding-left: 1.2rem;
}

.ai-profile-section li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.ai-profile-section li:last-child {
  margin-bottom: 0;
}

.session-jump-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0 0.35rem;
  border: none;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.16);
  color: #1f6feb;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  vertical-align: baseline;
}

.session-jump-arrow:hover {
  background: rgba(91, 170, 255, 0.28);
}

.bubble .session-jump-arrow {
  margin-left: 0.4rem;
}

.chat-role-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.12);
  color: #3a5f8a;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}

.skeleton {
  height: 180px;
  background: rgba(91, 170, 255, 0.08);
  border-radius: 16px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.hidden {
  display: none !important;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.vocab-word-card {
  text-align: left;
  border: 1px solid rgba(91, 170, 255, 0.2);
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vocab-word-card:hover,
.vocab-word-card.active {
  border-color: var(--sky);
  box-shadow: 0 6px 16px rgba(91, 170, 255, 0.18);
}

.vocab-word {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.vocab-meaning {
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.vocab-example {
  font-size: 0.82rem;
  opacity: 0.7;
  font-style: italic;
}

.vocab-log-row {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(91, 170, 255, 0.12);
  font-size: 0.9rem;
}

.vocab-log-row:last-child {
  border-bottom: none;
}

.student-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.student-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid rgba(91, 170, 255, 0.18);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.9);
}

.student-option-meta {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  opacity: 0.7;
}

.assignments-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 1rem;
}

.assignment-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(91, 170, 255, 0.18);
  border-radius: 14px;
  background: #fff;
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.assignment-list-item.active {
  border-color: var(--sky);
  box-shadow: 0 6px 16px rgba(91, 170, 255, 0.18);
}

.assignment-article {
  white-space: pre-wrap;
  line-height: 1.65;
  background: rgba(91, 170, 255, 0.05);
  border: 1px solid rgba(91, 170, 255, 0.12);
  border-radius: 14px;
  padding: 1rem;
  margin: 1rem 0 1.25rem;
}

.assignment-question {
  border-top: 1px solid rgba(91, 170, 255, 0.12);
  padding-top: 1rem;
  margin-top: 1rem;
}

.assignment-options {
  display: grid;
  gap: 0.65rem;
}

.assignment-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(91, 170, 255, 0.05);
}

/* ── Todo ─────────────────────────────────────────────────── */

.todo-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.4rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 140, 105, 0.18), transparent 42%),
    radial-gradient(circle at bottom left, rgba(91, 170, 255, 0.16), transparent 46%),
    linear-gradient(145deg, #ffffff 0%, #fff6ee 100%);
  border: 1px solid rgba(91, 170, 255, 0.14);
  box-shadow: 0 10px 28px rgba(45, 52, 54, 0.05);
}

.todo-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--coral);
}

.todo-hero .page-title {
  margin-bottom: 0.35rem;
}

.todo-date-label {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.72;
}

.todo-focus {
  margin: 0.85rem 0 0;
  max-width: 42rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  background: rgba(107, 203, 154, 0.12);
  border: 1px solid rgba(107, 203, 154, 0.22);
  font-size: 0.92rem;
  line-height: 1.45;
}

.todo-progress {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
}

.todo-progress-ring {
  --todo-progress: 0deg;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--mint) var(--todo-progress), rgba(107, 203, 154, 0.18) 0);
  position: relative;
  transition: background 0.35s ease;
}

.todo-progress-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #fff;
}

.todo-progress-text {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 850;
  color: #1f2d2a;
}

.todo-progress-caption {
  max-width: 7rem;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
  color: rgba(45, 52, 54, 0.68);
}

.todo-hero-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.todo-day-picker {
  display: grid;
  gap: 0.3rem;
  min-width: 150px;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(45, 52, 54, 0.68);
}

.todo-day-picker .select {
  min-height: 38px;
  padding: 0.5rem 0.7rem;
}

.todo-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.todo-sidebar,
.todo-workspace {
  min-height: 28rem;
}

.todo-workspace {
  border-color: rgba(45, 52, 54, 0.1);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(37, 54, 74, 0.08);
}

.todo-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.todo-sidebar-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.todo-count {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.12);
  color: #2f6fb8;
}

.todo-list {
  display: grid;
  gap: 0.75rem;
}

.todo-card {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(91, 170, 255, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 0.95rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.todo-card:hover {
  transform: translateY(-1px);
  border-color: rgba(91, 170, 255, 0.35);
  box-shadow: 0 8px 18px rgba(91, 170, 255, 0.12);
}

.todo-card.active {
  border-color: var(--sky);
  box-shadow: 0 10px 22px rgba(91, 170, 255, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f3f9ff 100%);
}

.todo-card.done {
  opacity: 0.88;
}

.todo-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: rgba(91, 170, 255, 0.12);
}

.todo-card[data-type="vocab"] .todo-card-icon {
  background: rgba(255, 140, 105, 0.16);
}

.todo-card[data-type="ca_topic"] .todo-card-icon,
.todo-card[data-type="ca_general"] .todo-card-icon {
  background: rgba(91, 170, 255, 0.16);
}

.todo-card[data-type="aptitude"] .todo-card-icon {
  background: rgba(107, 203, 154, 0.18);
}

.todo-card[data-type="subject"] .todo-card-icon,
.todo-card[data-type="interest"] .todo-card-icon {
  background: rgba(168, 120, 255, 0.14);
}

.todo-card-body {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.todo-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.todo-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.12);
  color: #2f6fb8;
}

.todo-type-badge.type-vocab {
  background: rgba(255, 140, 105, 0.16);
  color: #c45b3a;
}

.todo-type-badge.type-ca_topic,
.todo-type-badge.type-ca_general {
  background: rgba(91, 170, 255, 0.14);
  color: #2f6fb8;
}

.todo-type-badge.type-aptitude {
  background: rgba(107, 203, 154, 0.16);
  color: #2f8a5f;
}

.todo-type-badge.type-subject,
.todo-type-badge.type-interest {
  background: rgba(168, 120, 255, 0.14);
  color: #6d4bb8;
}

.todo-status-chip {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(45, 52, 54, 0.06);
  color: rgba(45, 52, 54, 0.72);
}

.todo-status-chip.done {
  background: rgba(107, 203, 154, 0.18);
  color: #2f8a5f;
}

.todo-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.35;
}

.todo-card-meta {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.65;
}

.todo-empty {
  min-height: 22rem;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.45rem;
  padding: 2rem 1rem;
}

.todo-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.5rem;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, rgba(91, 170, 255, 0.18), rgba(255, 140, 105, 0.18));
}

.todo-empty h3 {
  margin: 0;
}

.todo-empty p {
  margin: 0;
  max-width: 320px;
  opacity: 0.7;
}

.todo-detail-top {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.todo-detail h3 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

.todo-detail-desc {
  margin: 0 0 1rem;
  opacity: 0.72;
  line-height: 1.5;
}

.todo-assignment-reason {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--coral);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 140, 105, 0.09);
  color: #795243;
  font-size: 0.86rem;
  line-height: 1.45;
}

.todo-score-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(107, 203, 154, 0.14);
  border: 1px solid rgba(107, 203, 154, 0.24);
  font-weight: 700;
}

.todo-article {
  white-space: pre-wrap;
  line-height: 1.7;
  background: rgba(91, 170, 255, 0.05);
  border: 1px solid rgba(91, 170, 255, 0.12);
  border-radius: 16px;
  padding: 1.05rem 1.15rem;
  margin: 0 0 1.25rem;
}

.math-section-title {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-left: 4px solid var(--mint);
  border-radius: 0 10px 10px 0;
  background: rgba(107, 203, 154, 0.12);
  color: #24463a;
  font-size: 0.88rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.todo-detail mjx-container[display="true"] {
  max-width: 100%;
  margin: 0.85rem 0 !important;
  padding: 0.35rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.todo-detail mjx-container {
  color: #172b3d;
}

.todo-questions {
  display: grid;
  gap: 0.25rem;
}

.todo-questions .assignment-question {
  border: 0;
  border-top: 1px solid rgba(45, 52, 54, 0.1);
  border-radius: 0;
  padding: 1.25rem 0 0;
  margin: 0 0 0.85rem;
  background: transparent;
  min-width: 0;
}

.todo-questions .assignment-question h4,
.todo-questions .assignment-question legend {
  margin: 0 0 0.75rem;
  padding: 0;
  color: #25364a;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
}

.todo-questions .assignment-option {
  min-height: 76px;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 2px solid transparent;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(197, 241, 222, 0.8), rgba(155, 224, 199, 0.82));
  cursor: pointer;
  font-weight: 750;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.todo-questions .assignment-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.todo-questions .assignment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.todo-questions .assignment-option:hover {
  transform: translateY(-1px);
  border-color: rgba(63, 177, 135, 0.42);
  background: linear-gradient(135deg, rgba(188, 239, 217, 0.95), rgba(143, 217, 190, 0.95));
}

.todo-questions .assignment-option:has(input:checked) {
  border-color: #42b98c;
  background: linear-gradient(135deg, #b9ecd8, #8ed8bd);
  box-shadow: 0 7px 18px rgba(66, 185, 140, 0.18);
}

.todo-questions .assignment-option:focus-within {
  outline: 3px solid rgba(66, 185, 140, 0.28);
  outline-offset: 2px;
}

.option-letter,
.question-number {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  border-radius: 9px;
  background: rgba(91, 170, 255, 0.12);
  color: #3376b5;
  font-size: 0.75rem;
  font-weight: 800;
}

.todo-questions .assignment-option .option-letter {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  color: #25364a;
  font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(37, 54, 74, 0.12);
}

.question-number {
  margin-right: 0.5rem;
}

.assignment-text-response {
  min-height: 110px;
  resize: vertical;
  line-height: 1.55;
}

.todo-question-progress {
  position: sticky;
  top: 82px;
  z-index: 2;
  width: fit-content;
  margin: 0 0 0.8rem auto;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: #25364a;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(37, 54, 74, 0.18);
}

.todo-result-review {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.todo-result-review h4 {
  margin: 0;
}

.result-review-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(107, 203, 154, 0.28);
  border-radius: 12px;
  background: rgba(107, 203, 154, 0.09);
  font-size: 0.84rem;
}

.result-review-item.incorrect {
  border-color: rgba(255, 140, 105, 0.3);
  background: rgba(255, 140, 105, 0.09);
}

.todo-quiz-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.todo-question-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.9rem 0;
}

@media (max-width: 860px) {
  .todo-layout {
    grid-template-columns: 1fr;
  }

  .todo-sidebar,
  .todo-workspace {
    min-height: 0;
  }

  .todo-hero {
    align-items: flex-start;
  }

  .todo-questions .assignment-options {
    grid-template-columns: 1fr;
  }
}

/* Entry and application shell */
.welcome-screen {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, #fffaf2 0%, #f3f9ff 52%, #fff2ef 100%);
}

.welcome-glow {
  position: absolute;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.5;
}

.welcome-glow-one {
  top: -17rem;
  right: -8rem;
  background: rgba(91, 170, 255, 0.28);
}

.welcome-glow-two {
  bottom: -20rem;
  left: -8rem;
  background: rgba(255, 140, 105, 0.25);
}

.welcome-shell {
  width: min(1080px, 100%);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.8fr);
  gap: 5rem;
  align-items: center;
}

.welcome-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #285f9f;
}

.welcome-logo span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: white;
  box-shadow: 0 8px 24px rgba(91, 170, 255, 0.2);
}

.welcome-kicker,
.section-kicker {
  margin: 2rem 0 0.7rem;
  color: #d56e4d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.welcome-copy h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(2.8rem, 5vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: #25364a;
}

.welcome-copy h1 em {
  color: #4d9bea;
  font-style: normal;
}

.welcome-lead {
  max-width: 590px;
  margin: 1.4rem 0;
  color: #667688;
  font-size: 1.08rem;
  line-height: 1.7;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.feature-pills span {
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(91, 170, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
  color: #526274;
}

.welcome-card {
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(54, 84, 112, 0.16);
  backdrop-filter: blur(14px);
}

.welcome-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(91, 170, 255, 0.2), rgba(255, 140, 105, 0.25));
  font-size: 1.8rem;
}

.welcome-card h2 {
  margin: 0 0 0.4rem;
  color: #25364a;
  font-size: 1.75rem;
}

.welcome-card > p {
  margin: 0 0 1.5rem;
  color: #738092;
  line-height: 1.5;
}

.welcome-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid #dbe5ef;
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.welcome-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(91, 170, 255, 0.12);
}

.welcome-primary,
.welcome-secondary {
  width: 100%;
  min-height: 50px;
  margin-top: 1rem;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.welcome-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: linear-gradient(135deg, #5baaff, #448de0);
  color: white;
  box-shadow: 0 10px 24px rgba(91, 170, 255, 0.3);
}

.welcome-primary:hover {
  transform: translateY(-1px);
}

.welcome-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.welcome-secondary {
  margin-top: 0;
  border: 1.5px solid rgba(91, 170, 255, 0.25);
  background: rgba(91, 170, 255, 0.07);
  color: #347bbb;
}

.welcome-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.25rem 0;
  color: #9aa7b4;
  font-size: 0.75rem;
}

.welcome-divider::before,
.welcome-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e8edf2;
}

.onboarding-card {
  padding-top: 1.4rem;
}

.onboarding-card .welcome-kicker {
  margin-top: 1rem;
}

.back-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #63809c;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.onboarding-grid .full {
  grid-column: 1 / -1;
}

.children-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
}

.org-class-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.org-class-group-title {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted, #5a6a7a);
}

.child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #e8edf2;
  border-radius: 13px;
  background: #fff;
}

.child-row-name {
  font-weight: 700;
  color: var(--ink);
}

.child-row-id {
  font-size: 0.75rem;
  color: #9aa7b4;
}

.consent-status-chip {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(45, 52, 54, 0.06);
  color: rgba(45, 52, 54, 0.72);
  white-space: nowrap;
}

.consent-status-chip.consented {
  background: rgba(107, 203, 154, 0.18);
  color: #2f8a5f;
}

.consent-status-chip.declined,
.consent-status-chip.withdrawn,
.consent-status-chip.expired {
  background: rgba(255, 140, 105, 0.18);
  color: #b25a3d;
}

.consent-status-chip.pending_consent,
.consent-status-chip.invited {
  background: rgba(91, 170, 255, 0.16);
  color: #347bbb;
}

.consent-categories {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.9rem 0;
}

.consent-category-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid #e8edf2;
  border-radius: 13px;
  background: #fff;
}

.consent-category-row input {
  margin-top: 0.2rem;
}

.consent-category-label {
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.consent-category-purpose {
  font-size: 0.8rem;
  color: #738092;
  margin: 0.15rem 0 0;
}

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.student-menu {
  display: grid;
  justify-items: end;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.student-menu button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #568bc0;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
}

.section-intro {
  margin-bottom: 1.5rem;
}

.section-intro.compact {
  margin-bottom: 0;
}

.section-intro .section-kicker {
  margin: 0 0 0.4rem;
}

.section-intro h2 {
  margin: 0;
  color: #25364a;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.section-intro > p:last-child {
  margin: 0.45rem 0 0;
  color: #748191;
}

.chat-header p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  opacity: 0.55;
}

.vb-aside h3 {
  margin: 0;
}

.vb-aside p {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0.7;
}

.profile-card {
  padding: 1.5rem;
}

.profile-hobbies {
  margin-top: 1.25rem;
}

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(91, 170, 255, 0.1);
}

.profile-actions p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ── Reading Room ─────────────────────────────────────────── */

.reading-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.reading-sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 90px;
}

.reading-sidebar h3 {
  margin: 0;
  font-size: 1.05rem;
}

.reading-sidebar-divider {
  border: none;
  border-top: 1px solid rgba(91, 170, 255, 0.2);
  margin: 0.25rem 0;
}

.reading-interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.reading-interest-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(46, 196, 182, 0.16);
  color: #1a9e92;
}

.reading-interest-tag-author {
  background: rgba(91, 170, 255, 0.16);
  color: #397dbb;
}

.reading-fav-authors-block {
  margin-top: 0.75rem;
}

.reading-fav-authors-block.hidden {
  display: none;
}

.reading-sidebar-lists {
  display: grid;
  gap: 1rem;
}

.reading-sidebar-list-block {
  margin: 0;
}

.reading-sidebar-list-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.reading-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.reading-sidebar-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.reading-sidebar-book {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

a.reading-sidebar-book {
  color: #2563eb;
  text-decoration: underline;
}

.reading-sidebar-author {
  font-size: 0.75rem;
  opacity: 0.65;
}

.reading-sidebar-list-empty {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.55;
  font-style: italic;
}

button.reading-sidebar-book-btn {
  border: none;
  padding: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: #2563eb;
  text-decoration: underline;
  font-weight: 700;
}

button.reading-sidebar-book-btn.has-feedback::after {
  content: " ✓";
  font-size: 0.75rem;
  opacity: 0.7;
  text-decoration: none;
}

.reading-sidebar-read-btn {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.55rem;
  border: none;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.reading-sidebar-read-btn:hover {
  background: rgba(37, 99, 235, 0.2);
}

.read-feedback-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.read-feedback-dialog.hidden {
  display: none;
}

.read-feedback-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(37, 54, 74, 0.45);
  cursor: pointer;
}

.read-feedback-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow: auto;
  padding: 1.25rem;
}

.read-feedback-subtitle {
  margin: 0.35rem 0 1rem;
  font-size: 0.88rem;
  opacity: 0.75;
}

.read-feedback-form {
  display: grid;
  gap: 0.85rem;
}

.read-feedback-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.read-feedback-library-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #2563eb;
  text-decoration: underline;
}

.reading-main {
  display: grid;
  gap: 1.75rem;
}

.reading-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  color: #25364a;
}

.reading-section-empty {
  margin: 0;
  padding: 1.25rem;
  text-align: center;
  opacity: 0.65;
  font-size: 0.9rem;
}

.reading-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0.85rem 1rem;
}

.book-card-row {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  width: 100%;
}

.book-card-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.book-card-info h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.3;
}

.book-card-genre {
  align-self: flex-start;
  margin-bottom: 0.1rem;
}

.book-card-author {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.7;
}

.book-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.book-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.12);
  color: #397dbb;
  white-space: nowrap;
}

.book-tag-trending {
  background: rgba(46, 196, 182, 0.18);
  color: #1a9e92;
}

.book-tag-muted {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

.book-tag-cefr {
  background: rgba(139, 92, 246, 0.12);
  color: #6d28d9;
}

.book-tag-lexile {
  background: rgba(255, 183, 77, 0.2);
  color: #b45309;
}

.book-card-status {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(46, 196, 182, 0.18);
  color: #1a9e92;
}

.book-card-status[data-status="want_to_read"] {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}

.book-card-status[data-status="read"] {
  background: rgba(255, 183, 77, 0.22);
  color: #b45309;
}

.book-card-status[data-status="reading"] {
  background: rgba(46, 196, 182, 0.18);
  color: #1a9e92;
}

.book-card-cover-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.book-cover,
.book-cover-placeholder {
  width: 72px;
  height: 108px;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(160deg, #e8eef5 0%, #d5e0ec 100%);
  box-shadow: 0 2px 8px rgba(37, 54, 74, 0.12);
}

.book-cover-placeholder {
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  opacity: 0.7;
}

.book-card-description {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(45, 52, 54, 0.72);
}

.book-card-readmore {
  display: inline;
  margin-left: 0.2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #397dbb;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.book-card-readmore:hover {
  color: #2563eb;
}

.book-card-footer {
  display: none;
}

.book-reading-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.book-reading-stage {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.book-reading-stage.active {
  background: rgba(46, 196, 182, 0.22);
  color: #1a9e92;
}

.book-reading-stage[data-status="want_to_read"].active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
  font-weight: 800;
}

.book-reading-stage[data-status="read"].active {
  background: rgba(255, 183, 77, 0.25);
  color: #b45309;
}

.book-card-read {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: underline;
  white-space: nowrap;
}

.book-card-read:hover {
  color: #1d4ed8;
}

.book-detail-read-btn,
.read-feedback-read-btn {
  margin: 0.75rem 0 0.35rem;
}

.book-reader-dialog {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: #0f172a;
  display: flex;
  flex-direction: column;
}

.book-reader-dialog.hidden {
  display: none;
}

.book-reader-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.book-reader-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: #111827;
  color: #f8fafc;
  border-bottom: 1px solid rgba(248, 250, 252, 0.12);
}

.book-reader-heading {
  min-width: 0;
}

.book-reader-heading h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #f8fafc;
}

.book-reader-source {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.book-reader-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  min-height: 0;
}

.book-reader-dialog .alert {
  margin: 0.75rem 1rem;
}

.book-detail-dialog {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.book-detail-dialog.hidden {
  display: none;
}

.book-detail-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(37, 54, 74, 0.45);
  cursor: pointer;
}

.book-detail-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  max-height: min(90vh, 720px);
  overflow: auto;
  padding: 1.25rem 1.35rem 1.35rem;
}

.book-detail-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.book-detail-close:hover {
  background: rgba(100, 116, 139, 0.22);
}

.book-detail-layout {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}

.book-detail-cover .book-cover,
.book-detail-cover .book-cover-placeholder {
  width: 110px;
  height: 165px;
}

.book-detail-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 1.5rem;
}

.book-detail-main h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.book-detail-author {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0.7;
}

.book-detail-description {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  opacity: 0.88;
  text-align: justify;
}

.book-detail-main .book-reading-stages {
  margin-top: 0.35rem;
}

@media (max-width: 560px) {
  .book-detail-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .book-detail-main {
    padding-right: 0;
    align-items: center;
  }

  .book-detail-description {
    text-align: left;
  }

  .book-card-tags,
  .book-detail-main .book-card-tags {
    justify-content: center;
  }
}

@media (max-width: 800px) {
  .reading-layout {
    grid-template-columns: 1fr;
  }

  .reading-sidebar {
    position: static;
  }
}

@media (max-width: 900px) {
  .welcome-shell {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 620px;
  }

  .welcome-copy h1 {
    font-size: clamp(2.5rem, 9vw, 4rem);
  }

  .header-inner {
    justify-content: space-between;
  }

  nav.tabs {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
}

@media (max-width: 560px) {
  .welcome-screen {
    padding: 1rem;
  }

  .welcome-copy {
    padding: 1rem 0;
  }

  .welcome-card {
    padding: 1.35rem;
    border-radius: 22px;
  }

  .onboarding-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-grid .full {
    grid-column: auto;
  }

  .student-menu {
    display: none;
  }

  main {
    padding: 1.25rem 1rem;
  }
}

/* ── Reading Room (generated stories) ─────────────────────── */

.reading-vault-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.reading-room-toolbar {
  display: flex;
  align-items: end;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.reading-room-select-field {
  flex: 1 1 240px;
  min-width: 180px;
}

.reading-room-generate-wrap {
  display: grid;
  gap: 0.35rem;
  align-content: end;
}

.reading-room-generate-hint {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.75;
  max-width: 260px;
  line-height: 1.35;
}

#reading-room-generate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.reading-room-layout {
  display: block;
  width: 100%;
}

.reading-room-workspace {
  width: 100%;
  max-width: none;
}

.reading-room-detail-top {
  margin-bottom: 1rem;
}

.reading-room-detail-top h3 {
  margin: 0 0 0.45rem;
}

.reading-room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reading-room-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.16);
  color: #397dbb;
}

.reading-room-story {
  line-height: 1.75;
  white-space: pre-wrap;
  text-align: justify;
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.35rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(91, 170, 255, 0.15);
  font-size: 1.02rem;
}

.reading-room-synopsis {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.05rem 1.2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(91, 170, 255, 0.18);
}

.reading-room-synopsis h3 {
  margin: 0;
}

.reading-room-synopsis-hint {
  margin: 0;
  color: #5a6f86;
  font-size: 0.92rem;
}

.reading-room-synopsis-block {
  display: grid;
  gap: 0.45rem;
}

.reading-room-synopsis textarea.input,
.reading-room-item textarea.input {
  width: 100%;
  resize: vertical;
  min-height: 5.5rem;
}

.reading-room-field-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reading-room-word-count {
  font-size: 0.85rem;
  color: #5a6f86;
}

.reading-room-word-count.is-over {
  color: #c0392b;
  font-weight: 600;
}

.reading-room-field-status {
  margin: 0;
  font-size: 0.88rem;
  color: #2e7d4f;
}

.reading-room-field-status.is-error {
  color: #c0392b;
}

.reading-room-exercise-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.reading-room-exercise-head h4 {
  margin: 0;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.88rem;
}

.reading-room-exercises-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.reading-room-exercises-head h3 {
  margin: 0;
}

.reading-room-exercises {
  display: grid;
  gap: 1.1rem;
}

.reading-room-exercise {
  border: 1px solid rgba(91, 170, 255, 0.18);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.4);
}

.reading-room-exercise h4 {
  margin: 0 0 0.35rem;
}

.reading-room-exercise-instructions {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.reading-room-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem 0;
  border-top: 1px solid rgba(91, 170, 255, 0.12);
  text-align: justify;
}

.reading-room-item:first-of-type {
  border-top: none;
}

.reading-room-options {
  display: grid;
  gap: 0.35rem;
  text-align: left;
}

.reading-room-option {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.92rem;
}

.reading-room-item-result {
  font-size: 0.85rem;
  font-weight: 700;
}

.reading-room-item-result.correct {
  color: #1a9e92;
}

.reading-room-item-result.incorrect {
  color: #c0392b;
}

.reading-room-explanation {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0;
  text-align: justify;
}

.reading-room-final-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(37, 54, 74, 0.1);
}

#reading-room-final-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reading-room-score {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(46, 196, 182, 0.14);
  font-weight: 700;
}

.reading-room-complete-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.reading-room-complete-dialog.hidden {
  display: none;
}

.reading-room-complete-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(24, 36, 52, 0.55);
  cursor: pointer;
  animation: rr-fade-in 0.25s ease;
}

.reading-room-complete-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  overflow: hidden;
  padding: 1.6rem 1.35rem 1.35rem;
  text-align: center;
  border: 1px solid rgba(232, 184, 74, 0.35);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 232, 163, 0.45), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(91, 141, 239, 0.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(46, 196, 182, 0.16), transparent 45%),
    #fffdf7;
  box-shadow: 0 18px 48px rgba(24, 36, 52, 0.22);
  animation: rr-pop-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.reading-room-complete-burst {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.reading-room-complete-burst .sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #e8b84a;
  transform: rotate(45deg);
  opacity: 0;
  animation: rr-sparkle 1.6s ease-in-out infinite;
}

.reading-room-complete-burst .sparkle::after {
  content: "";
  position: absolute;
  inset: -3px;
  background: inherit;
  transform: rotate(45deg);
  opacity: 0.45;
  filter: blur(1px);
}

.reading-room-complete-burst .s1 { top: 12%; left: 14%; background: #e8b84a; animation-delay: 0s; }
.reading-room-complete-burst .s2 { top: 18%; right: 16%; background: #5b8def; animation-delay: 0.2s; }
.reading-room-complete-burst .s3 { top: 42%; left: 8%; background: #2ec4b6; animation-delay: 0.35s; }
.reading-room-complete-burst .s4 { top: 38%; right: 10%; background: #e85d75; animation-delay: 0.5s; }
.reading-room-complete-burst .s5 { bottom: 28%; left: 18%; background: #c9922a; animation-delay: 0.15s; }
.reading-room-complete-burst .s6 { bottom: 22%; right: 20%; background: #5b8def; animation-delay: 0.45s; }
.reading-room-complete-burst .s7 { top: 8%; left: 48%; background: #ffe8a3; animation-delay: 0.3s; }
.reading-room-complete-burst .s8 { bottom: 12%; left: 46%; background: #2ec4b6; animation-delay: 0.6s; }

.reading-room-complete-icon {
  display: grid;
  place-items: center;
  margin: 0 auto 0.65rem;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255, 232, 163, 0.55);
  box-shadow: 0 0 0 8px rgba(232, 184, 74, 0.12);
  animation: rr-icon-bounce 0.7s ease;
}

.reading-room-complete-panel h3 {
  margin: 0 0 0.45rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #c9922a, #e85d75 55%, #5b8def);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.reading-room-complete-lead {
  margin: 0 0 0.9rem;
  line-height: 1.45;
  font-size: 1.02rem;
}

.reading-room-complete-note {
  margin: 0 0 1.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(37, 54, 74, 0.06);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: left;
}

.reading-room-complete-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes rr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rr-pop-in {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rr-icon-bounce {
  0% { transform: scale(0.6) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes rr-sparkle {
  0%, 100% { opacity: 0; transform: rotate(45deg) scale(0.4); }
  40% { opacity: 1; transform: rotate(45deg) scale(1); }
  70% { opacity: 0.55; transform: rotate(45deg) scale(0.75); }
}

/* ── VB's Friends ─────────────────────────────────────────── */

#panel-friends {
  padding-bottom: 1rem;
}

.friends-shell {
  border-radius: 22px;
  padding: 1rem 1.1rem 1.2rem;
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(91, 170, 255, 0.1);
  border: 1px solid rgba(91, 170, 255, 0.12);
}

.friends-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.friends-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sky);
}

.friends-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.friends-subtitle {
  margin: 0.35rem 0 0;
  max-width: 42rem;
  font-size: 0.92rem;
  color: rgba(45, 52, 54, 0.62);
}

.friends-actions {
  display: flex;
  gap: 0.55rem;
  flex-shrink: 0;
}

.friends-btn-ghost {
  background: transparent;
  border: 1px solid rgba(91, 170, 255, 0.3);
  color: var(--sky);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.friends-btn-primary {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  color: #fff;
  background: var(--sky);
  box-shadow: 0 6px 18px rgba(91, 170, 255, 0.3);
  font-weight: 700;
  cursor: pointer;
}

.friends-meta {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: rgba(45, 52, 54, 0.55);
}

.friends-banner {
  margin-bottom: 0.85rem;
}

.friends-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 0.85rem;
  align-items: stretch;
}

.friends-graph-card,
.friends-list-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(91, 170, 255, 0.12);
  overflow: hidden;
}

.friends-graph-card {
  min-height: 760px;
}

.friends-graph-head,
.friends-list-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem 0.55rem;
}

.friends-graph-head h3,
.friends-list-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.friends-list-head p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: rgba(45, 52, 54, 0.5);
}

.friends-list-head {
  flex-direction: column;
  align-items: flex-start;
}

.friends-rapport-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.75rem;
  color: rgba(45, 52, 54, 0.6);
}

.friends-rapport-legend .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.friends-rapport-legend .dot.new { background: var(--sky); }
.friends-rapport-legend .dot.warm { background: #f0b429; }
.friends-rapport-legend .dot.close { background: var(--mint); }

.friends-graph-wrap {
  position: relative;
  min-height: 720px;
  background:
    radial-gradient(circle at 50% 48%, rgba(91, 170, 255, 0.08), transparent 42%),
    radial-gradient(circle at 20% 20%, rgba(255, 140, 105, 0.06), transparent 35%),
    var(--cream);
  cursor: grab;
  overflow: hidden;
  touch-action: none;
}

.friends-graph-wrap:active {
  cursor: grabbing;
}

.friends-graph-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 720px;
}

.friends-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 1.5rem;
  color: rgba(45, 52, 54, 0.65);
}

.friends-empty.hidden {
  display: none;
}

.friends-empty .emoji {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 620px;
  overflow-y: auto;
  padding: 0.35rem 0.85rem 1rem;
}

.friends-list-empty {
  padding: 0.5rem 1rem 1rem;
  font-size: 0.88rem;
  color: rgba(45, 52, 54, 0.5);
}

.friend-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 0.75rem;
  align-items: center;
  padding: 0.8rem 0.85rem;
  border-radius: 14px;
  background: rgba(91, 170, 255, 0.04);
  border: 1px solid rgba(91, 170, 255, 0.08);
}

.friend-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 750;
  color: #fff;
}

.friend-main {
  min-width: 0;
}

.friend-main h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: rgba(45, 52, 54, 0.5);
}

.friend-meta-row > span {
  min-width: 0;
  flex: 1 1 5.5rem;
}

.friend-meta-row strong {
  display: block;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-rapport-bar {
  grid-column: 2 / 3;
  height: 5px;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.12);
  overflow: hidden;
}

.friend-rapport-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--coral));
}

.rapport-pill {
  font-size: 0.65rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: var(--sky);
  align-self: start;
  margin-top: 0.15rem;
}

.rapport-pill.new { background: var(--sky); }
.rapport-pill.warm { background: #f0b429; color: #1a1405; }
.rapport-pill.close { background: var(--mint); color: #062923; }
.rapport-pill.chat { background: var(--cream); color: var(--ink); border: 1px solid rgba(91,170,255,0.2); }

@media (max-width: 900px) {
  .friends-topbar {
    flex-direction: column;
  }
  .friends-layout {
    grid-template-columns: 1fr;
  }
}

/* Guardian */
.guardian-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.guardian-layout-3col {
  grid-template-columns: minmax(200px, 230px) minmax(200px, 230px) minmax(0, 1fr);
}

.guardian-sidebar,
.guardian-workspace,
.guardian-children-sidebar {
  min-height: 22rem;
}

.guardian-sidebar-title {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9aa7b4;
}

.guardian-children-nav {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.guardian-child-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid rgba(91, 170, 255, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.guardian-child-nav-item:hover {
  border-color: rgba(91, 170, 255, 0.35);
}

.guardian-child-nav-item.active {
  border-color: var(--sky);
  box-shadow: 0 8px 18px rgba(91, 170, 255, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f3f9ff 100%);
}

.guardian-child-nav-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5baaff, #448de0);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.guardian-child-nav-name {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
}

.guardian-child-nav-id {
  display: block;
  font-size: 0.72rem;
  color: #9aa7b4;
}

@media (max-width: 900px) {
  .guardian-layout-3col {
    grid-template-columns: 1fr;
  }
}

.guardian-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.guardian-tab {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid rgba(91, 170, 255, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 0.85rem 1rem;
  font-weight: 650;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.guardian-tab:hover {
  border-color: rgba(91, 170, 255, 0.35);
}

.guardian-tab.active {
  border-color: var(--sky);
  box-shadow: 0 8px 18px rgba(91, 170, 255, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f3f9ff 100%);
}

.guardian-pane {
  display: none;
}

.guardian-pane.active {
  display: block;
}

.guardian-workspace h3 {
  margin: 0 0 0.2rem;
}

.guardian-attention-head > div > p {
  margin: 0;
  opacity: 0.7;
  font-size: 0.9rem;
}

.guardian-reading-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.guardian-reading-chip {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  background: #7a869a;
}

.guardian-reading-key {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  opacity: 0.68;
}

.guardian-reading-metrics {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}

.guardian-reading-metrics dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.65;
}

.guardian-reading-metrics dd {
  margin: 0;
  font-size: 0.95rem;
}

.guardian-attention-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.guardian-loading {
  margin: 0.5rem 0 1rem;
  opacity: 0.7;
}

.guardian-attention-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guardian-session {
  border: 1px solid rgba(91, 170, 255, 0.22);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: rgba(91, 170, 255, 0.04);
}

.guardian-session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}

.guardian-session-meta strong {
  font-size: 1rem;
}

.guardian-session-meta span {
  opacity: 0.72;
}

.guardian-flags {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guardian-flag {
  background: #fff;
  border: 1px solid rgba(45, 52, 54, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.guardian-flag-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.guardian-severity {
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: #7a869a;
}

.guardian-severity.imminent {
  background: #d64545;
}

.guardian-severity.elevated {
  background: #e67e22;
}

.guardian-severity.watch {
  background: #c9a227;
  color: #1a1405;
}

.guardian-category {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(91, 170, 255, 0.14);
  color: rgba(45, 52, 54, 0.85);
}

.guardian-flag p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.guardian-flag .label-muted {
  opacity: 0.65;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 900px) {
  .friends-topbar {
    flex-direction: column;
  }
  .friends-layout {
    grid-template-columns: 1fr;
  }
  .guardian-layout {
    grid-template-columns: 1fr;
  }
  .guardian-attention-head {
    flex-direction: column;
  }
}
