:root {
  --bg: #f6f8f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #60a5fa;
  --blue-deep: #2563eb;
  --blue-soft: #eff6ff;
  --green: var(--blue);
  --red: #dc2626;
  --mobile-dashboard-bg: #eef6ff;
  --mobile-dashboard-bg-soft: #f8fbff;
  --mobile-browser-chrome-gap: clamp(86px, 18svh, 142px);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  background: #eef0f2;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
button.primary { background: #111827; color: #fff; }
button.ghost-danger { background: #fef2f2; color: var(--red); }
button.link-button { width: 100%; margin-top: 8px; background: transparent; color: var(--muted); }
button.link-button:hover { color: var(--text); background: #f3f4f6; }
button.text-link {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
button.text-link:hover { color: var(--text); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--green); }
label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 700; }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -.04em; }
h2 { font-size: 20px; letter-spacing: -.02em; }

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 3000;
  transform: translate(-50%, -18px);
  min-width: min(360px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 14px 34px rgba(185, 28, 28, .14);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.success {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .13);
}

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 34px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-weight: 900;
}
.brand strong, .brand span { display: block; }
.brand span { margin-top: 2px; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 10px; }
nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}
nav a.active, nav a:hover { background: #f3f4f6; color: var(--text); }

.page-panel {
  display: grid;
  gap: 16px;
  animation: page-fade-in .22s ease both;
}
.page-panel[hidden] { display: none !important; }
.page-panel .card:last-child { margin-bottom: 0; }
.section-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.insight-dashboard-card { min-height: calc(100vh - 116px); }
#mailSettingsPage { align-content: start; }

.mailbox-required-banner {
  display: none;
  padding: 14px 16px;
  border: 1px solid #f3d79b;
  border-radius: 16px;
  background: #fff8e8;
  color: #5b4420;
}
.mailbox-required-banner strong,
.mailbox-required-banner span { display: block; }
.mailbox-required-banner strong { font-size: 15px; }
.mailbox-required-banner span { margin-top: 4px; font-size: 13px; line-height: 1.5; }
body.mailbox-required .mailbox-required-banner { display: block; }
body.mailbox-required #mainNav a[data-page="mail-settings"] {
  background: #0f172a;
  color: #fff;
}
body.mailbox-required #mainNav a:not([data-page="mail-settings"]) {
  opacity: .38;
  pointer-events: none;
}
.mailbox-empty {
  display: grid;
  gap: 5px;
  text-align: left;
}
.mailbox-empty strong { color: #111827; }
.mailbox-empty span { color: var(--muted); font-size: 13px; }
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }

.card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.status-dot {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-dot.ok { color: var(--blue-deep); background: #eff6ff; }
.status-dot.bad { color: var(--red); background: #fef2f2; }
.message { margin-top: 12px; color: var(--muted); font-weight: 700; }
.message.ok { color: #2563eb; }
.message.bad { color: #b91c1c; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.custom-field { display: none; }
.show-custom .custom-field { display: grid; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions.compact { margin-top: 0; }

.mail-setup-card {
  padding: 24px;
  overflow: hidden;
  border-color: rgba(226, 232, 240, .95);
  box-shadow: 0 18px 55px rgba(15, 23, 42, .06);
}
.mail-settings-head { align-items: flex-start; }
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.settings-account-card {
  padding: 22px 24px;
  border-color: rgba(226, 232, 240, .95);
  background:
    radial-gradient(circle at 92% 8%, rgba(96, 165, 250, .11), transparent 30%),
    #fff;
  box-shadow: 0 16px 46px rgba(15, 23, 42, .045);
}
.account-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #f8fafc;
}
.account-setting-row strong,
.account-setting-row span {
  display: block;
}
.account-setting-row strong {
  color: #111827;
  font-size: 15px;
}
.account-setting-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.ghost-danger {
  min-height: 40px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  box-shadow: none;
}
.ghost-danger:hover {
  border-color: #fca5a5;
  background: #fef2f2;
}
.eyebrow {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.mail-config-body {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(520px, 1.18fr);
  gap: 28px;
  align-items: stretch;
}
.mail-account-summary {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 16%, rgba(96, 165, 250, .16), transparent 34%),
    linear-gradient(145deg, #f8fbfa, #ffffff 58%, #eff6ff);
}
.mail-account-summary .summary-kicker {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(96, 165, 250, .14);
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 950;
}
.mail-account-summary strong {
  color: #111827;
  font-size: 17px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}
.mail-account-summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.mail-account-summary.is-bound {
  border-color: #bfdbfe;
  background:
    radial-gradient(circle at 22% 16%, rgba(96, 165, 250, .20), transparent 34%),
    linear-gradient(145deg, #eff6ff, #ffffff 62%);
}
.mail-config-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 0;
}
.exchange-card .mail-setup-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  align-items: end;
  gap: 14px 18px;
}
.mail-field-limit {
  max-width: 150px;
}
.exchange-card .mail-field input {
  min-height: 46px;
  border-radius: 14px;
  background: #fbfbfc;
}
.exchange-card .mail-field input:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .12);
}
.exchange-card .actions {
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
}
.exchange-card .actions .secondary {
  min-height: 48px;
  background: #f3f4f6;
  color: #111827;
}
.exchange-card .actions .primary {
  min-height: 48px;
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 24px rgba(17, 24, 39, .14);
}
#syncMsg.bad {
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
}
#syncMsg.ok {
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.student-auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.student-auth-box, .student-account-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafafa;
}
.mini-title { margin-bottom: 12px; }
.mini-title strong { font-size: 15px; }
.mini-title span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.compact-form { display: grid; gap: 10px; margin-bottom: 12px; }
.login-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}
.login-actions-row .primary { min-width: 112px; }
.student-bind-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-pending .student-bind-row { grid-template-columns: 1fr; }
.register-mode .password-login-box,
.needs-account-setup .password-login-box,
.needs-account-setup #registerPanel { display: none; }
#studentLogoutBtn { display: none; }
.student-account-panel { margin-top: 14px; }
.student-account-panel[hidden], .browser-login-panel[hidden] { display: none; }
.account-setup-grid { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
.browser-login-panel { display: grid; gap: 10px; margin-bottom: 12px; }
.browser-code {
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  text-align: center;
  background: #fff;
}
.browser-code span { display: block; font-size: 30px; font-weight: 900; letter-spacing: .18em; }
.browser-code small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.browser-login-copy { color: var(--muted); font-size: 13px; }

.account-list, .history-list, .insight-list { display: grid; gap: 10px; }
.account, .history-item, .insight {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.account, .history-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account strong, .account span, .history-item strong, .history-item span { display: block; }
.account span, .history-item span, .insight-meta { color: var(--muted); font-size: 13px; }
.account-actions, .insight-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.account-actions button, .insight-actions button { padding: 8px 11px; border-radius: 10px; font-size: 13px; }
.account-actions .delete { background: #fef2f2; color: var(--red); }
.history-count { font-weight: 800; white-space: nowrap; }
.empty { padding: 22px; color: var(--muted); text-align: center; }
.insight-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.insight-title { font-weight: 900; }
.insight-summary, .insight-details { margin-top: 8px; color: #374151; line-height: 1.55; }
.insight-details { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.deadline { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.badge.important { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge.medium { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge.notice { background: #eff6ff; color: var(--blue-deep); border: 1px solid #bfdbfe; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 18px; }
  .topbar, .card-head, .account, .history-item { display: grid; }
  .form-grid, .student-auth-grid, .account-setup-grid, .student-bind-row { grid-template-columns: 1fr; }
}


/* CareerCompass login page replica adapted to Kaopu Campus. */
.auth-pending .app,
.needs-account-setup .app {
  display: block;
  min-height: 100vh;
  background: hsl(0 0% 100%);
}

.auth-pending .sidebar,
.auth-pending .topbar,
.auth-pending .content > section:not(#student),
.needs-account-setup .sidebar,
.needs-account-setup .topbar,
.needs-account-setup .content > section:not(#student) {
  display: none !important;
}

.auth-pending .content,
.needs-account-setup .content {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.cc-auth-page {
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: hsl(0 0% 100%);
  color: hsl(222.2 84% 4.9%);
}

.cc-auth-grid {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.cc-auth-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 48px;
  color: white;
  background: linear-gradient(135deg, rgb(156 163 175), rgb(107 114 128), rgb(75 85 99));
}

.cc-auth-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.cc-auth-left::after {
  content: "";
  position: absolute;
  right: 18%;
  top: 25%;
  width: 16rem;
  height: 16rem;
  border-radius: 999px;
  background: rgba(156, 163, 175, .2);
  filter: blur(64px);
  box-shadow: -280px 230px 90px 60px rgba(209, 213, 219, .18);
}

.cc-left-content {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cc-brand,
.cc-mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 18px;
  font-weight: 600;
}

.cc-brand-logo {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  color: currentColor;
  font-weight: 800;
}

.cc-characters {
  position: relative;
  align-self: center;
  width: 550px;
  height: 400px;
  margin-bottom: 28px;
}

.cc-shape {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform .7s ease, height .7s ease;
}

.cc-purple {
  left: 70px;
  z-index: 1;
  width: 180px;
  height: 400px;
  border-radius: 10px 10px 0 0;
  background: #6C3FF5;
  animation: cc-purple-sway 7s ease-in-out infinite;
}

.cc-black {
  left: 240px;
  z-index: 2;
  width: 120px;
  height: 310px;
  border-radius: 8px 8px 0 0;
  background: #2D2D2D;
  animation: cc-black-sway 6.5s ease-in-out infinite;
}

.cc-orange {
  left: 0;
  z-index: 3;
  width: 240px;
  height: 200px;
  border-radius: 120px 120px 0 0;
  background: #FF9B6B;
  animation: cc-orange-sway 7.2s ease-in-out infinite;
}

.cc-yellow {
  left: 310px;
  z-index: 4;
  width: 140px;
  height: 230px;
  border-radius: 70px 70px 0 0;
  background: #E8D754;
  animation: cc-yellow-sway 6.8s ease-in-out infinite;
}

.cc-eyes,
.cc-pupils {
  position: absolute;
  display: flex;
  transition: transform .2s ease;
}

.cc-eyes { gap: 24px; }
.cc-eyes-purple { left: 45px; top: 40px; }
.cc-eyes-black { left: 26px; top: 32px; gap: 22px; }
.cc-pupils-orange { left: 82px; top: 90px; gap: 32px; }
.cc-pupils-yellow { left: 52px; top: 40px; gap: 24px; }

.cc-eyes span {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 999px;
  background: white;
  position: relative;
}
.cc-eyes-black span { width: 16px; height: 16px; }
.cc-eyes span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2D2D2D;
  animation: cc-look 4s ease-in-out infinite;
}
.cc-eyes-black span::after { width: 6px; height: 6px; }

.cc-pupils span {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #2D2D2D;
  animation: cc-look-small 4.5s ease-in-out infinite;
}

.cc-mouth {
  position: absolute;
  left: 40px;
  top: 88px;
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: #2D2D2D;
}

.cc-purple::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -14px;
  width: 34px;
  height: 22px;
  border-radius: 999px 999px 18px 18px;
  background: #8d6bff;
  box-shadow: 54px 10px 0 -7px rgb(255 255 255 / .22);
  transform: rotate(-8deg);
}
.cc-purple::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 82px;
  width: 26px;
  height: 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / .25);
}
.cc-black::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 70px;
  width: 32px;
  height: 3px;
  border-radius: 999px;
  background: rgb(255 255 255 / .44);
  opacity: .72;
}
.cc-black::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 28px;
  width: 18px;
  height: 18px;
  border: 3px solid rgb(255 255 255 / .36);
  border-radius: 999px;
  opacity: .85;
}
.cc-orange::after {
  content: "";
  position: absolute;
  left: 74px;
  top: 124px;
  width: 58px;
  height: 10px;
  border-bottom: 4px solid rgb(45 45 45 / .62);
  border-radius: 0 0 999px 999px;
}
.cc-yellow::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 70px;
  width: 16px;
  height: 9px;
  border-radius: 999px;
  background: rgb(255 155 107 / .48);
  box-shadow: 68px 0 0 rgb(255 155 107 / .40);
}

.cc-left-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
}
.cc-left-links a {
  color: rgb(75 85 99);
  text-decoration: none;
  transition: color .15s ease;
}
.cc-left-links a:hover { color: rgb(17 24 39); }

.cc-auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: hsl(0 0% 100%);
}

.cc-form-wrap {
  width: 100%;
  max-width: 420px;
}

.cc-mobile-brand { display: none; justify-content: center; margin-bottom: 48px; color: hsl(222.2 84% 4.9%); }
.cc-mobile-brand .cc-brand-logo { background: transparent; }

.cc-heading {
  margin-bottom: 40px;
  text-align: center;
}
.cc-heading h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.cc-heading p {
  color: hsl(215.4 16.3% 46.9%);
  font-size: 14px;
}
.cc-heading .status-dot { display: none; }

.cc-form-stack,
.auth-pending .cc-form-stack,
.needs-account-setup .cc-form-stack {
  display: block;
}

.cc-login-box,
.auth-pending .cc-login-box,
.needs-account-setup .cc-login-box,
.cc-register-box,
.cc-account-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cc-fields {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.cc-fields label,
.cc-account-panel label {
  display: grid;
  gap: 8px;
  color: hsl(222.2 84% 4.9%);
  font-size: 14px;
  font-weight: 500;
}

.cc-fields input,
.cc-account-panel input {
  width: 100%;
  height: 48px;
  border: 1px solid hsl(214.3 31.8% 91.4% / .6);
  border-radius: 10px;
  padding: 0 12px;
  background: hsl(0 0% 100%);
  color: hsl(222.2 84% 4.9%);
  font-size: 14px;
  outline: none;
}
.cc-fields input:focus,
.cc-account-panel input:focus {
  border-color: hsl(222.2 47.4% 11.2%);
}

.password-field { position: relative; display: block; }
.password-field input { padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 18px;
  line-height: 1;
}
.password-toggle:hover { color: hsl(222.2 84% 4.9%); background: transparent; }

.cc-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
}
.remember-check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: hsl(222.2 84% 4.9%);
  font-size: 14px !important;
  font-weight: 400 !important;
  cursor: pointer;
}
.remember-check input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: hsl(222.2 47.4% 11.2%);
}
.forgot-link,
.cc-signup-row .text-link {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: hsl(222.2 84% 4.9%);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.forgot-link:hover,
.cc-signup-row .text-link:hover { text-decoration: underline; background: transparent; }

.cc-submit,
.auth-pending .cc-submit,
.needs-account-setup .cc-submit {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  background: hsl(222.2 47.4% 11.2%);
  color: hsl(210 40% 98%);
  font-size: 16px;
  font-weight: 500;
}
.cc-submit:hover { background: hsl(222.2 47.4% 11.2% / .92); }

.cc-signup-row {
  margin-top: 32px;
  text-align: center;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 14px;
}
.cc-signup-row span { margin-right: 4px; }

.email-code-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid hsl(214.3 31.8% 91.4% / .8);
  border-radius: 14px;
  background: hsl(42 62% 96%);
}
.email-code-panel[hidden] { display: none !important; }
.email-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.email-code-row input { min-width: 0; }
.email-code-row button {
  height: 48px;
  white-space: nowrap;
  border-radius: 10px;
  padding: 0 14px;
}
.email-code-row button:not(.primary) {
  background: #111827;
  color: #fffaf0;
  border-color: #111827;
}
.compact-title {
  align-items: center;
  margin-bottom: 10px;
}
.compact-title span {
  display: block;
  margin-top: 4px;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 12px;
}
.inline-link {
  margin-top: 10px;
  width: auto;
}
.register-fields { margin-bottom: 12px; }
.register-fields .cc-submit { margin-top: 2px; }

