
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #fdfbf7;
  --surface: #ffffff;
  --ink:     #1a1a1e;
  --body:    #4b4b4f;
  --muted:   #9a9aa0;
  --line:    #ece6dd;
  --brand1:  #4f46e5;
  --brand2:  #635bff;
  --brand3:  #7c86ff;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #635bff 60%, #7c86ff 100%);
  --brand-soft: #f0eeff;
  --ok:      #15803d;
  --ok-bg:   #e8f5e9;
  --warn:    #a16207;
  --warn-bg: #fef3c7;
  --bad:     #dc2626;
  --bad-bg:  #fef2f2;
  --shadow:  0 8px 24px rgba(30, 30, 40, 0.06);
  --shadow-sm: 0 2px 10px rgba(30, 30, 40, 0.05);
  --r-lg:    18px;
  --r-md:    12px;
  --font:    'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg:      #121214;
  --surface: #1e1e20;
  --ink:     #f0f0f2;
  --body:    #b8b8bc;
  --muted:   #7a7a80;
  --line:    #2a2a2e;
  --brand-soft: #23233a;
  --ok-bg:   #1a2e1e;
  --warn-bg: #2e2510;
  --bad-bg:  #2e1a1c;
  --shadow:  0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
}

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body, nav, footer, .pv-card, .feat, .how-step, .auth-box, .modal-box,
.sidebar, .asgn-item, .asgn-banner, .chat-input-row, .msg-text,
.btn-solid, .btn-line, .auth-btn, .nav-cta, .theme-btn, .sb-foot-btn,
.consent, .pwa-banner {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

h1, h2, h3 { color: var(--ink); }
a { color: inherit; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }


nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1080px) / 2 + 24px));
  height: 64px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}

