:root {
  --green-950: #073d2b;
  --green-900: #0a4b35;
  --green-800: #0d6244;
  --green-700: #0f7b55;
  --green-600: #159b69;
  --green-100: #dff5ea;
  --green-50: #eefbf5;
  --ink: #17201c;
  --muted: #6d7b74;
  --line: #dce5df;
  --canvas: #f3f7f4;
  --panel: #ffffff;
  --danger: #b5403d;
  --danger-soft: #fbeceb;
  --amber: #a76910;
  --amber-soft: #fff4dd;
  --shadow: 0 18px 45px rgba(17, 49, 36, 0.09);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -0.04em; }
h2 { font-size: 17px; letter-spacing: -0.02em; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.full-width { width: 100%; }
.full-span { grid-column: 1 / -1; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--green-600);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.brand-mark svg { width: 23px; fill: white; }

.button {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 16px;
  font-weight: 650;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.button-primary {
  background: var(--green-700);
  color: white;
  box-shadow: 0 8px 18px rgba(15, 123, 85, 0.18);
}
.button-primary:hover { background: var(--green-800); }
.button-secondary {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}
.button-secondary:hover { border-color: #b8ccc1; background: #fbfdfc; }
.button-large { width: 100%; padding: 13px 18px; font-size: 15px; }
.text-button {
  border: 0;
  padding: 4px;
  background: transparent;
  color: var(--green-700);
  font-weight: 650;
}
.text-button:hover { color: var(--green-900); }
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
}
.icon-button:hover { background: var(--canvas); color: var(--ink); }

.login-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 20%, rgba(81, 208, 156, 0.38), transparent 27rem),
    radial-gradient(circle at 87% 88%, rgba(232, 192, 105, 0.2), transparent 24rem),
    linear-gradient(145deg, #061e16 0%, #0a3c2b 52%, #0d6043 100%);
}
.login-view::before,
.login-view::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.login-view::before { width: 520px; height: 520px; right: -220px; top: -210px; }
.login-view::after { width: 320px; height: 320px; left: -150px; bottom: -130px; }
.login-panel {
  width: min(100%, 430px);
  padding: 38px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
}
.brand-login { color: var(--green-900); margin-bottom: 44px; }
.login-panel h1 { font-size: 37px; line-height: 1.08; }
.login-subtitle { color: var(--muted); margin-top: 12px; line-height: 1.7; }
.login-form { margin-top: 34px; display: grid; gap: 18px; }
.login-form label, .form-grid label, .textarea-label { display: grid; gap: 7px; }
.login-form label > span, .form-grid label > span, .textarea-label > span {
  color: #38443e;
  font-size: 13px;
  font-weight: 650;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--green-600);
  background: white;
  box-shadow: 0 0 0 3px rgba(21, 155, 105, 0.12);
}
textarea { resize: vertical; line-height: 1.6; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-footnote { margin-top: 26px; color: #8a9690; font-size: 12px; text-align: center; }

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
}
.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #e7f6ee;
  background:
    radial-gradient(circle at 0 0, rgba(45, 193, 133, 0.24), transparent 18rem),
    linear-gradient(180deg, #082d21 0%, #073c2a 100%);
}
.sidebar .brand { padding: 0 8px 28px; }
.sidebar-nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: #b8cfc4;
  text-align: left;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: white; }