.auth-pending .message,
.needs-account-setup .message {
  margin-top: 12px;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.register-mode .cc-login-box,
.needs-account-setup .cc-login-box,
.needs-account-setup #registerPanel,
.register-mode .cc-signup-row,
.needs-account-setup .cc-signup-row { display: none !important; }

.register-mode .cc-heading h1::before { content: "注册账号"; }
.register-mode .cc-heading h1 { font-size: 0; }
.register-mode .cc-heading h1::before { font-size: 30px; }
.register-mode .cc-heading p::before { content: "请在小程序完成授权"; font-size: 14px; }
.register-mode .cc-heading p { font-size: 0; }

.needs-account-setup .cc-heading h1::before { content: "设置账号"; }
.needs-account-setup .cc-heading h1 { font-size: 0; }
.needs-account-setup .cc-heading h1::before { font-size: 30px; }
.needs-account-setup .cc-heading p::before { content: "设置网页登录用户名和密码"; font-size: 14px; }
.needs-account-setup .cc-heading p { font-size: 0; }

.auth-pending .student-bind-row,
.needs-account-setup .student-bind-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.auth-pending .student-bind-row button,
.needs-account-setup .student-bind-row button {
  height: 48px;
  border-radius: 10px;
}
.auth-pending .student-bind-row button:first-child,
.needs-account-setup .student-bind-row button:first-child {
  background: hsl(222.2 47.4% 11.2%);
  color: white;
}

.auth-pending .browser-code,
.needs-account-setup .browser-code {
  border-color: hsl(214.3 31.8% 91.4%);
  border-radius: 10px;
  background: hsl(210 40% 98%);
}

.auth-pending .account-setup-grid,
.needs-account-setup .account-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@keyframes cc-purple-sway { 0%,100%{ transform: skewX(0deg); } 50%{ transform: skewX(-4deg); } }
@keyframes cc-black-sway { 0%,100%{ transform: skewX(0deg); } 50%{ transform: skewX(3deg); } }
@keyframes cc-orange-sway { 0%,100%{ transform: skewX(0deg); } 50%{ transform: skewX(-2deg); } }
@keyframes cc-yellow-sway { 0%,100%{ transform: skewX(0deg); } 50%{ transform: skewX(2deg); } }
@keyframes cc-look { 0%,100%{ transform: translate(0,0); } 50%{ transform: translate(3px,2px); } }
@keyframes cc-look-small { 0%,100%{ transform: translate(0,0); } 50%{ transform: translate(-3px,2px); } }

@media (max-width: 1024px) {
  .cc-auth-grid { grid-template-columns: 1fr; }
  .cc-auth-left { display: none; }
  .cc-mobile-brand { display: flex; }
  .cc-auth-page { max-height: none; overflow: auto; }
}

@media (max-width: 720px) {
  html,
  body.auth-pending,
  body.needs-account-setup {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-text-size-adjust: 100%;
    background: #fff;
  }

  .auth-pending input,
  .auth-pending button,
  .needs-account-setup input,
  .needs-account-setup button {
    touch-action: manipulation;
  }

  .auth-pending .app,
  .needs-account-setup .app {
    min-height: 100svh;
    height: 100dvh;
    overflow: hidden;
    background:
      radial-gradient(circle at 10% 9%, rgb(255 155 107 / .20), transparent 29%),
      radial-gradient(circle at 86% 12%, rgb(232 215 84 / .17), transparent 28%),
      radial-gradient(circle at 15% 92%, rgb(108 63 245 / .13), transparent 30%),
      radial-gradient(circle at 91% 87%, rgb(45 45 45 / .09), transparent 27%),
      #fff;
  }

  .auth-pending .content,
  .needs-account-setup .content {
    min-height: 100svh;
    height: 100dvh;
    overflow: hidden;
    padding:
      max(8px, env(safe-area-inset-top))
      max(9px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(9px, env(safe-area-inset-left));
  }

  .auth-pending .cc-auth-page,
  .needs-account-setup .cc-auth-page {
    position: relative;
    min-height: 100svh;
    height: 100dvh;
    max-height: none;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
    isolation: isolate;
    touch-action: none;
  }

  .auth-pending .cc-auth-page::before,
  .needs-account-setup .cc-auth-page::before {
    content: "";
    position: absolute;
    inset: 3px 2px 5px;
    z-index: 0;
    border: 1px solid rgb(17 24 39 / .055);
    border-radius: 28px;
    background: rgb(255 255 255 / .58);
    box-shadow: 0 18px 52px rgb(15 23 42 / .075);
    backdrop-filter: blur(16px);
  }

  .auth-pending .cc-auth-grid,
  .needs-account-setup .cc-auth-grid {
    position: relative;
    z-index: 1;
    min-height: 100%;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .auth-pending .cc-auth-left,
  .needs-account-setup .cc-auth-left {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;
    padding: 0;
    pointer-events: none;
    color: hsl(222.2 84% 4.9%);
    background: transparent;
  }

  .auth-pending .cc-auth-left::before,
  .auth-pending .cc-auth-left::after,
  .needs-account-setup .cc-auth-left::before,
  .needs-account-setup .cc-auth-left::after {
    display: none;
  }

  .auth-pending .cc-left-content,
  .needs-account-setup .cc-left-content {
    min-height: 100%;
    display: block;
  }

  .auth-pending .cc-brand,
  .needs-account-setup .cc-brand {
    position: absolute;
    top: clamp(13px, 2.4dvh, 20px);
    left: 20px;
    z-index: 4;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: -.01em;
    opacity: .9;
  }

  .auth-pending .cc-brand-logo,
  .needs-account-setup .cc-brand-logo {
    width: 27px;
    height: 27px;
    border-radius: 10px;
    background: rgb(17 24 39 / .055);
    box-shadow: 0 8px 18px rgb(15 23 42 / .06);
  }

  .auth-pending .cc-left-links,
  .needs-account-setup .cc-left-links {
    display: none;
  }

  .auth-pending .cc-auth-right,
  .needs-account-setup .cc-auth-right {
    position: relative;
    z-index: 3;
    width: 100%;
    min-height: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(74px, 11dvh, 96px) 0 clamp(66px, 10dvh, 92px);
    background: transparent;
  }

  .register-mode.auth-pending .cc-auth-right,
  .needs-account-setup .cc-auth-right {
    padding: clamp(70px, 10dvh, 92px) 0 clamp(70px, 10dvh, 96px);
  }

  .auth-pending .cc-form-wrap,
  .needs-account-setup .cc-form-wrap {
    width: min(88vw, 348px);
    max-width: none;
    margin: 0 auto;
    padding: 18px 17px 16px;
    border: 1px solid rgb(15 23 42 / .075);
    border-radius: 22px;
    background: rgb(255 255 255 / .93);
    box-shadow: 0 18px 46px rgb(15 23 42 / .115);
    backdrop-filter: blur(20px);
    transform: translateY(clamp(0px, 1dvh, 8px));
  }

  .register-mode.auth-pending .cc-form-wrap,
  .needs-account-setup .cc-form-wrap {
    transform: translateY(0);
  }

  .auth-pending .cc-mobile-brand,
  .needs-account-setup .cc-mobile-brand {
    display: none;
  }

  .auth-pending .cc-heading,
  .needs-account-setup .cc-heading {
    margin-bottom: 15px;
    text-align: left;
  }

  .auth-pending .cc-heading h1,
  .needs-account-setup .cc-heading h1 {
    margin-bottom: 6px;
    font-size: clamp(24px, 6.2vw, 28px);
    line-height: 1.08;
    letter-spacing: -.05em;
  }

  .auth-pending .cc-heading p,
  .needs-account-setup .cc-heading p {
    font-size: 13px;
    line-height: 1.35;
  }

  .register-mode.auth-pending .cc-heading h1,
  .needs-account-setup .cc-heading h1,
  .register-mode.auth-pending .cc-heading p,
  .needs-account-setup .cc-heading p {
    font-size: 0;
  }

  .register-mode.auth-pending .cc-heading h1::before {
    content: "注册账号";
    font-size: clamp(24px, 6.2vw, 28px);
  }

  .needs-account-setup .cc-heading h1::before {
    content: "设置账号";
    font-size: clamp(24px, 6.2vw, 28px);
  }

  .register-mode.auth-pending .cc-heading p::before,
  .needs-account-setup .cc-heading p::before {
    font-size: 13px;
    line-height: 1.35;
  }

  .auth-pending .cc-fields,
  .needs-account-setup .cc-fields {
    gap: 10px;
    margin-bottom: 12px;
  }

  .auth-pending .cc-fields label,
  .auth-pending .cc-account-panel label,
  .needs-account-setup .cc-fields label,
  .needs-account-setup .cc-account-panel label {
    gap: 6px;
    font-size: 13px;
  }

  .auth-pending .cc-fields input,
  .auth-pending .cc-account-panel input,
  .needs-account-setup .cc-fields input,
  .needs-account-setup .cc-account-panel input {
    height: 45px;
    border-radius: 14px;
    padding: 0 12px;
    font-size: 16px;
  }

  .auth-pending .password-field input,
  .needs-account-setup .password-field input {
    padding-right: 42px;
  }

  .auth-pending .password-toggle,
  .needs-account-setup .password-toggle {
    right: 10px;
    width: 27px;
    height: 27px;
  }

  .auth-pending .cc-submit,
  .needs-account-setup .cc-submit {
    height: 45px;
    border-radius: 15px;
    font-size: 15px;
  }

  .auth-pending .cc-remember-row,
  .needs-account-setup .cc-remember-row {
    align-items: center;
    margin-bottom: 12px;
  }

  .auth-pending .remember-check,
  .needs-account-setup .remember-check,
  .auth-pending .forgot-link,
  .needs-account-setup .forgot-link {
    font-size: 12.5px !important;
  }

  .auth-pending .remember-check input,
  .needs-account-setup .remember-check input {
    width: 15px;
    height: 15px;
  }

  .auth-pending .cc-signup-row,
  .needs-account-setup .cc-signup-row {
    margin-top: 15px;
    font-size: 13px;
  }

  .auth-pending .message,
  .needs-account-setup .message {
    min-height: 0;
    margin-top: 8px;
    font-size: 12.5px;
  }

  .auth-pending .cc-register-box,
  .needs-account-setup .cc-account-panel {
    padding: 0;
  }

  .auth-pending .mini-title,
  .needs-account-setup .mini-title {
    margin-bottom: 9px;
  }

  .auth-pending .student-bind-row,
  .needs-account-setup .student-bind-row,
  .auth-pending .account-setup-grid,
  .needs-account-setup .account-setup-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .auth-pending .student-bind-row button,
  .needs-account-setup .student-bind-row button {
    height: 42px;
    border-radius: 13px;
    padding: 0 12px;
  }

  .auth-pending .browser-login-panel,
  .needs-account-setup .browser-login-panel {
    gap: 8px;
    margin-bottom: 10px;
  }

  .auth-pending .browser-code,
  .needs-account-setup .browser-code {
    padding: 12px 10px;
    border-radius: 14px;
  }

  .auth-pending .browser-code span,
  .needs-account-setup .browser-code span {
    font-size: clamp(23px, 8vw, 30px);
    letter-spacing: .14em;
  }

  .auth-pending .cc-characters,
  .needs-account-setup .cc-characters {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    pointer-events: none;
    filter: drop-shadow(0 12px 18px rgb(15 23 42 / .08));
    transform: translateZ(0);
  }

  .auth-pending .cc-shape,
  .needs-account-setup .cc-shape {
    bottom: auto;
  }

  .auth-pending .cc-purple,
  .needs-account-setup .cc-purple {
    left: clamp(16px, 7vw, 34px);
    top: clamp(84px, 14dvh, 112px);
    bottom: auto;
    width: 64px;
    height: 124px;
    border-radius: 15px 15px 10px 10px;
    opacity: .9;
    transform: scale(.92) rotate(-6deg);
    animation: cc-purple-mobile-idle 5.8s ease-in-out infinite;
  }

  .auth-pending .cc-black,
  .needs-account-setup .cc-black {
    left: auto;
    right: clamp(15px, 6vw, 30px);
    top: clamp(104px, 17dvh, 138px);
    bottom: auto;
    width: 55px;
    height: 108px;
    border-radius: 14px 14px 10px 10px;
    opacity: .86;
    transform: scale(.9) rotate(5deg);
    animation: cc-black-mobile-idle 6.4s ease-in-out infinite .18s;
  }

  .auth-pending .cc-orange,
  .needs-account-setup .cc-orange {
    left: clamp(16px, 7vw, 38px);
    top: auto;
    bottom: clamp(42px, 7dvh, 68px);
    width: 92px;
    height: 70px;
    border-radius: 58px 58px 16px 16px;
    opacity: .92;
    transform: scale(.96) rotate(-4deg);
    animation: cc-orange-mobile-idle 5.9s ease-in-out infinite .1s;
  }

  .auth-pending .cc-yellow,
  .needs-account-setup .cc-yellow {
    left: auto;
    right: clamp(20px, 7vw, 42px);
    top: auto;
    bottom: clamp(38px, 6.6dvh, 64px);
    width: 66px;
    height: 94px;
    border-radius: 44px 44px 14px 14px;
    opacity: .9;
    transform: scale(.95) rotate(5deg);
    animation: cc-yellow-mobile-idle 5.4s ease-in-out infinite .22s;
  }

  .register-mode.auth-pending .cc-purple,
  .needs-account-setup .cc-purple {
    top: clamp(74px, 11dvh, 98px);
  }

  .register-mode.auth-pending .cc-black,
  .needs-account-setup .cc-black {
    top: clamp(88px, 13dvh, 116px);
  }

  .register-mode.auth-pending .cc-orange,
  .needs-account-setup .cc-orange {
    bottom: clamp(34px, 5.8dvh, 54px);
  }

  .register-mode.auth-pending .cc-yellow,
  .needs-account-setup .cc-yellow {
    bottom: clamp(31px, 5.3dvh, 50px);
  }

  .auth-pending .cc-eyes-purple,
  .needs-account-setup .cc-eyes-purple {
    left: 15px;
    top: 22px;
    gap: 10px;
  }

  .auth-pending .cc-eyes-black,
  .needs-account-setup .cc-eyes-black {
    left: 12px;
    top: 19px;
    gap: 9px;
  }

  .auth-pending .cc-eyes span,
  .needs-account-setup .cc-eyes span {
    width: 10px;
    height: 10px;
  }

  .auth-pending .cc-eyes-black span,
  .needs-account-setup .cc-eyes-black span {
    width: 9px;
    height: 9px;
  }

  .auth-pending .cc-eyes span::after,
  .needs-account-setup .cc-eyes span::after {
    left: 3px;
    top: 3px;
    width: 4px;
    height: 4px;
  }

  .auth-pending .cc-pupils-orange,
  .needs-account-setup .cc-pupils-orange {
    left: 34px;
    top: 33px;
    gap: 13px;
  }

  .auth-pending .cc-pupils-yellow,
  .needs-account-setup .cc-pupils-yellow {
    left: 24px;
    top: 21px;
    gap: 10px;
  }

  .auth-pending .cc-pupils span,
  .needs-account-setup .cc-pupils span {
    width: 7px;
    height: 7px;
  }

  .auth-pending .cc-mouth,
  .needs-account-setup .cc-mouth {
    left: 18px;
    top: 43px;
    width: 34px;
    height: 3px;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .auth-pending .content,
  .needs-account-setup .content {
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }

  .auth-pending .cc-auth-grid,
  .needs-account-setup .cc-auth-grid {
    min-height: 100%;
    padding: 0;
  }

  .auth-pending .cc-auth-right,
  .needs-account-setup .cc-auth-right {
    padding: clamp(62px, 9dvh, 76px) 0 clamp(54px, 8dvh, 72px);
  }

  .auth-pending .cc-form-wrap,
  .needs-account-setup .cc-form-wrap {
    padding: 16px 16px 15px;
  }

  .auth-pending .cc-heading,
  .needs-account-setup .cc-heading {
    margin-bottom: 12px;
  }

  .auth-pending .cc-fields,
  .needs-account-setup .cc-fields {
    gap: 9px;
  }

  .auth-pending .cc-left-links,
  .needs-account-setup .cc-left-links {
    display: none;
  }

  .auth-pending .cc-purple,
  .needs-account-setup .cc-purple {
    top: clamp(66px, 11dvh, 86px);
    width: 58px;
    height: 106px;
    opacity: .88;
    transform: scale(.88) rotate(-6deg);
  }

  .auth-pending .cc-black,
  .needs-account-setup .cc-black {
    top: clamp(78px, 12.5dvh, 100px);
    width: 50px;
    height: 94px;
    opacity: .84;
    transform: scale(.86) rotate(5deg);
  }

  .auth-pending .cc-orange,
  .needs-account-setup .cc-orange {
    display: block;
    bottom: clamp(22px, 4.2dvh, 34px);
    width: 82px;
    height: 60px;
    transform: scale(.9) rotate(-4deg);
  }

  .auth-pending .cc-yellow,
  .needs-account-setup .cc-yellow {
    display: block;
    bottom: clamp(21px, 4dvh, 32px);
    width: 58px;
    height: 80px;
    transform: scale(.88) rotate(5deg);
  }
}

/* CareerCompass character interactions. */
.cc-characters {
  --look-x: 0px;
  --look-y: 0px;
  --look-small-x: 0px;
  --look-small-y: 0px;
  --purple-skew: 0deg;
  --black-skew: 0deg;
  --orange-skew: 0deg;
  --yellow-skew: 0deg;
  --focus-lift: 0px;
  filter: drop-shadow(0 28px 45px rgb(15 23 42 / .08));
}

.cc-shape {
  transition:
    height .48s cubic-bezier(.34, 1.56, .64, 1),
    left .48s cubic-bezier(.34, 1.56, .64, 1),
    transform .48s cubic-bezier(.34, 1.56, .64, 1),
    border-radius .42s ease;
  will-change: transform, height;
}

.cc-purple {
  transform: skewX(var(--purple-skew)) translateY(var(--focus-lift));
  animation: cc-purple-idle 6.6s ease-in-out infinite;
}
.cc-black {
  transform: skewX(var(--black-skew)) translateY(calc(var(--focus-lift) * .45));
  animation: cc-black-idle 7.4s ease-in-out infinite .35s;
}
.cc-orange {
  transform: skewX(var(--orange-skew)) translateY(calc(var(--focus-lift) * .28));
  animation: cc-orange-idle 6.9s ease-in-out infinite .12s;
}
.cc-yellow {
  transform: skewX(var(--yellow-skew)) translateY(calc(var(--focus-lift) * .34));
  animation: cc-yellow-idle 7.1s ease-in-out infinite .26s;
}

.cc-eyes,
.cc-pupils {
  transition:
    left .36s cubic-bezier(.34, 1.56, .64, 1),
    top .36s cubic-bezier(.34, 1.56, .64, 1),
    transform .2s ease;
}

.cc-eyes span,
.cc-pupils span {
  transition:
    height .22s cubic-bezier(.34, 1.56, .64, 1),
    width .22s cubic-bezier(.34, 1.56, .64, 1),
    opacity .16s ease,
    transform .22s cubic-bezier(.34, 1.56, .64, 1),
    border-radius .22s ease;
}

.cc-eyes span::after {
  opacity: 1;
  transform: translate(var(--look-x), var(--look-y));
  animation: cc-blink-pupil 5.8s ease-in-out infinite;
  transition:
    opacity .14s ease,
    transform .16s ease-out;
}

.cc-pupils span {
  transform: translate(var(--look-small-x), var(--look-small-y));
  animation: cc-blink-dot 6.2s ease-in-out infinite .4s;
}

.cc-mouth {
  transition:
    width .32s cubic-bezier(.34, 1.56, .64, 1),
    height .32s cubic-bezier(.34, 1.56, .64, 1),
    left .32s cubic-bezier(.34, 1.56, .64, 1),
    top .32s cubic-bezier(.34, 1.56, .64, 1),
    border-radius .28s ease,
    transform .28s ease;
}

.cc-is-typing .cc-characters { --focus-lift: -4px; }
.cc-is-username .cc-purple {
  height: 420px;
  transform: skewX(calc(var(--purple-skew) - 5deg)) translateX(12px) translateY(-6px);
}
.cc-is-username .cc-black {
  transform: skewX(calc(var(--black-skew) + 4deg)) translateX(8px) translateY(-2px);
}
.cc-is-username .cc-eyes-purple { left: 54px; top: 46px; }
.cc-is-username .cc-eyes-black { left: 31px; top: 28px; }

.cc-is-password .cc-purple,
.cc-password-hidden .cc-purple {
  height: 438px;
  transform: skewX(calc(var(--purple-skew) - 10deg)) translateX(34px) translateY(-8px);
}
.cc-is-password .cc-black,
.cc-password-hidden .cc-black {
  transform: skewX(calc(var(--black-skew) + 6deg)) translateX(16px) translateY(-4px);
}
.cc-is-password .cc-eyes-purple,
.cc-password-hidden .cc-eyes-purple { left: 55px; top: 64px; }
.cc-is-password .cc-eyes-black,
.cc-password-hidden .cc-eyes-black { left: 31px; top: 22px; }

/* Hidden password: characters close eyes softly instead of collapsing into ugly blocks. */
.cc-password-hidden .cc-eyes span {
  width: 20px;
  height: 5px;
  border-radius: 999px;
  background: white;
  opacity: .96;
  transform: translateY(4px) rotate(-3deg);
}
.cc-password-hidden .cc-eyes-black span { width: 17px; height: 5px; }
.cc-password-hidden .cc-eyes span::after {
  opacity: 0;
  transform: translate(0, 0) scale(.2);
  animation: none;
}
.cc-password-hidden .cc-pupils span {
  width: 16px;
  height: 5px;
  border-radius: 999px;
  opacity: .9;
  transform: translateY(4px) rotate(2deg);
  animation: none;
}
.cc-password-hidden .cc-mouth {
  width: 66px;
  height: 4px;
  left: 44px;
  top: 92px;
  border-radius: 999px;
}

/* Visible password: characters peek open, matching the original playful login-page idea. */
.cc-password-visible .cc-purple,
.cc-password-visible .cc-black,
.cc-password-visible .cc-orange,
.cc-password-visible .cc-yellow {
  transform: skewX(0deg) translateY(-2px);
}
.cc-password-visible .cc-eyes-purple { left: 42px; top: 36px; }
.cc-password-visible .cc-eyes-black { left: 28px; top: 28px; }
.cc-password-visible .cc-pupils-orange { left: 76px; top: 84px; }
.cc-password-visible .cc-pupils-yellow { left: 44px; top: 36px; }
.cc-password-visible .cc-mouth {
  left: 36px;
  top: 88px;
  width: 74px;
  height: 5px;
  transform: rotate(-2deg);
}
.cc-password-visible .cc-eyes span,
.cc-password-visible .cc-pupils span {
  opacity: 1;
  animation-duration: 4.8s;
}
.cc-password-visible .cc-eyes span::after,
.cc-password-visible .cc-pupils span {
  opacity: 1;
  transform: translate(var(--look-x), var(--look-y));
}
.cc-password-visible .cc-purple .cc-eyes span::after,
.cc-password-visible .cc-black .cc-eyes span::after {
  animation: cc-peek-around 3.2s ease-in-out infinite;
}

@media (max-width: 720px) {
  /* Mobile auth character state overrides: keep the decorative figures compact while inputs animate. */
  .cc-is-username.auth-pending .cc-purple,
  .cc-is-password.auth-pending .cc-purple,
  .cc-password-hidden.auth-pending .cc-purple,
  .cc-password-visible.auth-pending .cc-purple,
  .cc-is-username.needs-account-setup .cc-purple,
  .cc-is-password.needs-account-setup .cc-purple,
  .cc-password-hidden.needs-account-setup .cc-purple,
  .cc-password-visible.needs-account-setup .cc-purple {
    height: 128px;
    animation: cc-purple-wave .86s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(.96) rotate(-4deg) translate(6px, -4px);
  }

  .cc-is-username.auth-pending .cc-black,
  .cc-is-password.auth-pending .cc-black,
  .cc-password-hidden.auth-pending .cc-black,
  .cc-password-visible.auth-pending .cc-black,
  .cc-is-username.needs-account-setup .cc-black,
  .cc-is-password.needs-account-setup .cc-black,
  .cc-password-hidden.needs-account-setup .cc-black,
  .cc-password-visible.needs-account-setup .cc-black {
    height: 110px;
    animation: cc-black-nod .82s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(.92) rotate(3deg) translate(-4px, -3px);
  }

  .cc-is-password.auth-pending .cc-orange,
  .cc-password-visible.auth-pending .cc-orange,
  .cc-password-hidden.auth-pending .cc-orange,
  .cc-is-password.needs-account-setup .cc-orange,
  .cc-password-visible.needs-account-setup .cc-orange,
  .cc-password-hidden.needs-account-setup .cc-orange {
    animation: cc-orange-bounce .88s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(1) rotate(-2deg) translate(4px, -5px);
  }

  .cc-is-password.auth-pending .cc-yellow,
  .cc-password-visible.auth-pending .cc-yellow,
  .cc-password-hidden.auth-pending .cc-yellow,
  .cc-is-password.needs-account-setup .cc-yellow,
  .cc-password-visible.needs-account-setup .cc-yellow,
  .cc-password-hidden.needs-account-setup .cc-yellow {
    animation: cc-yellow-curious .88s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(.98) rotate(2deg) translate(-5px, -5px);
  }

  .cc-is-submit.auth-pending .cc-yellow,
  .cc-is-submit.needs-account-setup .cc-yellow {
    animation: cc-yellow-celebrate .7s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(1.06) rotate(-2deg) translateY(-13px);
  }

  .cc-is-submit.auth-pending .cc-orange,
  .cc-is-submit.needs-account-setup .cc-orange {
    animation: cc-orange-bounce .7s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(1.04) rotate(2deg) translateY(-8px);
  }

  .cc-is-register-action.auth-pending .cc-orange,
  .cc-is-register-action.needs-account-setup .cc-orange {
    animation: cc-orange-bounce .76s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(1.08) rotate(-1deg) translate(10px, -10px);
  }

  .cc-is-register-action.auth-pending .cc-purple,
  .cc-is-register-action.needs-account-setup .cc-purple {
    animation: cc-purple-wave .8s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(.98) rotate(-1deg) translate(10px, -8px);
  }

  .cc-is-forgot.auth-pending .cc-black,
  .cc-is-forgot.needs-account-setup .cc-black {
    animation: cc-black-nod .86s cubic-bezier(.34, 1.56, .64, 1) both;
    transform: scale(.96) rotate(-3deg) translate(-8px, -6px);
  }

  .cc-is-eye-action.auth-pending .cc-purple,
  .cc-is-eye-action.needs-account-setup .cc-purple,
  .cc-is-eye-action.auth-pending .cc-black,
  .cc-is-eye-action.needs-account-setup .cc-black {
    animation: cc-black-nod .72s cubic-bezier(.34, 1.56, .64, 1) both;
  }

  .cc-is-password.auth-pending .cc-eyes-purple,
  .cc-password-hidden.auth-pending .cc-eyes-purple,
  .cc-password-visible.auth-pending .cc-eyes-purple,
  .cc-is-password.needs-account-setup .cc-eyes-purple,
  .cc-password-hidden.needs-account-setup .cc-eyes-purple,
  .cc-password-visible.needs-account-setup .cc-eyes-purple {
    left: 18px;
    top: 30px;
  }

  .cc-is-password.auth-pending .cc-eyes-black,
  .cc-password-hidden.auth-pending .cc-eyes-black,
  .cc-password-visible.auth-pending .cc-eyes-black,
  .cc-is-password.needs-account-setup .cc-eyes-black,
  .cc-password-hidden.needs-account-setup .cc-eyes-black,
  .cc-password-visible.needs-account-setup .cc-eyes-black {
    left: 16px;
    top: 24px;
  }

  .cc-password-hidden.auth-pending .cc-eyes span,
  .cc-password-hidden.needs-account-setup .cc-eyes span {
    width: 13px;
    height: 4px;
  }

  .cc-password-hidden.auth-pending .cc-pupils span,
  .cc-password-hidden.needs-account-setup .cc-pupils span {
    width: 9px;
    height: 4px;
  }
}

@keyframes cc-purple-idle {
  0%, 100% { transform: skewX(var(--purple-skew)) translateY(0); }
  42% { transform: skewX(calc(var(--purple-skew) - 1.8deg)) translateY(-7px); }
  70% { transform: skewX(calc(var(--purple-skew) + .8deg)) translateY(-2px); }
}
@keyframes cc-black-idle {
  0%, 100% { transform: skewX(var(--black-skew)) translateY(0); }
  38% { transform: skewX(calc(var(--black-skew) + 1.4deg)) translateY(-5px); }
  72% { transform: skewX(calc(var(--black-skew) - .8deg)) translateY(-1px); }
}
@keyframes cc-orange-idle {
  0%, 100% { transform: skewX(var(--orange-skew)) translateY(0); }
  46% { transform: skewX(calc(var(--orange-skew) - 1.1deg)) translateY(-4px); }
}
@keyframes cc-yellow-idle {
  0%, 100% { transform: skewX(var(--yellow-skew)) translateY(0); }
  50% { transform: skewX(calc(var(--yellow-skew) + 1.2deg)) translateY(-6px); }
}
@keyframes cc-blink-pupil {
  0%, 8%, 100% { opacity: 1; }
  4% { opacity: 0; }
}
@keyframes cc-blink-dot {
  0%, 9%, 100% { opacity: 1; transform: translate(var(--look-small-x), var(--look-small-y)) scaleY(1); }
  4% { opacity: .2; transform: translate(var(--look-small-x), var(--look-small-y)) scaleY(.18); }
}
@keyframes cc-peek-around {
  0%, 68%, 100% { transform: translate(5px, -1px); }
  78% { transform: translate(7px, 3px); }
  88% { transform: translate(3px, -4px); }
}

@keyframes cc-purple-mobile-idle {
  0%, 100% { transform: scale(.92) rotate(-6deg) translateY(0); }
  44% { transform: scale(.94) rotate(-4deg) translateY(-6px); }
  72% { transform: scale(.91) rotate(-7deg) translateY(-2px); }
}
@keyframes cc-black-mobile-idle {
  0%, 100% { transform: scale(.9) rotate(5deg) translateY(0); }
  40% { transform: scale(.91) rotate(2deg) translateY(-5px); }
  74% { transform: scale(.89) rotate(7deg) translateY(-1px); }
}
@keyframes cc-orange-mobile-idle {
  0%, 100% { transform: scale(.96) rotate(-4deg) translateY(0); }
  45% { transform: scale(1) rotate(-2deg) translateY(-7px); }
  76% { transform: scale(.97) rotate(-5deg) translateY(-2px); }
}
@keyframes cc-yellow-mobile-idle {
  0%, 100% { transform: scale(.95) rotate(5deg) translateY(0); }
  48% { transform: scale(.98) rotate(2deg) translateY(-8px); }
  76% { transform: scale(.94) rotate(7deg) translateY(-2px); }
}
@keyframes cc-yellow-celebrate {
  0% { transform: scale(.95) rotate(5deg) translateY(0); }
  38% { transform: scale(1.12) rotate(-7deg) translateY(-18px); }
  68% { transform: scale(1.03) rotate(4deg) translateY(-10px); }
  100% { transform: scale(1.06) rotate(-2deg) translateY(-13px); }
}
@keyframes cc-orange-bounce {
  0% { transform: scale(.96) rotate(-4deg) translateY(0); }
  42% { transform: scale(1.1) rotate(3deg) translateY(-14px); }
  70% { transform: scale(1.02) rotate(-5deg) translateY(-6px); }
  100% { transform: scale(1.04) rotate(2deg) translateY(-8px); }
}
@keyframes cc-black-nod {
  0% { transform: scale(.9) rotate(5deg) translateY(0); }
  40% { transform: scale(.96) rotate(-4deg) translateY(-8px); }
  100% { transform: scale(.94) rotate(1deg) translateY(-4px); }
}
@keyframes cc-purple-wave {
  0% { transform: scale(.92) rotate(-6deg) translateY(0); }
  35% { transform: scale(1) rotate(2deg) translate(10px, -12px); }
  70% { transform: scale(.97) rotate(-9deg) translate(4px, -5px); }
  100% { transform: scale(.98) rotate(-3deg) translate(6px, -7px); }
}
@keyframes cc-yellow-curious {
  0% { transform: scale(.95) rotate(5deg) translateY(0); }
  45% { transform: scale(1.02) rotate(-4deg) translate(-7px, -11px); }
  100% { transform: scale(.98) rotate(2deg) translate(-5px, -5px); }
}

/* Mobile facial detail fixes: keep eyes, mouth, and blush inside each tiny character after keyboard resize. */
@media (max-width: 720px) {
  .auth-pending .cc-yellow,
  .needs-account-setup .cc-yellow {
    overflow: hidden;
  }

  .auth-pending .cc-eyes-purple,
  .needs-account-setup .cc-eyes-purple {
    left: 14px;
    top: 25px;
    gap: 7px;
  }

  .auth-pending .cc-eyes-black,
  .needs-account-setup .cc-eyes-black {
    left: 11px;
    top: 22px;
    gap: 7px;
  }

  .auth-pending .cc-eyes span,
  .needs-account-setup .cc-eyes span,
  .auth-pending .cc-pupils span,
  .needs-account-setup .cc-pupils span {
    overflow: hidden;
  }

  .auth-pending .cc-eyes span,
  .needs-account-setup .cc-eyes span {
    width: 9px;
    height: 9px;
  }

  .auth-pending .cc-eyes-black span,
  .needs-account-setup .cc-eyes-black span {
    width: 8px;
    height: 8px;
  }

  .auth-pending .cc-eyes span::after,
  .needs-account-setup .cc-eyes span::after {
    left: 2.5px;
    top: 2.5px;
    width: 4px;
    height: 4px;
    animation: cc-mobile-blink-pupil 5.8s ease-in-out infinite;
    transform: translate(clamp(-2px, var(--look-x), 2px), clamp(-2px, var(--look-y), 2px));
  }

  .auth-pending .cc-eyes-black span::after,
  .needs-account-setup .cc-eyes-black span::after {
    left: 2px;
    top: 2px;
    width: 4px;
    height: 4px;
  }

  .auth-pending .cc-pupils span,
  .needs-account-setup .cc-pupils span {
    animation: cc-mobile-blink-dot 6.2s ease-in-out infinite .4s;
    transform: translate(clamp(-2px, var(--look-small-x), 2px), clamp(-2px, var(--look-small-y), 2px));
  }

  .auth-pending .cc-black::before,
  .needs-account-setup .cc-black::before {
    display: none;
  }

  .auth-pending .cc-black::after,
  .needs-account-setup .cc-black::after {
    left: 18px;
    right: auto;
    bottom: auto;
    top: 62px;
    width: 24px;
    height: 3px;
    border: 0;
    border-radius: 999px;
    background: rgb(255 255 255 / .42);
    opacity: .82;
    transform: rotate(2deg);
  }

  .auth-pending .cc-yellow::after,
  .needs-account-setup .cc-yellow::after {
    left: 16px;
    top: 58px;
    width: 13px;
    height: 8px;
    border-radius: 999px;
    background: rgb(255 155 107 / .36);
    box-shadow: 24px 0 0 rgb(255 155 107 / .30);
  }

  .auth-pending .cc-orange::after,
  .needs-account-setup .cc-orange::after {
    left: 33px;
    top: 46px;
    width: 28px;
    height: 7px;
    border-bottom-width: 3px;
  }

  .cc-is-password.auth-pending .cc-mouth,
  .cc-password-hidden.auth-pending .cc-mouth,
  .cc-password-visible.auth-pending .cc-mouth,
  .cc-is-password.needs-account-setup .cc-mouth,
  .cc-password-hidden.needs-account-setup .cc-mouth,
  .cc-password-visible.needs-account-setup .cc-mouth {
    left: 16px;
    top: 49px;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    transform: none;
  }

  .cc-is-password.auth-pending .cc-eyes-purple,
  .cc-password-hidden.auth-pending .cc-eyes-purple,
  .cc-password-visible.auth-pending .cc-eyes-purple,
  .cc-is-password.needs-account-setup .cc-eyes-purple,
  .cc-password-hidden.needs-account-setup .cc-eyes-purple,
  .cc-password-visible.needs-account-setup .cc-eyes-purple {
    left: 13px;
    top: 28px;
    gap: 7px;
  }

  .cc-is-password.auth-pending .cc-eyes-black,
  .cc-password-hidden.auth-pending .cc-eyes-black,
  .cc-password-visible.auth-pending .cc-eyes-black,
  .cc-is-password.needs-account-setup .cc-eyes-black,
  .cc-password-hidden.needs-account-setup .cc-eyes-black,
  .cc-password-visible.needs-account-setup .cc-eyes-black {
    left: 12px;
    top: 23px;
    gap: 7px;
  }

  .cc-password-hidden.auth-pending .cc-eyes span,
  .cc-password-hidden.needs-account-setup .cc-eyes span {
    width: 11px;
    height: 4px;
    transform: translateY(2px) rotate(-2deg);
  }

  .cc-password-hidden.auth-pending .cc-eyes-black span,
  .cc-password-hidden.needs-account-setup .cc-eyes-black span {
    width: 10px;
    height: 4px;
  }

  .cc-password-visible.auth-pending .cc-purple .cc-eyes span::after,
  .cc-password-visible.auth-pending .cc-black .cc-eyes span::after,
  .cc-password-visible.needs-account-setup .cc-purple .cc-eyes span::after,
  .cc-password-visible.needs-account-setup .cc-black .cc-eyes span::after {
    animation: cc-mobile-peek-around 3.2s ease-in-out infinite;
  }

  @keyframes cc-mobile-blink-pupil {
    0%, 8%, 100% {
      opacity: 1;
      transform: translate(clamp(-2px, var(--look-x), 2px), clamp(-2px, var(--look-y), 2px)) scaleY(1);
    }
    4% {
      opacity: .12;
      transform: translate(clamp(-2px, var(--look-x), 2px), clamp(-2px, var(--look-y), 2px)) scaleY(.2);
    }
  }

  @keyframes cc-mobile-blink-dot {
    0%, 9%, 100% {
      opacity: 1;
      transform: translate(clamp(-2px, var(--look-small-x), 2px), clamp(-2px, var(--look-small-y), 2px)) scaleY(1);
    }
    4% {
      opacity: .2;
      transform: translate(clamp(-2px, var(--look-small-x), 2px), clamp(-2px, var(--look-small-y), 2px)) scaleY(.18);
    }
  }

  @keyframes cc-mobile-peek-around {
    0%, 68%, 100% { transform: translate(1px, 0); }
    78% { transform: translate(2px, 1px); }
    88% { transform: translate(0, -1px); }
  }
}


/* Hide login/register page after successful student/admin login. */
.auth-ready:not(.needs-account-setup) #student {
  display: none !important;
}

/* Auth page hard hidden state. */
#student[hidden] {
  display: none !important;
}
nav a[hidden] {
  display: none !important;
}

/* Eye-only password toggle: one clean icon, no text, no duplicated pseudo-eye states. */
.password-field { position: relative; display: block; }
.password-field input {
  padding-right: 54px;
  -webkit-text-security: initial;
}
.password-field input::-ms-reveal,
.password-field input::-ms-clear { display: none; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, color .18s ease, transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
.password-toggle:hover {
  background: hsl(210 40% 96.1%);
  color: hsl(222.2 84% 4.9%);
}
.password-toggle:active { transform: translateY(-50%) scale(.92); }
.password-toggle:focus-visible {
  outline: 2px solid hsl(222.2 47.4% 11.2% / .35);
  outline-offset: 2px;
}
.eye-icon {
  position: relative;
  width: 21px;
  height: 14px;
  display: block;
  color: currentColor;
  transform: translateZ(0);
}
.eye-icon::before,
.eye-icon::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
/* Open eye body. */
.eye-icon::before {
  inset: 1px 0;
  border: 2px solid currentColor;
  border-radius: 70% 70% 64% 64% / 80% 80% 60% 60%;
  background:
    radial-gradient(circle at 50% 50%, currentColor 0 3px, transparent 3.4px);
  opacity: 1;
  transform: scaleY(1) rotate(0deg);
  transition: opacity .16s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1), border-radius .2s ease;
}
/* Closed eyelid. */
.eye-icon::after {
  left: 1px;
  right: 1px;
  top: 7px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 999px 999px;
  opacity: 0;
  transform: translateY(-2px) scaleX(.65) rotate(-2deg);
  transition: opacity .16s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
/* aria-pressed=false: password is hidden, so show closed eye. */
.password-toggle[aria-pressed="false"] .eye-icon::before {
  opacity: 0;
  transform: scaleY(.12) rotate(-2deg);
}
.password-toggle[aria-pressed="false"] .eye-icon::after {
  opacity: 1;
  transform: translateY(-2px) scaleX(1) rotate(-2deg);
}
/* aria-pressed=true: password is visible, so show open eye. */
.password-toggle[aria-pressed="true"] .eye-icon::before {
  opacity: 1;
  transform: scaleY(1) rotate(0deg);
}
.password-toggle[aria-pressed="true"] .eye-icon::after {
  opacity: 0;
  transform: translateY(-2px) scaleX(.65) rotate(-2deg);
}

@media (prefers-reduced-motion: reduce) {
  .cc-purple,
  .cc-black,
  .cc-orange,
  .cc-yellow,
  .cc-eyes span::after,
  .cc-pupils span,
  .cc-password-visible .cc-purple .cc-eyes span::after,
  .cc-password-visible .cc-black .cc-eyes span::after {
    animation: none !important;
  }
  .cc-shape,
  .cc-eyes,
  .cc-pupils,
  .cc-eyes span,
  .cc-pupils span,
  .password-toggle,
  .eye-icon::before,
  .eye-icon::after {
    transition: none !important;
  }
}

/* Schedule page: compact course-table planner. */
.schedule-calendar-card {
  min-height: calc(100vh - 116px);
  padding: 20px;
  overflow: visible;
}
.schedule-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
}
.schedule-head .section-subtitle { max-width: 580px; }
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.schedule-toolbar input {
  width: 158px;
  height: 38px;
  padding: 9px 11px;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 750;
}
.schedule-toolbar button {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.schedule-toolbar .primary { box-shadow: none; }
.schedule-message {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
}
.schedule-message:empty { display: none; }
.schedule-message.bad {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
.schedule-message.ok {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}
.schedule-day-table {
  --schedule-hour-height: 52px;
  overflow: visible;
  border: 1px solid #e6e9ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .045);
}
.schedule-day-topbar {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  height: 38px;
  padding: 0 16px 0 0;
  border-bottom: 1px solid #e6e9ef;
  background: #fbfcfd;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .035em;
}
.schedule-day-topbar span {
  padding-right: 13px;
  text-align: right;
}
.schedule-day-topbar strong { color: #0f172a; }
.schedule-grid {
  display: grid;
  min-height: auto;
  height: auto;
  padding-bottom: 0;
  background: #fff;
}
.schedule-hour-slot {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: var(--schedule-hour-height);
  border-top: 1px solid rgba(226, 232, 240, .72);
  background: linear-gradient(90deg, #f8fafc 0 76px, transparent 76px);
}
.schedule-hour-slot:first-child { border-top: 0; }
.schedule-hour-terminal {
  min-height: 34px;
  border-bottom: 0;
}
.schedule-hour-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}
.schedule-slot-events {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  min-width: 0;
  padding: 7px 10px;
  border-left: 1px solid #e6e9ef;
}
.schedule-slot-empty {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}
.schedule-block {
  --schedule-width: 56;
  --schedule-bg: #eff6ff;
  --schedule-border: #bfdbfe;
  --schedule-accent: #60a5fa;
  --schedule-text: #1e3a5f;
  --schedule-muted: #647b99;
  position: relative;
  width: min(var(--schedule-card-width, calc(var(--schedule-width) * 1%)), 520px);
  max-width: 100%;
  min-width: min(260px, 100%);
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 32px;
  padding: 6px 10px 6px 11px;
  overflow: hidden;
  border: 1px solid var(--schedule-border);
  border-left: 4px solid var(--schedule-accent);
  border-radius: 12px;
  background: var(--schedule-bg);
  color: var(--schedule-text);
  box-shadow: none;
  transition: transform .16s ease, border-color .16s ease, filter .16s ease;
}
.schedule-block:hover {
  transform: translateY(-1px);
  filter: saturate(1.02) brightness(.995);
}
.schedule-block strong {
  min-width: 0;
  overflow: hidden;
  color: var(--schedule-text);
  font-size: 12px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-block-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}
.schedule-block-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.schedule-block-meta,
.schedule-block-time {
  overflow: hidden;
  color: var(--schedule-muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-block-time {
  flex: 0 0 auto;
  color: var(--schedule-accent);
  font-size: 11px;
  font-weight: 950;
}
.schedule-block-meta {
  display: block;
  min-width: 0;
}
.schedule-block-type {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .64);
  color: var(--schedule-text);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}
.schedule-block.school {
  --schedule-width: 58;
  --schedule-bg: #eef4ff;
  --schedule-border: #cfdcf6;
  --schedule-accent: #8aa7db;
  --schedule-text: #263a63;
  --schedule-muted: #7583a1;
}
.schedule-block.deadline,
.schedule-block.important {
  --schedule-width: 48;
  --schedule-bg: #fff4dc;
  --schedule-border: #f3d79b;
  --schedule-accent: #d1a253;
  --schedule-text: #5b4420;
  --schedule-muted: #8a7651;
}
.schedule-block.deadline {
  --schedule-width: 46;
  --schedule-bg: #ffecea;
  --schedule-border: #f1c7c1;
  --schedule-accent: #d9897d;
  --schedule-text: #65312d;
  --schedule-muted: #96645f;
}
.schedule-block.notice {
  --schedule-width: 54;
  --schedule-bg: #f0f7ff;
  --schedule-border: #cfe6ff;
  --schedule-accent: #7bb7f0;
  --schedule-text: #244463;
  --schedule-muted: #6b8298;
}
.schedule-block.conflict {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .12);
}
.schedule-empty {
  position: relative;
  margin: 12px;
  padding: 13px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: rgba(255,255,255,.86);
}
.schedule-floating-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  min-width: 0;
  gap: 9px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #eff6ff;
}
.schedule-floating-items:empty { display: none; }
.floating-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}
.floating-title strong {
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
}
.floating-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  gap: 5px 9px;
  align-items: center;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid #dbeafe;
  border-radius: 13px;
  background: rgba(255, 255, 255, .82);
}
.floating-item strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}
.floating-item small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.schedule-form-title { grid-column: 1 / -1; }
.schedule-form-action {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 138px;
}
.schedule-form-wide { grid-column: span 2; }
.schedule-import-grid {
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: end;
}
.schedule-import-grid .schedule-form-wide { grid-column: 1 / -1; }
.schedule-textarea-label textarea {
  min-height: 150px;
  resize: vertical;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  font: inherit;
}
.schedule-textarea-label textarea:focus { border-color: var(--green); }
.modal-open { overflow: hidden; }
.modal-shell[hidden] { display: none !important; }
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 34px 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(12px);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 68px));
  overflow: auto;
  padding: 24px 26px 26px;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 38px 110px rgba(15, 23, 42, .28);
  animation: modal-pop .18s cubic-bezier(.34, 1.56, .64, 1) both;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
