/* MathMind AI — colorful tutor theme
   Matches the blue, purple, cyan, mint and gold palette of the login page. */
:root {
  color-scheme: light;
  --navy: #10175e;
  --navy-2: #1c287b;
  --blue: #087df5;
  --blue-deep: #246bff;
  --purple: #773cff;
  --purple-soft: #eee7ff;
  --cyan: #00c8e8;
  --cyan-soft: #e4fbff;
  --mint: #09c9a6;
  --mint-soft: #e4fff7;
  --gold: #ffc83d;
  --gold-soft: #fff7d9;
  --pink: #ff72bb;
  --ink: #182052;
  --muted: #68749c;
  --line: #dfe7ff;
  --paper: rgba(255, 255, 255, .88);
  --shadow: 0 18px 50px rgba(44, 69, 153, .13);
  --shadow-sm: 0 8px 22px rgba(44, 69, 153, .10);
  --radius-xl: 30px;
  --radius-lg: 23px;
  --radius-md: 17px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(0, 200, 232, .20), transparent 27rem),
    radial-gradient(circle at 93% 12%, rgba(119, 60, 255, .16), transparent 30rem),
    radial-gradient(circle at 85% 90%, rgba(9, 201, 166, .12), transparent 26rem),
    linear-gradient(135deg, #f0fbff 0%, #f8f5ff 52%, #eefaff 100%);
  overflow-x: hidden;
}
button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid rgba(0, 200, 232, .65);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
svg { display: block; width: 1.25rem; height: 1.25rem; }

