/* ════════════════════════════════════════════════════════════════
   Bondhu AI — Material Design 3
   Icon palette: #4285F4 Blue · #EA4335 Red · #FBBC05 Yellow · #34A853 Green
   ════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600;700&family=Google+Sans+Display:wght@400;500;600;700;800&family=Hind+Siliguri:wght@400;500;600;700&display=swap');

/* ── M3 Color System ── */
:root {
  /* Blue — Primary / Tech Mentor */
  --blue:        #1A73E8;
  --blue-hi:     #4285F4;
  --blue-dk:     #0B57D0;
  --blue-cnt:    #D3E3FD;
  --on-blue:     #FFFFFF;
  --on-blue-cnt: #001D36;
  --blue-tint:   #E8F0FE;

  /* Green — Secondary / Progress */
  --green:        #34A853;
  --green-hi:     #46BF65;
  --green-dk:     #1E8E3E;
  --green-cnt:    #B7F5CC;
  --on-green:     #FFFFFF;
  --on-green-cnt: #002112;
  --green-tint:   #E6F4EA;

  /* Yellow — Tertiary / TB2 Guide */
  --yellow:        #F9AB00;
  --yellow-hi:     #FBBC04;
  --yellow-dk:     #E37400;
  --yellow-cnt:    #FFE08A;
  --on-yellow:     #261A00;
  --on-yellow-cnt: #261A00;
  --yellow-tint:   #FEF7E0;

  /* Red — Error / English Partner */
  --red:        #D93025;
  --red-hi:     #EA4335;
  --red-dk:     #A50E0E;
  --red-cnt:    #FCDAD3;
  --on-red:     #FFFFFF;
  --on-red-cnt: #410E0B;
  --red-tint:   #FCE8E6;

  /* Accent — switches per mode */
  --ac:      var(--blue);
  --ac-hi:   var(--blue-hi);
  --ac-dk:   var(--blue-dk);
  --ac-cnt:  var(--blue-cnt);
  --on-ac:   var(--on-blue);
  --on-ac-c: var(--on-blue-cnt);
  --ac-tint: var(--blue-tint);

  /* M3 Surface Hierarchy */
  --bg:   #F8FAFF;
  --s0:   #FFFFFF;
  --s1:   #F3F5FC;
  --s2:   #EDEEF5;
  --s3:   #E6E8EF;
  --s4:   #E0E2EA;

  --on-s:  #191C22;
  --on-sv: #43474F;
  --outl:  #74777F;
  --outl-v:#C3C7CF;

  /* Error */
  --err:     #BA1A1A;
  --err-cnt: #FFDAD6;
  --on-err-c:#410E0B;

  /* M3 Shape Scale */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   28px;
  --r-2xl:  36px;
  --r-full: 9999px;

  /* Elevation */
  --e1: 0 1px 2px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --e2: 0 2px 6px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --e3: 0 4px 8px rgba(0,0,0,.09), 0 8px 24px rgba(0,0,0,.07);
  --e4: 0 8px 16px rgba(0,0,0,.11), 0 16px 48px rgba(0,0,0,.09);

  /* Motion */
  --spring:  cubic-bezier(.34, 1.56, .64, 1);
  --ease-s:  cubic-bezier(.2, 0, 0, 1);
  --ease-e:  cubic-bezier(.05, .7, .1, 1);

  /* Typography */
  --font:  'Google Sans', 'Hind Siliguri', 'Segoe UI', system-ui, sans-serif;
  --fontd: 'Google Sans Display', 'Google Sans', 'Hind Siliguri', system-ui, sans-serif;
}

/* Mode Accent Override */
[data-mode="tech_mentor"]     { --ac:var(--blue);   --ac-hi:var(--blue-hi);   --ac-dk:var(--blue-dk);   --ac-cnt:var(--blue-cnt);   --on-ac:var(--on-blue);   --on-ac-c:var(--on-blue-cnt);   --ac-tint:var(--blue-tint); }
[data-mode="english_partner"] { --ac:var(--red);    --ac-hi:var(--red-hi);    --ac-dk:var(--red-dk);    --ac-cnt:var(--red-cnt);    --on-ac:var(--on-red);    --on-ac-c:var(--on-red-cnt);    --ac-tint:var(--red-tint); }
[data-mode="tb2_guide"]       { --ac:var(--yellow); --ac-hi:var(--yellow-hi); --ac-dk:var(--yellow-dk); --ac-cnt:var(--yellow-cnt); --on-ac:var(--on-yellow); --on-ac-c:var(--on-yellow-cnt); --ac-tint:var(--yellow-tint); }
[data-mode="progress_advisor"]{ --ac:var(--green);  --ac-hi:var(--green-hi);  --ac-dk:var(--green-dk);  --ac-cnt:var(--green-cnt);  --on-ac:var(--on-green);  --on-ac-c:var(--on-green-cnt);  --ac-tint:var(--green-tint); }

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--on-s);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ══════════════════════════════════════════
   AUTH PAGE
   ══════════════════════════════════════════ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: #0B57D0;
}

