/* Cuss: design tokens ------------------------------------------------------- */
:root {
  --bg: #f6f6fb;
  --bg-2: #eef0f7;
  --panel: #ffffff;
  --panel-2: #f8f8fc;
  --text: #15151f;
  --muted: #6b6e83;
  --line: #e6e7ef;
  --accent: #6d5ef6;
  --accent-2: #a855f7;
  --accent-3: #ec4899;
  --accent-soft: rgb(109 94 246 / 10%);
  --grad: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #ec4899 100%);
  --danger: #e5484d;
  --warn: #f5a524;
  --ok: #12a150;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(20 20 40 / 5%), 0 8px 24px rgb(20 20 40 / 6%);
  --shadow-lg: 0 24px 60px rgb(20 20 40 / 18%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b14;
    --bg-2: #11111d;
    --panel: #14141f;
    --panel-2: #1a1a28;
    --text: #ececf4;
    --muted: #8d90a8;
    --line: #25253a;
    --accent: #8b7bff;
    --accent-soft: rgb(139 123 255 / 14%);
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 25%);
    --shadow-lg: 0 24px 80px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  /* Apple's San Francisco on Apple devices, Inter elsewhere. */
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  letter-spacing: -.005em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.ic { flex: none; }
kbd { font: 11.5px Inter, sans-serif; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--panel); }
::selection { background: rgb(168 85 247 / 30%); }

/* Generic controls -------------------------------------------------------------- */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel); transition: background .15s, transform .15s;
}
.icon-btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.badge {
  position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: var(--grad);
  color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 600; transition: transform .15s var(--ease), box-shadow .2s, opacity .2s;
  box-shadow: 0 6px 18px rgb(124 58 237 / 28%);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgb(124 58 237 / 35%); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 7px 13px; font-size: 13.5px; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent); box-shadow: none; }
.btn.danger-solid { background: var(--danger); box-shadow: 0 6px 18px rgb(229 72 77 / 30%); }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 500; transition: all .2s var(--ease);
}
.toggle[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgb(124 58 237 / 30%); }

/* Layout ------------------------------------------------------------------------ */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr) 340px; height: 100vh; height: 100dvh; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); padding: 16px 12px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 16px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 19px; box-shadow: 0 6px 16px rgb(124 58 237 / 35%); flex: none;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-sub { font-size: 12.5px; color: var(--muted); }
.new-chat {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  padding: 10px 12px; font-weight: 600; box-shadow: var(--shadow); transition: transform .15s var(--ease), border-color .2s;
}
.new-chat:hover { border-color: var(--accent); transform: translateY(-1px); }
.side-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 8px 6px; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.chat-item {
  display: flex; align-items: center; gap: 9px; border-radius: 10px; padding: 8px 9px; font-size: 14px; cursor: pointer;
  color: var(--muted); transition: background .15s, color .15s; animation: fadeIn .3s var(--ease) both;
}
.chat-item:hover { background: var(--panel); color: var(--text); }
.chat-item.active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.chat-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del { border: 0; background: none; color: var(--muted); opacity: 0; padding: 2px; border-radius: 6px; display: grid; }
.chat-item:hover .del { opacity: 1; }
.chat-item .del:hover { color: var(--danger); }
.empty-note { color: var(--muted); font-size: 13px; padding: 6px 9px; }
.side-foot { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 12px 6px 0; margin-top: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.who { flex: 1; min-width: 0; }
.who-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chat column */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(12px); z-index: 2;
}
.chat-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.demo-pill { font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; background: #fde68a; color: #7c4a03; }
.only-mobile, .only-narrow { display: none !important; }

.messages { flex: 1; overflow-y: auto; padding: 28px 20px 12px; scroll-behavior: smooth; }
.messages > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Welcome */
.welcome { text-align: center; padding: 6vh 0 24px; animation: fadeUp .6s var(--ease) both; }
.welcome h1 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; margin: 18px 0 8px; font-weight: 800; }
.welcome h1 .grad-text, .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-sub { color: var(--muted); margin: 0 auto 28px; max-width: 520px; font-size: 16px; }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; }
.suggestion {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; padding: 15px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
  animation: fadeUp .5s var(--ease) both;
}
.suggestion:nth-child(2) { animation-delay: .04s; } .suggestion:nth-child(3) { animation-delay: .08s; }
.suggestion:nth-child(4) { animation-delay: .12s; } .suggestion:nth-child(5) { animation-delay: .16s; } .suggestion:nth-child(6) { animation-delay: .2s; }
.suggestion:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--shadow-lg); }
.suggestion .ic { color: var(--accent); margin-bottom: 6px; width: 22px; height: 22px; }
.suggestion b { font-size: 14.5px; }
.suggestion span { font-size: 13px; color: var(--muted); }