/* Colorful sign-in screen (auth.js fills the card). */
.auth-screen {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: clamp(22px, 4vw, 48px) 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 200, 232, .24), transparent 22rem),
    radial-gradient(circle at 90% 10%, rgba(119, 60, 255, .20), transparent 26rem),
    linear-gradient(135deg, #ecfbff, #f5f0ff 56%, #e8fffb);
}
.auth-screen::before,
.auth-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}
.auth-screen::before {
  width: 260px; height: 260px; left: -95px; bottom: 7%;
  background: linear-gradient(135deg, rgba(0, 200, 232, .18), rgba(9, 201, 166, .13));
}
.auth-screen::after {
  width: 330px; height: 330px; right: -115px; top: 5%;
  background: linear-gradient(135deg, rgba(119, 60, 255, .13), rgba(255, 200, 61, .15));
}
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--navy); text-align: left;
}
.auth-brand-mark, .brand-mark {
  display: grid; place-items: center;
  flex: 0 0 auto;
  color: white;
  font-weight: 900;
  background: linear-gradient(140deg, var(--cyan), var(--blue) 48%, var(--purple));
  box-shadow: 0 10px 25px rgba(45, 106, 245, .26);
}
.auth-brand-mark { width: 60px; height: 60px; border-radius: 20px; font-size: 34px; }
.auth-brand strong { display: block; font-size: clamp(30px, 5vw, 43px); line-height: 1.05; letter-spacing: -1.6px; }
.auth-brand strong span, .brand-copy strong span { color: var(--blue); }
.auth-brand small, .brand-copy small {
  display: block; margin-top: 6px; color: var(--muted); font-size: 10px;
  letter-spacing: 2.2px; font-weight: 900;
}
.auth-card {
  width: min(480px, 100%);
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 22px 70px rgba(49, 70, 151, .17);
  backdrop-filter: blur(18px);
}
.auth-card h1, .auth-card h2 { margin: 0 0 8px; color: var(--navy); letter-spacing: -.7px; }
.auth-card p { color: var(--muted); line-height: 1.55; }
.auth-card label { display: block; margin: 16px 0 7px; color: var(--navy); font-size: 13px; font-weight: 800; }
.auth-card input:not([type="checkbox"]), .auth-card select {
  width: 100%; min-height: 49px; padding: 13px 15px;
  color: var(--ink); background: #fbfdff; border: 1.5px solid #d7e2ff;
  border-radius: 14px; outline: none; transition: border-color .18s, box-shadow .18s;
}
.auth-card input:focus, .auth-card select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(8, 125, 245, .11); }
.auth-card button, .auth-card [type="submit"] {
  cursor: pointer; border: 0; border-radius: 14px; padding: 14px 18px;
  color: white; font-weight: 850;
  background: linear-gradient(100deg, var(--cyan), var(--blue), var(--purple));
  box-shadow: 0 9px 22px rgba(36, 107, 255, .20); transition: transform .18s, filter .18s;
}
.auth-card button:hover, .auth-card [type="submit"]:hover { transform: translateY(-1px); filter: saturate(1.1); }
.auth-card form button, .auth-card form [type="submit"] { width: 100%; margin-top: 20px; }
.auth-card a { color: var(--blue); font-weight: 800; }
.auth-card .auth-tabs, .auth-card .tabs { display: flex; gap: 8px; padding: 5px; border-radius: 15px; background: #f0f4ff; }
.auth-card .auth-tabs button, .auth-card .tabs button { flex: 1; margin: 0; padding: 11px; color: var(--muted); background: transparent; box-shadow: none; }
.auth-card .auth-tabs button.active, .auth-card .tabs button.active { color: white; background: linear-gradient(110deg, var(--blue), var(--purple)); }
.auth-loading { text-align: center; color: var(--muted); padding: 28px 10px; }
.creator-credit { color: #7581aa; text-align: center; font-size: 12px; letter-spacing: .1px; }
.auth-credit { margin: 0; }

/* Main tutor workspace. */
.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
}
.sidebar {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 22px;
  height: 100vh; min-height: 640px; overflow-y: auto;
  padding: 25px 18px 20px;
  background: rgba(255, 255, 255, .82);
  border-right: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 8px 0 38px rgba(49, 70, 151, .06);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; color: var(--navy); }
.brand-mark { width: 51px; height: 51px; border-radius: 17px; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; white-space: nowrap; font-size: 24px; line-height: 1.05; letter-spacing: -1px; }
.brand-copy small { font-size: 9px; letter-spacing: 1.55px; }
.new-chat {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 49px;
  padding: 11px 14px; border: 0; border-radius: 16px; cursor: pointer;
  color: white; font-weight: 850; text-align: left;
  background: linear-gradient(105deg, var(--cyan), var(--blue) 54%, var(--purple));
  box-shadow: 0 9px 20px rgba(36, 107, 255, .18); transition: transform .18s, box-shadow .18s;
}
.new-chat:hover { transform: translateY(-2px); box-shadow: 0 13px 24px rgba(36, 107, 255, .23); }
.new-chat .plus { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 9px; background: rgba(255,255,255,.2); font-size: 20px; line-height: 1; }
.new-chat kbd { margin-left: auto; padding: 3px 7px; border: 1px solid rgba(255,255,255,.35); border-radius: 7px; color: rgba(255,255,255,.88); font: 10px ui-monospace, monospace; }
.side-label { margin: 2px 4px -10px; color: #8a94bb; font-size: 10px; font-weight: 900; letter-spacing: 1.7px; }
.topic-list { display: grid; gap: 8px; }
.topic-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 51px;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 15px;
  color: #344071; background: transparent; cursor: pointer; text-align: left; font-weight: 750;
  transition: background .18s, border-color .18s, transform .18s;
}
.topic-btn:hover { border-color: #dce6ff; background: #fff; transform: translateX(2px); }
.topic-icon, .suggestion-glyph {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 12px; font-size: 16px; font-weight: 900;
}
.lilac { color: #6830e8; background: #eee7ff; }
.blue { color: #086ed9; background: #e3f3ff; }
.amber { color: #a16b00; background: #fff3ca; }
.green { color: #078b73; background: #dcfff5; }
.pink { color: #d72d8a; background: #ffe6f3; }
.topic-chevron { margin-left: auto; color: #9ba6cd; font-size: 23px; font-weight: 500; }
.sidebar-spacer { flex: 1; min-height: 8px; }
.math-only-card {
  padding: 17px; border: 1px solid rgba(255,255,255,.95); border-radius: 19px;
  background: linear-gradient(145deg, #eefbff, #f1ebff 60%, #e5fff7);
  box-shadow: inset 0 1px 0 #fff;
}
.shield-icon { display: grid; place-items: center; width: 37px; height: 37px; margin-bottom: 10px; border-radius: 12px; color: white; background: linear-gradient(135deg, var(--mint), var(--blue)); }
.math-only-card strong { display: block; color: var(--navy); font-size: 14px; }
.math-only-card p { margin: 6px 0 0; color: #68749c; font-size: 12px; line-height: 1.55; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; color: #6e7a9f; font-size: 11px; font-weight: 700; }
.status-dot, .mode-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(9, 201, 166, .13); }
.sidebar-credit { text-align: left; margin-top: -12px; padding-left: 2px; font-size: 11px; }

.main-panel { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 18px; min-height: 89px;
  padding: 17px clamp(22px, 4vw, 56px);
  border-bottom: 1px solid rgba(255,255,255,.75);
  background: rgba(248, 250, 255, .74); backdrop-filter: blur(16px);
}
.topbar-title { display: flex; flex-direction: column; gap: 4px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 950; letter-spacing: 1.8px; }
.topbar-heading { color: var(--navy); font-size: 23px; font-weight: 900; letter-spacing: -.65px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.mode-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid #d8e9ff; border-radius: 999px; color: #4b5b91; background: rgba(255,255,255,.78); font-size: 11px; font-weight: 850; white-space: nowrap; }
.mode-dot { width: 7px; height: 7px; }
.account-btn, .install-btn, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 13px; border: 1px solid #e0e7ff; border-radius: 13px;
  color: #344071; background: rgba(255,255,255,.88); cursor: pointer; font-size: 12px; font-weight: 850;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.account-btn:hover, .install-btn:hover, .icon-button:hover { transform: translateY(-1px); border-color: #b7caff; box-shadow: var(--shadow-sm); }
.account-avatar { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 8px; color: white; background: linear-gradient(135deg, var(--cyan), var(--blue), var(--purple)); font-size: 11px; }
.install-btn { color: white; border: 0; background: linear-gradient(110deg, var(--mint), var(--blue)); }
.install-btn svg { width: 16px; height: 16px; }
.mobile-menu { display: none; width: 42px; height: 42px; padding: 10px; }
.mobile-menu svg { width: 20px; height: 20px; }

.workspace { display: flex; flex: 1; flex-direction: column; width: min(1050px, 100%); margin: 0 auto; padding: clamp(28px, 5vw, 62px) clamp(18px, 4vw, 48px) 22px; }
.welcome {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(24px, 4vw, 45px); border: 1px solid rgba(255,255,255,.96); border-radius: 32px;
  background: rgba(255,255,255,.78); box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.welcome::before { content: ""; position: absolute; z-index: -1; width: 340px; height: 340px; top: -210px; right: -60px; border-radius: 50%; background: radial-gradient(circle, rgba(0,200,232,.25), rgba(119,60,255,.08) 65%, transparent 70%); }
.welcome::after { content: ""; position: absolute; z-index: -1; width: 260px; height: 260px; bottom: -190px; left: -70px; border-radius: 50%; background: radial-gradient(circle, rgba(9,201,166,.19), transparent 70%); }
.welcome-orbit { position: absolute; z-index: -1; border: 1px solid rgba(119,60,255,.12); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 200px; height: 200px; right: 12%; top: -135px; }
.orbit-two { width: 300px; height: 300px; right: 6%; top: -180px; border-color: rgba(0,200,232,.12); }
.hero-symbol { display: flex; align-items: center; gap: 8px; margin-bottom: 25px; }
.hero-symbol span { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; color: white; font-size: 17px; font-weight: 900; box-shadow: 0 6px 13px rgba(45, 80, 180, .12); }
.hero-symbol span:nth-child(1) { background: linear-gradient(140deg, var(--blue), var(--purple)); }
.hero-symbol span:nth-child(2) { color: #125a9c; background: #c9f7ff; }
.hero-symbol span:nth-child(3) { color: #8b5a00; background: var(--gold); }
.hero-symbol span:nth-child(4) { color: #087f69; background: #caffef; }
.tiny-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 12px; padding: 7px 11px; border: 1px solid #dbe7ff; border-radius: 999px; color: #3860bb; background: #f4f7ff; font-size: 10px; font-weight: 950; letter-spacing: 1.2px; }
.sparkle { color: #ffb91f; font-size: 13px; }
.welcome h1 { max-width: 720px; margin: 0; color: var(--navy); font-size: clamp(36px, 5.2vw, 62px); line-height: 1.02; letter-spacing: -2.8px; }
.welcome h1 span { color: transparent; background: linear-gradient(100deg, var(--blue), var(--purple) 53%, #13adbd); -webkit-background-clip: text; background-clip: text; }
.hero-subtitle { max-width: 620px; margin: 18px 0 0; color: #647098; font-size: clamp(15px, 1.6vw, 17px); line-height: 1.7; }
.welcome-points { display: flex; flex-wrap: wrap; gap: 10px 17px; margin: 20px 0 32px; color: #4e5d8c; font-size: 12px; font-weight: 750; }
.welcome-points > span { display: inline-flex; align-items: center; gap: 6px; }
.check { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; color: #087f69; background: #d4fff0; font-size: 11px; font-weight: 950; }
.suggestion-heading { margin-bottom: 12px; color: #818bb0; font-size: 10px; font-weight: 950; letter-spacing: 1.6px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.suggestion {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 78px; padding: 12px;
  border: 1px solid #e3eaff; border-radius: 18px; color: var(--ink); background: rgba(255,255,255,.84);
  cursor: pointer; text-align: left; box-shadow: 0 4px 13px rgba(47, 73, 150, .04);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.suggestion:hover { transform: translateY(-3px); border-color: #c5d6ff; box-shadow: 0 12px 24px rgba(47, 73, 150, .10); }
.suggestion-glyph { width: 43px; height: 43px; border-radius: 14px; font-size: 16px; }
.suggestion > span:nth-child(2) { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.suggestion strong { color: var(--navy); font-size: 12px; font-weight: 900; }
.suggestion small { color: #8791b2; font-size: 11px; }
.suggestion-arrow { margin-left: auto; align-self: center; color: #9aa7cf; font-size: 18px; }

/* Chat and answer cards */
.chat-feed { display: flex; flex-direction: column; gap: 18px; width: 100%; padding: 6px 0 20px; }
.chat-message { display: flex; align-items: flex-start; gap: 12px; max-width: 100%; animation: message-in .22s ease-out both; }
@keyframes message-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 13px; color: white; background: linear-gradient(140deg, var(--blue), var(--purple)); box-shadow: 0 6px 16px rgba(60, 92, 200, .16); font-size: 12px; font-weight: 950; }
.chat-message.user .message-avatar { color: #4b3500; background: linear-gradient(140deg, #ffe986, var(--gold)); }
.message-body { min-width: 0; max-width: min(800px, calc(100% - 50px)); }
.message-name { display: flex; align-items: center; gap: 10px; margin: 0 0 7px; color: var(--navy); font-size: 10px; font-weight: 950; letter-spacing: .9px; }
.message-time { color: #9ba5c5; font-size: 10px; font-weight: 650; letter-spacing: 0; }
.message-text { padding: 17px 19px; border: 1px solid rgba(255,255,255,.95); border-radius: 6px 20px 20px 20px; color: #2e396f; background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.user .message-text { border-color: #d7e7ff; border-radius: 20px 6px 20px 20px; background: linear-gradient(145deg, #e4f6ff, #f1edff); }
.message-photo { display: block; max-width: min(100%, 390px); max-height: 300px; margin-top: 10px; border: 3px solid #fff; border-radius: 15px; box-shadow: var(--shadow-sm); object-fit: contain; }
.typing-dots { display: flex; align-items: center; gap: 5px; min-width: 75px; padding: 19px; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: typing-pulse 1s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .15s; background: var(--purple); }
.typing-dots span:nth-child(3) { animation-delay: .3s; background: var(--cyan); }
@keyframes typing-pulse { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Question composer */
.composer-wrap { position: sticky; bottom: 0; z-index: 4; width: min(1050px, 100%); margin: auto auto 0; padding: 14px clamp(18px, 4vw, 48px) 20px; background: linear-gradient(180deg, rgba(242,248,255,0), rgba(242,248,255,.92) 18%, rgba(242,248,255,.98)); }
.composer {
  padding: 9px 10px 10px 16px; border: 1.5px solid rgba(204, 218, 255, .95); border-radius: 23px;
  background: rgba(255,255,255,.96); box-shadow: 0 13px 35px rgba(55, 78, 160, .13); transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within { border-color: rgba(8, 125, 245, .65); box-shadow: 0 0 0 4px rgba(8, 125, 245, .08), 0 13px 35px rgba(55, 78, 160, .13); }
.composer textarea { display: block; width: 100%; min-height: 48px; max-height: 180px; resize: none; padding: 13px 8px; border: 0; outline: 0; color: var(--navy); background: transparent; font-size: 14px; line-height: 1.6; }
.composer textarea::placeholder { color: #a0a9c6; }
.composer textarea:focus-visible { outline: 0; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0 0; }
.composer-left { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: #8791b2; font-size: 11px; }
.tool-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid #e1e8ff; border-radius: 12px; color: #4d5b91; background: #f7f9ff; cursor: pointer; font-size: 11px; font-weight: 850; transition: background .18s, border-color .18s; }
.tool-button:hover { border-color: #b7caff; background: #eef4ff; }
.tool-button svg { width: 16px; height: 16px; color: var(--blue); }
.composer-divider { width: 1px; height: 21px; background: #e3e8f8; }
.hint-text { font-size: 11px; }
.send-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 100px; min-height: 42px; padding: 10px 16px; border: 0; border-radius: 14px; color: white; background: linear-gradient(105deg, var(--cyan), var(--blue) 55%, var(--purple)); box-shadow: 0 7px 17px rgba(36, 107, 255, .23); cursor: pointer; font-size: 12px; font-weight: 950; transition: transform .18s, box-shadow .18s, opacity .18s; }
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(36, 107, 255, .28); }
.send-btn:disabled { cursor: wait; opacity: .65; transform: none; }
.send-btn svg { width: 17px; height: 17px; }
.below-composer { display: flex; justify-content: space-between; gap: 12px; margin: 9px 4px 0; color: #8993b2; font-size: 10px; }
.attachment-preview { display: flex; align-items: center; gap: 11px; margin: 4px 4px 10px; padding: 9px; border: 1px solid #d7e8ff; border-radius: 15px; background: linear-gradient(105deg, #f2fbff, #f7f2ff); }
.attachment-preview img { width: 48px; height: 48px; border-radius: 10px; background: white; object-fit: cover; }
.attachment-preview > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.attachment-preview strong { overflow: hidden; max-width: min(400px, 65vw); color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview small { color: #078b73; font-size: 10px; font-weight: 800; }
.remove-image { display: grid; place-items: center; width: 32px; height: 32px; margin-left: auto; border: 0; border-radius: 10px; color: #b33d78; background: #ffe7f3; cursor: pointer; font-size: 21px; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 32px)); padding: 14px 17px; border: 1px solid #d5e3ff; border-radius: 15px; color: var(--navy); background: rgba(255,255,255,.96); box-shadow: 0 14px 40px rgba(38, 55, 120, .2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; font-size: 12px; line-height: 1.5; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 1500px) {
  .app-shell { grid-template-columns: 306px minmax(0, 1fr); }
  .sidebar { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .brand-copy strong { font-size: 21px; }
  .topbar { padding-right: 22px; padding-left: 22px; }
  .topbar-actions { gap: 7px; }
  .mode-chip { padding: 9px 10px; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; top: 0; left: 0; width: min(310px, 86vw); height: 100dvh; min-height: 0; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 15px 0 45px rgba(32, 45, 107, .18); }
  .sidebar.open { transform: translateX(0); }
  .main-panel { min-height: 100vh; }
  .mobile-menu { display: inline-flex; flex: 0 0 auto; }
  .topbar { min-height: 76px; gap: 12px; }
  .topbar-heading { font-size: 20px; }
  .mode-chip { display: none; }
  .workspace { padding-top: 27px; }
  .welcome { padding: clamp(22px, 5vw, 38px); }
  .welcome h1 { letter-spacing: -1.8px; }
  .composer-wrap { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .auth-screen { gap: 17px; padding: 24px 14px; }
  .auth-brand-mark { width: 51px; height: 51px; border-radius: 16px; font-size: 29px; }
  .auth-brand strong { font-size: 31px; }
  .auth-card { padding: 23px 19px; border-radius: 24px; }
  .topbar { padding: 13px 14px; min-height: 70px; }
  .topbar-heading { font-size: 17px; }
  .eyebrow { font-size: 8px; letter-spacing: 1.3px; }
  .topbar-actions { gap: 6px; }
  .account-btn { width: 39px; min-width: 39px; height: 39px; padding: 7px; overflow: hidden; gap: 0; font-size: 0; }
  .account-avatar { flex: 0 0 auto; }
  .install-btn { width: 39px; min-width: 39px; height: 39px; padding: 9px; }
  .install-btn span { display: none; }
  .workspace { padding: 18px 12px 14px; }
  .welcome { padding: 22px 16px 17px; border-radius: 24px; }
  .hero-symbol { margin-bottom: 19px; }
  .hero-symbol span { width: 34px; height: 34px; border-radius: 10px; }
  .welcome h1 { font-size: clamp(34px, 10vw, 48px); letter-spacing: -1.7px; }
  .hero-subtitle { margin-top: 12px; font-size: 14px; }
  .welcome-points { display: grid; gap: 8px; margin: 17px 0 25px; font-size: 11px; }
  .suggestions { grid-template-columns: 1fr; gap: 8px; }
  .suggestion { min-height: 68px; padding: 10px; }
  .suggestion-glyph { width: 39px; height: 39px; }
  .chat-feed { gap: 14px; }
  .chat-message { gap: 8px; }
  .message-avatar { width: 31px; height: 31px; border-radius: 11px; }
  .message-body { max-width: calc(100% - 39px); }
  .message-text { padding: 13px 14px; font-size: 13px; line-height: 1.7; }
  .composer-wrap { padding: 10px 10px max(12px, env(safe-area-inset-bottom)); }
  .composer { padding: 7px 7px 8px 11px; border-radius: 19px; }
  .composer textarea { min-height: 43px; padding: 10px 4px; font-size: 13px; }
  .composer-bottom { align-items: flex-end; }
  .composer-left { gap: 7px; }
  .tool-button { padding: 8px 9px; }
  .hint-text, .composer-divider { display: none; }
  .send-btn { min-width: 82px; min-height: 39px; padding: 9px 12px; }
  .below-composer { font-size: 9px; }
  .sidebar-credit { margin-top: -10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