/* 4-brand-color animated mesh */
.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.auth-bg::before,
.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 15% 15%, rgba(66,133,244,.85) 0%, transparent 55%),
    radial-gradient(ellipse 55% 50% at 85% 12%, rgba(234,67,53,.75)  0%, transparent 52%),
    radial-gradient(ellipse 55% 55% at 12% 85%, rgba(52,168,83,.80)  0%, transparent 55%),
    radial-gradient(ellipse 60% 52% at 82% 82%, rgba(251,188,5,.80)  0%, transparent 54%);
  filter: blur(48px);
  animation: meshAnim 20s ease-in-out infinite;
}
.auth-bg::after {
  animation-delay: -10s;
  opacity: .55;
  filter: blur(64px);
}
@keyframes meshAnim {
  0%,100% { transform: scale(1) rotate(0deg); }
  33%     { transform: scale(1.07) rotate(5deg); }
  66%     { transform: scale(.96) rotate(-4deg); }
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  border-radius: var(--r-2xl);
  padding: 2.5rem 2.25rem 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--e4), 0 0 0 1px rgba(255,255,255,.5);
  animation: authCardIn .55s var(--spring);
}
@keyframes authCardIn {
  from { opacity:0; transform:translateY(36px) scale(.93); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ── Auth Logo ── */
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.auth-icon-wrap {
  width: 72px;
  height: 72px;
  background: var(--s1);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--e2);
  animation: iconBob 4s ease-in-out infinite;
}
@keyframes iconBob {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50%     { transform: translateY(-6px) rotate(3deg); }
}

.auth-icon-wrap svg { width:42px; height:42px; }

.auth-logo h1 {
  font-family: var(--fontd);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  display: inline-block;
  padding-bottom: .2em;
  background: linear-gradient(130deg, var(--blue) 0%, var(--red-hi) 40%, var(--yellow-hi) 70%, var(--green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-logo p {
  font-size: .85rem;
  color: var(--on-sv);
  font-weight: 500;
}

/* Track dots */
.auth-track-dots {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.auth-track-dots .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  animation: dotPulse 2.4s ease-in-out infinite;
}
.dot-blue   { background: var(--blue-hi);   animation-delay: 0s; }
.dot-red    { background: var(--red-hi);    animation-delay: .3s; }
.dot-yellow { background: var(--yellow-hi); animation-delay: .6s; }
.dot-green  { background: var(--green-hi);  animation-delay: .9s; }
@keyframes dotPulse {
  0%,100% { transform:scale(1);   opacity:.8; }
  50%     { transform:scale(1.35); opacity:1; }
}

/* ── Shared Form & Button ── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ac-dk);
  margin-bottom: .4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .95rem 1.1rem;
  background: var(--s1);
  border: 2px solid transparent;
  border-radius: var(--r-lg);
  font-size: .95rem;
  font-family: var(--font);
  color: var(--on-s);
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .2s var(--spring);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--ac);
  background: var(--s0);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 14%, transparent);
  transform: translateY(-1px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .95rem 1.75rem;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .1px;
  cursor: pointer;
  transition: all .28s var(--spring);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.btn:hover::after  { opacity: .08; }
.btn:active::after { opacity: .16; }

.btn-primary {
  background: var(--ac);
  color: var(--on-ac);
  width: 100%;
  font-weight: 700;
  box-shadow: var(--e2);
}
.btn-primary:hover {
  box-shadow: var(--e3);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--e1); }

.btn-secondary {
  background: var(--s2);
  color: var(--on-s);
  font-size: .875rem;
  padding: .6rem 1.2rem;
}
.btn-secondary:hover { background: var(--s3); transform: translateY(-1px); }

/* Alerts */
.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--r-lg);
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
  animation: slideDown .3s var(--spring);
}
@keyframes slideDown {
  from { opacity:0; transform:translateY(-10px); }
  to   { opacity:1; transform:translateY(0); }
}
.alert-error   { background: var(--err-cnt);   color: var(--err); }
.alert-success { background: var(--green-cnt); color: var(--on-green-cnt); }

.auth-switch {
  text-align: center;
  margin-top: 1.1rem;
  font-size: .875rem;
  color: var(--on-sv);
}
.auth-switch a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* Social login */
.or-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.1rem 0;
  color: var(--on-sv);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .5px;
}
.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outl-v);
}

