:root {
  --bg: #f3f6fc;
  --bg-deep: #edf2fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --ink: #172033;
  --ink-soft: #35415a;
  --muted: #77829a;
  --muted-light: #98a2b6;
  --line: #e5eaf4;
  --line-strong: #d8e0ef;
  --blue: #3b6ef6;
  --blue-deep: #2859e6;
  --blue-soft: #eef4ff;
  --purple: #7c5cf0;
  --orange: #f59e0b;
  --green: #10b981;
  --danger: #e65757;
  --shadow-sm: 0 2px 8px rgba(24, 43, 84, .035);
  --shadow-md: 0 14px 40px rgba(35, 57, 104, .07);
  --shadow-lg: 0 28px 70px rgba(26, 45, 88, .16);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --font: "Inter", "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 50% -140px, rgba(91, 136, 255, .10), transparent 70%),
    linear-gradient(180deg, #f7f9fe 0%, var(--bg) 36%, #f1f5fc 100%);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: rgba(59, 110, 246, .18); }

.page-glow {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(4px);
  pointer-events: none;
}
.page-glow-a {
  width: 430px;
  height: 430px;
  left: -220px;
  top: 260px;
  background: radial-gradient(circle, rgba(111, 150, 255, .10), transparent 70%);
}
.page-glow-b {
  width: 520px;
  height: 520px;
  right: -280px;
  bottom: -180px;
  background: radial-gradient(circle, rgba(124, 92, 240, .08), transparent 70%);
}

.app-shell {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 27px 0 18px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 17px;
  background:
    radial-gradient(70% 90% at 22% 5%, rgba(255, 255, 255, .32), transparent 60%),
    linear-gradient(145deg, #306bd9 0%, #4a7df6 55%, #7ea4ff 100%);
  box-shadow: 0 11px 22px rgba(53, 105, 224, .22), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand-mark svg { width: 38px; height: 38px; }

.brand-copy { min-width: 0; }
.brand-title-row { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -.7px;
  font-weight: 760;
  color: #182136;
}
.brand-badge {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #dbe5fa;
  background: #fff;
  color: #5471a8;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .6px;
  box-shadow: var(--shadow-sm);
}
.brand p {
  margin: 7px 0 0;
  color: #7b879d;
  font-size: 13.5px;
  letter-spacing: .15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  box-shadow: 0 6px 22px rgba(41, 66, 119, .055);
  color: #6e7a91;
  font-size: 12.5px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.status-pill strong { color: #293956; font-weight: 650; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .10);
  flex: 0 0 auto;
  transition: .25s ease;
}
.status-pill.is-online .status-dot {
  background: #17b783;
  box-shadow: 0 0 0 4px rgba(23, 183, 131, .10);
}
.status-pill.is-error .status-dot {
  background: #e65757;
  box-shadow: 0 0 0 4px rgba(230, 87, 87, .10);
}
.status-sep { color: #c3cad8; }

.settings-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 17px;
  border: 1px solid #e3e9f4;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: #576783;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, color .18s ease;
}
.settings-button svg { width: 17px; height: 17px; }
.settings-button:hover {
  color: var(--blue);
  border-color: #cad8f7;
  box-shadow: 0 7px 18px rgba(47, 82, 160, .08);
  transform: translateY(-1px);
}

/* ---------- modules ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.module-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 84px;
  padding: 13px 15px;
  border: 1.5px solid rgba(226, 232, 243, .95);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 5px 16px rgba(38, 60, 108, .035);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.module-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.module-card:hover {
  transform: translateY(-2px);
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 30%, #dfe6f2);
  box-shadow: 0 13px 26px rgba(41, 64, 115, .075);
}
.module-card.is-active {
  background: linear-gradient(112deg, #fff 0%, var(--accent-soft) 145%);
  border-color: var(--accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 13%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--accent) 9%, transparent);
}
.module-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: 0 8px 16px color-mix(in srgb, var(--accent) 17%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.module-icon svg { width: 24px; height: 24px; }
.module-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}
.module-copy strong {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  color: #2b3850;
  letter-spacing: -.15px;
}
.module-copy small {
  color: #8d98ab;
  font-size: 11.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-arrow {
  color: #c3ccda;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  transition: transform .18s ease, color .18s ease;
}
.module-arrow svg { width: 100%; height: 100%; }
.module-card.is-active .module-arrow { color: var(--accent); transform: translateX(2px); }

/* ---------- workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 415px;
  gap: 24px;
  margin-top: 20px;
  align-items: stretch;
}

.chat-panel {
  display: flex;
  min-width: 0;
  height: clamp(620px, calc(100vh - 252px), 790px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(228, 234, 243, .95);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 15px 23px;
  border-bottom: 1px solid #eef2f8;
  background: linear-gradient(180deg, #fff, #fdfdff);
}
.chat-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}
.module-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .1px;
  box-shadow: 0 5px 11px rgba(59, 110, 246, .19);
  transition: background .2s ease;
}
.chat-context {
  min-width: 0;
  color: #7f8ba0;
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}
.route-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid #e8edf6;
  border-radius: 999px;
  color: #8994a8;
  font-size: 10.5px;
  white-space: nowrap;
}
.route-indicator i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #25b98a;
  box-shadow: 0 0 0 3px rgba(37, 185, 138, .10);
}
.icon-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #9aa5b8;
  cursor: pointer;
  transition: .18s ease;
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { color: var(--danger); background: #fff5f5; border-color: #fde4e4; }

.config-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 23px;
  border-bottom: 1px solid #f5ead2;
  background: #fffbf2;
  color: #8d6c2d;
  font-size: 10.5px;
  line-height: 1.5;
}
.config-banner-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #e9a83e;
  box-shadow: 0 0 0 3px rgba(233, 168, 62, .10);
}
.config-banner span:nth-child(2) { flex: 1; min-width: 0; }
.config-banner-button {
  flex: 0 0 auto;
  height: 25px;
  padding: 0 9px;
  border: 1px solid #efd5a6;
  border-radius: 6px;
  background: #fff;
  color: #a47628;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .18s ease;
}
.config-banner-button:hover { border-color: #dfb96c; background: #fffdf7; }
.message-scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  background:
    radial-gradient(600px 260px at 0 0, rgba(243, 247, 255, .64), transparent 55%),
    #fff;
  scrollbar-width: thin;
  scrollbar-color: #d9e2f1 transparent;
}
.message-scroller::-webkit-scrollbar { width: 6px; }
.message-scroller::-webkit-scrollbar-thumb { background: #d9e2f1; border-radius: 99px; }
.message-scroller::-webkit-scrollbar-thumb:hover { background: #c6d2e7; }

.message-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 25px 26px 18px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  max-width: 88%;
  animation: message-in .26s ease both;
}
@keyframes message-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 82%;
}
.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 5px 13px rgba(45, 60, 94, .13);
}
.avatar.ai {
  background:
    radial-gradient(85% 85% at 25% 12%, rgba(255, 255, 255, .38), transparent 58%),
    linear-gradient(145deg, #5f7cf1, #3156bb);
  border: 2px solid #fff;
}
.avatar.ai svg { width: 22px; height: 22px; }
.avatar.user {
  background: linear-gradient(145deg, #ffcd70, #ffb344);
  border: 2px solid #fff;
  font-size: 16px;
  font-weight: 750;
}
.message-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.message.is-user .message-main { align-items: flex-end; }
.message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #a1aabd;
  font-size: 10.5px;
  line-height: 1;
}
.message-meta .meta-module {
  padding: 3px 6px;
  border-radius: 5px;
  background: #f3f6fb;
  color: #94a0b3;
  font-size: 9.5px;
}
.message-meta time { letter-spacing: .1px; }

.message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: -1px;
  opacity: .72;
  transition: opacity .16s ease;
}
.message-actions:hover { opacity: 1; }
.message.is-user .message-actions { justify-content: flex-end; }
.message-action {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #9aa6b9;
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.message-action svg { width: 12px; height: 12px; }
.message-action:hover { background: #eef3fc; color: #4f6fb5; }
.message-action-danger:hover { background: #fff0f0; color: #d05a5a; }
.message.is-user .message-action:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.math-display {
  margin: 9px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.math-display .katex-display { margin: 0; }
.bubble-content .katex { font-size: 1.04em; }
.bubble-content .katex-display { margin: .35em 0; overflow-x: auto; overflow-y: hidden; }
.bubble-content .katex-error { color: #b24a4a; }

.bubble {
  position: relative;
  min-width: 48px;
  max-width: 100%;
  padding: 13px 17px;
  border: 1px solid #e8edf5;
  border-radius: 5px 16px 16px 16px;
  background: #f9fbff;
  color: #33415a;
  font-size: 13.5px;
  line-height: 1.78;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(30, 51, 92, .02);
}
.is-user .bubble {
  border-color: #3b6ef6;
  border-radius: 16px 5px 16px 16px;
  background: linear-gradient(145deg, #4e7cf7, #3b6ef6);
  color: #fff;
  box-shadow: 0 8px 17px rgba(59, 110, 246, .17);
}
.bubble.is-error {
  border-color: #f6dfb6;
  background: #fffaf1;
  color: #7e5b22;
}
.bubble.is-notice {
  border-color: #dce6f7;
  background: #f4f8ff;
  color: #52647f;
}
.bubble.is-local {
  border-color: #e4e9f4;
  background: #fbfcff;
}
.bubble.is-welcome {
  border-color: #e6ecf7;
  background: linear-gradient(135deg, #fbfcff, #f6f9ff);
}
.plain-text { white-space: pre-wrap; }
.local-badge {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef2f8;
  color: #8d99ac;
  font-size: 8.5px;
  line-height: 1.5;
}
.user-image {
  display: inline-block;
  max-width: 265px;
  margin: 0 0 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
}
.user-image img { display: block; width: auto; max-width: 100%; max-height: 260px; object-fit: contain; }
.user-image:last-child { margin-bottom: 0; }
.user-document {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 265px;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
}
.user-document-icon {
  display: grid;
  width: 31px;
  height: 34px;
  flex: 0 0 31px;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  color: #3b6ef6;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .2px;
}
.user-document-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-document-copy strong {
  max-width: 190px;
  overflow: hidden;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-document-copy small { color: rgba(255, 255, 255, .72); font-size: 8.5px; }
.tool-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  padding: 5px 8px;
  border: 1px solid #e1eafb;
  border-radius: 7px;
  background: #f4f8ff;
  color: #7189b5;
  font-size: 9.5px;
  line-height: 1.5;
}
.tool-status .mini-spinner {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 1.5px solid #c4d5f4;
  border-top-color: #5c84d9;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bubble .bubble-actions {
  display: flex;
  gap: 4px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed #e9eef7;
}
.bubble-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8d99ad;
  font-size: 10.5px;
  cursor: pointer;
}
.bubble-action:hover { background: #eef3fc; color: var(--blue); }
.bubble-action svg { width: 12px; height: 12px; }

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 2px;
}
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8da5da;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .16s; }
.typing-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.stream-cursor::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--blue);
  animation: blink .9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* markdown */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  margin: 14px 0 7px;
  color: #253450;
  font-weight: 720;
  line-height: 1.45;
}
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }
.bubble h1 { font-size: 17px; }
.bubble h2 { font-size: 15.5px; }
.bubble h3 { font-size: 14.5px; }
.bubble h4 { font-size: 13.5px; }
.bubble strong { color: #26354f; font-weight: 720; }
.is-user .bubble strong { color: #fff; }
.bubble em { color: inherit; }
.bubble a { color: #3265e9; text-decoration: underline; text-underline-offset: 2px; }
.is-user .bubble a { color: #eaf1ff; }
.bubble ul, .bubble ol { margin: 6px 0 8px; padding-left: 21px; }
.bubble li { margin: 3px 0; padding-left: 1px; }
.bubble li::marker { color: #8ba6dd; }
.bubble blockquote {
  margin: 9px 0;
  padding: 8px 12px;
  border-left: 3px solid #c9d8f7;
  border-radius: 0 7px 7px 0;
  background: #f1f6ff;
  color: #5b6c88;
}
.bubble code {
  padding: 1.5px 5px;
  border: 1px solid #e4eaf5;
  border-radius: 5px;
  background: #f1f5fc;
  color: #3c5d9d;
  font-family: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: .9em;
}
.is-user .bubble code { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .2); color: #fff; }
.bubble pre {
  position: relative;
  margin: 10px 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid #e0e8f4;
  border-radius: 10px;
  background: #f4f7fc;
  color: #2f4568;
  font-size: 12px;
  line-height: 1.65;
}
.bubble pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 -3px;
  padding: 7px 11px;
  border: 1px solid #e0e8f4;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #edf3fb;
  color: #8a99b2;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}
.code-head + pre { margin-top: 0; border-radius: 0 0 10px 10px; }
.copy-code {
  border: 0;
  background: transparent;
  color: #7f90ad;
  font-size: 10px;
  cursor: pointer;
}
.copy-code:hover { color: var(--blue); }
.bubble table { width: 100%; border-collapse: collapse; margin: 9px 0; font-size: 12.5px; }
.bubble th, .bubble td { padding: 6px 8px; border: 1px solid #e1e9f5; text-align: left; }
.bubble th { background: #f1f6fe; color: #50627f; font-weight: 650; }

/* schedule update card */
.schedule-update {
  margin: 10px 0 4px;
  border: 1px solid #dbe7fb;
  border-radius: 12px;
  background: #f7faff;
  overflow: hidden;
}
.schedule-update-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e6eefb;
  background: #eff6ff;
  color: #44618e;
  font-size: 11.5px;
}
.schedule-update-head strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.schedule-update-head svg { width: 14px; height: 14px; color: #4780e9; }
.schedule-diff { display: flex; flex-wrap: wrap; gap: 5px; padding: 9px 12px 2px; }
.diff-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
}
.diff-chip.add { background: #e8f8f1; color: #158662; }
.diff-chip.remove { background: #fff0f0; color: #c25555; }
.diff-chip.change { background: #fff7e7; color: #a16b12; }
.schedule-update-items { padding: 6px 12px 10px; }
.schedule-update-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: #5b6d88;
  font-size: 11.5px;
}
.schedule-update-item b { color: #334f7e; font-weight: 650; }
.schedule-update-item .dot { width: 5px; height: 5px; border-radius: 50%; background: #83a8e8; }
.schedule-pending {
  padding: 10px 12px;
  border-top: 1px solid #f2dfb8;
  background: #fffbf2;
  color: #8d6522;
  font-size: 11.5px;
}
.schedule-pending-actions { display: flex; gap: 8px; margin-top: 9px; }
.mini-button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d9e3f4;
  border-radius: 7px;
  background: #fff;
  color: #51627d;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.mini-button.primary { border-color: #f3bd55; background: #f7b84b; color: #fff; }
.mini-button.primary:hover { background: #eda92e; }
.mini-button:hover { border-color: #b9c9e5; }

/* ---------- composer ---------- */
.composer-area {
  padding: 0 22px 15px;
  border-top: 1px solid #f1f4f9;
  background: linear-gradient(180deg, #fff, #fdfdff);
}
.quick-prompts {
  display: flex;
  gap: 8px;
  padding: 13px 0 11px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-prompts::-webkit-scrollbar { display: none; }
.quick-chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #fafbfe;
  color: #7a869b;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: .18s ease;
}
.quick-chip:hover {
  color: var(--blue);
  border-color: #c8d8fa;
  background: #f4f8ff;
  transform: translateY(-1px);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 58px;
  padding: 9px 9px 9px 16px;
  border: 1.5px solid #dfe5f0;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(39, 61, 106, .035);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer:focus-within {
  border-color: #a8c0f7;
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .08), 0 6px 18px rgba(50, 82, 150, .045);
}
.composer.is-busy { border-color: #dce5f4; background: #fdfefe; }
.composer.is-dragging { border-color: #8fb0f2; background: #f7faff; box-shadow: 0 0 0 3px rgba(59, 110, 246, .10); }
.text-button:disabled { opacity: .4; cursor: default; }
.text-button:disabled:hover { color: #9aa4b5; background: transparent; }
.composer-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 5px 0;
}
.attach-button {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  margin-top: -1px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #93a0b5;
  cursor: pointer;
  transition: .18s ease;
}
.attach-button svg { width: 18px; height: 18px; }
.attach-button:hover { color: var(--blue); border-color: #dbe6fa; background: #f5f9ff; }
.attachment-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 9px;
  padding: 7px 9px;
  border: 1px dashed #d8e3f4;
  border-radius: 11px;
  background: #f8fbff;
  animation: message-in .18s ease both;
}
.attachment-thumb {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  border: 1px solid #e0e9f6;
  border-radius: 8px;
  background: #fff;
}
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-file-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #eef4ff, #e4edff);
  color: #3b6ef6;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .2px;
}
.attachment-file-icon[hidden] { display: none; }
.attachment-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.attachment-copy strong { color: #50617b; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-copy span { color: #9ba7b9; font-size: 9px; }
.attachment-remove {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9aa6b7;
  cursor: pointer;
}
.attachment-remove:hover { color: var(--danger); background: #fff0f0; }
.attachment-remove svg { width: 13px; height: 13px; }

.composer-module {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #eff4ff;
  color: #6680b2;
  font-size: 9.5px;
  line-height: 1.65;
}
#messageInput {
  width: 100%;
  min-height: 26px;
  max-height: 126px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #2c3a52;
  font-size: 13px;
  line-height: 1.7;
}
#messageInput::placeholder { color: #a3adbd; }
.composer-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  min-width: 79px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #4b7df7, #3b6ef6);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(59, 110, 246, .19);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.send-button svg { width: 15px; height: 15px; }
.send-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 11px 22px rgba(59, 110, 246, .25); }
.send-button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.stop-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid #f0d4d4;
  border-radius: 9px;
  background: #fff7f7;
  color: #c55a5a;
  font-size: 11px;
  cursor: pointer;
}
.stop-button span { width: 7px; height: 7px; border-radius: 2px; background: #d66363; }
.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 8px 2px 0;
  color: #9da7b8;
  font-size: 9.5px;
}
.secure-hint { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.secure-hint svg { width: 11px; height: 11px; }

/* ---------- sidebar ---------- */
.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}
.side-card {
  border: 1px solid rgba(227, 233, 242, .95);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(36, 58, 103, .045);
}
.schedule-card { padding: 18px 19px 15px; }
.schedule-date {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: #9aa5b7;
  font-size: 9.5px;
  white-space: nowrap;
}
.schedule-date-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: #7fa4e9;
  box-shadow: 0 0 0 3px rgba(127, 164, 233, .12);
}
.schedule-date-source {
  margin-left: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2f6fd;
  color: #91a1bb;
  font-size: 8px;
}
.day-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #edf1f7;
}
.day-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 29px;
  padding: 0 2px;
  border: 1px solid #e9eef7;
  border-radius: 7px;
  background: #fbfcff;
  color: #7d8a9f;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .16s ease;
}
.day-tab span { white-space: nowrap; }
.day-tab i {
  min-width: 8px;
  color: #aeb8c7;
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
  text-align: center;
}
.day-tab.has-items i { color: #6f91cc; }
.day-tab.is-today { border-color: #d4e0f6; background: #f7faff; }
.day-tab.is-today::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #7fa4e9;
  transform: translateX(-50%);
}
.day-tab.is-active {
  border-color: #bcd2f8;
  background: #edf4ff;
  color: #3566dc;
  box-shadow: inset 0 0 0 1px rgba(59, 110, 246, .07);
}
.day-tab.is-active i { color: #3f6fd6; }
.day-tab:hover:not(.is-active) { border-color: #cfdcf2; color: #5372a8; background: #f8fbff; }
.empty-jump-button {
  margin-top: 9px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #5680d8;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}
.empty-jump-button:hover { color: #3566dc; text-decoration: underline; }
.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.side-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #2c3a52;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.1px;
}
.side-title-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}
.side-title-icon svg { width: 17px; height: 17px; }
.schedule-icon { background: #edf3ff; color: #4e7de8; }
.protocol-icon { background: #fff5e5; color: #e5a02e; }
.count-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff2de;
  color: #d88a14;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}
.side-head-actions { display: flex; align-items: center; gap: 3px; }
.subtle-button {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #e7ecf5;
  border-radius: 7px;
  background: #fff;
  color: #8793a6;
  cursor: pointer;
  transition: .18s ease;
}
.subtle-button svg { width: 15px; height: 15px; }
.subtle-button:hover { border-color: #c7d7f6; color: var(--blue); background: #f6f9ff; }
.text-button {
  height: 27px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #9aa4b5;
  font-size: 10.5px;
  cursor: pointer;
}
.text-button:hover { color: var(--danger); background: #fff5f5; }

.schedule-list {
  display: flex;
  max-height: 310px;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #dce5f2 transparent;
}
.schedule-list::-webkit-scrollbar { width: 5px; }
.schedule-list::-webkit-scrollbar-thumb { border-radius: 99px; background: #dce5f2; }
.schedule-list::-webkit-scrollbar-track { background: transparent; }
.schedule-day-group + .schedule-day-group { border-top: 1px dashed #edf1f7; margin-top: 10px; padding-top: 10px; }
.schedule-day-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: #9aa5b7;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .35px;
}
.schedule-day-label::after { content: ""; flex: 1; height: 1px; background: #f1f4f9; }
.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 39px;
  padding: 5px 1px;
  border-radius: 8px;
  transition: background .15s ease;
}
.schedule-row:hover { background: #fafcff; }
.schedule-time {
  flex: 0 0 81px;
  color: #77849a;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1px;
}
.schedule-content {
  flex: 1;
  min-width: 0;
  color: #34445d;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-type {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.5;
}
.schedule-type.class { background: #edf3ff; color: #4b71c9; }
.schedule-type.task { background: #fff4e2; color: #b97c19; }
.schedule-type.other { background: #f2f4f8; color: #7d8a9e; }
.schedule-delete {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #b6c0cf;
  cursor: pointer;
  opacity: 0;
  transition: .15s ease;
}
.schedule-row:hover .schedule-delete { opacity: 1; }
.schedule-delete:hover { color: var(--danger); background: #fff0f0; }
.schedule-delete svg { width: 12px; height: 12px; }
.schedule-empty {
  padding: 25px 10px 20px;
  text-align: center;
}
.empty-illustration {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: #f4f7fd;
  color: #b3c2da;
}
.empty-illustration svg { width: 30px; height: 30px; }
.schedule-empty strong { color: #66748c; font-size: 12px; font-weight: 650; }
.schedule-empty p { margin: 5px auto 0; max-width: 220px; color: #a0aabd; font-size: 10.5px; line-height: 1.6; }
.schedule-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 11px;
  border-top: 1px solid #f1f4f9;
  color: #9ca7b8;
  font-size: 9.5px;
}
.schedule-foot span { display: inline-flex; align-items: center; gap: 5px; }
.schedule-foot i { width: 5px; height: 5px; border-radius: 50%; background: #f0af43; }
.link-button {
  border: 0;
  background: none;
  color: #7991bf;
  font-size: 9.5px;
  cursor: pointer;
  padding: 2px;
}
.link-button:hover { color: var(--blue); }
.link-button-muted { color: #a8b3c5; }
.schedule-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid #eef2f8;
}

.protocol-card { padding: 18px 19px 17px; }
.protocol-tag {
  padding: 3px 6px;
  border: 1px solid #f0e2c8;
  border-radius: 4px;
  background: #fffaf0;
  color: #b98a3d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  letter-spacing: .2px;
}
.protocol-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: protocol;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.protocol-list li {
  position: relative;
  display: flex;
  gap: 9px;
  color: #7b879b;
  font-size: 10.5px;
  line-height: 1.62;
}
.protocol-list li::before {
  counter-increment: protocol;
  content: counter(protocol);
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 50%;
  background: #f4f7fd;
  color: #97a5ba;
  font-size: 8.5px;
  font-weight: 650;
}
.protocol-list code {
  display: block;
  margin-top: 4px;
  padding: 5px 7px;
  border: 1px solid #edf1f8;
  border-radius: 5px;
  background: #fafbfe;
  color: #8595ad;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.protocol-tip {
  display: flex;
  gap: 7px;
  margin-top: 13px;
  padding: 9px 10px;
  border: 1px dashed #ece3d1;
  border-radius: 8px;
  background: #fffdf8;
  color: #a08b67;
  font-size: 9.5px;
  line-height: 1.55;
}
.protocol-tip svg { width: 13px; height: 13px; flex: 0 0 13px; margin-top: 1px; color: #d6a34a; }

.tip-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-radius: 15px;
  background: linear-gradient(120deg, #f8fbff, #f4f8ff);
  box-shadow: none;
}
.tip-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #6b87c5;
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 3px 9px rgba(41, 66, 119, .07);
}
.tip-card strong { display: block; color: #57647a; font-size: 10.5px; font-weight: 650; }
.tip-card p { margin: 3px 0 0; color: #8e9aae; font-size: 10px; line-height: 1.5; }

.page-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 17px 0 2px;
  color: #a3adbd;
  font-size: 10px;
}
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: #c2cada; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(21, 32, 55, .42);
  backdrop-filter: blur(7px);
  animation: backdrop-in .2s ease both;
}
@keyframes backdrop-in { from { opacity: 0; } }
.modal {
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in .24s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(13px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.settings-modal { max-width: 760px; }
.schedule-modal { max-width: 510px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px 17px;
  border-bottom: 1px solid #eef2f8;
}
.modal-head h2 { margin: 0; color: #1f2c43; font-size: 19px; letter-spacing: -.3px; }
.modal-head p { margin: 5px 0 0; color: #8d98aa; font-size: 11px; line-height: 1.5; }
.modal-close {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  border: 1px solid #ebeff6;
  border-radius: 9px;
  background: #fff;
  color: #8d99ab;
  cursor: pointer;
}
.modal-close:hover { color: #56647a; background: #f7f9fd; }
.modal-close svg { width: 16px; height: 16px; }
.modal-body {
  padding: 19px 24px 20px;
  overflow-y: auto;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: #dbe3f0; border-radius: 99px; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 24px;
  border-top: 1px solid #eef2f8;
  background: #fcfdff;
}
.modal-foot-right { display: flex; align-items: center; gap: 9px; }
.primary-button, .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 37px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 7px 14px rgba(59, 110, 246, .17);
}
.primary-button:hover { background: var(--blue-deep); }
.ghost-button {
  border: 1px solid #e7ecf5;
  background: #fff;
  color: #718097;
}
.ghost-button:hover { border-color: #d0dcef; color: #4d5f79; background: #fafcff; }
.ghost-button svg { width: 14px; height: 14px; }

.field-label {
  margin-bottom: 9px;
  color: #526077;
  font-size: 11px;
  font-weight: 650;
}
.provider-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.provider-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 9px;
  border: 1px solid #e7ecf5;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.provider-card:hover { border-color: #cfdcf2; background: #fbfdff; }
.provider-card.is-active { border-color: #95b2f6; background: #f6f9ff; box-shadow: inset 0 0 0 1px rgba(59, 110, 246, .08); }
.provider-logo {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
}
.provider-logo svg { width: 17px; height: 17px; }
.coze-logo { background: linear-gradient(145deg, #547ef4, #355cc8); color: #fff; }
.bot-logo { background: #eef3ff; color: #5b7fd1; }
.openai-logo { background: #eaf7f2; color: #178d6d; }
.local-logo { background: #f3f5f9; color: #7e8ba1; }
.provider-card > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.provider-card strong { color: #45536a; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider-card small { color: #a0aaba; font-size: 8.5px; white-space: nowrap; }
.provider-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border: 1px solid #d9e1ee;
  border-radius: 50%;
  background: #fff;
}
.provider-card.is-active .provider-check { border: 3px solid var(--blue); }
.settings-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #dcebe2;
  border-radius: 8px;
  background: #f6fcf9;
  color: #5e806d;
  font-size: 10px;
  line-height: 1.55;
}
.note-dot { width: 5px; height: 5px; flex: 0 0 5px; margin-top: 5px; border-radius: 50%; background: #20b981; }
.provider-panel { margin-top: 18px; }
.panel-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid #f0f3f8;
}
.panel-intro strong { color: #33425a; font-size: 12px; font-weight: 650; }
.panel-intro p { margin: 4px 0 0; max-width: 590px; color: #929dae; font-size: 10px; line-height: 1.6; }
.panel-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid #e3eaf5;
  border-radius: 4px;
  background: #f8faff;
  color: #9aa9bf;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7.5px;
  letter-spacing: .4px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field > span { color: #657287; font-size: 10px; font-weight: 600; }
.field > span em { margin-left: 3px; color: #acb5c3; font-style: normal; font-weight: 400; }
.field input, .field select {
  width: 100%;
  height: 37px;
  padding: 0 11px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  outline: 0;
  background: #fcfdff;
  color: #3e4c63;
  font-size: 11.5px;
  transition: .18s ease;
}
.field input::placeholder { color: #b5bdc9; }
.field input:focus, .field select:focus {
  border-color: #a9c1f5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .075);
}
.field small { color: #a2acbc; font-size: 9px; line-height: 1.5; }
.field small code { padding: 1px 3px; border-radius: 3px; background: #f3f6fb; font-size: 8.5px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 45px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: #f3f6fb;
  color: #91a0b6;
  font-size: 8.5px;
  cursor: pointer;
}
.password-toggle:hover { color: var(--blue); background: #edf3ff; }
.panel-mini-note {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #e7eef9;
  border-radius: 8px;
  background: #f8fbff;
  color: #8493a9;
  font-size: 9.5px;
  line-height: 1.6;
}
.panel-mini-note span {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #eaf2ff;
  color: #5d7db4;
  font-size: 8.5px;
  font-weight: 650;
}
.panel-mini-note code { padding: 1px 3px; border-radius: 3px; background: #eef4fc; font-size: 8.5px; }
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.inline-actions .ghost-button { height: 30px; padding: 0 10px; font-size: 9.5px; }
.inline-hint { color: #a8b2c2; font-size: 9px; }
.local-feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.local-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #7d899c;
  font-size: 10px;
  line-height: 1.5;
}
.local-feature-list li span { color: #26ac7e; font-weight: 750; }
.local-feature-list li:last-child span { color: #b6bfcd; }
.security-note {
  display: flex;
  gap: 9px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid #edf1f7;
  border-radius: 9px;
  background: #fafbfd;
}
.security-note svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; color: #7d9dcd; }
.security-note p { margin: 0; color: #929daf; font-size: 9.5px; line-height: 1.65; }
.security-note strong { color: #6f7e93; font-weight: 650; }
.form-error {
  margin-top: 13px;
  padding: 8px 10px;
  border: 1px solid #f5dada;
  border-radius: 7px;
  background: #fff7f7;
  color: #b95b5b;
  font-size: 10px;
  line-height: 1.55;
}
.schedule-modal .modal-body { padding-top: 18px; }

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 11px 14px;
  border: 1px solid #e7ecf4;
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  color: #53627a;
  font-size: 11px;
  line-height: 1.5;
  box-shadow: 0 12px 30px rgba(28, 46, 83, .13);
  animation: toast-in .22s ease both;
  backdrop-filter: blur(8px);
}
.toast.success { border-color: #d6ecdF; color: #31735b; }
.toast.error { border-color: #f2dada; color: #a95656; }
.toast svg { width: 14px; height: 14px; flex: 0 0 14px; }
.toast.out { animation: toast-out .2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(5px) scale(.98); } }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .app-shell { width: calc(100% - 40px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 365px; gap: 18px; }
  .module-grid { gap: 13px; }
  .module-card { padding: 12px; gap: 10px; }
  .module-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .module-copy strong { font-size: 14px; }
  .chat-context { max-width: 430px; }
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
  .route-indicator { display: none; }
  .chat-context { max-width: 390px; }
  .schedule-time { flex-basis: 74px; }
  .status-pill { padding: 0 12px; }
}

@media (max-width: 980px) {
  .topbar { align-items: flex-start; }
  .brand h1 { font-size: 26px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .chat-panel { height: min(690px, calc(100vh - 230px)); min-height: 570px; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .tip-card { display: none; }
  .chat-context { max-width: none; }
}

@media (max-width: 740px) {
  .app-shell { width: calc(100% - 24px); padding-top: 16px; }
  .topbar { flex-direction: column; gap: 14px; }
  .brand-mark { width: 51px; height: 51px; flex-basis: 51px; border-radius: 14px; }
  .brand-mark svg { width: 33px; height: 33px; }
  .brand h1 { font-size: 23px; }
  .brand p { margin-top: 5px; font-size: 11.5px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .status-pill { flex: 1; min-width: 0; overflow: hidden; }
  .status-pill > * { flex: 0 0 auto; }
  .status-pill #statusText { overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
  .settings-button { padding: 0 14px; }
  .module-grid { margin-top: 16px; gap: 9px; }
  .module-card { min-height: 73px; padding: 9px 10px; border-radius: 13px; }
  .module-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
  .module-icon svg { width: 21px; height: 21px; }
  .module-copy { gap: 3px; }
  .module-copy strong { font-size: 12.5px; }
  .module-copy small { font-size: 9.5px; }
  .module-arrow { display: none; }
  .workspace { margin-top: 13px; gap: 14px; }
  .chat-panel { height: min(650px, calc(100vh - 205px)); min-height: 540px; border-radius: 17px; }
  .chat-header { min-height: 57px; padding: 11px 14px; gap: 8px; }
  .chat-heading { gap: 8px; }
  .module-pill { height: 27px; padding: 0 11px; font-size: 11px; }
  .chat-context { font-size: 9.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
  .config-banner { padding: 7px 13px; font-size: 9.5px; gap: 6px; }
  .config-banner-button { height: 23px; padding: 0 7px; font-size: 9px; }
  .message-list { padding: 18px 14px 12px; gap: 17px; }
  .message { max-width: 95%; gap: 8px; }
  .message.is-user { max-width: 91%; }
  .avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .avatar.ai svg { width: 18px; height: 18px; }
  .bubble { padding: 10px 12px; font-size: 12.5px; line-height: 1.7; border-radius: 4px 13px 13px 13px; }
  .is-user .bubble { border-radius: 13px 4px 13px 13px; }
  .composer-area { padding: 0 12px 12px; }
  .quick-prompts { padding: 10px 0 9px; gap: 6px; }
  .quick-chip { height: 28px; padding: 0 10px; font-size: 10px; }
  .composer { gap: 7px; padding: 7px 7px 7px 11px; border-radius: 13px; }
  .composer-main { padding: 4px 0; gap: 6px; }
  .composer-module { display: none; }
  .attach-button { width: 26px; height: 26px; flex-basis: 26px; }
  .attachment-bar { margin-top: 0; }
  .user-image { max-width: 220px; }
  .user-document { max-width: 220px; }
  .day-tab { height: 28px; font-size: 9px; }
  .schedule-list { max-height: 330px; }
  #messageInput { font-size: 12px; }
  .send-button { min-width: 55px; height: 37px; padding: 0 11px; font-size: 11.5px; }
  .send-button svg { display: none; }
  .composer-foot { font-size: 8.5px; }
  .secure-hint { display: none; }
  .sidebar { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .schedule-card, .protocol-card { padding: 15px; border-radius: 15px; }
  .protocol-list { gap: 8px; }
  .page-footer { flex-wrap: wrap; gap: 6px; padding-top: 13px; font-size: 9px; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 19px; }
  .modal-head { padding: 16px 16px 13px; }
  .modal-head h2 { font-size: 17px; }
  .modal-body { padding: 15px 16px; }
  .modal-foot { padding: 12px 16px; }
  .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .field-full { grid-column: auto; }
  .local-feature-list { grid-template-columns: minmax(0, 1fr); }
  .footer-dot { display: none; }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid #5c86f5;
  outline-offset: 2px;
}
