:root {
  --ink: #163832;
  --ink-soft: #1F4A42;
  --indigo: #24304D;
  --brass: #A9824C;
  --brass-light: #C7A56E;
  --parchment: #F4EEDF;
  --sand: #FBF7EC;
  --charcoal: #2A2621;
  --charcoal-soft: #5C564C;
  --line: #E4D9C0;
  --success: #4C7A63;
  --danger: #A94442;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--parchment);
  color: var(--charcoal);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  margin: 0;
}

main {
  min-height: calc(100vh - 142px);
}

h1,
h2,
h3,
.display {
  font-family: 'Amiri', serif;
}

a {
  color: inherit;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 32px;
}

.wrap-narrow {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 32px;
}

.chat-page {
  max-width: none;
  height: calc(100vh - 142px);
  padding: 0;
  display: flex;
  flex-direction: column;
}

header.site-header {
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: var(--sand);
  padding: 9px 0;
  border-bottom: 1px solid rgba(199, 165, 110, 0.25);
  position: relative;
  z-index: 1000;
}

.header-wrap {
  position: relative;
}

nav.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Amiri', serif;
  font-size: 21px;
  font-weight: 700;
  text-decoration: none;
  color: var(--sand);
  letter-spacing: 0.3px;
  line-height: 1;
}

.logo-icon {
  color: var(--brass);
  font-size: 18px;
  line-height: 1;
}

.star-mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.mobile-nav-controls {
  display: none;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(199, 165, 110, 0.35);
  border-radius: 7px;
  color: var(--sand);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-toggle:hover {
  background: rgba(199, 165, 110, 0.18);
  color: var(--brass-light);
  border-color: var(--brass);
}

.nav-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--sand);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(199, 165, 110, 0.25);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  transition: all 0.15s ease;
}

.nav-bell:hover {
  background: rgba(199, 165, 110, 0.18);
  color: var(--brass-light);
  border-color: var(--brass);
}

.nav-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13.5px;
  color: #D9CFB8;
}

.navlinks a {
  text-decoration: none;
  color: #D9CFB8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}

.navlinks a i {
  font-size: 14px;
}

.navlinks a:hover {
  color: var(--brass-light);
}

.navlinks .nav-action {
  border: 1px solid rgba(199, 165, 110, 0.65);
  border-radius: 7px;
  color: var(--sand);
  padding: 6px 12px;
  background: rgba(199, 165, 110, 0.08);
  font-weight: 500;
  gap: 6px;
}

.navlinks .nav-action:hover {
  background: rgba(199, 165, 110, 0.2);
  color: #fff;
}

.navlinks .nav-muted {
  color: #B9C0B2;
}

.nav-logout-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.nav-logout-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #B9C0B2;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s ease;
}

.nav-logout-btn:hover {
  color: var(--brass-light);
}

.language-form {
  display: inline-flex;
  margin: 0;
}

.lang-select {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sand);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}

.lang-select:focus {
  outline: none;
  border-color: var(--brass);
}

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--sand);
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.btn:hover {
  background: var(--ink-soft);
}

.btn-brass {
  background: var(--brass);
  color: var(--ink);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.messages li {
  padding: 12px 20px;
  font-size: 14px;
}

.messages .success {
  background: rgba(76, 122, 99, 0.12);
  color: var(--success);
}

.messages .error {
  background: rgba(169, 68, 66, 0.1);
  color: var(--danger);
}

.messages .info {
  background: rgba(36, 48, 77, 0.08);
  color: var(--indigo);
}

section {
  padding: 50px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-head h2 {
  font-size: 24px;
  color: var(--ink);
  margin: 0;
}

.see-all {
  font-size: 13px;
  color: var(--brass);
  text-decoration: none;
  font-weight: 600;
}

.hero {
  text-align: center;
  padding: 72px 0 64px;
  background: var(--ink);
  color: var(--sand);
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-light);
  margin-bottom: 16px;
}

.hero h1 {
  font-weight: 700;
  font-size: 40px;
  max-width: 620px;
  margin: 0 auto 16px;
  line-height: 1.2;
}

.hero p {
  color: #D9CFB8;
  max-width: 480px;
  margin: 0 auto 30px;
  font-size: 15px;
}

.flow-select {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--sand);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}

.flow-select select,
.flow-select button,
.flow-select input {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  border: none;
  background: transparent;
  padding: 12px 14px;
  color: var(--charcoal);
}

.flow-select button {
  background: var(--ink);
  color: var(--sand);
  border-radius: 6px;
  font-weight: 600;
  padding: 12px 22px;
  cursor: pointer;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  position: relative;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sand);
  font-family: 'Amiri', serif;
  font-size: 18px;
  margin-bottom: 12px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.verified-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
}