.social-btns {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  width: 100%;
  padding: .75rem 1rem;
  border-radius: var(--r-lg);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--outl-v);
  transition: all .22s var(--spring);
  min-height: 46px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-social:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.btn-social:active { transform: scale(.97); }

.btn-google {
  background: #fff;
  color: #3C4043;
  border-color: #dadce0;
}
.btn-google:hover { background: #f8f9fa; border-color: #b0b8c1; }

.btn-github {
  background: #24292F;
  color: #fff;
  border-color: #24292F;
}
.btn-github:hover { background: #1a1e22; }

.forgot-link {
  display: block;
  text-align: right;
  font-size: .8rem;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  margin-top: .25rem;
  margin-bottom: .1rem;
}
.forgot-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ══════════════════════════════════════════
   M3 NAVIGATION RAIL
   ══════════════════════════════════════════ */
.sidebar {
  width: 88px;
  background: var(--s1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .75rem 0 .75rem;
  border-right: 1px solid var(--outl-v);
  transition: width .32s var(--ease-e);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  z-index: 10;
}
.sidebar:hover {
  width: 272px;
  box-shadow: var(--e3);
}

/* Logo / Brand header */
.sidebar-header {
  padding: .5rem .75rem 1rem;
  width: 100%;
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  background: var(--s0);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--e2), 0 0 0 1px var(--outl-v);
  transition: transform .35s var(--spring), border-radius .3s var(--spring), box-shadow .3s;
  cursor: default;
}
.sidebar-logo svg { width: 28px; height: 28px; }
.sidebar-logo:hover {
  transform: rotate(-10deg) scale(1.08);
  border-radius: var(--r-xl);
  box-shadow: var(--e3);
}

.sidebar-header-text {
  opacity: 0;
  transition: opacity .18s .08s;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.sidebar:hover .sidebar-header-text { opacity: 1; }

.sidebar-header-text h2 {
  font-family: var(--fontd);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--red-hi) 60%, var(--yellow-hi) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-header-text p {
  font-size: .7rem;
  color: var(--on-sv);
  font-weight: 500;
  margin-top: .1rem;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  width: 100%;
  padding: .25rem 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--outl);
  padding: 1rem 1.1rem .3rem;
  opacity: 0;
  transition: opacity .18s;
  white-space: nowrap;
}
.sidebar:hover .nav-section-label { opacity: 1; }

/* M3 Nav Item — icon + label stacked then inline */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: .2rem .55rem;
  border: none;
  background: none;
  width: calc(100% - 1rem);
  margin: .15rem .5rem;
  cursor: pointer;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  color: var(--on-sv);
  white-space: nowrap;
  text-align: left;
  position: relative;
  text-decoration: none;
  border-radius: var(--r-full);
  transition: color .22s var(--ease-s);
}
.nav-item:hover { color: var(--on-s); }

/* M3 active indicator pill behind icon */
.nav-icon {
  min-width: 56px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--on-sv);
  transition: background .22s var(--ease-s), transform .28s var(--spring), min-width .32s var(--ease-e);
  position: relative;
}

.nav-item:hover  .nav-icon { background: var(--s3); }
.nav-item.active .nav-icon { background: var(--ac-cnt); }

/* Mode-specific active indicator colors */
.nav-item[data-mode="tech_mentor"].active     .nav-icon { background: var(--blue-cnt);   color: var(--blue-dk); }
.nav-item[data-mode="english_partner"].active .nav-icon { background: var(--red-cnt);    color: var(--red-dk); }
.nav-item[data-mode="tb2_guide"].active       .nav-icon { background: var(--yellow-cnt); color: var(--yellow-dk); }
.nav-item[data-mode="progress_advisor"].active .nav-icon{ background: var(--green-cnt);  color: var(--green-dk); }

.nav-item.active .nav-label { font-weight: 700; }
.nav-item[data-mode="tech_mentor"].active     { color: var(--on-blue-cnt); }
.nav-item[data-mode="english_partner"].active { color: var(--on-red-cnt); }
.nav-item[data-mode="tb2_guide"].active       { color: var(--on-yellow-cnt); }
.nav-item[data-mode="progress_advisor"].active{ color: var(--on-green-cnt); }

.nav-label {
  opacity: 0;
  transition: opacity .18s;
  overflow: hidden;
  padding-left: .5rem;
  flex: 1;
  min-width: 0;
}
.sidebar:hover .nav-label { opacity: 1; }