.nav-item.is-active { background: rgba(255, 255, 255, 0.12); color: white; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.nav-icon { width: 20px; text-align: center; opacity: 0.8; }
.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #d8f66b;
  color: #1c2a11;
  font-size: 11px;
  font-weight: 800;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.current-user { color: #e7f6ee; font-size: 13px; margin-bottom: 6px; }
.sidebar-footer .text-button { color: #9fc0b1; padding-left: 0; }
.sidebar-footer .text-button:hover { color: white; }

.main-content { min-width: 0; min-height: 0; overflow: hidden; }
.view { display: none; height: 100%; min-height: 0; padding: 28px 34px; overflow: auto; }
.view.is-active { display: block; }
#view-conversations.is-active { display: flex; flex-direction: column; overflow: hidden; }
.page-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-header h1 { margin-top: 4px; }
.eyebrow {
  color: var(--green-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.page-subtitle { color: var(--muted); margin-top: 8px; line-height: 1.6; }
.stats-row { display: flex; gap: 9px; }
.stat-pill {
  min-width: 86px;
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.stat-pill strong { font-size: 20px; letter-spacing: -0.04em; }
.stat-pill span { color: var(--muted); font-size: 12px; }

.inbox {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 318px minmax(360px, 1fr) 250px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
}
.conversation-pane { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fbfdfc; }
.conversation-tools { padding: 14px; display: grid; gap: 9px; border-bottom: 1px solid var(--line); }
.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
}
.search-box input { border: 0; box-shadow: none; padding-left: 0; background: transparent; }
.conversation-tools select { padding: 9px 10px; font-size: 12px; }
.conversation-list { flex: 1; overflow: auto; padding: 7px; }
.conversation-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  text-align: left;
  color: var(--ink);
}
.conversation-item:hover { background: #f1f7f3; }
.conversation-item.is-active { background: var(--green-50); box-shadow: inset 3px 0 0 var(--green-600); }
.conversation-main { min-width: 0; }
.conversation-top { display: flex; align-items: center; gap: 7px; }
.conversation-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-time { margin-left: auto; color: #8b9891; font-size: 10px; flex: 0 0 auto; }
.conversation-account { color: var(--green-700); font-size: 10px; font-weight: 650; margin-top: 2px; }
.conversation-preview { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 5px; }
.conversation-bottom { display: flex; align-items: center; gap: 6px; margin-top: 5px; min-height: 15px; }
.mode-chip { font-size: 10px; padding: 2px 6px; border-radius: 999px; background: #e8f0eb; color: #5f6f67; }
.mode-chip.auto { background: var(--green-100); color: var(--green-800); }
.unread-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-700);
  color: white;
  font-size: 10px;
  font-weight: 800;
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #e3efe8;
  color: var(--green-900);
  font-weight: 800;
  font-size: 15px;
}
.avatar.tone-0 { background: #e2f3e9; color: #0b6948; }
.avatar.tone-1 { background: #e7edfb; color: #345f9d; }
.avatar.tone-2 { background: #f9efd9; color: #92631d; }
.avatar.tone-3 { background: #f6e6e2; color: #9c4c3d; }
.avatar.tone-4 { background: #eee7f5; color: #694a8d; }
.avatar-large { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto; font-size: 22px; }

.chat-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #f8faf9; position: relative; }
.chat-empty { flex: 1; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.chat-empty h2 { margin-top: 22px; }
.chat-empty p { max-width: 360px; color: var(--muted); line-height: 1.7; margin-top: 9px; }
.empty-orbit {
  width: 92px;
  height: 92px;
  border: 1px solid #d6e8de;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.empty-orbit::before, .empty-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid #c7e1d4;
}
.empty-orbit::before { inset: 13px; }
.empty-orbit::after { inset: 29px; background: var(--green-600); border: 0; box-shadow: 0 8px 20px rgba(15, 123, 85, 0.28); }
.empty-orbit span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #d8f66b; top: 10px; right: 10px; }
.chat-active { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.chat-title { min-width: 0; }
.chat-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.mode-toggle {
  margin-left: auto;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #516159;
  font-size: 11px;
  font-weight: 700;
}
.mode-toggle:hover { background: var(--canvas); }
.mode-toggle .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa8a1; }
.mode-toggle.is-auto { color: var(--green-800); background: var(--green-50); border-color: #c7e7d7; }
.mode-toggle.is-auto .status-dot { background: var(--green-600); box-shadow: 0 0 0 3px rgba(21, 155, 105, 0.13); }
.message-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.message-day { align-self: center; color: #94a198; font-size: 10px; padding: 3px 9px; background: #edf2ef; border-radius: 999px; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.message-row.is-out { align-self: flex-end; align-items: flex-end; }
.message-meta { display: flex; align-items: center; gap: 6px; color: #8a9890; font-size: 10px; margin: 0 3px 5px; }
.message-bubble {
  padding: 10px 13px;
  border-radius: 5px 15px 15px 15px;
  background: white;
  border: 1px solid #e1e9e4;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(23, 50, 37, 0.035);
}
.is-out .message-bubble { border-radius: 15px 5px 15px 15px; background: var(--green-700); border-color: var(--green-700); color: white; }
.message-bubble.is-failed { background: var(--danger-soft); border-color: #f1cfcc; color: var(--danger); }
.message-bubble.is-sending { opacity: 0.65; }
.message-status { color: var(--danger); font-size: 10px; margin-top: 4px; }
.composer {
  margin: 0 18px 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 10px 24px rgba(24, 55, 41, 0.05);
}
.composer textarea { border: 0; box-shadow: none; resize: none; background: transparent; padding: 7px 8px; min-height: 48px; max-height: 140px; }
.composer .button { align-self: end; padding: 10px 18px; }
.composer-hint { grid-column: 1 / -1; color: #94a198; font-size: 10px; padding: 0 8px 2px; }

.contact-pane { min-width: 0; border-left: 1px solid var(--line); background: white; padding: 24px 18px; overflow: auto; }
.contact-empty { color: var(--muted); text-align: center; padding-top: 24px; }
.contact-content h3 { text-align: center; margin-top: 12px; }
#contact-openid { text-align: center; margin-top: 5px; font-size: 10px; word-break: break-all; }
.detail-list { margin: 24px 0; display: grid; gap: 15px; }
.detail-list div { display: grid; gap: 4px; }
.detail-list dt { color: var(--muted); font-size: 10px; }
.detail-list dd { margin: 0; font-size: 12px; line-height: 1.5; word-break: break-word; }
.notice-box { margin-top: 18px; padding: 14px; border-radius: 12px; background: var(--green-50); border: 1px solid #d6eadf; }
.notice-box strong { display: block; font-size: 12px; color: var(--green-900); }
.notice-box p { margin-top: 6px; color: #587064; font-size: 11px; line-height: 1.65; }
.notice-wide { margin-top: 22px; max-width: 760px; }

.knowledge-layout { display: grid; grid-template-columns: minmax(280px, 0.72fr) minmax(400px, 1.28fr); gap: 22px; align-items: start; }
.upload-card {
  min-height: 288px;
  border: 1.5px dashed #b8d5c6;
  border-radius: 18px;
  background: linear-gradient(145deg, #f0faf5, #fbfdfc);
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 32px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.upload-card.is-dragging { border-color: var(--green-600); background: #e7f8ef; transform: translateY(-2px); }
.upload-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); font-size: 29px; margin-bottom: 16px; }
.upload-card h2 { font-size: 18px; }
.upload-card p { color: var(--muted); line-height: 1.7; max-width: 330px; margin: 9px 0 18px; font-size: 12px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 9px 26px rgba(17, 49, 36, 0.04); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.document-list { padding: 7px; }
.document-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; }
.document-item + .document-item { border-top: 1px solid #eef2ef; border-radius: 0; }
.document-icon { width: 38px; height: 42px; border-radius: 9px; display: grid; place-items: center; background: #eef8f3; color: var(--green-700); font-size: 10px; font-weight: 800; text-transform: uppercase; flex: 0 0 auto; }
.document-main { min-width: 0; flex: 1; }
.document-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-meta { color: var(--muted); font-size: 11px; margin-top: 3px; }
.empty-state { color: var(--muted); text-align: center; padding: 44px 16px; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.account-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 8px 22px rgba(17, 49, 36, 0.04); }
.account-card.is-disabled { opacity: 0.7; }
.account-card-top { display: flex; align-items: flex-start; gap: 12px; }
.account-card-top .avatar { width: 46px; height: 46px; border-radius: 14px; }
.account-card-title { min-width: 0; flex: 1; }
.account-card-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card-title p { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; margin-top: 4px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; background: var(--green-50); color: var(--green-800); font-size: 10px; font-weight: 700; }
.status-badge.is-off { background: #f1f2f1; color: #7b837e; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.account-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 14px; }
.tag { padding: 4px 8px; border-radius: 7px; background: #f2f6f3; color: #607067; font-size: 10px; }
.webhook-mini { display: flex; gap: 7px; align-items: center; padding: 8px 9px; background: #f6f9f7; border-radius: 8px; }
.webhook-mini code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #5f7067; font-size: 10px; }
.account-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.account-actions .button { padding: 8px 12px; font-size: 12px; }

.settings-form { max-width: 850px; }
.setting-panel { padding: 8px 24px 24px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 21px 0; border-bottom: 1px solid var(--line); }
.setting-row h2 { font-size: 15px; }
.setting-row p { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 5px; max-width: 600px; }
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #ccd5d0; transition: background 180ms ease; }
.switch span::before { content: ""; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); transition: transform 180ms ease; }
.switch input:checked + span { background: var(--green-600); }
.switch input:checked + span::before { transform: translateX(19px); }
.setting-panel .form-grid { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.checkbox-line { display: flex !important; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.checkbox-line input { width: 16px; height: 16px; accent-color: var(--green-700); }
.setting-panel .textarea-label { margin-top: 18px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.settings-actions .muted { font-size: 11px; }

.dialog {
  width: min(94vw, 620px);
  border: 0;
  border-radius: 22px;
  padding: 0;
  background: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
}
.dialog::backdrop { background: rgba(7, 30, 22, 0.48); backdrop-filter: blur(3px); }
.dialog form { padding: 26px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-heading h2 { margin-top: 5px; }
.dialog .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.webhook-box { margin-top: 18px; padding: 12px 14px; border-radius: 11px; background: var(--green-50); }
.webhook-box > span { color: var(--green-800); font-size: 11px; font-weight: 700; }
.webhook-box > div { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.webhook-box code { flex: 1; overflow-wrap: anywhere; color: #516d60; font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  max-width: min(90vw, 440px);
  padding: 11px 16px;
  border-radius: 11px;
  background: #0b3929;
  color: white;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  font-size: 13px;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #8e3835; }
.copy-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px minmax(340px, 1fr); }
  .contact-pane { display: none; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px 14px; }
  .sidebar .brand { justify-content: center; padding: 0 0 25px; }
  .sidebar .brand > span:last-child { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .nav-item > span:nth-child(2) { display: none; }
  .nav-count { position: absolute; margin: 0; transform: translate(17px, -14px); }
  .sidebar-footer { padding-left: 0; padding-right: 0; text-align: center; }
  .current-user { display: none; }
  .view { padding: 22px; }
  .inbox { grid-template-columns: 285px minmax(0, 1fr); }
  .knowledge-layout { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 10;
    left: 0;
    right: 0;
    bottom: 0;
    height: 66px;
    min-height: 0;
    padding: 7px 10px;
    display: block;
    background: rgba(7, 45, 33, 0.98);
    backdrop-filter: blur(12px);
  }
  .sidebar .brand, .sidebar-footer { display: none; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .nav-item { display: flex; flex-direction: column; gap: 2px; font-size: 10px; padding: 7px 3px; }
  .nav-item > span:nth-child(2) { display: block; }
  .nav-icon { font-size: 18px; line-height: 1; }
  .nav-count { transform: translate(16px, -31px); }
  .main-content { height: 100%; padding-bottom: 66px; }
  .view { padding: 16px 14px; }
  #view-conversations.is-active { padding: 0; }
  .page-header { min-height: 58px; margin-bottom: 15px; align-items: flex-start; }
  .page-header h1 { font-size: 25px; }
  .stats-row { display: none; }
  .inbox { border: 0; border-radius: 0; min-height: calc(100vh - 66px); grid-template-columns: 1fr; }
  .conversation-pane { border-right: 0; }
  .chat-pane { display: none; }
  .inbox.chat-open .conversation-pane { display: none; }
  .inbox.chat-open .chat-pane { display: flex; }
  .mobile-only { display: grid; place-items: center; }
  .chat-header { padding-left: 8px; }
  .mode-toggle { padding: 7px 9px; }
  .message-list { padding: 16px 12px 10px; }
  .message-row { max-width: 88%; }
  .composer { margin: 0 10px 10px; }
  .login-view { padding: 18px; }
  .login-panel { padding: 28px 22px; border-radius: 20px; }
  .login-panel h1 { font-size: 31px; }
  .brand-login { margin-bottom: 34px; }
  .dialog form { padding: 20px; }
  .dialog .form-grid, .setting-panel .form-grid { grid-template-columns: 1fr; }
  .dialog .full-span { grid-column: auto; }
  .setting-panel { padding: 4px 16px 18px; }
  .setting-row { gap: 14px; }
  .settings-actions { align-items: flex-end; }
  .settings-actions .muted { max-width: 55%; }
}