.verified-badge i {
  font-size: 20px;
  line-height: 1;
}

.card h3 {
  font-size: 16px;
  margin: 0 0 4px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.card .meta {
  font-size: 12.5px;
  color: var(--charcoal-soft);
  margin-bottom: 12px;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  background: rgba(169, 130, 76, 0.12);
  color: var(--brass);
  padding: 4px 9px;
  border-radius: 100px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--charcoal-soft);
  background: var(--sand);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.filter-bar select,
.filter-bar input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sand);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

form.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
}

form.stack label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}

form.stack input[type=text],
form.stack input[type=email],
form.stack input[type=password],
form.stack input[type=number],
form.stack select,
form.stack textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sand);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

.password-field {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sand);
}

form.stack .password-field input[type=password],
form.stack .password-field input[type=text] {
  border: none;
  background: transparent;
  outline: none;
}

.password-toggle {
  border: 0;
  background: transparent;
  color: var(--brass);
  cursor: pointer;
  font: 600 12px 'Inter', sans-serif;
  padding: 8px 12px;
}

.password-toggle:hover {
  color: var(--ink);
}

form.stack .errorlist {
  color: var(--danger);
  font-size: 12.5px;
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}

form.stack .helptext {
  font-size: 12px;
  color: var(--charcoal-soft);
}