/* ── Sidebar User ── */
.sidebar-user {
  width: calc(100% - 1rem);
  margin: .5rem;
  padding: .6rem .55rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-radius: var(--r-full);
  background: var(--s2);
  overflow: hidden;
  transition: background .2s;
  flex-shrink: 0;
}
.sidebar-user:hover { background: var(--s3); }

.user-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--ac), var(--ac-hi));
  color: #fff;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  box-shadow: var(--e1);
  transition: transform .3s var(--spring);
}
.sidebar-user:hover .user-avatar { transform: scale(1.08); }

.user-name {
  font-size: .83rem;
  font-weight: 600;
  flex: 1;
  opacity: 0;
  transition: opacity .18s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar:hover .user-name { opacity: 1; }

.btn-logout {
  background: none;
  border: none;
  color: var(--on-sv);
  cursor: pointer;
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  transition: all .22s var(--spring);
  opacity: 0;
}
.sidebar:hover .btn-logout { opacity: 1; }
.btn-logout:hover {
  background: var(--err-cnt);
  color: var(--err);
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
  min-width: 0;
}

#chatPage, #progressPage {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* ── M3 Top App Bar ── */
.content-header {
  padding: 1rem 1.75rem;
  background: var(--s0);
  border-bottom: 1px solid var(--outl-v);
  display: flex;
  align-items: center;
  gap: .85rem;
  min-height: 72px;
  position: relative;
  box-shadow: 0 1px 0 var(--outl-v);
}
.content-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ac-tint) 0%, transparent 55%);
  opacity: .65;
  pointer-events: none;
  transition: background .35s var(--ease-s);
}
.content-header > * { position: relative; z-index: 1; }

.content-header h2 {
  font-family: var(--fontd);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--ac-dk);
  transition: color .3s var(--ease-s);
  white-space: nowrap;
}

.mode-badge {
  padding: .35rem .9rem;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1px;
  background: var(--ac-cnt);
  color: var(--on-ac-c);
  transition: all .3s var(--ease-s);
}

.clear-btn {
  margin-left: auto;
  font-size: .8rem;
  padding: .45rem .95rem;
  background: var(--s2);
  color: var(--on-sv);
  border-radius: var(--r-full);
}
.clear-btn:hover { background: var(--err-cnt); color: var(--err); }

/* ══════════════════════════════════════════
   CHAT MESSAGES
   ══════════════════════════════════════════ */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
  max-width: 940px;
  margin: 0 auto;
  width: 100%;
}

.message {
  display: flex;
  gap: .75rem;
  max-width: 80%;
  animation: msgIn .38s var(--spring);
}
@keyframes msgIn {
  from { opacity:0; transform:scale(.88) translateY(14px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

.message.user      { align-self:flex-end;   flex-direction:row-reverse; }
.message.assistant { align-self:flex-start; }

.message-avatar {
  width: 38px; height: 38px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: var(--e1);
  transition: transform .28s var(--spring);
}
.message-avatar:hover { transform: scale(1.12) rotate(-6deg); }

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--ac), var(--ac-hi));
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
}

/* Bondhu avatar — uses the SVG icon */
.message.assistant .message-avatar {
  background: var(--s0);
  border: 1.5px solid var(--outl-v);
  padding: 5px;
}
.message.assistant .message-avatar svg { width: 22px; height: 22px; }

.message-bubble {
  padding: .95rem 1.2rem;
  line-height: 1.72;
  font-size: .94rem;
  word-wrap: break-word;
}

/* User bubble — M3 Primary filled */
.message.user .message-bubble {
  background: var(--ac);
  color: var(--on-ac);
  border-radius: var(--r-xl) var(--r-xl) var(--r-sm) var(--r-xl);
  box-shadow: var(--e2);
}

/* Assistant bubble — M3 Surface Container */
.message.assistant .message-bubble {
  background: var(--s0);
  color: var(--on-s);
  border-radius: var(--r-xl) var(--r-xl) var(--r-xl) var(--r-sm);
  border: 1px solid var(--outl-v);
  box-shadow: var(--e1);
}

.message.assistant .message-bubble pre {
  background: #1a1d23;
  color: #dde1ed;
  padding: 1rem 1.2rem;
  border-radius: var(--r-lg);
  overflow-x: auto;
  margin: .75rem 0;
  font-size: .82rem;
  line-height: 1.6;
  font-family: 'JetBrains Mono','Fira Code',Consolas,monospace;
}
.message.assistant .message-bubble code {
  background: var(--s2);
  color: var(--red-dk);
  padding: .15em .45em;
  border-radius: var(--r-sm);
  font-size: .87em;
  font-family: 'JetBrains Mono',Consolas,monospace;
  font-weight: 500;
}
.message.assistant .message-bubble pre code { background:none; color:inherit; padding:0; }
.message.assistant .message-bubble strong { color:var(--ac-dk); font-weight:700; }
.message.assistant .message-bubble h1,
.message.assistant .message-bubble h2,
.message.assistant .message-bubble h3 { margin:.8rem 0 .3rem; color:var(--ac-dk); font-weight:700; }
.message.assistant .message-bubble ul,
.message.assistant .message-bubble ol { margin:.45rem 0 .45rem 1.45rem; }
.message.assistant .message-bubble li { margin:.22rem 0; }