.modal-close:hover {
  background: #e2e8f0;
  color: #111827;
  transform: rotate(6deg);
}
.email-source-panel {
  width: min(780px, calc(100vw - 40px));
}
.policy-panel {
  width: min(680px, calc(100vw - 40px));
}
.policy-content {
  display: grid;
  gap: 14px;
}
.policy-content section {
  padding: 14px 15px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
}
.policy-content h3 {
  margin: 0 0 7px;
  color: #111827;
  font-size: 15px;
  line-height: 1.25;
}
.policy-content p {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.75;
}
.email-source-body {
  max-height: min(56vh, 520px);
  overflow: auto;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
  color: #1f2937;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 860px) {
  .schedule-calendar-card { padding: 18px; }
  .schedule-head { grid-template-columns: 1fr; align-items: start; }
  .schedule-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }
  .schedule-toolbar input { grid-column: 1 / -1; }
  .schedule-toolbar input,
  .schedule-toolbar button { width: 100%; }
  .schedule-day-topbar { grid-template-columns: 64px 1fr; }
  .schedule-hour-slot {
    grid-template-columns: 64px minmax(0, 1fr);
    background: linear-gradient(90deg, #f8fafc 0 64px, transparent 64px);
  }
  .schedule-hour-label {
    padding-right: 9px;
    font-size: 11px;
  }
  .schedule-slot-events {
    padding: 7px 9px;
  }
  .schedule-block {
    width: min(var(--schedule-card-width, calc(var(--schedule-width) * 1%)), 100%);
    min-width: min(245px, 100%);
    padding: 7px 9px;
  }
  .schedule-floating-items { grid-template-columns: 1fr; }
  .schedule-form-grid,
  .schedule-import-grid { grid-template-columns: 1fr; }
  .schedule-form-title,
  .schedule-form-wide { grid-column: auto; }
  .schedule-form-action { width: 100%; justify-self: stretch; }
  .modal-shell { padding: 14px; align-items: end; }
  .modal-panel { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; }
}