.logo {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.nav-r {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-cta {
  background: var(--brand-grad);
  color: #fff !important;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.nav-cta:hover { filter: brightness(1.07); text-decoration: none; }
.nav-cta:active { transform: scale(0.97); }

.lang-menu { position: relative; }
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 38px;
}
.lang-btn:hover { color: var(--ink); border-color: var(--brand1); }
.lang-btn svg { flex-shrink: 0; }
.lang-code { min-width: 20px; text-align: center; }
.lang-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  z-index: 120;
}
.lang-dropdown[hidden] { display: none !important; }
.lang-dropdown button {
  text-align: left;
  border: none;
  background: transparent;
  padding: 11px 12px;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
}
.lang-dropdown button:hover { background: var(--bg); color: var(--ink); }
.lang-dropdown button.on { background: var(--brand-grad); color: #fff; }

.lang-sw { display: none; }

.auth-lang .lang-menu { margin: 0 auto; }
.auth-lang .lang-dropdown { right: 50%; transform: translateX(50%); }

.theme-btn {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-sm);
}
.theme-btn:hover { border-color: var(--brand1); transform: translateY(-1px); }
.theme-btn:active { transform: scale(0.92); }
.theme-btn:focus-visible { outline: 2px solid var(--brand1); outline-offset: 2px; }
.theme-btn svg {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: opacity .25s ease, transform .35s ease;
}
[data-theme="light"] .theme-btn .ic-sun  { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .theme-btn .ic-moon { opacity: 1; transform: none; }
[data-theme="dark"]  .theme-btn .ic-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"]  .theme-btn .ic-sun  { opacity: 1; transform: none; }

.nav-logo-img, .sb-logo-img {
  width: 30px; height: 30px;
  object-fit: contain;
  margin-right: 9px;
}
.sb-logo-img { width: 26px; height: 26px; margin-right: 7px; }
.sb-logo { display: inline-flex; align-items: center; font-weight: 800; color: var(--ink); }
.hero-logo-img {
  width: 132px; height: 132px;
  object-fit: contain;
  margin-bottom: 24px;
}
.auth-logo-img {
  width: 96px; height: 96px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}
.empty-logo-img {
  width: 76px; height: 76px;
  object-fit: contain;
}

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.hero {
  width: 100%;
  text-align: center;
  padding: 72px 24px 56px;
}
.hero-badge {
  display: inline-block;
  background: var(--surface);
  color: var(--brand1);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
  transform: rotate(-0.4deg);
}
[data-theme="dark"] .hero-badge { color: #a99cff; border-color: var(--line); }
.hero h1 {
  font-size: clamp(38px, 6.5vw, 68px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -1.2px;
  margin-bottom: 18px;
}
.hero h1 .grad {
  color: var(--brand1);
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  position: relative;
}
.hero h1 .grad::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -4px;
  bottom: 2px;
  height: 8px;
  background: var(--brand-soft);
  border-radius: 4px;
  z-index: -1;
  transform: rotate(-0.6deg);
}
.hero-sub {
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 28px;
  color: var(--body);
}
.hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.btn-solid {
  background: var(--brand-grad);
  color: #fff;
  padding: 14px 34px;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.btn-solid:hover { filter: brightness(1.07); text-decoration: none; transform: translateY(-1px); }
.btn-solid:active { transform: scale(0.98); }
.hero-meta { font-size: 13px; color: var(--muted); font-weight: 600; }

.pv-wrap { padding: 0 24px 72px; }
.pv-card {
  max-width: 620px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.pv-ava {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.pv-title { font-weight: 800; color: var(--ink); font-size: 14px; }
.pv-due {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  color: var(--warn);
  background: var(--warn-bg);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.pv-task {
  margin: 16px 20px 0;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
}
.pv-body { padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.pv-msg {
  max-width: 88%;
  padding: 11px 16px;
  border-radius: 4px 18px 18px 18px;
  font-size: 14px;
  line-height: 1.6;
}
.pv-msg.ai { background: var(--bg); border: 1px solid var(--line); align-self: flex-start; }
.pv-msg.me {
  background: var(--brand-grad);
  color: #fff;
  border-radius: 18px 4px 18px 18px;
  align-self: flex-end;
}
.pv-who { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 2px; }

.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 0 24px 72px;
}
.feat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feat { transition: transform .2s ease, box-shadow .2s ease, background-color .25s ease, border-color .25s ease; }
.feat-ico {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--brand1);
}
.feat-ico svg { width: 22px; height: 22px; stroke: currentColor; }
.feat h3 { font-size: 17px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.2px; }
.feat p { font-size: 14px; line-height: 1.65; }

.how { padding: 0 24px 88px; text-align: center; }
.how h2 { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -0.8px; margin-bottom: 28px; }
.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}
.how-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}
.how-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.how-label { display: block; font-weight: 800; color: var(--ink); font-size: 15px; margin-bottom: 6px; }
.how-note { font-size: 13px; line-height: 1.65; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 24px max(24px, calc((100vw - 1080px) / 2 + 24px));
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
footer a { text-decoration: none; }
footer a:hover { color: var(--brand1); text-decoration: underline; }
.foot-brand { white-space: nowrap; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }

.doc {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  padding: 64px 24px 88px;
}
.doc h1 {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 14px;
}
.doc-lead { font-size: 16px; line-height: 1.7; margin-bottom: 20px; }
.doc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 28px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.doc-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.doc-card p, .doc-card li { font-size: 14px; line-height: 1.75; }
.doc-card p { margin-bottom: 10px; }
.doc-card p:last-child { margin-bottom: 0; }
.doc-card ul { margin: 0 0 10px 20px; }
.doc-card li { margin-bottom: 6px; }
.doc-card li::marker { color: var(--brand1); }
.doc-card b, .doc-card strong { color: var(--ink); }
.doc-card code {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
}
.doc-card a { color: var(--brand1); font-weight: 700; }

.consent, .pwa-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  z-index: 400;
  box-shadow: var(--shadow);
  font-size: 13px;
}
.consent span { flex: 1; line-height: 1.55; }
.consent a { color: var(--brand1); font-weight: 700; }
.consent-ok, .pwa-install {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 44px;
}
.consent-ok:hover, .pwa-install:hover { filter: brightness(1.07); }
.pwa-banner img { border-radius: 10px; flex-shrink: 0; }
.pwa-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pwa-txt b { font-size: 13px; color: var(--ink); }
.pwa-txt span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.pwa-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 10px;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
}
.pwa-close:hover { color: var(--ink); background: var(--bg); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 300;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


.app-page { background: var(--bg); }

.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-box {
  width: 400px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo { font-size: 24px; font-weight: 800; color: var(--ink); margin-bottom: 6px; letter-spacing: -0.5px; }
.auth-tag  { font-size: 14px; margin-bottom: 28px; }
.auth-btn  {
  width: 100%;
  background: var(--brand-grad);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  min-height: 52px;
}
.auth-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.auth-btn:active { transform: scale(0.98); }
.auth-btn svg { background: #fff; border-radius: 50%; padding: 2px; }
.auth-note { font-size: 12px; color: var(--muted); margin-top: 18px; text-align: center; line-height: 1.7; }
.auth-note a { color: var(--brand1); font-weight: 700; }
.auth-notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--bad);
  background: var(--bad-bg);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  text-align: left;
}
.auth-lang { margin-top: 18px; display: flex; justify-content: center; }

.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sb-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sb-user {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  flex-shrink: 0;
}

.sb-search { padding: 12px 14px; }
.sb-search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  color: var(--ink);
}
.sb-search input:focus { border-color: var(--brand1); background: var(--surface); }
.sb-search input::placeholder { color: var(--muted); }

.sb-list { flex: 1; overflow-y: auto; padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.sb-empty { padding: 24px 8px; font-size: 13px; color: var(--muted); line-height: 1.7; text-align: center; }
.sb-list::-webkit-scrollbar { width: 4px; }
.sb-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.course-hd {
  padding: 12px 4px 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.asgn-item {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.asgn-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--brand1); }
.asgn-item.active { background: var(--brand-soft); border-color: var(--brand1); box-shadow: var(--shadow-sm); }
.asgn-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asgn-due { font-size: 11px; font-weight: 800; }
.due-warn { color: #fff !important; background: var(--bad); padding: 2px 9px; border-radius: 999px; }
.due-near { color: var(--warn) !important; background: var(--warn-bg); padding: 2px 9px; border-radius: 999px; }
.asgn-item:not(.active) .asgn-due:not(.due-warn):not(.due-near) { color: var(--muted); }
[data-theme="dark"] .due-warn { color: #ffd7d7 !important; }

.sb-foot {
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px;
  gap: 4px;
}
.sb-foot-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 10px 4px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
.sb-foot-btn:hover { background: var(--bg); color: var(--ink); }

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-topbar {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chat-topbar-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.chat-meta .due-warn, .chat-meta .due-near { font-size: 11px; }

.asgn-banner {
  margin: 16px 22px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand1);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.asgn-banner-lbl { font-size: 10px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.asgn-banner-txt { font-size: 13px; line-height: 1.65; white-space: pre-wrap; }

.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msgs::-webkit-scrollbar { width: 4px; }
.msgs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.msg-row { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.msg-who { font-size: 11px; font-weight: 800; color: var(--muted); padding: 0 4px; }
.msg-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--body);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  max-width: min(660px, 88%);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.msg-text strong { font-weight: 800; color: var(--ink); }
.msg-text code {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  background: var(--bg);
}
.msg-text pre {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  background: var(--bg);
}
.msg-text pre code { border: none; padding: 0; background: none; }
.msg-row.user { align-items: flex-end; }
.msg-row.user .msg-who { color: var(--brand1); }
.msg-row.user .msg-text {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  border-radius: 18px 4px 18px 18px;
}
.msg-row.user .msg-text strong { color: #fff; }

.typing-row .msg-text { color: var(--muted); }
.typing-dots span {
  display: inline-block;
  animation: blink 1s step-end infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .3s; }
.typing-dots span:nth-child(3) { animation-delay: .6s; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 24px;
}
.empty-logo { font-size: 26px; font-weight: 800; color: var(--ink); margin-bottom: 2px; letter-spacing: -0.5px; }
.btn-line {
  background: var(--surface);
  color: var(--brand1);
  border: 1px solid var(--brand1);
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.btn-line:hover { background: var(--brand-soft); }
.btn-menu-mobile { display: none; margin-top: 14px; }

.chat-input-area {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 22px;
}
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-ta {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  padding: 13px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  resize: none;
  min-height: 50px;
  max-height: 130px;
  line-height: 1.5;
}
.chat-ta:focus { border-color: var(--brand1); background: var(--surface); }
.chat-ta::placeholder { color: var(--muted); }
.send-btn {
  background: var(--brand-grad);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.send-btn:hover { filter: brightness(1.08); }
.send-btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.chat-hint { font-size: 11px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.chat-hint a { color: var(--brand1); }

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 50, 0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  width: 460px;
  max-width: 100%;
  box-shadow: var(--shadow);
  animation: pop .22s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } }
.modal-title { font-size: 19px; font-weight: 800; color: var(--ink); margin-bottom: 6px; letter-spacing: -0.3px; }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  color: var(--ink);
  background: var(--bg);
}
.field input:focus, .field select:focus { border-color: var(--brand1); background: var(--surface); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 26px; }
.modal-save {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  min-height: 46px;
}
.modal-save:hover { filter: brightness(1.07); }
.modal-cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 26px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  min-height: 46px;
}
.modal-cancel:hover { border-color: var(--brand1); color: var(--ink); }

@media (max-width: 1024px) {
  .sidebar { width: 250px; }
  .msgs { padding: 16px; }
  .asgn-banner { margin: 12px 16px 0; }
  .features { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  nav { padding: 0 16px; height: 60px; }
  .logo { font-size: 17px; }
  .nav-cta { padding: 9px 18px; font-size: 13px; }
  main { max-width: 100%; }
  .hero { padding: 48px 20px 40px; text-align: center; }
  .hero-sub { margin: 0 auto 28px; }
  .hero-btns { justify-content: center; }
  .hero-logo-img { width: 92px; height: 92px; margin-bottom: 18px; }
  .pv-wrap, .features, .how { padding-left: 16px; padding-right: 16px; }
  .features { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; }
  .doc { padding: 44px 20px 64px; }
  footer { padding: 18px 20px; flex-direction: column; gap: 10px; text-align: center; }
  .foot-links { justify-content: center; }

  .app-layout { flex-direction: column; }
  .sidebar { display: none; width: 100%; border-right: none; border-bottom: 1px solid var(--line); max-height: 55vh; }
  .sidebar.open { display: flex; }
  .sb-foot-btn { min-height: 48px; font-size: 12px; }
  .btn-menu-mobile { display: inline-flex; }
  .chat-input-area { padding: 12px; }
  .asgn-banner { margin: 12px 12px 0; }
  .msgs { padding: 14px 12px; }
  .msg-text { max-width: 94%; }
  .chat-topbar { padding: 12px; }
  .auth-box { padding: 32px 24px; }
  .auth-logo-img { width: 80px; height: 80px; }
  .modal-box { padding: 24px; }
  .consent { font-size: 12px; }
}

@media (max-width: 380px) {
  .hero-btns .btn-solid { width: 100%; justify-content: center; }
  .empty-logo-img { width: 56px; height: 56px; }
  .pwa-install { padding: 10px 12px; }
  .feat, .how-step { padding: 22px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 32px 20px; }
  .hero-logo-img { width: 64px; height: 64px; margin-bottom: 12px; }
  .empty-logo-img { display: none; }
  .asgn-banner { display: none; }
  .chat-topbar { padding: 8px 12px; }
}

@media (pointer: coarse) {
  .chat-ta, .sb-search input, .field input, .field select { font-size: 16px; }
  .theme-btn { width: 42px; height: 42px; }
  .asgn-item { padding-top: 13px; padding-bottom: 13px; }
}