/* ── Hero (empty state) ── */
.chat-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  animation: heroIn .55s var(--spring);
}
@keyframes heroIn {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

.hero-icon-wrap {
  width: 96px; height: 96px;
  background: var(--s0);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--e3);
  animation: heroBob 3.5s ease-in-out infinite;
  border: 1px solid var(--outl-v);
}
.hero-icon-wrap svg { width: 56px; height: 56px; }
@keyframes heroBob {
  0%,100% { transform:translateY(0) rotate(-3deg); }
  50%     { transform:translateY(-10px) rotate(3deg); }
}

/* fallback for old .chat-hero .hero-icon (emoji) */
.chat-hero .hero-icon {
  font-size: 4rem;
  margin-bottom: 1.25rem;
  animation: heroBob 3.5s ease-in-out infinite;
}

.chat-hero h1 {
  font-family: var(--fontd);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: .55rem;
  background: linear-gradient(135deg, var(--ac-dk), var(--ac));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-hero p {
  font-size: .98rem;
  color: var(--on-sv);
  max-width: 440px;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

/* M3 Suggestion Chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  justify-content: center;
  max-width: 580px;
}

.chip {
  padding: .65rem 1.15rem;
  background: var(--s0);
  border: 1.5px solid var(--outl-v);
  border-radius: var(--r-full);
  font-size: .84rem;
  font-weight: 600;
  color: var(--on-sv);
  cursor: pointer;
  transition: all .24s var(--spring);
  font-family: var(--font);
}
.chip:hover {
  background: var(--ac-cnt);
  color: var(--on-ac-c);
  border-color: var(--ac);
  transform: translateY(-2px);
  box-shadow: var(--e2);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: .95rem 1.2rem;
}
.typing-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  animation: typeBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(1) { background: var(--blue-hi); }
.typing-dot:nth-child(2) { background: var(--red-hi);    animation-delay: .16s; }
.typing-dot:nth-child(3) { background: var(--yellow-hi); animation-delay: .32s; }
@keyframes typeBounce {
  0%,60%,100% { transform:translateY(0); opacity:.45; }
  30%         { transform:translateY(-9px); opacity:1; }
}

/* ══════════════════════════════════════════
   CHAT INPUT — M3 Text Field Style
   ══════════════════════════════════════════ */
.chat-input-area {
  padding: .85rem 1.75rem 1.4rem;
  background: var(--bg);
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  max-width: 940px;
  margin: 0 auto;
  width: 100%;
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--s0);
  border-radius: var(--r-xl);
  border: 2px solid var(--outl-v);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--spring);
  padding: .55rem .9rem;
  box-shadow: var(--e1);
}
.chat-input-wrapper:focus-within {
  border-color: var(--ac);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 14%, transparent), var(--e2);
  transform: translateY(-1px);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--on-s);
  resize: none;
  min-height: 28px;
  max-height: 140px;
  padding: .35rem .2rem;
  line-height: 1.55;
}
.chat-input::placeholder { color: var(--on-sv); }