/* Mobile dashboard adaptation: app-like shell after login. */
@media (max-width: 720px) {
  html.dashboard-ready,
  html:has(body.auth-ready:not(.auth-pending):not(.needs-account-setup)) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.auth-ready:not(.auth-pending):not(.needs-account-setup) {
    background:
      radial-gradient(circle at 16% 0%, rgba(96, 165, 250, .12), transparent 34%),
      linear-gradient(180deg, #f8fbfa 0%, #f4f6f8 100%);
    height: auto;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .app {
    display: block;
    min-height: 100svh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: visible;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    top: auto;
    z-index: 1200;
    height: auto;
    padding: 8px;
    border: 1px solid rgba(226, 232, 240, .82);
    border-radius: 24px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16);
    backdrop-filter: blur(18px);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .sidebar .brand {
    display: none;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a {
    position: relative;
    min-height: 50px;
    padding: 27px 6px 7px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: -.01em;
    transition: background .18s ease, color .18s ease, transform .18s ease;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 17px;
    height: 17px;
    transform: translateX(-50%);
    border-radius: 7px;
    background: currentColor;
    opacity: .78;
    box-shadow: inset 0 -5px 0 rgba(255, 255, 255, .35);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a[data-page="schedule"]::before {
    border-radius: 5px;
    background:
      linear-gradient(currentColor 0 0) center 7px / 11px 2px no-repeat,
      linear-gradient(currentColor 0 0) center 12px / 11px 2px no-repeat,
      currentColor;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a[data-page="mail-settings"]::before {
    border-radius: 999px;
    background:
      radial-gradient(circle at 50% 50%, rgba(255,255,255,.86) 0 3px, transparent 3.5px),
      currentColor;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a.active {
    background: #0f172a;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, .18);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .content {
    width: 100%;
    max-width: none;
    min-width: 0;
    overflow-x: hidden;
    padding: 8px 12px 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .topbar {
    position: relative;
    top: 0;
    z-index: 900;
    display: flex;
    min-height: auto;
    margin: 0 0 10px;
    padding: 6px 2px 0;
    align-items: center;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .topbar h1 {
    font-size: 22px;
    line-height: 1.05;
    letter-spacing: -.04em;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .page-panel {
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 12px;
    padding: 16px;
    border-color: rgba(226, 232, 240, .9);
    border-radius: 22px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .06);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .card-head {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) h2 {
    font-size: 20px;
    line-height: 1.1;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .section-subtitle {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .actions {
    gap: 8px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .actions.compact {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .actions.compact button {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 13px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-dashboard-card,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-calendar-card {
    min-height: auto;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-list {
    gap: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight {
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .04);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-title {
    font-size: 15px;
    line-height: 1.32;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-meta {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .badge {
    min-height: 23px;
    padding: 0 9px;
    font-size: 11px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-summary,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-details {
    font-size: 13px;
    line-height: 1.55;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-actions button {
    width: 100%;
    min-height: 38px;
    border-radius: 13px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-calendar-card {
    padding: 14px 13px 15px;
    overflow: visible;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head {
    gap: 13px;
    margin: -2px -1px 12px;
    padding: 14px;
    border: 0;
    border-radius: 20px;
    background:
      radial-gradient(circle at 12% 0%, rgba(96, 165, 250, .14), transparent 36%),
      #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, .82);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head h2 {
    font-size: 22px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head .section-subtitle {
    max-width: 28em;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 1px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar input,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar button {
    width: 100%;
    min-height: 38px;
    padding: 8px 8px;
    border-radius: 999px;
    font-size: 12px;
    box-shadow: none;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar input {
    grid-column: 1 / -1;
    height: 40px;
    border-color: rgba(203, 213, 225, .85);
    border-radius: 15px;
    background: #fff;
    color: #0f172a;
    font-weight: 800;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar .primary {
    background: #0f172a;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-message {
    margin-bottom: 10px;
    padding: 9px 10px;
    border-radius: 14px;
    font-size: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-day-table {
    --schedule-hour-height: 46px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: 18px;
    overflow: visible;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-day-topbar,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-grid,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-floating-items {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-day-topbar {
    grid-template-columns: 46px minmax(0, 1fr);
    height: 36px;
    padding-right: 8px;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-day-topbar span {
    padding-right: 6px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-grid {
    display: grid;
    height: auto;
    min-height: auto;
    background: #fff;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-hour-slot {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: var(--schedule-hour-height);
    background: linear-gradient(90deg, #f8fafc 0 46px, transparent 46px);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-hour-label {
    padding-right: 5px;
    font-size: 9px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-slot-events {
    padding: 6px 7px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block {
    width: min(var(--schedule-card-width, calc(var(--schedule-width) * 1%)), 100%);
    max-width: 100%;
    min-width: min(205px, 100%);
    min-height: 30px;
    padding: 6px 7px 6px 8px;
    border-left-width: 4px;
    border-radius: 11px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block-main {
    display: flex;
    gap: 5px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block-footer {
    gap: 4px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block strong {
    font-size: 11px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block-time {
    font-size: 10px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block-meta,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-block-type {
    font-size: 9px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-empty {
    margin: 10px;
    padding: 12px;
    font-size: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-floating-items {
    grid-template-columns: 1fr;
    margin-bottom: 12px;
    padding: 10px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .floating-item {
    grid-template-columns: 1fr;
    min-width: 0;
    gap: 6px;
    padding: 11px 12px;
    overflow: hidden;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .floating-item small {
    grid-column: auto;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mailSettingsPage {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mailSettingsPage .card-head {
    align-items: start;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card {
    margin-left: 0;
    margin-right: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .mail-config-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .settings-grid {
    gap: 12px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .settings-account-card {
    padding: 18px 16px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account-setting-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account-setting-row button {
    width: 100%;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .mail-account-summary {
    min-height: 124px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    min-width: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card label,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card input,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card select {
    min-width: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .mail-field-limit {
    max-width: none;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .exchange-card .actions button {
    width: 100%;
    min-height: 40px;
    border-radius: 13px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account {
    display: grid;
    gap: 12px;
    padding: 14px 13px;
    border-radius: 18px;
    justify-items: stretch;
    text-align: left;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account > div:first-child {
    min-width: 0;
    width: 100%;
    justify-self: start;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account span {
    margin-top: 5px;
    max-width: 100%;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .account-actions button {
    width: 100%;
    min-height: 38px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .modal-shell {
    align-items: end;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .modal-panel {
    width: 100%;
    max-height: min(86svh, 720px);
    padding: 18px 16px 20px;
    border-radius: 24px 24px 0 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .modal-head {
    gap: 10px;
    margin-bottom: 14px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-form-grid,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-import-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-form-title,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-form-wide {
    grid-column: auto;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-form-action {
    width: 100%;
    justify-self: stretch;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .email-source-body {
    max-height: 58svh;
    padding: 13px;
    font-size: 12px;
  }
}

/* Public student toolbox page. Keep the same deployed card/sidebar language. */
.student-tools-card { min-height: calc(100vh - 116px); }
.tools-head { align-items: flex-start; }
.tools-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 58%, #eff6ff 100%);
}
.tools-hero strong { display: block; font-size: 19px; letter-spacing: -.02em; }
.tools-hero p { margin-top: 6px; max-width: 620px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.tools-hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tool-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: #eef0f2;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}
.tool-action.primary { background: #111827; color: #fff; }
.tools-section { margin-top: 18px; }
.tools-section-head { margin-bottom: 12px; }
.tools-section-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.tools-section-head p { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tool-link {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.tool-link:hover { transform: translateY(-2px); border-color: #cbd5e1; box-shadow: 0 14px 32px rgba(15, 23, 42, .08); }
.tool-link strong { font-size: 15px; letter-spacing: -.01em; }
.tool-link span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.tools-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.soft-panel { margin-top: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fafafa; }
.tool-mini-list { display: grid; gap: 8px; }
.tool-mini-list a {
  display: block;
  padding: 11px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}
.tool-mini-list a:hover { color: var(--text); border-color: #cbd5e1; }

@media (max-width: 980px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .tools-hero { display: grid; }
  .tools-hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav a[data-page="tools"]::before {
    border-radius: 5px;
    background:
      linear-gradient(currentColor 0 0) 4px 4px / 4px 4px no-repeat,
      linear-gradient(currentColor 0 0) 10px 4px / 4px 4px no-repeat,
      linear-gradient(currentColor 0 0) 4px 10px / 4px 4px no-repeat,
      linear-gradient(currentColor 0 0) 10px 10px / 4px 4px no-repeat,
      currentColor;
  }
}

/* Pubao floating mail assistant. Minimal Doubao-like chat, matching deployed white-card language. */
.pubao-widget[hidden], .pubao-hidden-on-page { display: none !important; }
.pubao-widget {
  position: fixed;
  right: 48px;
  bottom: 76px;
  z-index: 2400;
  pointer-events: none;
}
.pubao-bubble {
  width: auto;
  height: 56px;
  min-width: 116px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(229, 231, 235, .95);
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, .96);
  color: #111827;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .16);
  pointer-events: auto;
  transition: transform .22s ease, box-shadow .22s ease, opacity .18s ease, border-color .18s ease;
}
.pubao-bubble:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 24, 39, .16);
  box-shadow: 0 24px 58px rgba(15, 23, 42, .20);
}
.pubao-bubble-orb {
  width: 40px;
  height: 40px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.06em;
}
.pubao-bubble-copy {
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.15;
}
.pubao-bubble-copy strong { font-size: 14px; letter-spacing: -.02em; }
.pubao-bubble-copy small { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .06em; }
.pubao-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 126px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(229, 231, 235, .96);
  border-radius: 24px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .18);
  transform-origin: right bottom;
  animation: pubao-pop .22s cubic-bezier(.2, .8, .2, 1) both;
  pointer-events: auto;
}
.pubao-panel[hidden] { display: none !important; }
@keyframes pubao-pop {
  from { opacity: 0; transform: translate(16px, 16px) scale(.18); border-radius: 999px; }
  to { opacity: 1; transform: translate(0, 0) scale(1); border-radius: 24px; }
}
.pubao-open .pubao-bubble { opacity: .18; transform: scale(.88); pointer-events: none; }
.pubao-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.pubao-title, .assistant-page-head { display: flex; align-items: center; gap: 11px; }
.pubao-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-weight: 950;
  letter-spacing: -.06em;
}
.pubao-title strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.pubao-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.pubao-head-actions { display: flex; align-items: center; gap: 6px; }
.pubao-page-link, .pubao-close {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}
.pubao-close { font-size: 22px; line-height: 1; }
.pubao-quick-prompts {
  display: flex;
  gap: 8px;
  padding: 12px 14px 4px;
  overflow-x: auto;
}
.pubao-quick-prompts button,
.assistant-suggestion-row button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 850;
}
.assistant-suggestion-row button { background: #f8fafc; }
.pubao-quick-prompts button:hover,
.assistant-suggestion-row button:hover { background: #f3f4f6; color: #111827; }
.pubao-messages {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  scroll-behavior: smooth;
}
.pubao-message {
  max-width: 88%;
  display: grid;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 17px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: normal;
}
.pubao-message.ai { align-self: flex-start; background: #f6f7f9; color: #111827; border-top-left-radius: 7px; }
.pubao-message.user { align-self: flex-end; background: #111827; color: #fff; border-top-right-radius: 7px; }
.pubao-message.loading { color: var(--muted); }
.pubao-sources { display: grid; gap: 7px; }
.pubao-sources button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  text-align: left;
}
.pubao-sources strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pubao-sources span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pubao-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid #f1f5f9;
  background: #fff;
}
.pubao-input-row textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px 12px;
  outline: none;
  font: inherit;
  line-height: 1.5;
}
.pubao-input-row textarea:focus { border-color: var(--green); }
.pubao-input-row button { min-width: 68px; border-radius: 15px; }
.assistant-page-panel { justify-items: center; }
.assistant-page-card {
  width: 100%;
  max-width: 920px;
  min-height: min(720px, calc(100vh - 116px));
  display: grid;
  padding: 0;
  overflow: hidden;
}
.assistant-page-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: min(720px, calc(100vh - 116px));
  background: #fff;
}
.assistant-page-hero {
  padding: 24px 26px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}
.assistant-page-head {
  padding-bottom: 0;
  border-bottom: 0;
}
.assistant-page-head h2 { font-size: 22px; }
.assistant-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.pubao-page-messages {
  order: 2;
  padding: 20px 26px;
  min-height: 0;
  overflow-y: auto;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(180deg, rgba(248, 250, 252, .9), rgba(255, 255, 255, 0)) border-box;
}
.pubao-page-messages .pubao-message { max-width: min(680px, 90%); }
.assistant-page-input {
  position: sticky;
  bottom: 0;
  order: 3;
  z-index: 30;
  margin: 0 24px 24px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(18px);
  box-shadow: 0 -14px 35px rgba(15, 23, 42, .07);
}

@media (max-width: 860px) {
  .auth-ready:not(.auth-pending):not(.needs-account-setup) #mainNav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .pubao-widget { right: 24px; bottom: calc(118px + env(safe-area-inset-bottom)); }
  .pubao-bubble { width: 58px; height: 58px; }
  .pubao-panel {
    position: fixed;
    inset: 10px 10px max(10px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    border-radius: 24px;
    transform-origin: right bottom;
  }
  .pubao-message { max-width: 92%; font-size: 14px; }
  .assistant-page-card { min-height: calc(100svh - 150px); padding: 16px; }
  .assistant-page-shell { min-height: calc(100svh - 186px); }
  .assistant-page-input { grid-template-columns: 1fr; }
  .assistant-page-input button { width: 100%; }
}

/* Mobile polish 20260616: mail actions, schedule header, and Pubao keyboard behavior. */
@media (max-width: 720px) {
  .auth-ready:not(.auth-pending):not(.needs-account-setup) #insightsPage .actions.compact {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #refreshBtn {
    min-height: 42px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 900;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #clearInsightsBtn {
    min-width: 72px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 900;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-calendar-card {
    padding: 14px 12px 15px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin: -2px 0 14px;
    padding: 16px;
    overflow: hidden;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head > div:first-child {
    min-width: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head h2 {
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -.05em;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head .section-subtitle {
    max-width: none;
    font-size: 13px;
    line-height: 1.55;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar input {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(203, 213, 225, .9);
    border-radius: 17px;
    background: #fff;
    color: #0f172a;
    text-align: center;
    font-size: 15px;
    font-weight: 950;
    letter-spacing: .01em;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 950;
    white-space: nowrap;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #openCalendarImportModalBtn {
    grid-column: 1 / -1;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #openManualScheduleModalBtn {
    background: #0f172a;
    color: #fff;
  }

  body.assistant-page-active.pubao-input-focused {
    height: 100svh;
    overflow: hidden;
  }

  body.assistant-page-active.pubao-input-focused .app {
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
  }

  body.assistant-page-active.pubao-input-focused .content {
    height: 100svh;
    overflow: hidden;
    padding-bottom: 0;
  }

  body.assistant-page-active .assistant-page-panel {
    height: calc(100svh - 72px - env(safe-area-inset-bottom));
    min-height: 0;
    overflow: hidden;
  }

  body.assistant-page-active .assistant-page-card {
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  body.assistant-page-active .assistant-page-shell {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  body.assistant-page-active .assistant-page-hero {
    padding: 16px 16px 12px;
  }

  body.assistant-page-active .pubao-page-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 14px 14px 18px;
    -webkit-overflow-scrolling: touch;
  }

  body.assistant-page-active .assistant-page-input {
    position: sticky;
    bottom: 0;
    z-index: 20;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
    padding: 10px;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 -12px 28px rgba(15, 23, 42, .08);
  }

  body.assistant-page-active .assistant-page-input textarea {
    min-height: 46px;
    max-height: 92px;
  }

  body.assistant-page-active .assistant-page-input button {
    width: auto;
    min-width: 70px;
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-hero {
    display: none;
  }

  body.assistant-page-active.pubao-input-focused .pubao-page-messages {
    padding-bottom: 18px;
  }
}

@media (max-width: 720px) {
  body.pubao-open.pubao-input-focused:not(.assistant-page-active) {
    height: 100svh;
    overflow: hidden;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-widget {
    inset: 8px 8px max(8px, env(safe-area-inset-bottom));
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    align-items: stretch;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-panel {
    inset: 0;
    height: auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-quick-prompts {
    display: none;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-messages {
    min-height: 0;
    padding-bottom: 88px;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-input-row {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }
}

/* Hard fix 20260616: prevent iOS keyboard/page jump and close mobile schedule header overflow. */
@media (max-width: 720px) {
  body.assistant-page-active.pubao-input-focused,
  body.pubao-open.pubao-input-focused:not(.assistant-page-active) {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden !important;
  }

  body.assistant-page-active.pubao-input-focused .topbar {
    display: none;
  }

  body.assistant-page-active.pubao-input-focused .content {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    padding: 10px 10px 0;
    overflow: hidden !important;
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-panel {
    height: 100%;
    padding: 0;
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-card {
    height: 100%;
    border-radius: 22px;
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-shell {
    position: relative;
    height: 100%;
    min-height: 0;
    display: block;
    padding-bottom: calc(88px + var(--pubao-keyboard-bottom, 0px));
  }

  body.assistant-page-active.pubao-input-focused .pubao-page-messages {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 14px 18px;
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-input {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--pubao-keyboard-bottom, 0px));
    z-index: 4000;
    margin: 0;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 22px 22px 0 0;
    background: #fff;
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-widget {
    position: fixed;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: calc(var(--pubao-keyboard-bottom, 0px));
    width: auto;
    height: auto;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-panel {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-input-row {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-messages {
    padding-bottom: 92px;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-calendar-card,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-head {
    width: auto !important;
    margin: 0 0 14px !important;
    padding: 14px !important;
    box-sizing: border-box;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar {
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar input,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar button {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .schedule-toolbar input {
    display: block;
    grid-column: 1 / -1 !important;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #openCalendarImportModalBtn {
    grid-column: 1 / -1 !important;
  }
}

/* Fix 20260616: mobile Pubao floating panel should stay as a floating card, not full screen. */
@media (max-width: 720px) {
  .pubao-open:not(.assistant-page-active) .pubao-widget {
    left: auto !important;
    top: auto !important;
    right: 18px !important;
    bottom: calc(104px + env(safe-area-inset-bottom)) !important;
    width: min(360px, calc(100vw - 32px)) !important;
    height: auto !important;
    display: block !important;
  }

  .pubao-open:not(.assistant-page-active) .pubao-panel {
    position: absolute !important;
    inset: auto 0 76px auto !important;
    width: min(360px, calc(100vw - 32px)) !important;
    height: min(520px, calc(100svh - 230px)) !important;
    border-radius: 24px !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    background: rgba(255, 255, 255, .98) !important;
  }

  .pubao-open:not(.assistant-page-active) .pubao-messages {
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 14px !important;
  }

  .pubao-open:not(.assistant-page-active) .pubao-input-row {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) {
    position: static !important;
    height: auto !important;
    overflow-y: auto !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-widget {
    top: auto !important;
    left: auto !important;
    right: 12px !important;
    bottom: calc(var(--pubao-keyboard-bottom, 0px) + 12px) !important;
    width: min(360px, calc(100vw - 24px)) !important;
    height: auto !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-panel {
    position: absolute !important;
    inset: auto 0 0 auto !important;
    width: min(360px, calc(100vw - 24px)) !important;
    height: min(430px, calc(100svh - var(--pubao-keyboard-bottom, 0px) - 84px)) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-panel-head {
    padding: 12px 12px 10px !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-quick-prompts {
    display: none !important;
  }

  .pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-messages {
    padding: 12px !important;
  }
}

/* Final fix 20260616: opening Pubao bubble must create exactly one stable floating panel. */
@media (max-width: 720px) {
  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) {
    position: static !important;
    inset: auto !important;
    height: auto !important;
    min-height: 100svh !important;
    overflow-y: auto !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-widget {
    position: fixed !important;
    left: auto !important;
    top: auto !important;
    right: 16px !important;
    bottom: calc(104px + env(safe-area-inset-bottom)) !important;
    width: min(360px, calc(100vw - 32px)) !important;
    height: auto !important;
    display: block !important;
    pointer-events: none !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-panel {
    position: absolute !important;
    left: auto !important;
    top: auto !important;
    right: 0 !important;
    bottom: 72px !important;
    inset: auto 0 72px auto !important;
    width: min(360px, calc(100vw - 32px)) !important;
    height: min(480px, calc(100svh - 230px)) !important;
    min-height: 320px !important;
    max-height: 520px !important;
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-bubble {
    opacity: .18 !important;
    transform: scale(.88) !important;
    pointer-events: none !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-quick-prompts {
    display: flex !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-messages {
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  body.pubao-open:not(.pubao-input-focused):not(.assistant-page-active) .pubao-input-row {
    position: static !important;
  }
}

/* Safari mobile safe-area fix 20260616: remove the reddish browser/status strip,
   keep mail cards inside the viewport, and lift Pubao input above Safari chrome. */
@media (max-width: 720px) {
  html.dashboard-ready,
  html:has(body.auth-ready:not(.auth-pending):not(.needs-account-setup)) {
    background: var(--mobile-dashboard-bg) !important;
  }

  body.auth-ready:not(.auth-pending):not(.needs-account-setup) {
    background: var(--mobile-dashboard-bg) !important;
    padding-top: max(18px, env(safe-area-inset-top));
    color-scheme: light;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .app {
    background: var(--mobile-dashboard-bg);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .content {
    padding-top: 0 !important;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .topbar {
    margin-bottom: 12px;
    padding-top: 0 !important;
    background: var(--mobile-dashboard-bg);
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) #insightsPage {
    padding-bottom: calc(var(--mobile-browser-chrome-gap) + env(safe-area-inset-bottom)) !important;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-dashboard-card {
    overflow: hidden;
  }

  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-title,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-meta,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-summary,
  .auth-ready:not(.auth-pending):not(.needs-account-setup) .insight-details {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.assistant-page-active .assistant-page-panel {
    height: calc(100svh - 72px - var(--mobile-browser-chrome-gap) - env(safe-area-inset-bottom)) !important;
    min-height: 320px;
    overflow: hidden;
  }

  body.assistant-page-active .assistant-page-card,
  body.assistant-page-active .assistant-page-shell {
    min-height: 0 !important;
  }

  body.assistant-page-active .pubao-page-messages {
    padding-bottom: 18px !important;
  }

  body.assistant-page-active .assistant-page-input {
    position: sticky !important;
    left: 12px;
    right: 12px;
    top: auto !important;
    bottom: 0 !important;
    z-index: 2600;
    margin: 0 !important;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 22px;
    background: rgba(255, 255, 255, .98);
  }

  body.assistant-page-active.pubao-input-focused .assistant-page-input {
    bottom: calc(max(var(--pubao-keyboard-bottom, 0px), env(safe-area-inset-bottom))) !important;
  }

  body.pubao-open.pubao-input-focused:not(.assistant-page-active) .pubao-widget {
    bottom: calc(max(var(--pubao-keyboard-bottom, 0px), var(--mobile-browser-chrome-gap))) !important;
  }
}