/* Orb (assistant avatar + voice mode) */
.orb { position: relative; border-radius: 50%; background: var(--grad); box-shadow: 0 0 40px rgb(168 85 247 / 45%); }
.orb span { position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 85%), rgb(255 255 255 / 0) 60%); }
.orb::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgb(168 85 247 / 35%);
  animation: ring 3s ease-out infinite;
}
.small-orb { width: 64px; height: 64px; margin: 0 auto; animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes ring { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }

/* Messages */
.msg { display: flex; gap: 12px; margin: 14px auto; animation: fadeUp .35s var(--ease) both; }
.msg.user { justify-content: flex-end; }
.msg .av { width: 30px; height: 30px; flex: none; margin-top: 2px; }
.msg .av::after { display: none; }
.msg.bot + .msg.bot .av { visibility: hidden; }
.card:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.bubble { max-width: min(640px, 88%); overflow-wrap: anywhere; }
.msg.user .bubble {
  background: var(--grad); color: #fff; padding: 10px 16px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap;
  box-shadow: 0 6px 18px rgb(124 58 237 / 25%);
}
.msg.bot .bubble { padding: 4px 0; font-size: 15.5px; line-height: 1.65; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child, .bubble ul:last-child, .bubble ol:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 10px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble li::marker { color: var(--accent); }
.bubble h3 { margin: 14px 0 6px; font-size: 16px; }
.bubble strong { font-weight: 700; }
.bubble code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; font-size: 13.5px; }
.bubble a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.bubble.error-text { color: var(--danger); }
.msg-tools { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity .2s; }
.msg.bot:hover .msg-tools { opacity: 1; }
.msg-tools button { border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 4px 8px; border-radius: 8px; }
.msg-tools button:hover { background: var(--accent-soft); color: var(--text); }
.cursor::after { content: ""; display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Typing dots */
.typing { display: inline-flex; gap: 5px; padding: 12px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .4; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Agent steps */
.steps { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.step {
  display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); width: fit-content;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 7px; animation: fadeUp .3s var(--ease) both;
}
.step .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.step.running .dot { border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.step.done .dot { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.step.error .dot { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.step.done { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); margin: 16px auto;
  overflow: hidden; animation: pop .45s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.card-head .ic { color: var(--accent); }
.card-head h3 { margin: 0; font-size: 15px; flex: 1; }
.card-body { padding: 16px 18px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.card input, .card textarea, dialog input, dialog select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
  color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.card input:focus, .card textarea:focus, dialog input:focus, dialog select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }

/* Email card */
.mail-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mail-row .k { width: 64px; color: var(--muted); flex: none; }
.mail-row input { border: 0; background: transparent; padding: 4px 0; font-weight: 600; box-shadow: none !important; }
.recipient { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 999px; padding: 3px 10px 3px 4px; margin-right: 6px; font-weight: 500; }
.recipient .mini { width: 20px; height: 20px; font-size: 10px; }
.mail-body { margin-top: 12px; }
.mail-body textarea { min-height: 200px; resize: vertical; line-height: 1.6; background: var(--panel-2); }
.sent-note { display: inline-flex; align-items: center; gap: 7px; color: var(--ok); font-weight: 600; }

.quote { margin-top: 12px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 12px 12px 0; padding: 10px 12px; font-size: 13.5px; }
.quote-head { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.quote-head b { color: var(--text); }
.quote-body { white-space: pre-wrap; color: var(--muted); max-height: 140px; overflow-y: auto; }

/* Flashcards */
.fc-wrap { perspective: 1200px; }
.flashcard { height: 220px; cursor: pointer; user-select: none; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform .6s var(--ease); transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; display: grid; place-items: center;
  padding: 22px; text-align: center; font-size: 18px; font-weight: 600; overflow-y: auto; border: 1px solid var(--line); background: var(--panel-2);
}
.flashcard-face small { position: absolute; top: 12px; left: 16px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.flashcard-face.back { transform: rotateY(180deg); background: var(--grad); color: #fff; border: 0; font-weight: 500; }
.flashcard-face.back small { color: rgb(255 255 255 / 75%); }
.fc-progress { display: flex; gap: 5px; justify-content: center; margin-top: 14px; }
.fc-progress i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all .25s; }
.fc-progress i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.counter { color: var(--muted); font-size: 13px; margin-left: auto; }

/* Quiz */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 16px; }
.progress > div { height: 100%; background: var(--grad); transition: width .4s var(--ease); }
.quiz-q { font-weight: 700; font-size: 16.5px; margin-bottom: 14px; line-height: 1.4; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 9px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--panel-2); transition: all .18s var(--ease);
}
.choice .letter { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 13px; flex: none; }
.choice:hover:not(:disabled) { border-color: var(--accent); transform: translateX(3px); }
.choice:disabled { cursor: default; }
.choice.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.choice.correct .letter { background: var(--ok); color: #fff; border-color: var(--ok); }
.choice.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); animation: shake .35s; }
.choice.wrong .letter { background: var(--danger); color: #fff; border-color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.explain { font-size: 14px; color: var(--muted); margin: 6px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); animation: fadeUp .3s var(--ease) both; }
.score { text-align: center; padding: 10px 0; }
.score-num { font-size: 44px; font-weight: 800; letter-spacing: -.02em; }
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; border-radius: 2px; z-index: 100; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* Composer */
.composer-wrap { padding: 8px 20px calc(14px + env(safe-area-inset-bottom)); }
.composer {
  display: flex; gap: 6px; align-items: flex-end; max-width: 760px; margin: 0 auto; padding: 7px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg); transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-soft); }
.composer textarea { flex: 1; resize: none; max-height: 180px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15.5px; padding: 9px 6px; outline: none; }
.comp-btn { width: 40px; height: 40px; border-radius: 14px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; transition: all .15s; }
.comp-btn:hover { background: var(--accent-soft); color: var(--accent); }
.comp-btn.listening { background: var(--danger); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(229 72 77 / 45%); } 100% { box-shadow: 0 0 0 14px rgb(229 72 77 / 0%); } }
.send { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; transition: transform .15s, opacity .2s; }
.send:hover { transform: scale(1.06); }
.send:disabled { opacity: .45; transform: none; }
.composer-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }
.composer-hint.live { color: var(--danger); font-weight: 600; }

/* Today panel */
.today { background: var(--bg-2); border-left: 1px solid var(--line); padding: 18px 16px; overflow-y: auto; }
.today-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.today-title { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.today-date { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 11px 10px; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stat.warn .stat-num { color: var(--danger); }
.stat.good .stat-num { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 11.5px; color: var(--muted); }
.panel-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 2px 8px; }
.deadlines, .courses { list-style: none; margin: 0; padding: 0; }
.deadline {
  display: flex; gap: 11px; padding: 11px 12px; border-radius: 14px; margin-bottom: 7px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); transition: transform .15s var(--ease), border-color .2s; animation: fadeUp .4s var(--ease) both;
}
.deadline:hover { transform: translateX(2px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.deadline .bar { width: 4px; border-radius: 4px; background: var(--line); flex: none; }
.deadline.urgent .bar { background: var(--danger); } .deadline.soon .bar { background: var(--warn); } .deadline.later .bar { background: var(--accent); }
.deadline .info { flex: 1; min-width: 0; }
.deadline .title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.deadline .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.when { font-size: 12px; font-weight: 700; white-space: nowrap; padding: 2px 8px; border-radius: 999px; height: fit-content; background: var(--accent-soft); color: var(--accent); }
.deadline.urgent .when { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.deadline.soon .when { background: color-mix(in srgb, var(--warn) 18%, transparent); color: #b7791f; }
.deadline.done { opacity: .5; }
.deadline.done .when { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.missing { background: color-mix(in srgb, var(--danger) 9%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); border-radius: 14px; padding: 10px 12px; margin-bottom: 9px; font-size: 13.5px; }
.missing summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 7px; }
.missing ul { margin: 6px 0 0; padding-left: 20px; }
.missing a { color: inherit; }
.course { padding: 9px 2px; }
.course-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 500; }
.course-top .g { font-weight: 700; }
.gbar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.gbar > div { height: 100%; background: var(--grad); border-radius: 3px; transition: width 1s var(--ease); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--grad); color: #fff; font-size: 10.5px; letter-spacing: 0; margin-left: 4px; vertical-align: 1px; }
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox-item {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; margin-bottom: 7px; cursor: pointer; background: var(--panel);
  border: 1px solid var(--line); transition: transform .15s var(--ease), border-color .2s; animation: fadeUp .4s var(--ease) both;
}
.inbox-item:hover { transform: translateX(2px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.inbox-item .avatar.mini, .recipient .avatar.mini { width: 28px; height: 28px; font-size: 11px; }
.recipient .avatar.mini { width: 20px; height: 20px; font-size: 10px; }
.inbox-item .info { flex: 1; min-width: 0; }
.inbox-item .from { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.dot-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); }
.inbox-item .subj { font-size: 13px; }
.inbox-item .snip { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 500; }
.impact-row { display: flex; flex-wrap: wrap; gap: 6px; }
.impact-chip { font-size: 12.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.impact-chip b { color: var(--text); }
.notify-box { margin-top: 20px; background: var(--grad); color: #fff; padding: 14px; border-radius: 16px; font-size: 13.5px; }
.notify-box p { margin: 4px 0 10px; opacity: .9; }
.notify-box .btn { background: #fff; color: #6d28d9; box-shadow: none; }
.skeleton { height: 58px; border-radius: 14px; margin-bottom: 7px; background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skeleton.short { height: 34px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Voice overlay */
.voice-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px;
  background: radial-gradient(ellipse at center, rgb(40 20 80 / 92%), rgb(8 8 16 / 97%)); color: #fff; backdrop-filter: blur(14px);
  animation: fadeIn .35s var(--ease) both;
}
.voice-close { position: absolute; top: 18px; right: 18px; color: rgb(255 255 255 / 70%); }
.big-orb { width: 190px; height: 190px; transition: transform .3s var(--ease); }
.big-orb::before { content: ""; position: absolute; inset: -30px; border-radius: 50%; background: var(--grad); filter: blur(40px); opacity: .45; z-index: -1; }
.voice-overlay.listening .big-orb { animation: breathe 1.6s ease-in-out infinite; }
.voice-overlay.thinking .big-orb { animation: spinOrb 2.4s linear infinite; }
.voice-overlay.speaking .big-orb { animation: talk .5s ease-in-out infinite alternate; }
@keyframes breathe { 50% { transform: scale(1.08); } }
@keyframes spinOrb { to { transform: rotate(360deg); } }
@keyframes talk { from { transform: scale(1); } to { transform: scale(1.13); } }
.voice-state { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.voice-caption { max-width: 640px; text-align: center; font-size: 17px; line-height: 1.55; color: rgb(255 255 255 / 75%); min-height: 54px; }
.voice-actions { display: flex; gap: 10px; }
.voice-overlay .btn.ghost { color: #fff; border-color: rgb(255 255 255 / 25%); }

/* Settings dialog */
dialog {
  border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop .3s var(--ease) both; }
dialog::backdrop { background: rgb(8 8 16 / 55%); backdrop-filter: blur(4px); }
dialog form { padding: 22px 24px; max-height: 86vh; overflow-y: auto; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
dialog h2 { margin: 0; font-size: 20px; }
dialog label { display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 4px; }
dialog label input, dialog label select { margin-top: 6px; font-weight: 400; }
.account-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px; border-radius: 14px; background: var(--panel-2); }
.account-row span { flex: 1; font-size: 14px; }
.settings-sub { margin: 22px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
dialog label.switch-row { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 10px 0; }
dialog label.switch-row input { appearance: none; width: 40px; height: 23px; border-radius: 999px; background: var(--line); position: relative; flex: none; margin: 2px 0 0; padding: 0; cursor: pointer; transition: background .2s; border: 0; }
dialog label.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
dialog label.switch-row input:checked { background: var(--accent); }
dialog label.switch-row input:checked::after { transform: translateX(17px); }
dialog label.switch-row small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }
.inline-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-row label { flex: 1; min-width: 180px; }
.memory-list { list-style: none; padding: 0; margin: 8px 0; font-size: 14px; }
.memory-list li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); margin-bottom: 6px; }
.memory-list li span { flex: 1; }
.memory-list button { border: 0; background: none; color: var(--muted); display: grid; }
.memory-add { display: flex; gap: 8px; }
.memory-add input { flex: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.form-error { color: var(--danger); font-size: 14px; margin: 12px 0 0; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 70; max-width: calc(100vw - 40px); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
  box-shadow: var(--shadow-lg); width: 340px; max-width: 100%; font-size: 13.5px; animation: slideIn .35s var(--ease) both;
}
.toast .ti { width: 30px; height: 30px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.toast b { display: block; font-size: 14px; }
.toast span { color: var(--muted); }
.toast.out { animation: slideOut .3s var(--ease) forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.scrim { display: none; }
/* Accessibility: visible keyboard focus and a skip link */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.composer textarea:focus-visible { outline: none; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--panel); color: var(--text); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); }
.skip-link:focus { top: 12px; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 0; }
.tabbar { display: none; }

/* Responsive */
@media (max-width: 1180px) {
  .app { grid-template-columns: 248px minmax(0, 1fr); }
  .only-narrow { display: inline-grid !important; }
  .today { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 40; transform: translateX(100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  .today.open { transform: none; }
}
@media (max-width: 760px) {
  /* iOS-style app shell: frosted header, bottom tab bar, full-screen panels, sheets */
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .chat-head { padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .chat-title { text-align: center; font-size: 16px; }
  #menuBtn, #todayBtn, #voiceModeBtn { display: none !important; }
  .composer-wrap { padding-bottom: calc(var(--tabbar-h) + 8px) !important; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: var(--tabbar-h); padding: 6px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-top: .5px solid var(--line);
  }
  .tabbar button {
    flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; border: 0; background: none;
    color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .01em; padding-top: 3px; -webkit-tap-highlight-color: transparent; transition: color .15s;
  }
  .tabbar button.active { color: var(--accent); }
  .tabbar button:active { transform: scale(.94); }
  .tabbar .badge { top: 0; right: calc(50% - 22px); }
  .tab-talk .talk-orb { width: 30px; height: 30px; margin-top: -2px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgb(168 85 247 / 45%); }
  .tab-talk .talk-orb svg { width: 18px; height: 18px; }
  .sidebar, .today {
    position: fixed; top: 0; left: 0; right: 0; bottom: var(--tabbar-h); width: auto !important; z-index: 40; transform: none; opacity: 0; pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease); padding-top: calc(16px + env(safe-area-inset-top)); box-shadow: none; border: 0;
  }
  .sidebar { transform: translateX(-12px); }
  .today { transform: translateX(12px); background: var(--bg); }
  .sidebar.open, .today.open { opacity: 1; transform: none; pointer-events: auto; }
  .today-title { font-size: 32px; letter-spacing: -.02em; }
  .side-foot { padding-bottom: 8px; }
  .scrim.show { display: none; }
  dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 22px 22px 0 0; border-bottom: 0; }
  dialog[open] { animation: sheetUp .35s var(--ease) both; }
  dialog form { max-height: 88vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  dialog form::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: -10px auto 14px; }
  .voice-overlay { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .only-mobile { display: inline-grid !important; }

  .toggle span { display: none; }
  .suggestions { grid-template-columns: repeat(2, 1fr); }
  .chat-head { padding: 10px 12px; }
  .messages { padding: 18px 14px 8px; }
  .composer-wrap { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .welcome { padding-top: 3vh; }
  .toasts { right: 12px; left: 12px; bottom: 90px; }
  .toast { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Login / landing page ------------------------------------------------------------- */
body.login-page { overflow: auto; }
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 48px; padding: 48px clamp(20px, 6vw, 96px); position: relative; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; z-index: -1; animation: drift 14s ease-in-out infinite alternate; }
.blob.b1 { width: 520px; height: 520px; background: #6366f1; top: -160px; left: -120px; }
.blob.b2 { width: 460px; height: 460px; background: #ec4899; bottom: -180px; right: -100px; animation-delay: -5s; }
.blob.b3 { width: 340px; height: 340px; background: #a855f7; top: 40%; left: 38%; opacity: .25; animation-delay: -9s; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.1); } }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.hero h1 { font-size: clamp(38px, 5.4vw, 64px); line-height: 1.04; letter-spacing: -.035em; margin: 18px 0 16px; font-weight: 800; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 540px; margin: 0 0 28px; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; }
.feature { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 75%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); animation: fadeUp .6s var(--ease) both; }
.feature:nth-child(2) { animation-delay: .08s; } .feature:nth-child(3) { animation-delay: .16s; } .feature:nth-child(4) { animation-delay: .24s; }
.feature .fi { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.feature b { display: block; font-size: 14.5px; }
.feature span { font-size: 13px; color: var(--muted); }
.login-card {
  width: min(430px, 100%); justify-self: center; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: 26px;
  box-shadow: var(--shadow-lg); padding: 34px 30px; text-align: center; backdrop-filter: blur(16px); animation: pop .6s var(--ease) both;
}
.logo-img { width: 38px; height: 38px; border-radius: 11px; flex: none; display: block; box-shadow: 0 6px 16px rgb(124 58 237 / 35%); }
.logo-img.big { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px; }
.logo.big { width: 64px; height: 64px; border-radius: 20px; font-size: 32px; margin: 0 auto 16px; }
.login-card h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.login-card .tagline { color: var(--muted); margin: 6px 0 24px; font-size: 14.5px; }
.sso-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--grad); color: #fff; text-decoration: none; font-weight: 700;
  font-size: 16px; padding: 14px 18px; border-radius: 14px; box-shadow: 0 10px 26px rgb(124 58 237 / 35%); transition: transform .15s var(--ease);
}
.sso-btn:hover { transform: translateY(-2px); }
.demo-btn {
  display: flex; align-items: center; gap: 12px; text-align: left; margin: 12px 0 0; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; background: var(--panel); transition: transform .15s var(--ease), border-color .2s;
}
.demo-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.demo-btn .play { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.demo-btn b { display: block; }
.demo-btn b + span { display: block; font-size: 13px; color: var(--muted); }
.demo-btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 10px 26px rgb(124 58 237 / 35%); }
.demo-btn.primary b + span { color: rgb(255 255 255 / 85%); }
.demo-btn.primary .play { background: rgb(255 255 255 / 22%); }
.fine { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.notice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 13.5px; text-align: left; margin-top: 14px; color: var(--muted); }
.notice b { color: var(--text); }
.token-login { margin-top: 16px; text-align: left; font-size: 13.5px; }
.token-login summary { cursor: pointer; color: var(--muted); }
.token-login form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.token-login input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--text); font: inherit; }
.login-foot { margin-top: 22px; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; padding-top: 32px; gap: 28px; }
  .hero { text-align: center; }
  .feature { text-align: left; }
  .login-card { order: -1; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .features { margin: 0 auto; }
}
@media (max-width: 520px) { .features { grid-template-columns: 1fr; } }

/* ==========================================================================
   Apple design language (overrides the earlier theme)
   Light: #f5f5f7 / white / #1d1d1f with Apple blue. Dark: black / #1c1c1e.
   ========================================================================== */
:root {
  --bg: #f5f5f7;
  --bg-2: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --bubble: #0a84ff;
  --danger: #e3261c;
  --warn: #c76e00;
  --ok: #248a3d;
  --grad: #0071e3;
  /* Apple Intelligence-style glow, used only for the orb and highlights */
  --brand: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 35%, #bf5af2 62%, #ff375f 84%, #ff9f0a 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 18px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #000000;
    --panel: #1c1c1e;
    --panel-2: #2c2c2e;
    --text: #f5f5f7;
    --muted: #98989d;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --danger: #ff453a;
    --warn: #ff9f0a;
    --ok: #30d158;
    --grad: #0a84ff;
    --shadow: none;
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif; font-size: 15px; letter-spacing: -0.01em; }
h1, h2, h3, .today-title, .brand-name, .welcome h1, .score-num, .stat-num { font-family: var(--display); }
::selection { background: rgba(0, 113, 227, 0.25); }

/* Buttons: Apple pills */
.btn { background: var(--accent); box-shadow: none; border-radius: 980px; font-weight: 500; padding: 10px 20px; }
.btn:hover { background: var(--accent-hover); box-shadow: none; transform: none; }
.btn.small { border-radius: 980px; padding: 7px 15px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { border-radius: 980px; }
.btn.danger-solid { background: var(--danger); box-shadow: none; }
.toggle { border-radius: 980px; font-weight: 500; }
.toggle[aria-pressed="true"] { background: var(--accent); box-shadow: none; }
.icon-btn { border-radius: 50%; }
.icon-btn:hover { background: var(--panel-2); }
.link-btn { color: var(--accent); }

/* Shell */
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); }
.logo-img { box-shadow: none; border-radius: 10px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.new-chat { border-radius: 12px; box-shadow: none; background: var(--panel); border: 1px solid var(--line); font-weight: 500; }
.new-chat:hover { transform: none; border-color: var(--line); background: var(--panel-2); }
.chat-item { border-radius: 10px; }
.chat-item:hover { background: rgba(0, 0, 0, 0.05); }
.chat-item.active { background: var(--panel); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) {
  .chat-item:hover { background: rgba(255, 255, 255, 0.07); }
  .chat-item.active { background: var(--panel); }
}
.avatar { background: linear-gradient(180deg, #a1a1a6, #8e8e93); }
.chat { background: var(--panel); }
.chat-head { background: rgba(255, 255, 255, 0.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .chat-head { background: rgba(28, 28, 30, 0.72); } .chat { background: var(--bg); } }
.today { background: var(--bg-2); border-left: 1px solid var(--line); }
.demo-pill { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

/* Welcome */
.orb { background: var(--brand); box-shadow: 0 0 46px rgba(94, 92, 230, 0.35); }
.orb::after { border-color: rgba(94, 92, 230, 0.25); }
.grad-text, .welcome h1 .grad-text { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome h1 { font-weight: 700; letter-spacing: -0.03em; font-size: clamp(32px, 4vw, 48px); }
.welcome-sub { font-size: 17px; line-height: 1.5; }
.suggestion { background: var(--panel-2); border: 0; box-shadow: none; border-radius: 18px; padding: 18px; }
.suggestion:hover { transform: scale(1.015); box-shadow: none; border-color: transparent; background: var(--panel-2); }
.suggestion .ic { color: var(--accent); }
.suggestion b { font-size: 15px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .suggestion, .suggestion:hover { background: var(--panel); } }

/* Messages */
.msg.user .bubble { background: var(--bubble); box-shadow: none; border-radius: 20px 20px 6px 20px; }
.bubble li::marker { color: var(--muted); }
.cursor::after { background: var(--accent); }
.typing i { background: var(--muted); }
.step { background: var(--panel-2); border: 0; }
.step.running .dot { border-top-color: var(--accent); }
.msg-tools button:hover { background: var(--panel-2); }

/* Cards */
.card { border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-head { background: var(--panel); }
.card-head .ic { color: var(--accent); }
.chip { background: var(--panel-2); color: var(--muted); }
.chip.ok { background: rgba(52, 199, 89, 0.14); color: var(--ok); }
.recipient { background: var(--panel-2); }
.flashcard-face { background: var(--panel-2); border: 0; }
.flashcard-face.back { background: var(--accent); }
.fc-progress i.on { background: var(--accent); }
.progress > div, .gbar > div { background: var(--accent); }
.choice { background: var(--panel); }
.choice .letter { border-radius: 50%; }
.score-num.grad-text { background: var(--brand); -webkit-background-clip: text; background-clip: text; }
.confetti { border-radius: 50%; }

/* Composer */
.composer { border-radius: 26px; box-shadow: var(--shadow); background: var(--panel); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.send { background: var(--accent); border-radius: 50%; }
.send:hover { transform: none; background: var(--accent-hover); }
.comp-btn { border-radius: 50%; }
.comp-btn:hover { background: var(--panel-2); color: var(--accent); }
@media (prefers-color-scheme: dark) { .composer { background: var(--panel); } }

/* Today */
.today-title { font-weight: 700; letter-spacing: -0.02em; }
.stat { box-shadow: none; border: 0; border-radius: 16px; }
.stat.good .stat-num { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--accent); }
.deadline, .inbox-item { border: 0; box-shadow: none; border-radius: 14px; }
.deadline:hover, .inbox-item:hover { transform: none; background: var(--panel); filter: brightness(0.98); }
.missing { border-radius: 14px; }
.count { background: var(--accent); }
.dot-unread { background: var(--accent); }
.impact-chip { border: 0; }
.notify-box { background: var(--accent); border-radius: 18px; }
.notify-box .btn { color: var(--accent); }
.cal-link { color: var(--accent); }

/* Toasts, dialogs, voice */
.toast { border-radius: 18px; background: rgba(255, 255, 255, 0.8); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); }
.toast .ti { background: var(--accent); border-radius: 50%; }
@media (prefers-color-scheme: dark) { .toast { background: rgba(44, 44, 46, 0.8); } }
dialog { border-radius: 20px; }
dialog label.switch-row input:checked { background: #34c759; }
.voice-overlay { background: radial-gradient(ellipse at center, rgba(28, 28, 30, 0.94), rgba(0, 0, 0, 0.98)); }
.big-orb::before { background: var(--brand); }

/* Phone tab bar */
@media (max-width: 760px) {
  .tabbar { background: rgba(249, 249, 249, 0.82); }
  .tab-talk .talk-orb { background: var(--brand); box-shadow: 0 4px 14px rgba(94, 92, 230, 0.4); }
  .chat-head { background: rgba(255, 255, 255, 0.72); }
}
@media (max-width: 760px) and (prefers-color-scheme: dark) {
  .tabbar { background: rgba(22, 22, 23, 0.82); }
  .chat-head { background: rgba(0, 0, 0, 0.72); }
}

/* ==========================================================================
   Website (landing page) in the style of apple.com. Always light, like apple.com.
   ========================================================================== */
body.site {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f5f5f7; --text: #1d1d1f; --muted: #6e6e73; --line: rgba(0, 0, 0, 0.1);
  --accent: #0071e3; --accent-hover: #0077ed; --accent-soft: rgba(0, 113, 227, 0.1);
  color-scheme: light; background: #ffffff; color: #1d1d1f; overflow: auto; font-size: 17px; letter-spacing: -0.022em;
}
.gnav { position: sticky; top: 0; z-index: 50; background: rgba(251, 251, 253, 0.8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.gnav-in { max-width: 1024px; margin: 0 auto; height: 48px; padding: 0 22px; display: flex; align-items: center; gap: 28px; font-size: 13px; }
.gbrand { display: flex; align-items: center; gap: 8px; color: #1d1d1f; text-decoration: none; font-weight: 600; font-size: 15px; }
.glinks { flex: 1; display: flex; justify-content: center; gap: 32px; }
.glinks a, .gsign { color: rgba(0, 0, 0, 0.8); text-decoration: none; }
.glinks a:hover, .gsign:hover { color: #000; }
.gsign { color: var(--accent); }
.hero { text-align: center; padding: 72px 22px 0; max-width: 1100px; margin: 0 auto; }
.hero-icon { width: 96px; height: 96px; border-radius: 22px; display: block; margin: 0 auto 20px; }
.eyebrow-apple { font-size: 21px; font-weight: 600; color: #1d1d1f; margin: 0 0 6px; letter-spacing: 0.01em; }
.hero h1 { font-family: var(--display); font-size: clamp(48px, 8vw, 96px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 700; margin: 0 0 18px; }
.hero .sub { font-size: clamp(19px, 2.2vw, 24px); line-height: 1.4; color: #6e6e73; max-width: 760px; margin: 0 auto 30px; font-weight: 500; letter-spacing: -0.02em; }
.ctas { display: flex; gap: 22px; justify-content: center; align-items: center; flex-wrap: wrap; }
.pill { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; font-size: 17px; padding: 12px 24px; border-radius: 980px; transition: background 0.2s; }
.pill:hover { background: var(--accent-hover); }
.pill.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.textlink { color: var(--accent); text-decoration: none; font-size: 17px; }
.textlink:hover { text-decoration: underline; }
.textlink.light { color: #2997ff; font-size: 21px; }
.site .notice { max-width: 520px; margin: 22px auto 0; background: #f5f5f7; border: 0; border-radius: 14px; text-align: center; color: #6e6e73; font-size: 14px; }
.site .form-error { text-align: center; }
.site .token-login { max-width: 420px; margin: 16px auto 0; font-size: 14px; }
.hero-shot { margin: 56px auto 0; max-width: 1040px; }
.hero-shot img { width: 100%; height: auto; display: block; border-radius: 18px 18px 0 0; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06); }
.tiles-wrap { background: #f5f5f7; padding: 100px 22px 90px; }
.section-title { font-family: var(--display); text-align: center; font-size: clamp(36px, 5vw, 56px); line-height: 1.07; letter-spacing: -0.035em; font-weight: 700; margin: 0 0 56px; }
.tiles { max-width: 1024px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { background: #ffffff; border-radius: 28px; padding: 36px 32px; min-height: 260px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; transition: transform 0.4s var(--ease); }
.tile:hover { transform: scale(1.012); }
.tile .ic { color: var(--accent); margin-bottom: auto; }
.tile h3 { font-family: var(--display); font-size: 28px; line-height: 1.12; letter-spacing: -0.025em; margin: 0; font-weight: 700; }
.tile p { margin: 0; color: #6e6e73; font-size: 17px; line-height: 1.45; }
.tile.wide { grid-column: span 2; }
.tile.dark { background: #000; color: #f5f5f7; }
.tile.dark p { color: #a1a1a6; }
.tile-orb { width: 72px; height: 72px; margin-bottom: auto; }
.for-who { text-align: center; color: #6e6e73; max-width: 680px; margin: 48px auto 0; font-size: 19px; line-height: 1.5; }
.profs { background: #000; color: #f5f5f7; text-align: center; padding: 110px 22px; }
.profs .eyebrow-apple { color: #f5f5f7; }
.profs h2 { font-family: var(--display); font-size: clamp(40px, 6vw, 72px); letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 18px; font-weight: 700; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.profs p { color: #a1a1a6; font-size: clamp(19px, 2vw, 24px); max-width: 720px; margin: 0 auto 26px; line-height: 1.4; font-weight: 500; }
.gfoot { background: #f5f5f7; color: #6e6e73; font-size: 12px; padding: 22px; text-align: center; border-top: 1px solid rgba(0, 0, 0, 0.08); }
.gfoot p { margin: 6px 0; }
.gfoot a { color: #424245; }
@media (max-width: 760px) {
  .glinks { display: none; }
  .gnav-in { justify-content: space-between; }
  .hero { padding-top: 48px; }
  .tiles { grid-template-columns: 1fr; }
  .tile.wide { grid-column: auto; }
  .tile { min-height: 200px; }
  .hero-shot { margin-top: 40px; }
}
.skip-link { box-shadow: none; top: -120px; }
.skip-link:focus { box-shadow: var(--shadow-lg); top: 12px; }
.tile.full { grid-column: 1 / -1; min-height: 200px; }

/* 3D app icon: layered shadow, and a gentle tilt toward the pointer */
.hero-icon {
  width: 128px; height: 128px; border-radius: 29px; margin-bottom: 24px;
  filter: drop-shadow(0 2px 2px rgb(46 10 92 / 18%)) drop-shadow(0 14px 22px rgb(124 58 237 / 30%)) drop-shadow(0 30px 50px rgb(236 72 153 / 18%));
  transform: perspective(700px) rotateX(8deg);
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.hero-icon:hover { transform: perspective(700px) rotateX(0deg) rotateY(-10deg) translateY(-4px) scale(1.04); }
.gbrand img { width: 26px; height: 26px; filter: drop-shadow(0 2px 3px rgb(124 58 237 / 35%)); }
@media (prefers-reduced-motion: reduce) { .hero-icon, .hero-icon:hover { transform: none; transition: none; } }

/* ---------- Class library ---------- */
.cal-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
button.cal-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; }
.cal-link.subtle { color: var(--muted); font-weight: 400; }
.label-hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .8; margin-left: 4px; }
.course.clickable { cursor: pointer; border-radius: 12px; padding: 9px 8px; margin: 0 -6px; transition: background .15s; }
.course.clickable:hover, .course.clickable:focus-visible { background: var(--accent-soft); outline: none; }
.course .chev { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--muted); }

dialog.class-sheet { width: min(720px, calc(100vw - 24px)); }
.sheet-inner { padding: 22px 24px 26px; max-height: 88vh; overflow-y: auto; }
.sheet-kicker { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.meets { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 16px 0 14px; padding: 12px 14px; border-radius: 16px; background: var(--panel-2); }
.meets-label { font-size: 13px; font-weight: 600; }
.day-chips { display: flex; gap: 6px; }
.day-chip { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, transform .1s; }
.day-chip:active { transform: scale(.94); }
.day-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.next-class { font-size: 13px; color: var(--muted); margin-left: auto; }
.lib-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.lib-actions .ic, .lib-actions-panel .ic { vertical-align: -3px; margin-right: 5px; }
.lib-upload { cursor: pointer; display: inline-flex; align-items: center; margin: 0; }
.lib-editor { padding: 14px; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; display: grid; gap: 10px; background: var(--panel); }
.lib-editor textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.lib-editor-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.lib-editor-row label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.lib-editor-row select, .lib-editor-row input[type="date"] { width: auto; padding: 7px 10px; margin: 0; }
.spacer { flex: 1; }
.lib-group { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 2px 8px; }
.lib-item { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); margin-bottom: 8px; transition: border-color .2s, box-shadow .2s; animation: fadeUp .3s var(--ease) both; }
.lib-item.open { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 8px 24px rgb(0 0 0 / 6%); }
.lib-item.done .lib-title { text-decoration: line-through; color: var(--muted); }
.lib-main { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.lib-check { width: 22px; height: 22px; flex: none; accent-color: var(--accent); cursor: pointer; margin: 0; }
.lib-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lib-kind { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.lib-kind.k-canvas { background: color-mix(in srgb, #e66000 14%, transparent); color: #c2410c; }
.lib-kind.k-note { background: color-mix(in srgb, #f5b400 20%, transparent); color: #a16207; }
.lib-kind.k-task { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.lib-text { display: flex; flex-direction: column; min-width: 0; }
.lib-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.lib-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lib-meta b { font-weight: 600; color: var(--accent); }
.lib-meta b.late { color: var(--danger); }
.lib-actions-panel { padding: 4px 12px 12px 56px; display: grid; gap: 8px; }
.lib-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.lib-line-label { font-size: 12.5px; font-weight: 600; color: var(--muted); width: 74px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s; }
.chip:hover { background: var(--accent-soft); }
.chip:active { transform: scale(.97); }
.chip.ghost { background: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.danger { color: var(--danger); background: transparent; }
.chip-date { width: auto !important; padding: 5px 9px !important; border-radius: 999px !important; font-size: 13px !important; }
.lib-empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.lib-empty b { display: block; color: var(--text); font-size: 15px; margin: 8px 0 4px; }
.lib-empty p { margin: 0 auto; max-width: 380px; font-size: 13.5px; line-height: 1.5; }
.lib-empty-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.hidden { display: none !important; }
@media (max-width: 640px) {
  dialog.class-sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .sheet-inner { max-height: 100dvh; height: 100%; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  .next-class { margin-left: 0; width: 100%; }
  .lib-actions-panel { padding-left: 12px; }
  .lib-line-label { width: 100%; }
}
.class-sheet .dialog-head { position: sticky; top: -22px; z-index: 3; background: var(--panel); margin: -22px -24px 0; padding: 20px 24px 10px; }
@media (max-width: 640px) {
  .class-sheet .dialog-head { top: calc(-16px - env(safe-area-inset-top)); margin: calc(-16px - env(safe-area-inset-top)) -16px 0; padding: calc(14px + env(safe-area-inset-top)) 16px 10px; }
}
.lib-card-title { font-weight: 600; font-size: 15px; margin: 6px 0 2px; }
.lib-card-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.lib-card .lib-line { margin-top: 8px; }
.lib-card { padding-bottom: 14px; }
.lib-card .lib-card-title, .lib-card .lib-card-meta, .lib-card .lib-line { padding-left: 18px; padding-right: 18px; }
.lib-card .lib-card-title { margin-top: 12px; }

/* UI review: semantic status colors, readable controls and quieter loading. */
:root {
  --action: #0068d5;
  --danger: #b42318;
  --warn: #8a4b00;
  --ok: #16713a;
  --info: #005ea8;
  --skeleton-base: #e4e6eb;
  --skeleton-highlight: #f0f1f4;
}
@media (prefers-color-scheme: dark) {
  :root { --danger:#ff8a80; --warn:#ffc267; --ok:#75df9b; --info:#8ac8ff; --skeleton-base:#38383c; --skeleton-highlight:#48484e; }
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.btn:not(.ghost):not(.danger):not(.danger-solid), .send, .toggle[aria-pressed="true"], .day-chip.on { background:var(--action); color:#fff; }
.msg.user .bubble, .flashcard-face.back { background:var(--action); color:#fff; }
.btn.danger-solid { background:#b42318; color:#fff; }
.stat.good .stat-num { color:var(--text); }
.deadline.soon .when { color:var(--warn); background:color-mix(in srgb,var(--warn) 12%,var(--panel)); }
.deadline.urgent .when { color:var(--danger); background:color-mix(in srgb,var(--danger) 10%,var(--panel)); }
.deadline.done .when { color:var(--ok); background:color-mix(in srgb,var(--ok) 10%,var(--panel)); }
.skeleton { background:var(--panel-2); padding:14px; display:flex; flex-direction:column; justify-content:center; gap:9px; height:74px; animation:none; }
.skeleton.short { height:55px; padding:10px 12px; }
.skeleton-line { display:block; height:9px; width:82%; border-radius:4px; background:linear-gradient(90deg,var(--skeleton-base),var(--skeleton-highlight),var(--skeleton-base)); background-size:200% 100%; animation:shimmer 1.5s linear infinite; }
.skeleton-line.narrow { width:52%; height:7px; }
.load-error { list-style:none; padding:12px; border:1px solid var(--line); border-radius:12px; color:var(--danger); display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-size:13px; }
.load-error .link-btn { margin-left:auto; min-height:32px; padding:3px 8px; }
.chat-open { flex:1; min-width:0; display:flex; gap:9px; align-items:center; border:0; padding:5px 0; background:none; color:inherit; text-align:left; font:inherit; min-height:32px; }
.chat-item:focus-within .del { opacity:1; }
.chat-item .del { min-width:28px; min-height:28px; place-items:center; }
@media (hover:none) { .chat-item .del { opacity:1; } }
button.inbox-item, button.course { width:100%; text-align:left; font:inherit; color:inherit; }
button.inbox-item { border:0; }
button.course { border:0; background:transparent; }
.inbox-item .info > .from, .inbox-item .info > .subj, .inbox-item .info > .snip { display:block; }
.suggestion { min-height:72px; }
.suggestion b { align-self:center; }
button.flashcard { width:100%; padding:0; border:0; background:none; color:inherit; font:inherit; text-align:center; }
button.flashcard .flashcard-inner { display:block; }
.course.clickable:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
button, [role="button"], input[type="checkbox"] { scroll-margin:20px; }
.chip, .link-btn { min-height:28px; }
.lib-check { width:24px; height:24px; }
.voice-overlay { width:100%; max-width:none; height:100dvh; max-height:none; margin:0; border:0; border-radius:0; }
.voice-overlay:not([open]) { display:none; }
.voice-overlay::backdrop { background:var(--bg); }
@media (max-width:1180px) {
  .today:not(.open) { visibility:hidden; pointer-events:none; }
  .today.open { visibility:visible; pointer-events:auto; }
}
@media (max-width:760px) {
  .sidebar:not(.open) { visibility:hidden; pointer-events:none; }
  .sidebar.open { visibility:visible; pointer-events:auto; }
}
@media (prefers-reduced-motion:reduce) { .skeleton-line { animation:none; } }
@media (forced-colors:active) {
  button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline:3px solid Highlight; }
  .when, .btn, .chip, .flashcard-face { border:1px solid ButtonText; }
}
:root { --accent:#0067cf; }
@media (prefers-color-scheme:dark) { :root { --accent:#72b8ff; } }
.when, .chip.accent { color:var(--info); }
.grad-text, .welcome h1 .grad-text, .profs h2 { background:none; color:var(--accent); -webkit-background-clip:initial; background-clip:initial; }
.composer textarea::placeholder { color:var(--muted); opacity:1; }
@media (prefers-contrast:more) { :root { --line:currentColor; } .skeleton { border:1px solid var(--line); } }
.suggestion { flex-direction:row; align-items:center; gap:12px; padding:16px; }
.suggestion .ic { margin-bottom:0; }
.suggestion b { text-align:left; }

/* ---------- iPhone layout (Apple Human Interface Guidelines) ----------
   Centered navigation title, 16pt margins, 17pt text, and every screen
   filling the display: the home screen centers its content, and Settings
   opens as a full-screen page like Today and History. */
@media (max-width: 760px) {
  .chat-head { min-height: 44px; padding-left: 16px; padding-right: 16px; display: grid; grid-template-columns: 1fr minmax(0, 52%) 1fr; align-items: center; }
  .chat-head #menuBtn { grid-column: 1; justify-self: start; }
  .chat-title { grid-column: 2; text-align: center; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
  .chat-head .head-actions { grid-column: 3; justify-self: end; }
  .composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
  .composer textarea:focus, .composer textarea:focus-visible { outline: none; box-shadow: none; }
  .messages { padding-left: 16px; padding-right: 16px; }
  .msg.bot .bubble, .msg.user .bubble { font-size: 17px; line-height: 1.4; }
  .composer { min-height: 44px; }
  .composer textarea { font-size: 17px; }
  .composer-hint { display: none; }

  /* Home: content sits in the middle of the screen instead of bunching at the top. */
  .messages:has(> .welcome:not(.hidden)) { display: flex; flex-direction: column; }
  .messages > .welcome:not(.hidden) { margin: auto 0; padding: 12px 0 16px; width: 100%; }

  /* Settings fills the screen like the other tabs. */
  dialog#settings { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  dialog#settings form { height: 100%; max-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
  #settings .dialog-head { position: sticky; top: calc(-12px - env(safe-area-inset-top)); z-index: 2; background: var(--panel); margin: calc(-12px - env(safe-area-inset-top)) -16px 0; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; }
  .inline-row { flex-direction: column; align-items: stretch; }
  .inline-row label { min-width: 0; }
  .inline-row .btn { justify-content: center; }
}

/* Dismiss buttons on notifications */
.toast-text { flex: 1; min-width: 0; }
.toast-close, .notify-close {
  flex: none; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: transparent; color: var(--muted); cursor: pointer;
}
.toast-close:hover, .notify-close:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.notify-box { position: relative; }
.notify-close { position: absolute; top: 10px; right: 10px; margin: 0; color: rgb(255 255 255 / 80%); }
.notify-close:hover { color: #fff; background: rgb(255 255 255 / 18%); }

/* Show or hide the Today panel on wide screens */
.only-wide { display: none !important; }
@media (min-width: 1181px) {
  .only-wide { display: inline-grid !important; }
  .app { transition: grid-template-columns .3s var(--ease); }
  .app.today-collapsed { grid-template-columns: 268px minmax(0, 1fr) 0px; }
  .app.today-collapsed .today { visibility: hidden; padding: 0; border: 0; overflow: hidden; }
  #panelToggle.on { color: var(--accent); }
}
@media (min-width: 1181px) and (prefers-reduced-motion: reduce) { .app { transition: none; } }

/* Show or hide the chat history sidebar on tablets and computers */
.only-sidebar-toggle { display: none !important; }
@media (min-width: 761px) {
  .only-sidebar-toggle:not(.hidden) { display: inline-grid !important; }
  .chat-head #sidebarToggle { margin-left: -6px; }
  .app { transition: grid-template-columns .3s var(--ease); }
  .app.sidebar-collapsed .sidebar { visibility: hidden; padding: 0; border: 0; overflow: hidden; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .app.sidebar-collapsed { grid-template-columns: 0px minmax(0, 1fr); }
}
@media (min-width: 1181px) {
  .app.sidebar-collapsed { grid-template-columns: 0px minmax(0, 1fr) 340px; }
  .app.sidebar-collapsed.today-collapsed { grid-template-columns: 0px minmax(0, 1fr) 0px; }
}
@media (min-width: 761px) and (prefers-reduced-motion: reduce) { .app { transition: none; } }