/* M3 FAB-style Send button */
.btn-send {
  width: 54px; height: 54px;
  background: var(--ac);
  color: var(--on-ac);
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--e2);
  transition: all .28s var(--spring);
  flex-shrink: 0;
}
.btn-send:hover {
  border-radius: var(--r-xl);
  box-shadow: var(--e3);
  transform: scale(1.07) rotate(-8deg);
  background: var(--ac-dk);
}
.btn-send:active { transform: scale(.93); box-shadow: var(--e1); }
.btn-send:disabled {
  background: var(--s3);
  color: var(--outl);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Mic button */
.btn-mic {
  width: 54px; height: 54px;
  background: var(--s0);
  color: var(--ac-dk);
  border: 2px solid var(--outl-v);
  border-radius: var(--r-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all .28s var(--spring);
  flex-shrink: 0;
}
.btn-mic:hover {
  border-color: var(--ac);
  background: var(--ac-tint);
  transform: scale(1.05) rotate(-5deg);
  border-radius: var(--r-xl);
}
.btn-mic:active { transform: scale(.95); }
.btn-mic.listening {
  background: var(--red-hi);
  color: #fff;
  border-color: transparent;
  border-radius: var(--r-full);
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow:0 0 0 0 color-mix(in srgb,var(--red-hi) 50%,transparent); }
  50%     { box-shadow:0 0 0 13px color-mix(in srgb,var(--red-hi) 0%,transparent); }
}

/* Speak button */
.speak-btn {
  background: transparent;
  border: 1.5px solid var(--outl-v);
  cursor: pointer;
  font-size: .78rem;
  padding: .3rem .75rem;
  margin-top: .75rem;
  border-radius: var(--r-full);
  color: var(--on-sv);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: all .22s var(--spring);
  font-family: var(--font);
  font-weight: 600;
  opacity: .65;
}
.message.assistant .message-bubble:hover .speak-btn { opacity: 1; }
.speak-btn:hover {
  background: var(--ac-cnt);
  color: var(--on-ac-c);
  border-color: var(--ac);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════
   PROGRESS PAGE
   ══════════════════════════════════════════ */
.progress-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* M3 Elevated Card */
.progress-card {
  background: var(--s0);
  border-radius: var(--r-xl);
  padding: 1.6rem;
  border: 1px solid var(--outl-v);
  transition: all .3s var(--spring);
  position: relative;
  overflow: hidden;
}
.progress-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--blue-hi), var(--red-hi), var(--yellow-hi), var(--green-hi));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.progress-card:hover {
  box-shadow: var(--e3);
  transform: translateY(-5px);
  border-color: var(--ac);
}

.progress-card h4 {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--on-sv);
  font-weight: 700;
  margin-bottom: .5rem;
}

.track-name {
  font-family: var(--fontd);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--on-s);
  margin-bottom: 1.1rem;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--outl-v);
  font-size: .88rem;
}
.progress-item:last-child { border-bottom: none; }

.progress-topic { font-size: .9rem; font-weight: 600; }
.progress-notes {
  font-size: .74rem;
  color: var(--on-sv);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.item-actions {
  display: flex;
  gap: .25rem;
  opacity: 0;
  transition: opacity .22s;
  flex-shrink: 0;
  margin-left: auto;
}
.progress-item:hover .item-actions { opacity: 1; }

.action-btn {
  background: none;
  border: none;
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .88rem;
  transition: all .2s var(--spring);
}
.edit-btn:hover { background: var(--blue-cnt); transform: scale(1.1); }
.del-btn:hover  { background: var(--err-cnt); transform: scale(1.1) rotate(8deg); }

/* M3 Status Chips */
.status-badge {
  padding: .28rem .75rem;
  border-radius: var(--r-full);
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .1px;
}
.status-completed   { background: var(--green-cnt); color: var(--on-green-cnt); }
.status-in_progress { background: var(--blue-cnt);  color: var(--on-blue-cnt); }
.status-started     { background: var(--yellow-cnt);color: var(--on-yellow-cnt); }

.score-bar {
  width: 60px; height: 6px;
  background: var(--outl-v);
  border-radius: var(--r-full);
  overflow: hidden;
  flex-shrink: 0;
}
.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-hi), var(--yellow-hi), var(--green-hi));
  border-radius: var(--r-full);
  transition: width .65s var(--spring);
}

.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--on-sv);
  grid-column: 1/-1;
}
.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 1.1rem;
  opacity: .65;
  animation: heroBob 3.5s ease-in-out infinite;
}
.empty-state p { font-size: 1rem; line-height: 1.6; font-weight: 500; }

.hidden { display:none !important; }

/* ══════════════════════════════════════════
   MODAL — M3 Dialog
   ══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,18,27,.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeScrim .22s ease;
}
@keyframes fadeScrim {
  from { opacity:0; }
  to   { opacity:1; }
}

.modal-card {
  background: var(--s0);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--e4);
  animation: dialogIn .35s var(--spring);
  overflow: hidden;
  border: 1px solid var(--outl-v);
}
@keyframes dialogIn {
  from { opacity:0; transform:scale(.88) translateY(24px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid var(--outl-v);
  background: linear-gradient(135deg, var(--ac-tint) 0%, transparent 80%);
}
.modal-header h3 {
  font-family: var(--fontd);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ac-dk);
  letter-spacing: -.2px;
}
.modal-close {
  background: var(--s2);
  border: none;
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  color: var(--on-sv);
  transition: all .22s var(--spring);
}
.modal-close:hover { background: var(--err-cnt); color: var(--err); transform: rotate(90deg); }

.modal-body {
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.modal-body .form-group { margin-bottom: 0; }

.modal-body select,
.modal-body textarea,
.modal-body input {
  width: 100%;
  padding: .85rem 1rem;
  background: var(--s1);
  border: 2px solid transparent;
  border-radius: var(--r-lg);
  font-size: .93rem;
  font-family: var(--font);
  color: var(--on-s);
  outline: none;
  transition: all .22s;
}
.modal-body select:focus,
.modal-body textarea:focus,
.modal-body input:focus {
  border-color: var(--ac);
  background: var(--s0);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 12%, transparent);
}
.modal-body textarea { resize: vertical; min-height: 68px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--ac);
  height: 6px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--outl-v);
  background: var(--s1);
}

/* ══════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--outl-v) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--outl-v);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--outl); background-clip: content-box; }

/* ══════════════════════════════════════════
   PROFILE MODAL — usage bars
   ══════════════════════════════════════════ */