/* Chat */
/* ── Chat Shell & Layout ─────────────────────────────────────────────── */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 520px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.chat-shell {
  background: var(--sand, #FAF7F2);
  border: 1px solid var(--line, #E5DEC9);
  border-radius: 16px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  box-shadow: 0 10px 30px rgba(22, 56, 50, 0.08);
  position: relative;
}

/* Chat Header */
.chat-head {
  background: var(--ink, #163832);
  color: var(--sand, #FAF7F2);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(169, 130, 76, 0.25);
  flex-shrink: 0;
  z-index: 5;
}

.chat-head-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-head .avatar.chat-avatar {
  margin: 0;
  width: 44px;
  height: 44px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 50%;
  border: 2px solid var(--brass, #A9824C);
  background: var(--indigo, #24304D);
  color: var(--sand, #FAF7F2);
  flex-shrink: 0;
}

.chat-head .avatar.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.chat-meta {
  min-width: 0;
}

.chat-recipient-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--sand, #FAF7F2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.chat-submeta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

/* Real-Time Presence Badge */
.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #C7A56E;
  font-weight: 500;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #9ca3af;
  transition: background 0.2s ease;
}

.presence-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: presencePulse 2s infinite;
}

@keyframes presencePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Chat Messages Container */
.chat-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: radial-gradient(circle at top right, rgba(169, 130, 76, 0.03), transparent 70%),
              radial-gradient(circle at bottom left, rgba(36, 48, 77, 0.03), transparent 70%),
              var(--sand, #FAF7F2);
}

/* Date Separators */
.chat-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px;
  position: relative;
}

.chat-date-separator span {
  background: var(--sand-soft, #f4efe6);
  border: 1px solid var(--line, #E5DEC9);
  color: var(--charcoal-soft, #5A544C);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Message Bubbles */
.bubble {
  max-width: 76%;
  padding: 10px 14px 8px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
  transition: background 0.15s ease;
}

.bubble.user {
  align-self: flex-end;
  background: var(--indigo, #24304D);
  color: var(--sand, #FAF7F2);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(36, 48, 77, 0.15);
}

.bubble.scholar {
  align-self: flex-start;
  background: #ffffff;
  color: var(--ink, #163832);
  border: 1px solid var(--line, #E5DEC9);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Message Grouping */
.bubble.grouped-next {
  margin-top: -6px;
}

.bubble.grouped-next.user {
  border-top-right-radius: 4px;
}

.bubble.grouped-next.scholar {
  border-top-left-radius: 4px;
}

.bubble.grouped-next .bubble-header {
  display: none;
}

.bubble-header {
  margin-bottom: 4px;
}

.bubble .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  font-weight: 600;
  display: block;
}

.bubble.user .label {
  color: #C7A56E;
}

.bubble.scholar .label {
  color: var(--brass, #A9824C);
}

/* Quoted Reply inside Bubble */
.reply-quote {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  overflow: hidden;
}

.bubble.user .reply-quote {
  background: rgba(255, 255, 255, 0.1);
}

.reply-quote:hover {
  background: rgba(0, 0, 0, 0.1);
}

.bubble.user .reply-quote:hover {
  background: rgba(255, 255, 255, 0.16);
}

.reply-quote-bar {
  width: 3px;
  border-radius: 3px;
  background: var(--brass, #A9824C);
  margin-right: 8px;
  flex-shrink: 0;
}

.reply-quote-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.reply-quote-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass, #A9824C);
}

.bubble.user .reply-quote-author {
  color: #C7A56E;
}

.reply-quote-text {
  font-size: 11.5px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Highlight flash animation when scrolling to referenced message */
.bubble.highlight-flash {
  animation: bubbleFlash 1.6s ease;
}

@keyframes bubbleFlash {
  0% { box-shadow: 0 0 0 4px var(--brass, #A9824C); }
  50% { box-shadow: 0 0 0 8px rgba(169, 130, 76, 0.4); }
  100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
}

/* Text message content */
.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.5;
}

/* Attachment Card */
.attachment-card {
  margin: 6px 0;
  border-radius: 8px;
  overflow: hidden;
}

.attachment-img-link {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  max-width: 260px;
}

.attachment-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.attachment-thumb:hover {
  transform: scale(1.02);
}

.attachment-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.bubble.user .attachment-file-row {
  background: rgba(255, 255, 255, 0.12);
}

.attachment-icon {
  font-size: 22px;
  color: var(--brass, #A9824C);
  flex-shrink: 0;
}

.attachment-meta {
  flex: 1;
  min-width: 0;
}

.attachment-filename {
  font-size: 12.5px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-filesize {
  font-size: 11px;
  opacity: 0.75;
}

.attachment-dl-btn {
  color: inherit;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.attachment-dl-btn:hover {
  opacity: 1;
}

/* Audio Player Container */
.audio-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 4px 0;
}

.audio-bubble audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.audio-play {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--brass, #A9824C);
  color: var(--sand, #FAF7F2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(169, 130, 76, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.audio-play:hover {
  background: #C7A56E;
  transform: scale(1.05);
}

.audio-track {
  flex: 1;
  min-width: 80px;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.audio-progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
  position: relative;
}

.bubble.user .audio-progress-bar {
  background: rgba(255, 255, 255, 0.25);
}

.audio-progress {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--brass, #A9824C);
  border-radius: 4px;
  transition: width 0.08s linear;
}

.bubble.user .audio-progress {
  background: #C7A56E;
}

.audio-time-wrap {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  opacity: 0.85;
  white-space: nowrap;
  font-weight: 500;
}

.audio-speed {
  background: rgba(169, 130, 76, 0.15);
  border: 1px solid rgba(169, 130, 76, 0.3);
  color: inherit;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bubble.user .audio-speed {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.audio-speed:hover {
  background: var(--brass, #A9824C);
  color: #fff;
}

.audio-download {
  color: inherit;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  text-decoration: none;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

.audio-download:hover {
  opacity: 1;
}

/* Audio Player States */
.audio-bubble.loading .audio-play i {
  animation: spinLoading 1s linear infinite;
}

@keyframes spinLoading {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.audio-bubble.error .audio-time-wrap {
  color: var(--danger, #dc2626) !important;
}

/* Bubble Footer (Meta, Status, Actions) */
.bubble-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  font-size: 10.5px;
}

.bubble-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.8;
}

.msg-time {
  font-family: 'Inter', sans-serif;
  font-size: 10.5px;
}

.msg-edited-tag {
  font-size: 10px;
  opacity: 0.75;
  font-style: italic;
}

/* Real-time status ticks */
.msg-status {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  line-height: 1;
}

.msg-status .read {
  color: #C7A56E;
  font-weight: bold;
}

/* Action Menu Trigger (⋮) */
.msg-action-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.msg-menu-btn {
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.45;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.bubble:hover .msg-menu-btn {
  opacity: 0.9;
}

.msg-menu-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  opacity: 1;
}

.bubble.user .msg-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Action Menu Dropdown */
.msg-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--line, #E5DEC9);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 6px 0;
  min-width: 140px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: menuDrop 0.15s ease;
}

.msg-menu-dropdown[hidden] {
  display: none !important;
}

@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-menu-dropdown button {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink, #163832);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s ease;
  width: 100%;
}

.msg-menu-dropdown button:hover {
  background: var(--sand, #FAF7F2);
  color: var(--brass, #A9824C);
}

.msg-menu-dropdown button.menu-danger {
  color: var(--danger, #dc2626);
}

.msg-menu-dropdown button.menu-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger, #dc2626);
}

/* Floating Scroll to Bottom Pill */
.scroll-bottom-pill {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink, #163832);
  color: var(--sand, #FAF7F2);
  border: 1px solid var(--brass, #A9824C);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  z-index: 20;
  transition: transform 0.15s ease, background 0.15s ease;
  animation: pillFadeIn 0.2s ease;
}

.scroll-bottom-pill[hidden] {
  display: none !important;
}

@keyframes pillFadeIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.scroll-bottom-pill:hover {
  background: var(--indigo, #24304D);
  transform: translate(-50%, -2px);
}

.scroll-unread-badge {
  background: var(--danger, #dc2626);
  color: #fff;
  border-radius: 100px;
  font-size: 10px;
  padding: 1px 6px;
  font-weight: 700;
}

/* Real-Time Typing Indicator Bar */
.typing-indicator-bar {
  padding: 6px 20px;
  display: flex;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.typing-indicator-bar[hidden] {
  display: none !important;
}

.typing-bubble {
  background: rgba(22, 56, 50, 0.08);
  border-radius: 100px;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--charcoal, #2B2620);
}

.typing-name {
  font-weight: 600;
  color: var(--ink, #163832);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass, #A9824C);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Reply Preview Dock above Composer */
.composer-reply-dock {
  background: #ffffff;
  border-top: 1px solid var(--line, #E5DEC9);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUpDock 0.15s ease;
}

.composer-reply-dock[hidden] {
  display: none !important;
}

@keyframes slideUpDock {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.reply-dock-bar {
  width: 3px;
  height: 28px;
  border-radius: 3px;
  background: var(--brass, #A9824C);
  flex-shrink: 0;
}

.reply-dock-body {
  flex: 1;
  min-width: 0;
}

.reply-dock-to {
  font-size: 11.5px;
  color: var(--brass, #A9824C);
}

.reply-dock-snippet {
  font-size: 12px;
  color: var(--charcoal, #2B2620);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-dock-close {
  border: 0;
  background: transparent;
  color: var(--charcoal-soft, #5A544C);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 4px;
}

.reply-dock-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--danger, #dc2626);
}

/* Attachment Preview Dock above Composer */
.composer-attachment-dock {
  background: #ffffff;
  border-top: 1px solid var(--line, #E5DEC9);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-attachment-dock[hidden] {
  display: none !important;
}

.attachment-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sand, #FAF7F2);
  border: 1px solid var(--line, #E5DEC9);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
}

.attachment-chip-name {
  font-weight: 600;
  color: var(--ink, #163832);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-chip-size {
  color: var(--charcoal-soft, #5A544C);
  font-size: 11px;
}

.attachment-chip-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--danger, #dc2626);
  padding: 0;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
}

/* Audio Recording Dock */
.audio-recording-dock {
  background: #ffffff;
  border-top: 1px solid var(--line, #E5DEC9);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-recording-dock[hidden] {
  display: none !important;
}

.rec-pulsing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger, #dc2626);
  animation: recPulse 1.2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes recPulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

.rec-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger, #dc2626);
}

.rec-timer {
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: var(--ink, #163832);
}

.rec-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  height: 20px;
}

.rec-waveform span {
  flex: 1;
  max-width: 4px;
  height: 4px;
  background: var(--brass, #A9824C);
  border-radius: 2px;
  animation: waveAnim 1s ease-in-out infinite alternate;
}

.rec-waveform span:nth-child(2) { animation-delay: 0.15s; }
.rec-waveform span:nth-child(3) { animation-delay: 0.3s; }
.rec-waveform span:nth-child(4) { animation-delay: 0.45s; }
.rec-waveform span:nth-child(5) { animation-delay: 0.6s; }
.rec-waveform span:nth-child(6) { animation-delay: 0.75s; }
.rec-waveform span:nth-child(7) { animation-delay: 0.9s; }
.rec-waveform span:nth-child(8) { animation-delay: 1.05s; }

@keyframes waveAnim {
  0% { height: 4px; }
  100% { height: 18px; }
}

.rec-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-btn-cancel,
.rec-btn-preview,
.rec-btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.rec-btn-cancel {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger, #dc2626);
}

.rec-btn-preview {
  background: rgba(169, 130, 76, 0.15);
  color: var(--brass, #A9824C);
}

.rec-btn-send {
  background: var(--ink, #163832);
  color: var(--sand, #FAF7F2);
}

.rec-btn-cancel:hover,
.rec-btn-preview:hover,
.rec-btn-send:hover {
  transform: scale(1.1);
}

/* Audio Review / Replay Dock */
.audio-review-dock {
  background: #ffffff;
  border-top: 1px solid var(--line, #E5DEC9);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-review-dock[hidden] {
  display: none !important;
}

.review-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--brass, #A9824C);
  color: var(--sand, #FAF7F2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.review-track {
  flex: 1;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.review-progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: var(--line, #E5DEC9);
  overflow: hidden;
}

.review-progress {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--brass, #A9824C);
  border-radius: 4px;
}

.review-time {
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--ink, #163832);
}

.review-discard-btn {
  border: 0;
  background: transparent;
  color: var(--danger, #dc2626);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.review-send-btn {
  padding: 6px 14px;
  font-size: 12.5px;
}

/* Islamic Quick Greetings Bar */
.quick-greetings-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  border-top: 1px solid var(--line, #E5DEC9);
  background: var(--sand-soft, #f4efe6);
  scrollbar-width: none;
  flex-shrink: 0;
}

.quick-greetings-bar::-webkit-scrollbar {
  display: none;
}

.greeting-chip {
  background: #ffffff;
  border: 1px solid var(--line, #E5DEC9);
  color: var(--charcoal, #2B2620);
  font-size: 11.5px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.greeting-chip:hover {
  border-color: var(--brass, #A9824C);
  background: var(--sand, #FAF7F2);
  color: var(--ink, #163832);
}

/* Chat Input Bar */
.chat-input {
  border-top: 1px solid var(--line, #E5DEC9);
  padding: 10px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  flex-shrink: 0;
}

.chat-input input[type=text] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line, #E5DEC9);
  background: var(--sand, #FAF7F2);
  border-radius: 100px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--ink, #163832);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input input[type=text]:focus {
  outline: none;
  border-color: var(--brass, #A9824C);
  box-shadow: 0 0 0 3px rgba(169, 130, 76, 0.15);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  font-size: 16px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn.attach-btn {
  background: rgba(169, 130, 76, 0.12);
  color: var(--brass, #A9824C);
}

.icon-btn.attach-btn:hover {
  background: rgba(169, 130, 76, 0.22);
}

.icon-btn.mic {
  background: var(--indigo, #24304D);
  color: var(--sand, #FAF7F2);
}

.icon-btn.mic:hover {
  background: #1e2840;
}

.icon-btn.send {
  background: var(--ink, #163832);
  color: var(--sand, #FAF7F2);
}

.icon-btn.send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.icon-btn.send:not(:disabled):hover {
  background: #112d28;
  transform: scale(1.05);
}

/* Empty chat notice */
.empty-chat-notice {
  text-align: center;
  padding: 48px 20px;
  color: var(--charcoal-soft, #5A544C);
  margin: auto;
}

.empty-chat-notice i {
  font-size: 36px;
  color: var(--brass, #A9824C);
  display: block;
  margin-bottom: 8px;
  opacity: 0.6;
}

.empty-chat-notice p {
  font-size: 14px;
  margin: 0;
}

/* Forward Dialog Conversation List */
.forward-conversation-list {
  max-height: 240px;
  overflow-y: auto;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forward-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line, #E5DEC9);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.forward-conv-item:hover {
  border-color: var(--brass, #A9824C);
  background: var(--sand, #FAF7F2);
}

.forward-conv-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.forward-conv-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #163832);
}

.forward-conv-category {
  font-size: 11px;
  color: var(--charcoal-soft, #5A544C);
}

/* Responsive Styles for Mobile */
@media (max-width: 768px) {
  .chat-page {
    height: calc(100vh - 70px);
    padding: 0;
  }

  .chat-shell {
    height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .chat-head {
    padding: 10px 14px;
  }

  .chat-head .avatar.chat-avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .chat-recipient-name {
    font-size: 14px;
  }

  .chat-body {
    padding: 12px 10px;
    gap: 8px;
  }

  .bubble {
    max-width: 88%;
    padding: 8px 12px 6px;
    font-size: 13px;
  }

  .audio-bubble {
    min-width: 220px;
  }

  .chat-input {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
}

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal);
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-bell:hover {
  color: var(--brass);
  background: rgba(169, 130, 76, 0.08);
}

.nav-bell-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: var(--danger, #a94442);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  border-radius: 10px;
  padding: 0 3px;
  border: 1.5px solid var(--parchment);
}

/* Islamic Quick Greetings Bar */
.quick-greetings-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: var(--sand);
  scrollbar-width: none;
}

.quick-greetings-bar::-webkit-scrollbar {
  display: none;
}

.greeting-chip {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--charcoal);
  font-size: 11.5px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.greeting-chip:hover {
  border-color: var(--brass);
  background: var(--parchment);
  color: var(--ink);
}

/* Status Filter Tabs on Scholar Dashboard */
.status-tab-btn {
  display: inline-block;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--charcoal);
  background: var(--sand, #fbf7ec);
  border: 1px solid var(--line);
  border-radius: 100px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-tab-btn:hover {
  border-color: var(--brass);
  background: var(--white);
}

.status-tab-btn.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
  font-weight: 600;
}

.voice-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--parchment);
}

.voice-preview[hidden] {
  display: none;
}

.voice-preview audio {
  flex: 1;
  min-width: 0;
  height: 32px;
}

.voice-cancel {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: 600 12px 'Inter', sans-serif;
}

.voice-send {
  flex-shrink: 0;
}

.question-composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sand);
  overflow: hidden;
}

.question-composer textarea {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  resize: vertical;
}

.question-composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 10px;
}

.question-composer-actions .send {
  background: var(--ink);
  color: var(--sand);
}

.question-composer-actions .recording-indicator {
  margin: 0;
  padding: 0;
  text-align: left;
}

.question-composer .voice-preview {
  border-top: 1px solid var(--line);
}

.chat-input {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chat-input input[type=text] {
  flex: 1;
  border: none;
  background: var(--parchment);
  border-radius: 100px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
}

.icon-btn.mic {
  background: var(--indigo);
  color: var(--sand);
  transition: transform 0.2s, background 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.icon-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.icon-btn.mic.recording {
  background: var(--danger);
  animation: pulse 1.5s infinite;
  transform: scale(1.1);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(169, 68, 66, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(169, 68, 66, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(169, 68, 66, 0);
  }
}

.icon-btn.send {
  background: var(--ink);
  color: var(--sand);
}

.recording-indicator {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  padding: 4px 0;
  display: none;
}

.integrity-note {
  max-width: 480px;
  margin: 14px auto 0;
  font-size: 11.5px;
  color: var(--charcoal-soft);
  text-align: center;
  padding: 0 10px;
}

.integrity-note b {
  color: var(--ink);
}

footer.site-footer {
  background: var(--indigo);
  color: #B9C0D6;
  text-align: center;
  padding: 30px 32px;
  font-size: 12.5px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 30px;
  align-items: start;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.category-card {
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  border-radius: var(--radius, 12px);
  border: 1px solid var(--line);
  background: var(--white);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--brass);
  box-shadow: 0 4px 14px rgba(169, 130, 76, 0.15);
}

.category-card.active {
  border-color: var(--brass);
  background: rgba(169, 130, 76, 0.08);
  box-shadow: 0 0 0 2px var(--brass);
}

.category-card h3 {
  font-size: 14px;
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 600;
}

.category-card strong {
  display: block;
  font-size: 25px;
  color: var(--brass);
  line-height: 1;
}

.category-card span {
  display: block;
  margin-top: 6px;
  color: var(--charcoal-soft);
  font-size: 12px;
}

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

.conv-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  cursor: pointer;
}

.conv-card-link:hover {
  border-color: var(--brass);
  background: var(--sand-soft, #fbfaf6);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
}

.conv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.conv-user-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-snippet {
  font-size: 12.5px;
  color: var(--charcoal);
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--charcoal-soft);
}

.category-tag {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10.5px;
  background: var(--sand, #f4efe6);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 500;
  color: var(--charcoal);
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  flex-shrink: 0;
}

.conv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

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

.status-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pill.pending {
  background: rgba(169, 130, 76, 0.15);
  color: var(--brass);
}

.status-pill.active {
  background: rgba(36, 48, 77, 0.12);
  color: var(--indigo);
}

.status-pill.answered {
  background: rgba(76, 122, 99, 0.14);
  color: var(--success);
}

.status-pill.closed {
  background: rgba(90, 84, 76, 0.12);
  color: var(--charcoal-soft);
}

@media (max-width: 768px) {
  .mobile-nav-controls {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .desktop-bell {
    display: none !important;
  }

  .navlinks {
    display: none;
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--ink);
    border-top: 1px solid rgba(199, 165, 110, 0.2);
    border-bottom: 2px solid var(--brass);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px 20px;
    gap: 12px;
    z-index: 999;
  }

  .navlinks.open {
    display: flex;
    animation: navSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .navlinks a,
  .navlinks .nav-logout-btn {
    font-size: 15px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--sand);
    width: 100%;
  }

  .navlinks .nav-action {
    text-align: center;
    justify-content: center;
    padding: 11px 16px;
    margin-top: 6px;
    background: rgba(199, 165, 110, 0.15);
  }

  .navlinks .language-form {
    width: 100%;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(199, 165, 110, 0.2);
  }

  .navlinks .lang-select {
    width: 100%;
    padding: 9px 12px;
    background: rgba(0, 0, 0, 0.3);
  }
}

@keyframes navSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {

  .wrap,
  .wrap-narrow {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero {
    padding: 52px 0 48px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .flow-select {
    display: flex;
    width: 100%;
    align-items: stretch;
  }

  .flow-select select,
  .flow-select button {
    min-width: 0;
    flex: 1 1 100%;
  }

  .flow-select button {
    margin-top: 4px;
  }

  section {
    padding: 42px 0;
  }

  .card {
    padding: 18px;
  }

  .chat-page {
    height: calc(100vh - 118px);
    padding: 0;
  }

  .chat-shell {
    height: calc(100vh - 150px);
    min-height: 400px;
    border-radius: 0;
  }

  .chat-body {
    padding: 16px 12px;
  }

  .chat-input {
    padding: 10px;
    gap: 8px;
  }

  .audio-bubble audio {
    max-width: 100%;
  }

  .audio-bubble {
    min-width: 0;
  }

  .audio-track {
    width: min(120px, 35vw);
  }

  .voice-preview {
    flex-wrap: wrap;
  }

  .voice-preview audio {
    order: 3;
    flex-basis: 100%;
  }
}

/* ── Confirmation Modal Dialog ────────────────────────────────────────── */
.confirm-modal {
  border: none;
  background: transparent;
  padding: 16px;
  max-width: 440px;
  width: 90vw;
  margin: auto;
}

.confirm-modal::backdrop {
  background: rgba(22, 56, 50, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.confirm-modal-card {
  background: var(--cream, #FAF7F2);
  border: 1px solid var(--line, #E5DEC9);
  border-radius: 16px;
  padding: 26px 28px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.confirm-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.confirm-modal-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink, #1B2B27);
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
}

.confirm-modal-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--charcoal, #4A5568);
  margin: 0 0 22px 0;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #dc2626;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════════
   SCHOLAR DASHBOARD - EXECUTIVE STYLING & RESPONSIVE ARCHITECTURE
   ══════════════════════════════════════════════════════════════════════════ */

.scholar-dashboard-wrap {
  padding-top: 24px;
  padding-bottom: 50px;
}

/* ── 1. Scholar Command Header ─────────────────────────────────────────── */
.scholar-hero-card {
  background: linear-gradient(135deg, #163832 0%, #1c453d 100%);
  border: 1px solid rgba(199, 165, 110, 0.35);
  border-radius: 16px;
  padding: 24px 28px;
  color: var(--sand);
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(22, 56, 50, 0.15);
}

.scholar-identity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.scholar-identity-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1 1 340px;
}

.scholar-avatar-frame {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--brass-light);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scholar-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scholar-avatar-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #A9824C, #C7A56E);
  color: var(--ink);
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
}

.scholar-info-block {
  min-width: 0;
  flex: 1;
}

.scholar-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.scholar-display-name {
  margin: 0;
  font-size: 24px;
  font-family: 'Amiri', serif;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}

.scholar-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.scholar-badge.badge-verified {
  background: rgba(76, 122, 99, 0.3);
  color: #7FE0B5;
  border: 1px solid rgba(127, 224, 181, 0.4);
}

.scholar-badge.badge-pending {
  background: rgba(199, 165, 110, 0.25);
  color: #F8D8A0;
  border: 1px solid rgba(248, 216, 160, 0.4);
}

.scholar-meta-chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12.5px;
  color: #D9CFB8;
}

.scholar-meta-chips .meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.scholar-meta-chips .stat-chip {
  color: var(--brass-light);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Control buttons group on the right */
.scholar-controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Availability Pill */
.scholar-availability-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.scholar-availability-switch.is-active {
  border-color: rgba(127, 224, 181, 0.35);
}

.scholar-availability-switch.is-paused {
  border-color: rgba(248, 216, 160, 0.3);
}

.availability-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.is-active .availability-indicator-dot {
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
}

.is-paused .availability-indicator-dot {
  background: #FBBF24;
}

.availability-label {
  color: var(--sand);
  white-space: nowrap;
}

.availability-form {
  display: inline-flex;
  margin: 0;
}

.btn-toggle-availability {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-toggle-availability:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* The Executive Profile & Settings Dropdown Button */
.btn-scholar-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #C7A56E 0%, #A9824C 100%);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(169, 130, 76, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-scholar-dropdown:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(169, 130, 76, 0.45);
  background: linear-gradient(135deg, #d6b782 0%, #b89057 100%);
}

.btn-scholar-dropdown .caret-icon {
  font-size: 12px;
  transition: transform 0.25s ease;
}

.btn-scholar-dropdown[aria-expanded="true"] .caret-icon {
  transform: rotate(180deg);
}

.btn-public-profile {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--sand);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-public-profile:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}


/* ── 2. The Profile & Settings Dropdown Panel ──────────────────────────── */
.scholar-settings-dropdown {
  display: none;
  margin-bottom: 26px;
}

.scholar-settings-dropdown.is-open {
  display: block;
  animation: settingsSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes settingsSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-panel-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: 16px;
  padding: 26px 30px;
  box-shadow: 0 14px 40px rgba(22, 56, 50, 0.08);
}

.settings-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.settings-panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(169, 130, 76, 0.12);
  color: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.settings-panel-title {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Amiri', serif;
  color: var(--ink);
}

.settings-panel-desc {
  margin: 0;
  font-size: 13px;
  color: var(--charcoal-soft);
}

.btn-close-settings {
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.btn-close-settings:hover {
  background: var(--ink);
  color: var(--sand);
  border-color: var(--ink);
}

.settings-form-alerts .form-alert-banner {
  background: rgba(169, 68, 66, 0.08);
  border: 1px solid rgba(169, 68, 66, 0.25);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.settings-subcard {
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}

.subcard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.subcard-header i {
  font-size: 16px;
  color: var(--brass);
}

.subcard-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}

.form-field-group {
  margin-bottom: 14px;
}

.form-field-group:last-child {
  margin-bottom: 0;
}

.form-field-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}

.form-field-group label .req {
  color: var(--danger);
}

.form-field-group .field-hint {
  display: block;
  font-size: 11.5px;
  color: var(--charcoal-soft);
  margin-top: 4px;
  line-height: 1.4;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  color: var(--charcoal-soft);
  font-size: 14px;
  pointer-events: none;
}

.input-with-icon input,
.input-with-icon select {
  width: 100%;
  padding: 9px 12px 9px 34px !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-with-icon input:focus,
.input-with-icon select:focus,
.form-field-group textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(169, 130, 76, 0.15);
}

.form-field-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  resize: vertical;
  min-height: 90px;
}

/* Profile photo upload widget */
.profile-pic-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pic-preview-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  overflow: hidden;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pic-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pic-preview-circle .pic-fallback-icon {
  font-size: 26px;
  color: var(--charcoal-soft);
}

.pic-input-col {
  flex: 1;
  min-width: 0;
}

.pic-input-col input[type=file] {
  font-size: 12px;
  width: 100%;
}

/* Availability Subcard in form */
.settings-availability-subcard {
  margin-bottom: 22px;
}

.availability-setting-row .custom-toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}

.custom-toggle-label input[type=checkbox] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brass);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-main-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.toggle-subtext {
  display: block;
  font-size: 12px;
  color: var(--charcoal-soft);
  line-height: 1.45;
}

/* Footer Actions */
.settings-actions-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.btn-save-profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  font-weight: 600;
}

.preview-profile-link {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--brass);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.preview-profile-link:hover {
  text-decoration: underline;
}


/* ── 3. Responsive Category Chips Filter ──────────────────────────────── */
.category-filter-wrapper {
  margin-bottom: 24px;
}

.category-filter-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.category-filter-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.category-filter-subtitle {
  font-size: 12px;
  color: var(--charcoal-soft);
}

.category-filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.category-filter-scroll::-webkit-scrollbar {
  height: 5px;
}

.category-filter-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--sand);
  border: 1px solid var(--line);
  color: var(--charcoal);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
}

.category-chip:hover {
  border-color: var(--brass);
  background: #FFFFFF;
  transform: translateY(-1px);
}

.category-chip.active {
  background: var(--ink);
  color: var(--sand);
  border-color: var(--ink);
  box-shadow: 0 4px 12px rgba(22, 56, 50, 0.2);
}

.category-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.category-chip.active .chip-count {
  background: var(--brass);
  color: var(--ink);
}


/* ── 4. Questions Section & Filter Bar ────────────────────────────────── */
.questions-workspace-card {
  padding: 24px;
}

.workspace-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-title {
  margin: 0;
  font-size: 18px;
  font-family: 'Amiri', serif;
  font-weight: 700;
  color: var(--ink);
}

.workspace-search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.workspace-search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
}

.status-tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.status-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  background: var(--sand);
  border: 1px solid var(--line);
  color: var(--charcoal);
  transition: all 0.15s ease;
}

.status-tab-btn:hover {
  border-color: var(--brass);
  background: #FFFFFF;
}

.status-tab-btn.active {
  background: var(--indigo);
  color: #FFFFFF;
  border-color: var(--indigo);
}


/* ── 5. Responsive Media Queries ──────────────────────────────────────── */
@media (max-width: 960px) {
  .settings-sections-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .scholar-identity-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .scholar-controls-group {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .scholar-hero-card {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .scholar-identity-main {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
  }

  .scholar-avatar-frame {
    width: 58px;
    height: 58px;
  }

  .scholar-display-name {
    font-size: 20px;
  }

  .scholar-controls-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 10px;
  }

  .scholar-availability-switch {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .btn-scholar-dropdown,
  .btn-public-profile {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
  }

  .settings-panel-card {
    padding: 18px 16px;
    border-radius: 12px;
  }

  .profile-pic-uploader {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .workspace-search-form {
    flex-direction: column;
    gap: 8px;
  }

  .workspace-search-form button,
  .workspace-search-form a {
    width: 100%;
    text-align: center;
  }

  .settings-actions-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-actions-footer button,
  .settings-actions-footer a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .preview-profile-link {
    margin-left: 0;
    justify-content: center;
    padding-top: 8px;
  }
}