.profile-usage {
  background: var(--s1);
  border-radius: var(--r-lg);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  border: 1px solid var(--outl-v);
}
.usage-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: .6rem;
}
.usage-label { font-size: .8rem; font-weight: 600; color: var(--on-sv); }
.usage-bar-wrap {
  height: 8px;
  background: var(--s3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  background: var(--ac);
  border-radius: var(--r-full);
  transition: width .6s var(--spring);
}
.usage-bar-fill.warn   { background: var(--yellow, #F9AB00); }
.usage-bar-fill.danger { background: var(--red-hi, #EA4335); }
.usage-val { font-size: .72rem; color: var(--on-sv); white-space: nowrap; }

/* Profile quick actions (home + admin + logout) */
.profile-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .35rem;
  padding-top: .85rem;
  border-top: 1px solid var(--outl-v);
}
.profile-action {
  flex: 1;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .65rem .4rem;
  border-radius: var(--r-lg);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .22s var(--spring);
  min-height: 44px;
  white-space: nowrap;
}
.home-action {
  background: var(--s2);
  color: var(--on-sv);
  border: 1.5px solid var(--outl-v);
}
.home-action:hover { background: var(--s3); color: var(--on-s); border-color: var(--outl); }
.logout-action {
  background: color-mix(in srgb, var(--red-hi, #EA4335) 10%, transparent);
  color: var(--red-dk, #A50E0E);
  border: 1.5px solid color-mix(in srgb, var(--red-hi, #EA4335) 30%, transparent);
}
.logout-action:hover {
  background: var(--red-hi, #EA4335);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--e2);
}
.admin-action {
  background: color-mix(in srgb, var(--blue-hi, #4285F4) 10%, transparent);
  color: var(--blue-dk, #0B57D0);
  border: 1.5px solid color-mix(in srgb, var(--blue-hi, #4285F4) 30%, transparent);
  text-decoration: none;
}
.admin-action:hover {
  background: var(--blue-hi, #4285F4);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--e2);
}

/* Mobile header home logo (hidden on desktop) */
.mobile-home-logo {
  display: none;
  align-items: center;
  justify-content: center;
  padding: .3rem;
  border-radius: var(--r-md);
  flex-shrink: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .15s;
}
.mobile-home-logo:active { background: var(--s2); }

/* ══════════════════════════════════════════
   BOTTOM NAVIGATION (mobile only — hidden on ≥641px)
   ══════════════════════════════════════════ */
.bottom-nav {
  display: none;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { width: 72px; }
  .sidebar:hover { width: 72px; }
  .sidebar-header-text,
  .nav-section-label,
  .nav-label,
  .user-name,
  .btn-logout { opacity: 0 !important; }

  .content-header { padding: .85rem 1.1rem; min-height: 60px; }
  .content-header h2 { font-size: 1.2rem; }
  .chat-container, .chat-input-area { padding-left: 1rem; padding-right: 1rem; }
  .message { max-width: 90%; }
  .chat-hero h1 { font-size: 1.75rem; }
  .progress-container { padding: 1.1rem; }
  .progress-grid { grid-template-columns: 1fr; }
}

/* ── Phone: hide sidebar, show bottom nav ── */
@media (max-width: 640px) {
  /* Hide sidebar entirely */
  .sidebar { display: none !important; }

  /* App layout: full width, viewport-aware */
  .app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;                    /* base fallback */
    height: -webkit-fill-available;   /* old iOS Safari */
    height: 100dvh;                   /* modern — wins last */
  }

  .main-content {
    flex: 1;
    min-height: 0;                    /* critical: allows flex shrink on iOS */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* Chat page fills space */
  #chatPage {
    flex: 1;                          /* replaces height:100% */
    min-height: 0;                    /* critical: allows shrink */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-container {
    flex: 1;
    min-height: 0;                    /* critical: allows shrink so input stays visible */
    overflow-y: auto;
    padding: .75rem .85rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }

  /* Word wrap fix — prevents text overflow */
  .message-bubble {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  /* Bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    background: var(--s0);
    border-top: 1px solid var(--outl-v);
    z-index: 200;
    box-shadow: 0 -2px 16px rgba(0,0,0,.1);
    padding: 0 .15rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: stretch;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .3rem .2rem;
    border-radius: var(--r-lg);
    transition: background .15s, color .15s;
    color: var(--on-sv);
    font-family: var(--font);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .bottom-nav-item:active { background: var(--s2); transform: scale(.94); }
  .bottom-nav-item.active { color: var(--ac); }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 46px;
    height: 26px;
    background: var(--ac-tint);
    border-radius: var(--r-full);
    z-index: -1;
  }
  .bn-icon {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: inherit;
  }
  /* Profile initial in bottom nav */
  .bottom-nav-item:last-child .bn-icon {
    font-size: .8rem;
    font-weight: 700;
    background: var(--ac-tint);
    color: var(--ac);
    border-radius: var(--r-full);
    border: 1.5px solid var(--ac);
  }
  .bn-label {
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: .1px;
    margin-top: 1px;
  }

  /* Touch-friendly inputs and buttons */
  .chat-input { font-size: 16px; } /* prevent iOS zoom */
  .btn-send  { min-width: 46px; min-height: 46px; width: 46px; height: 46px; }
  .btn-mic   { min-width: 46px; min-height: 46px; width: 46px; height: 46px; }

  /* Chat input area compact + safe area */
  .chat-input-area {
    flex-shrink: 0;                   /* never compress — always visible */
    padding: .55rem .75rem;
    padding-bottom: max(.65rem, .65rem);
    gap: .5rem;
  }

  /* Mobile home logo */
  .mobile-home-logo { display: flex; }
  .mobile-home-logo svg { width: 24px; height: 24px; }

  /* Content header compact */
  .content-header {
    padding: .55rem .85rem;
    min-height: 50px;
    gap: .55rem;
  }
  .content-header h2 {
    font-size: 1rem;
    letter-spacing: -.2px;
  }
  .mode-badge { display: none; }
  .clear-btn { font-size: .78rem; padding: .38rem .8rem; }

  /* Messages full width */
  .message { max-width: 92%; }
  .message-bubble { font-size: .91rem; line-height: 1.6; padding: .75rem .95rem; }

  /* Speak button — always visible + bigger touch target */
  .speak-btn {
    opacity: 1 !important;
    min-height: 34px;
    padding: .35rem .75rem;
    font-size: .75rem;
    margin-top: .55rem;
  }

  /* Avatar smaller */
  .message-avatar { width: 30px; height: 30px; font-size: .75rem; }
  .message.assistant .message-avatar { width: 30px; height: 30px; }

  /* Chat hero compact */
  .chat-hero { padding: 1.25rem .85rem .75rem; gap: .65rem; }
  .hero-icon-wrap { width: 64px; height: 64px; margin-bottom: .75rem; }
  .hero-icon-wrap svg { width: 38px; height: 38px; }
  .chat-hero h1 { font-size: 1.4rem; margin-bottom: .35rem; }
  .chat-hero p { font-size: .86rem; line-height: 1.55; }
  .suggestion-chips { gap: .4rem; }
  .chip { padding: .5rem .85rem; font-size: .8rem; }

  /* Progress page */
  .progress-container { padding: .75rem; padding-bottom: 80px; }
  .progress-grid { grid-template-columns: 1fr; }

  /* Modal: bottom sheet style */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
    backdrop-filter: blur(6px);
  }
  .modal-card {
    max-width: 100%;
    max-height: 94dvh;
    max-height: 94vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* drag handle indicator */
    box-shadow: 0 -4px 32px rgba(0,0,0,.15);
  }
  .modal-card::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--outl-v);
    border-radius: var(--r-full);
    margin: .75rem auto .25rem;
  }
  .modal-header { border-radius: 0; }

  /* Auth page */
  .auth-card { padding: 2rem 1.25rem 1.75rem; }
  .auth-logo h1 { font-size: 1.85rem; }
  .auth-icon-wrap { width: 58px; height: 58px; }
  .auth-icon-wrap svg { width: 32px; height: 32px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 2rem 1.4rem 1.75rem; }
  .auth-logo h1 { font-size: 1.9rem; }
  .auth-icon-wrap { width: 60px; height: 60px; }
  .auth-icon-wrap svg { width: 34px; height: 34px; }
}
