:root {
  color-scheme: dark;
  --bg: #080b14;
  --panel: rgba(18, 24, 42, 0.72);
  --panel-strong: rgba(24, 31, 54, 0.92);
  --text: #eef4ff;
  --muted: #93a4c3;
  --line: rgba(137, 164, 224, 0.18);
  --accent: #7c5cff;
  --accent-2: #21d4fd;
  --success: #35e6a7;
  --danger: #ff6b8a;
  --surface-subtle: rgba(255, 255, 255, 0.05);
  --surface-raised: rgba(255, 255, 255, 0.08);
  --field: rgba(255, 255, 255, 0.06);
  --sidebar: rgba(4, 7, 16, 0.5);
  --overlay: rgba(4, 7, 16, 0.68);
  --sticky-surface: rgba(17, 24, 42, 0.96);
  --shadow: rgba(0, 0, 0, 0.26);
  --shadow-strong: rgba(0, 0, 0, 0.42);
  --danger-text: #ffd5dd;
  --warning-text: #ffd490;
  --info-text: #9fdcff;
  --success-text: #9ee5bc;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fc;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --text: #182238;
  --muted: #62718d;
  --line: rgba(76, 99, 145, 0.2);
  --accent: #6047dc;
  --accent-2: #078db5;
  --success: #1f9d6c;
  --danger: #d94461;
  --surface-subtle: rgba(45, 64, 98, 0.045);
  --surface-raised: rgba(45, 64, 98, 0.075);
  --field: #ffffff;
  --sidebar: rgba(248, 250, 255, 0.88);
  --overlay: rgba(21, 34, 56, 0.28);
  --sticky-surface: rgba(248, 250, 255, 0.98);
  --shadow: rgba(31, 47, 78, 0.12);
  --shadow-strong: rgba(31, 47, 78, 0.22);
  --danger-text: #b42345;
  --warning-text: #9a5d00;
  --info-text: #086e93;
  --success-text: #16734d;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 20% 10%, rgba(104, 83, 227, 0.14), transparent 30rem),
    radial-gradient(circle at 80% 0%, rgba(33, 174, 215, 0.12), transparent 30rem),
    var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(124, 92, 255, 0.28), transparent 28rem),
    radial-gradient(circle at 80% 0%, rgba(33, 212, 253, 0.18), transparent 30rem),
    var(--bg);
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
}

.update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(53, 230, 167, 0.45);
  border-radius: 16px;
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: 0 18px 60px var(--shadow-strong);
  transform: translateX(-50%);
  backdrop-filter: blur(22px);
}

.update-banner[hidden] { display: none; }

.update-banner button {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(124, 92, 255, 0.35);
}

.brand span, .eyebrow, .section-title span, .settings-panel p { color: var(--muted); }

nav { display: grid; gap: 10px; }

.logout-form { margin-top: auto; }
.logout-form button { width: 100%; }

nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
}

nav a.active, nav a:hover {
  color: var(--text);
  background: rgba(124, 92, 255, 0.14);
}

main {
  display: grid;
  gap: 22px;
  align-content: start;
  height: 100vh;
  overflow: hidden;
  padding: 24px 28px 130px;
}

main[data-page="settings"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 48px;
}

main[data-page="sales"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 176px;
}

main[data-page="today"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 48px;
}

main[data-page="knowledge"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 48px;
}

.today-dashboard { min-height: calc(100vh - 48px); }
.today-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-right: 96px; }
.today-heading h1 { margin: 2px 0 5px; font-size: 26px; letter-spacing: 0; }
.today-heading span { color: var(--muted); font-size: 13px; }
.today-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }
.today-metric { display: grid; gap: 3px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; text-align: left; color: var(--text); background: var(--surface-subtle); box-shadow: none; }
.today-metric strong { font-size: 22px; }
.today-metric span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.today-metric.overdue strong,
.today-metric.conflict strong { color: var(--danger); }
.today-metric.today strong,
.today-metric.followup strong { color: var(--accent-2); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 14px; }
.today-ai-section { margin-bottom: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 2px; }
.today-ai-section .today-section-title { margin-bottom: 10px; }
.today-ai-section .today-section-title > div { display: grid; gap: 2px; }
.today-ai-section .today-section-title p { margin: 0; }
.today-ai-section .today-section-title > span { color: var(--muted); font-size: 12px; }
.today-ai-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.today-ai-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; border-left: 3px solid var(--accent-2); border-radius: 6px; padding: 10px 12px; background: var(--surface-subtle); }
.today-ai-item.warning { border-left-color: #e3a221; }
.today-ai-item.danger { border-left-color: var(--danger); }
.today-ai-item > div { display: grid; min-width: 0; gap: 3px; }
.today-ai-item strong { font-size: 13px; }
.today-ai-item span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.today-ai-item button { flex: 0 0 auto; padding: 6px 8px; font-size: 11px; }
.today-section { min-width: 0; border-top: 1px solid var(--line); padding: 14px 2px 2px; }
.today-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.today-section-title h2 { margin: 0; font-size: 15px; letter-spacing: 0; }
.today-section-title button { padding: 5px 7px; color: var(--muted); background: transparent; box-shadow: none; font-size: 12px; }
.today-list { display: grid; gap: 6px; }
.today-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 6px; padding: 10px; text-align: left; color: var(--text); background: var(--surface-subtle); box-shadow: none; }
.today-item:hover { border-color: var(--line); background: var(--surface-raised); }
.today-item.overdue { border-left: 3px solid var(--danger); }
.today-item > div { display: grid; min-width: 0; gap: 3px; }
.today-item strong,
.today-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-item strong { font-size: 13px; }
.today-item span { color: var(--muted); font-size: 11px; }
.today-item > button { flex: 0 0 auto; padding: 6px 9px; font-size: 11px; }
.today-state { flex: 0 0 auto; border-radius: 4px; padding: 4px 6px; background: var(--surface-raised); }
.today-state.active { color: var(--success-text); }
.today-state.locked { color: var(--muted); }
.today-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }

@media (max-width: 1100px) {
  .today-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .today-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .today-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-dashboard { min-height: auto; }
  .today-heading { padding-right: 82px; }
  .today-ai-list { grid-template-columns: 1fr; }
}

main[data-page="workspace"] {
  padding-bottom: 24px;
}

.shell[data-page="workspace"] .agent-dock-panel {
  display: none;
}

.page-section[hidden] { display: none !important; }

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 24px 80px var(--shadow);
  backdrop-filter: blur(24px);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  padding: 34px;
}

.hero h1 {
  max-width: 720px;
  margin: 8px 0;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.hero p { max-width: 620px; color: var(--muted); }

.orb {
  position: absolute;
  right: 50px;
  top: 34px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #fff, var(--accent-2) 28%, var(--accent) 64%, transparent 70%);
  filter: blur(0.2px);
  opacity: 0.8;
}

.grid.two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 22px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(190px, 14vw) minmax(0, 1fr);
  gap: 22px;
  height: calc(100vh - 154px);
  min-height: 0;
}

.chat-layout .session-panel,
.chat-layout .chat-panel {
  min-height: 0;
  max-height: calc(100vh - 154px);
  overflow: hidden;
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-log {
  flex: 1;
  min-height: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 10px;
}

.compact-title { padding: 14px 18px 4px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar select { min-width: 180px; }

.usage-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 10px;
  color: var(--muted);
  font-size: 13px;
}

.usage-strip span,
.participant-list span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.usage-strip strong { color: var(--text); }

.tool-request-panel {
  display: grid;
  gap: 8px;
  padding: 0 30px 10px;
}

.tool-request-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 214, 102, 0.35);
  border-radius: 14px;
  background: rgba(255, 214, 102, 0.08);
}

.tool-request-item small { display: block; color: var(--muted); }
.tool-request-actions { display: flex; gap: 8px; align-items: center; }

.meeting-control {
  display: grid;
  gap: 12px;
  padding: 14px 20px 22px;
}

.project-directory-panel {
  position: relative;
  display: flex;
  flex-direction: column;
}

.project-directory-list {
  display: grid;
  gap: 4px;
  overflow: auto;
  padding: 10px;
}

.project-directory-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
}

.project-directory-item:hover,
.project-directory-item.active {
  border-color: var(--line);
  background: var(--panel-strong);
}

.project-directory-item strong,
.project-directory-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-directory-item small,
.project-opportunity-label {
  color: var(--muted);
  font-size: 12px;
}

.project-create-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 16px;
  background: var(--panel);
}

.project-create-panel[hidden] { display: none; }

.project-create-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-create-panel label,
.project-picker-group {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.meeting-agent-picker {
  display: grid;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
}

.meeting-agent-row {
  display: grid;
  grid-template-columns: auto 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}

.meeting-agent-row input { width: auto; }
.meeting-agent-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-participants { padding: 0 24px 10px; }
.project-status { padding: 0 24px 8px; margin: 0; }

.project-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 24px 12px;
  border: 1px solid var(--line);
  background: var(--line);
}

.project-overview span {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
}

.project-overview small,
.project-file-item small { color: var(--muted); font-size: 12px; }
.project-overview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.project-files {
  margin: 0 24px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.project-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.project-file-actions { display: flex; align-items: center; gap: 6px; }
.project-file-actions button { min-height: 30px; padding: 5px 8px; font-size: 12px; }

.project-file-list { display: grid; max-height: 118px; overflow: auto; }

.project-file-item {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
}

.project-file-item:last-child { border-bottom: 0; }
.project-file-item:hover { background: var(--surface-raised); }
.meeting-message-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.meeting-message-actions .ghost-button { min-height: 30px; padding: 4px 8px; font-size: 12px; }

.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meeting-member-picker {
  display: grid;
  gap: 8px;
  max-height: 232px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meeting-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 132px;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.meeting-member-row input { width: auto; }
.meeting-member-row select { min-height: 36px; }
.meeting-member-role { color: var(--muted); font-size: 12px; }
.meeting-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line input { width: auto; }

h2 { margin: 0; }
h3 { margin: 0 0 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  padding: 14px 24px 24px;
}

.app-launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 18px;
  padding: 20px 24px 28px;
}

.app-launch {
  display: grid;
  width: 86px;
  height: 112px;
  grid-template-rows: 58px minmax(18px, auto);
  align-content: center;
  gap: 7px;
  justify-items: center;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface-raised);
  box-shadow: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.app-launch:hover {
  transform: translateY(-2px);
  border-color: rgba(33, 212, 253, 0.42);
  background: rgba(124, 92, 255, 0.16);
}

.app-card, .agent-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  padding: 18px;
}

.agent-dock-panel {
  position: fixed;
  right: 28px;
  bottom: 14px;
  left: 288px;
  z-index: 20;
  border-radius: 18px;
  background: var(--panel-strong);
}

.agent-dock-panel .section-title {
  padding: 7px 12px 2px;
}

.agent-dock-panel .section-title h2 {
  font-size: 14px;
}

.agent-dock-panel .section-title span {
  font-size: 11px;
}

.agent-dock-panel .agent-card {
  min-width: 104px;
  padding: 6px;
  border-radius: 14px;
  cursor: pointer;
}

.agent-dock-panel .agent-card:hover,
.agent-dock-panel .agent-card:focus-visible {
  border-color: rgba(124, 92, 255, 0.55);
  outline: none;
  transform: translateY(-1px);
}

.agent-card.working {
  border-color: rgba(53, 230, 167, 0.55);
  box-shadow: 0 0 28px rgba(53, 230, 167, 0.12);
}

.agent-dock-panel .agent-card.working {
  box-shadow: 0 0 18px rgba(53, 230, 167, 0.12);
}

.agent-workstation {
  position: relative;
  height: 160px;
  margin-bottom: 14px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 12%, rgba(33, 212, 253, 0.13), transparent 46%),
    rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.agent-dock-panel .agent-workstation {
  height: 46px;
  margin-bottom: 5px;
  border-radius: 10px;
}

.agent-monitor {
  position: absolute;
  left: 50%;
  top: 22px;
  display: grid;
  width: 92px;
  height: 58px;
  place-items: center;
  border: 2px solid rgba(137, 164, 224, 0.35);
  border-radius: 12px;
  color: rgba(147, 164, 195, 0.85);
  background: rgba(5, 9, 20, 0.82);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

.agent-dock-panel .agent-monitor {
  top: 5px;
  width: 34px;
  height: 20px;
  border-radius: 6px;
  border-width: 1px;
}

.agent-card.working .agent-monitor {
  border-color: rgba(53, 230, 167, 0.72);
  color: var(--success);
  box-shadow: 0 0 22px rgba(53, 230, 167, 0.22), inset 0 0 20px rgba(53, 230, 167, 0.12);
}

.agent-screen-lines { font-size: 13px; letter-spacing: 0.22em; }

.agent-dock-panel .agent-screen-lines { font-size: 7px; letter-spacing: 0.04em; }

.agent-desk {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 88px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.8), rgba(33, 212, 253, 0.72));
}

.agent-dock-panel .agent-desk {
  left: 14px;
  right: 14px;
  top: 27px;
  height: 4px;
}

.agent-person {
  position: absolute;
  left: 50%;
  top: 72px;
  width: 66px;
  height: 66px;
  transform: translateX(-50%);
}

.agent-dock-panel .agent-person {
  top: 21px;
  width: 24px;
  height: 24px;
}

.agent-head {
  position: absolute;
  left: 50%;
  top: 0;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 20px;
  transform: translateX(-50%);
}

.agent-dock-panel .agent-head {
  width: 13px;
  height: 13px;
  font-size: 8px;
}

.agent-body {
  position: absolute;
  left: 50%;
  top: 31px;
  width: 40px;
  height: 38px;
  border-radius: 18px 18px 10px 10px;
  background: rgba(124, 92, 255, 0.8);
  transform: translateX(-50%);
}

.agent-dock-panel .agent-body {
  top: 12px;
  width: 15px;
  height: 14px;
  border-radius: 8px 8px 5px 5px;
}

.agent-arm {
  position: absolute;
  top: 41px;
  width: 28px;
  height: 8px;
  border-radius: 999px;
  background: rgba(238, 244, 255, 0.72);
}

.agent-dock-panel .agent-arm {
  top: 17px;
  width: 10px;
  height: 3px;
}

.agent-dock-panel .agent-arm.left { left: 2px; }
.agent-dock-panel .agent-arm.right { right: 2px; }

.agent-arm.left { left: 3px; transform: rotate(-24deg); }
.agent-arm.right { right: 3px; transform: rotate(24deg); }
.agent-card.working .agent-arm.left { transform: rotate(18deg); }
.agent-card.working .agent-arm.right { transform: rotate(-18deg); }

.agent-chair {
  position: absolute;
  left: 50%;
  bottom: 12px;
  display: grid;
  min-width: 96px;
  max-width: calc(100% - 32px);
  height: 34px;
  place-items: center;
  border: 1px solid rgba(137, 164, 224, 0.28);
  border-radius: 14px 14px 18px 18px;
  color: var(--text);
  background: rgba(24, 31, 54, 0.92);
  transform: translateX(-50%);
}

.agent-dock-panel .agent-chair {
  bottom: 3px;
  min-width: 52px;
  height: 14px;
  border-radius: 7px 7px 8px 8px;
}

.agent-chair span {
  max-width: 150px;
  overflow: hidden;
  padding: 0 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.agent-dock-panel .agent-chair span {
  max-width: 68px;
  padding: 0 5px;
  font-size: 9px;
}

.agent-card:not(.working) .agent-person {
  transform: translateX(-50%) rotate(-5deg);
}

.agent-card:not(.working) .agent-head {
  filter: saturate(0.78);
}

.agent-card.working .agent-person {
  animation: typing-bob 0.65s ease-in-out infinite alternate;
}

@keyframes typing-bob {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(3px); }
}

.app-icon, .agent-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
}

.app-launch .app-icon {
  width: 58px;
  height: 58px;
  margin: 0;
  border-radius: 20px;
  font-size: 30px;
}
.app-launch-name {
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-icon-paste {
  display: grid;
  min-height: 104px;
  place-items: center;
  border: 1px dashed rgba(137, 164, 224, 0.48);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  outline: none;
}
.app-icon-paste:hover, .app-icon-paste:focus { border-color: var(--accent-2); background: rgba(33, 212, 253, 0.08); }
.app-icon-paste img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; }
.app-icon-paste img:not([hidden]) + span { display: none; }

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.app-icon.small, .agent-avatar.small {
  width: 38px;
  height: 38px;
  min-width: 38px;
  margin: 0;
  border-radius: 12px;
  font-size: 20px;
}

.app-card strong, .agent-card strong { display: block; margin-bottom: 4px; }
.app-card p, .agent-card p { min-height: 22px; margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.app-card small, .agent-card small { color: var(--muted); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

.agent-work-status, .agent-card-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.agent-work-status {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.agent-card-status { margin: -4px 0 10px; }

.agent-work-light {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 transparent;
}

.agent-work-status.working, .agent-card.working .agent-card-status { color: var(--text); }
.agent-work-status.working .agent-work-light, .agent-card.working .agent-work-light {
  background: var(--success);
  box-shadow: 0 0 16px rgba(53, 230, 167, 0.75);
}

.form-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 24px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  padding: 13px 14px;
  color: var(--text);
  background: var(--field);
}

textarea { min-height: 112px; resize: vertical; }

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
}

.ghost-button, .card-actions button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: none;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.card-actions button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.card-actions .danger { color: var(--danger-text); }

.agent-list { display: grid; gap: 14px; padding: 14px 24px 24px; }
.agent-dock-panel .agent-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 5px 12px 8px;
}

.agent-dock-panel .agent-card-status {
  justify-content: center;
  margin: 0;
  font-size: 10px;
}

.session-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding: 12px 14px 20px;
}

.session-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  color: var(--muted);
  background: var(--surface-subtle);
}

.session-item.active {
  color: var(--text);
  background: rgba(124, 92, 255, 0.2);
}

.session-item small { display: block; margin-top: 4px; color: var(--muted); }

.session-main {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.session-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.session-actions button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 6px;
  color: var(--text);
  background: var(--surface-subtle);
  font-size: 12px;
}

.session-actions .danger { color: var(--danger-text); }

.chat-panel { padding-bottom: 18px; }

.chat-log {
  display: grid;
  align-content: start;
  flex: 1;
  gap: 16px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 20px 30px;
}

.message {
  max-width: min(86%, 980px);
  padding: 18px 20px;
  border-radius: 22px;
  background: var(--surface-raised);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  background: rgba(124, 92, 255, 0.28);
}

.message.assistant { white-space: normal; }
.message.assistant > :first-child { margin-top: 0; }
.message.assistant > :last-child { margin-bottom: 0; }
.message.assistant h1,
.message.assistant h2,
.message.assistant h3,
.message.assistant h4 { margin: 16px 0 7px; letter-spacing: 0; line-height: 1.35; }
.message.assistant h1 { font-size: 20px; }
.message.assistant h2 { font-size: 18px; }
.message.assistant h3,
.message.assistant h4 { font-size: 16px; }
.message.assistant p { margin: 8px 0; }
.message.assistant ul,
.message.assistant ol { margin: 8px 0; padding-left: 22px; }
.message.assistant li + li { margin-top: 5px; }
.message.assistant blockquote { margin: 10px 0; border-left: 3px solid var(--accent-2); padding: 5px 10px; color: var(--muted); background: var(--surface-subtle); }
.message.assistant code { border-radius: 4px; padding: 2px 4px; background: var(--surface-subtle); font-size: 0.9em; }
.message.assistant pre { overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--surface-subtle); }
.message.assistant pre code { padding: 0; background: transparent; }
.message.assistant a { color: var(--accent-2); text-decoration: underline; }
.message.assistant a > img {
  width: min(240px, 100%);
  height: 180px;
  display: block;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 0 30px 12px;
}

#meeting-form {
  grid-template-columns: 168px minmax(0, 1fr) auto;
}

#meeting-target-agent {
  min-width: 0;
  max-width: 168px;
  min-height: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-input input {
  min-height: 52px;
  font-size: 16px;
}

.chat-input select {
  min-height: 52px;
}

.chat-input button {
  min-width: 96px;
  min-height: 52px;
}

.settings-panel, .settings-form { display: grid; gap: 12px; }
.settings-panel { padding: 24px; }
.settings-hint { margin: 0; font-size: 13px; }
.form-actions { display: flex; gap: 10px; }
.form-actions button { flex: 1; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.sales-panel {
  display: grid;
  grid-template-columns: minmax(340px, 0.36fr) minmax(520px, 0.64fr);
  grid-template-areas:
    "title title"
    "summary summary"
    "analysis analysis"
    "ops board"
    "manage manage";
  gap: 12px;
  padding-bottom: 16px;
}

.sales-panel > .section-title { grid-area: title; }

#work-plans {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 154px);
  min-height: 0;
  overflow: hidden;
}

#work-plans > .section-title { flex: 0 0 auto; }

.sales-summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px;
}

.sales-summary article {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--surface-subtle);
}

.sales-summary strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.sales-summary span { color: var(--muted); font-size: 13px; }

.sales-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  padding: 10px 24px 0;
}

.sales-main-grid {
  grid-area: ops;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "schedule-form schedule-list"
    "visit-form visit-list";
  gap: 10px;
  padding: 0 0 0 18px;
  align-content: start;
}

.visit-form-card { grid-area: visit-form; }
.visit-list-card { grid-area: visit-list; }
.schedule-form-card { grid-area: schedule-form; }
.schedule-list-card { grid-area: schedule-list; }

.customer-search-select {
  position: relative;
  min-width: 0;
}

.customer-search-select > input[type="search"] { width: 100%; }

.customer-search-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--surface-raised);
  box-shadow: 0 12px 28px rgba(13, 21, 36, 0.18);
}

.customer-search-results[hidden] { display: none; }

.customer-search-results button {
  display: grid;
  width: 100%;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.customer-search-results button:hover,
.customer-search-results button:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised));
  outline: none;
}

.customer-search-results button span,
.customer-search-results > p {
  color: var(--muted);
  font-size: 12px;
}

.customer-search-results > p { margin: 8px; }

.work-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "plan-top"
    "plan-list";
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
  padding: 0 18px 18px;
  align-items: stretch;
}

.plan-top-card { grid-area: plan-top; }
.plan-form-card { grid-area: plan-form; }
.plan-list-card {
  grid-area: plan-list;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.plan-list-card h3 { flex: 0 0 auto; }
.plan-list-card #plan-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: var(--overlay);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] { display: none; }

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-radius: 24px;
  box-shadow: 0 28px 90px var(--shadow-strong);
  transform: translateX(-20vw);
}

.modal-title {
  position: sticky;
  top: -18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  grid-column: 1 / -1;
  margin: -4px -4px 2px;
  padding: 4px 4px 10px;
  background: linear-gradient(180deg, var(--sticky-surface), color-mix(in srgb, var(--sticky-surface) 92%, transparent));
}

.modal-title h3 { margin: 0; }

.modal-card textarea,
.modal-card .form-actions,
.modal-card input[name="title"],
.modal-card input[name="source"] {
  grid-column: 1 / -1;
}

.modal-card textarea { min-height: 72px; }

.modal-card .form-actions {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin: 2px -4px -4px;
  padding: 10px 4px 4px;
  background: linear-gradient(0deg, var(--sticky-surface), color-mix(in srgb, var(--sticky-surface) 92%, transparent));
}

.plan-ai-inline {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.plan-ai-inline textarea {
  min-height: 48px;
  resize: vertical;
}

.plan-ai-inline small { grid-column: 1 / -1; }

.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.plan-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.plan-reminder-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.plan-reminder,
.plan-reminder-empty {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
}

.plan-reminder-empty { color: var(--muted); background: var(--surface-subtle); }
.plan-reminder-overdue { color: var(--danger-text); background: rgba(255, 96, 120, 0.15); }
.plan-reminder-today { color: var(--warning-text); background: rgba(255, 184, 77, 0.14); }
.plan-reminder-upcoming { color: var(--info-text); background: rgba(73, 180, 255, 0.14); }
.plan-completion { margin-top: 3px; color: var(--success-text) !important; }

.plan-group {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.plan-group-title {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(137, 164, 224, 0.16);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.plan-group-title span { color: var(--muted); font-size: 12px; }

.plan-table { display: grid; gap: 5px; }

.plan-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) minmax(120px, 0.65fr) minmax(130px, 0.7fr) minmax(76px, 0.42fr) minmax(96px, 0.48fr) auto;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.04);
}

.plan-row strong,
.plan-row span,
.plan-row small { display: block; }
.plan-row strong { font-size: 14px; line-height: 1.25; }
.plan-row span { font-size: 13px; line-height: 1.25; }
.plan-row small { color: var(--muted); font-size: 11px; line-height: 1.2; }
.plan-main-cell small {
  margin-top: 2px;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-row select {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.plan-actions { justify-content: flex-end; gap: 5px; }
.plan-actions button {
  padding: 5px 7px;
  border-radius: 9px;
  font-size: 12px;
}

.plan-workspace-heading,
.plan-heading-actions,
.plan-view-tabs,
.plan-controls,
.plan-list-header,
.plan-card-labels,
.plan-card-actions {
  display: flex;
  align-items: center;
}

.plan-workspace-heading {
  justify-content: space-between;
  gap: 18px;
}

.workspace-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.plan-workspace-heading h3,
.plan-list-header h3 { margin: 0; font-size: 18px; }
.plan-heading-actions { gap: 9px; }
.plan-heading-actions > button { white-space: nowrap; }

.plan-ai-panel { position: relative; }
.plan-ai-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}
.plan-ai-panel summary::-webkit-details-marker { display: none; }
.plan-ai-panel[open] .plan-ai-inline {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(460px, calc(100vw - 64px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: 0 16px 44px var(--shadow-strong);
}

.plan-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0 12px;
}

.plan-overview-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  text-align: left;
  border: 1px solid rgba(137, 164, 224, 0.15);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  transition: 160ms ease;
}
.plan-overview-card:hover,
.plan-overview-card.active { border-color: rgba(124, 92, 255, 0.75); background: rgba(124, 92, 255, 0.12); }
.plan-overview-card span { color: var(--muted); font-size: 12px; }
.plan-overview-card strong { font-size: 24px; line-height: 1; }
.plan-overview-card small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }

.plan-view-tabs { gap: 6px; border-bottom: 1px solid var(--line); }
.plan-view-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 7px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}
.plan-view-tab.active { border-bottom-color: var(--accent); color: var(--text); background: transparent; }

.plan-controls { flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.plan-controls label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.plan-controls select { min-height: 34px; padding: 6px 8px; font-size: 12px; }
.plan-search { flex: 1 1 260px; }
.plan-search input { width: 100%; min-height: 34px; padding: 6px 9px; }

.plan-list-header { justify-content: space-between; margin-bottom: 10px; }
.plan-list-header > span { color: var(--muted); font-size: 12px; }
.plan-list-header .workspace-kicker { margin-bottom: 2px; }
.plan-list-card #plan-list { padding-right: 4px; }
.plan-group { gap: 8px; margin-bottom: 16px; }
.plan-group-title { padding: 4px 10px; }
.plan-table { gap: 8px; }

.plan-task-card {
  display: grid;
  grid-template-columns: minmax(300px, 1.7fr) minmax(250px, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 3px solid rgba(137, 164, 224, 0.3);
  border-radius: 15px;
  padding: 14px 15px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  transition: 160ms ease;
}
.plan-task-card:hover { transform: translateY(-1px); border-color: rgba(137, 164, 224, 0.45); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16); }
.plan-task-card.status-progress { border-left-color: #5ab9ff; }
.plan-task-card.status-done { border-left-color: #5ecb94; opacity: 0.78; }
.plan-task-card.priority-high { border-left-color: #ff737f; }

.plan-card-labels { flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.plan-status,
.plan-priority { border-radius: 999px; padding: 3px 7px; font-size: 11px; }
.plan-status.status-pending { color: var(--warning-text); background: rgba(255, 184, 77, 0.14); }
.plan-status.status-progress { color: var(--info-text); background: rgba(73, 180, 255, 0.14); }
.plan-status.status-done { color: var(--success-text); background: rgba(67, 201, 137, 0.15); }
.plan-priority.priority-high { color: var(--danger-text); background: rgba(255, 96, 120, 0.14); }
.plan-priority.priority-normal { color: var(--muted); background: rgba(160, 178, 218, 0.13); }
.plan-priority.priority-low { color: var(--success-text); background: rgba(84, 205, 177, 0.12); }
.plan-card-main strong { display: block; font-size: 16px; line-height: 1.35; }
.plan-card-main p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.plan-card-main .plan-reminder { margin-top: 7px; }

.plan-card-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.plan-card-details span { display: grid; gap: 3px; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.plan-card-details small { color: var(--muted); font-size: 10px; }
.plan-card-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.plan-card-actions select,
.plan-card-actions button { min-height: 32px; padding: 6px 8px; border-radius: 9px; font-size: 12px; }
.plan-complete-button { border-color: rgba(94, 203, 148, 0.42); color: var(--success-text); }
.plan-completion { margin-top: 8px; color: var(--success-text); font-size: 11px; line-height: 1.45; }
.plan-empty-state { display: grid; place-items: center; gap: 6px; min-height: 240px; color: var(--muted); text-align: center; }
.plan-empty-state strong { color: var(--text); }

@media (max-width: 1020px) {
  .plan-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-task-card { grid-template-columns: 1fr auto; }
  .plan-card-details { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .plan-workspace-heading { align-items: flex-start; flex-direction: column; }
  .plan-heading-actions { width: 100%; justify-content: space-between; }
  .plan-overview { grid-template-columns: 1fr 1fr; }
  .plan-task-card { grid-template-columns: 1fr; gap: 12px; }
  .plan-card-details { grid-template-columns: 1fr 1fr; }
  .plan-card-actions { justify-content: flex-start; }
  .plan-ai-panel[open] .plan-ai-inline { right: auto; left: 0; width: min(420px, calc(100vw - 48px)); }
}

.sales-manage-entry {
  grid-area: manage;
  margin: 0 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.035);
}

.sales-manage-entry summary {
  cursor: pointer;
  padding: 12px 16px;
  color: var(--text);
  font-weight: 700;
}

.sales-manage-entry .sales-grid { padding: 0 18px 18px; }

.sales-analysis {
  grid-area: analysis;
  margin: 0 18px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 20px;
  background: rgba(124, 92, 255, 0.08);
}

.sales-analysis[hidden] { display: none; }

.sales-analysis pre {
  margin: 0;
  padding: 12px 18px 18px;
  overflow: auto;
  color: var(--text);
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.65;
}

.sales-board-wrap {
  grid-area: board;
  min-width: 0;
  margin: 0 18px 0 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-subtle);
}

.opportunity-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  max-height: 470px;
  padding: 10px 12px 12px;
}

.opportunity-column {
  flex: 0 0 188px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-raised);
}

.opportunity-column header {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.opportunity-column header span {
  color: var(--muted);
  font-size: 12px;
}

.opportunity-column-list {
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 8px;
}

.opportunity-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: var(--surface-subtle);
}

.opportunity-card.overdue { border-color: rgba(255, 107, 138, 0.55); }
.opportunity-card.today { border-color: rgba(53, 230, 167, 0.55); }
.opportunity-card.upcoming { border-color: rgba(33, 212, 253, 0.38); }

.opportunity-card small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-badge {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.follow-badge.overdue { color: var(--danger-text); border-color: rgba(255, 107, 138, 0.55); }
.follow-badge.today { color: var(--success-text); border-color: rgba(53, 230, 167, 0.55); }
.follow-badge.upcoming { color: var(--info-text); border-color: rgba(33, 212, 253, 0.45); }

.mini-actions { display: flex; gap: 8px; }

.mini-actions button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  background: var(--surface-raised);
  box-shadow: none;
  font-size: 12px;
}

.sales-list-card { min-height: 0; }

.sales-list {
  display: grid;
  gap: 8px;
  max-height: 198px;
  overflow: auto;
}

.sales-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  background: var(--surface-subtle);
}

.sales-item.schedule-overdue { border-color: rgba(255, 107, 138, 0.55); }
.sales-item.schedule-today { border-color: rgba(53, 230, 167, 0.55); }
.sales-item.schedule-upcoming { border-color: rgba(33, 212, 253, 0.38); }

.sales-item small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-actions { display: flex; gap: 8px; }

.sales-actions button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--surface-raised);
  box-shadow: none;
  font-size: 13px;
}

.sales-actions .danger { color: var(--danger-text); }

.settings-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: var(--surface-subtle);
}

.sales-panel .settings-card {
  border-radius: 18px;
  padding: 12px;
}

.sales-panel .settings-form {
  gap: 8px;
}

.sales-panel h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.sales-panel input,
.sales-panel textarea,
.sales-panel select {
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.sales-panel textarea {
  min-height: 42px;
  resize: vertical;
}

.sales-panel button {
  padding: 9px 10px;
  border-radius: 12px;
}

#work-plans .plan-row {
  min-height: 0;
  grid-auto-rows: min-content;
  gap: 5px;
  border-radius: 9px;
  padding: 4px 7px;
}

#work-plans .plan-row > div { min-width: 0; }

#work-plans .plan-row strong,
#work-plans .plan-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#work-plans .plan-row strong {
  font-size: 13px;
  line-height: 1.15;
}

#work-plans .plan-row span {
  font-size: 12px;
  line-height: 1.15;
}

#work-plans .plan-main-cell small,
#work-plans .plan-row > div:not(.plan-main-cell) small:first-child,
#work-plans .plan-row > div:nth-child(3) small,
#work-plans .plan-row > div:nth-child(4) small {
  display: none;
}

#work-plans .plan-row select {
  min-height: 22px;
  height: 22px;
  padding: 1px 6px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.1;
}

#work-plans .plan-actions {
  flex-wrap: nowrap;
  gap: 4px;
}

#work-plans .plan-actions button {
  min-height: 22px;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.1;
}

.manage-list { display: grid; gap: 10px; }

.manage-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: var(--surface-subtle);
}

.manage-item small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-item button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--surface-raised);
  box-shadow: none;
  font-size: 13px;
}

.manage-item .danger { color: var(--danger-text); }

.item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

code { color: #b9ccff; }

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.login-remember small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.login-card {
  width: min(460px, 100%);
  padding: 32px;
}

.login-brand { margin-bottom: 24px; }
.login-card h1 { margin: 8px 0; font-size: 38px; line-height: 1; letter-spacing: -0.04em; }
.login-copy { color: var(--muted); }
.login-error { color: var(--danger-text); }

@media (max-width: 980px) {
  .shell, .grid.two-columns, .chat-layout { grid-template-columns: 1fr; }
  .shell { grid-template-rows: auto minmax(0, 1fr); }
  .project-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    height: auto;
    padding: 10px 112px 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand { gap: 8px; margin: 0 14px 0 0; }
  .sidebar .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
  .sidebar .brand > div:last-child { display: none; }
  .sidebar nav { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { flex: 0 0 auto; padding: 8px 10px; border-radius: 8px; font-size: 12px; }
  .sidebar .logout-form { margin: 0 0 0 8px; }
  .sidebar .logout-form button { width: auto; min-height: 34px; padding: 7px 10px; font-size: 12px; }
  .orb { opacity: 0.28; }
  .manage-item { grid-template-columns: auto minmax(0, 1fr); }
  .sales-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "summary"
      "analysis"
      "board"
      "ops"
      "manage";
  }
  #work-plans { height: auto; min-height: calc(100vh - 220px); overflow: visible; }
  .sales-summary, .sales-grid, .sales-main-grid, .work-plan-grid { grid-template-columns: 1fr; }
  .sales-main-grid {
    grid-template-areas:
      "schedule-form"
      "schedule-list"
      "visit-form"
      "visit-list";
    padding: 0 18px;
  }
  .work-plan-grid {
    grid-template-areas:
      "plan-top"
      "plan-list";
  }
  .plan-list-card { min-height: 520px; max-height: none; }
  .plan-ai-inline { grid-template-columns: 1fr; }
  .plan-row { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; place-items: start center; }
  .modal-card {
    grid-template-columns: 1fr;
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
    transform: none;
  }
  .sales-board-wrap { margin: 0 18px; }
  .sales-item { grid-template-columns: 1fr; }
  main { height: calc(100vh - 59px); padding-bottom: 176px; }
  .agent-dock-panel { left: 18px; right: 18px; bottom: 18px; }
}

.sales-panel > .section-title,
.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 18px 0;
}

.sales-panel > .section-title h2,
.settings-heading h2 { margin: 0; }
.sales-panel > .section-title span,
.settings-heading span { display: block; margin-top: 4px; }
.sales-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sales-header-actions button { white-space: nowrap; }

.sales-summary { gap: 12px; }
.sales-summary article {
  position: relative;
  overflow: hidden;
  min-height: 82px;
  padding: 14px 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
}
.sales-summary article::after {
  position: absolute;
  right: -18px;
  bottom: -28px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  content: "";
  background: rgba(124, 92, 255, 0.18);
}
.sales-summary article:nth-child(2)::after { background: rgba(33, 212, 253, 0.16); }
.sales-summary article:nth-child(3)::after { background: rgba(94, 203, 148, 0.15); }
.sales-summary article:nth-child(4)::after { background: rgba(255, 184, 77, 0.16); }
.sales-summary strong { position: relative; z-index: 1; font-size: 28px; }
.sales-summary span { position: relative; z-index: 1; margin-top: 6px; }

.sales-board-wrap { border-radius: 20px; }
.sales-board-wrap > .section-title { padding: 14px 14px 0; }
.opportunity-board { max-height: 510px; padding: 12px 14px 14px; }
.opportunity-column { border-radius: 16px; }
.opportunity-card { padding: 10px; transition: 160ms ease; }
.opportunity-card:hover { transform: translateY(-1px); border-color: rgba(137, 164, 224, 0.45); }

.sales-main-grid { gap: 12px; }
.sales-main-grid .settings-card { min-height: 100%; }
.visit-form-card h3::after,
.visit-list-card h3::after {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.visit-form-card h3::after { content: "记录每次沟通，让下一步清晰可追踪"; }
.visit-list-card h3::after { content: "按时间查看最新客户反馈与跟进动作"; }
.sales-manage-entry { border-radius: 18px; }
.sales-manage-entry summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.sales-manage-entry summary::after { color: var(--muted); content: "展开客户与商机资料库"; font-size: 12px; font-weight: 400; }
.sales-manage-entry[open] summary::after { content: "收起资料库"; }
.sales-manage-entry .sales-grid { padding-top: 4px; }

.sales-entry-tabs {
  display: flex;
  gap: 8px;
  padding: 0 12px 10px;
}

.sales-entry-tab {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.sales-entry-tab.active {
  border-color: rgba(33, 212, 253, 0.48);
  background: rgba(33, 212, 253, 0.12);
  color: var(--text);
}

.sales-entry-status {
  margin: 0 12px 10px;
  color: var(--muted);
  font-size: 13px;
}

.sales-entry-panel[hidden] { display: none; }
.sales-manage-entry[data-sales-entry="customer"] [data-sales-entry-panel="opportunity"],
.sales-manage-entry[data-sales-entry="opportunity"] [data-sales-entry-panel="customer"] { display: none; }

.sales-entry-modal[hidden] { display: none; }

.sales-entry-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 8vh 20px 40px;
  background: rgba(10, 16, 28, 0.52);
}

.sales-entry-modal-card {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.sales-entry-modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
}

.sales-entry-modal-title h3 { margin: 0; }
.sales-entry-modal .sales-grid { display: block; padding: 0 18px 18px; }
.sales-entry-modal .sales-grid .sales-entry-panel { min-height: 0; }

.sales-data-library {
  grid-area: manage;
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0 18px;
}

.sales-data-heading,
.sales-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sales-data-heading h3,
.sales-list-heading h3 { margin: 0; }
.sales-data-heading > span { color: var(--muted); font-size: 13px; }

.sales-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sales-list-heading input { width: min(260px, 52%); }

.sales-data-library .sales-list {
  max-height: none;
  overflow: visible;
}

.customer-level-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-level-filter button {
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-raised);
  box-shadow: none;
  font-size: 12px;
}

.customer-level-filter button:hover,
.customer-level-filter button.active {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-raised));
}

.customer-table-list {
  display: block;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.customer-table-header,
.customer-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(110px, 1fr) 74px minmax(118px, 0.9fr);
  gap: 12px;
  align-items: center;
}

.customer-table-header {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-raised);
  font-size: 12px;
}

.customer-row {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 12px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.customer-row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.customer-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-name { font-weight: 650; }

.customer-level {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  justify-content: center;
  border-radius: 4px;
  padding: 3px 6px;
  font-style: normal;
  font-size: 12px;
  line-height: 1.2;
}

.customer-level-核心 { color: #c52f4e; background: rgba(229, 73, 108, 0.13); }
.customer-level-普通 { color: #1974a7; background: rgba(39, 157, 213, 0.14); }
.customer-level-潜在 { color: #a06508; background: rgba(223, 158, 33, 0.16); }
.customer-level-流失 { color: var(--muted); background: rgba(127, 138, 153, 0.16); }

.customer-last-contact.overdue {
  color: var(--danger-text);
  font-weight: 650;
}

#sales {
  height: auto;
  min-height: calc(100vh - 154px);
  overflow: visible;
}

.sales-form-more {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.sales-form-more summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
}

.sales-form-more-fields {
  display: grid;
  gap: 8px;
  padding: 0 0 10px;
}

.settings-panel {
  gap: 16px;
  padding: 20px 24px 28px;
}
.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "model model"
    "user user-list"
    "app app-list"
    "agent agent-list";
  align-items: start;
  gap: 14px;
}
.settings-model-card { grid-area: model; }
.settings-user-card { grid-area: user; }
.settings-user-list-card { grid-area: user-list; }
.settings-app-card { grid-area: app; }
.settings-app-list-card { grid-area: app-list; }
.settings-agent-card { grid-area: agent; }
.settings-agent-list-card { grid-area: agent-list; }
.settings-card { border-radius: 18px; }
.settings-grid > .settings-card > h3,
.settings-grid > .settings-form > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.settings-model-card {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  padding: 20px;
  background: linear-gradient(110deg, rgba(124, 92, 255, 0.12), rgba(255, 255, 255, 0.035));
}
.settings-model-card h3,
.settings-model-card > p,
.settings-model-card .form-actions,
.settings-model-card #model-test-status { grid-column: 1 / -1; }
.settings-model-card .settings-hint { line-height: 1.5; }
.settings-user-list-card,
.settings-app-list-card,
.settings-agent-list-card { max-height: 500px; overflow: hidden; }
.settings-user-list-card .manage-list,
.settings-app-list-card .manage-list,
.settings-agent-list-card .manage-list { max-height: 418px; overflow: auto; padding-right: 4px; }
.settings-grid .manage-item { border-radius: 14px; }
.settings-grid .manage-item:hover { border-color: rgba(137, 164, 224, 0.42); }

@media (max-width: 980px) {
  .sales-panel > .section-title,
  .settings-heading { align-items: flex-start; flex-direction: column; }
  .sales-header-actions { justify-content: flex-start; }
  .settings-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "model"
      "user"
      "user-list"
      "app"
      "app-list"
      "agent"
      "agent-list";
  }
  .settings-model-card { grid-template-columns: 1fr; }
  .sales-data-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .sales-panel > .section-title,
  .settings-heading { padding-left: 0; padding-right: 0; }
  .sales-header-actions { width: 100%; }
  .sales-header-actions button { flex: 1; }
  .sales-summary { grid-template-columns: 1fr 1fr; padding: 0; }
  .sales-summary article { min-height: 74px; }
  .sales-manage-entry { margin-left: 0; margin-right: 0; }
  .sales-manage-entry summary::after { display: none; }
  .sales-entry-modal { padding: 20px 12px; }
  .sales-data-library { margin-left: 0; margin-right: 0; }
  .sales-data-heading,
  .sales-list-heading { align-items: flex-start; flex-direction: column; }
  .sales-list-heading input { width: 100%; }
  .customer-table-list { overflow-x: auto; }
  .customer-table-header,
  .customer-row { min-width: 510px; }
  .settings-panel { padding-left: 0; padding-right: 0; }
  .settings-model-card { padding: 16px; }
}

.notification-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  font-size: 13px;
}
.notification-button:hover { color: var(--text); background: rgba(124, 92, 255, 0.12); }
.notification-button strong {
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 999px;
  padding: 0 5px;
  color: white;
  background: #e96478;
  font-size: 10px;
}
.notification-center {
  position: fixed;
  z-index: 90;
  top: 18px;
  left: 268px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(360px, calc(100vw - 302px));
  max-height: min(650px, calc(100vh - 36px));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 15px;
  background: var(--panel-strong);
  box-shadow: 0 24px 80px var(--shadow-strong);
}
.notification-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 10px; }
.notification-header h3 { margin: 0; font-size: 17px; }
.notification-list { display: grid; gap: 7px; min-height: 0; overflow: auto; padding-right: 3px; }
.notification-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}
.notification-item.unread { border-color: rgba(124, 92, 255, 0.52); background: rgba(124, 92, 255, 0.1); }
.notification-item.read { opacity: 0.68; }
.notification-item.live { border-color: rgba(34, 211, 238, 0.28); }
.notification-kind { color: var(--accent); font-size: 10px; font-weight: 700; }
.notification-item strong { font-size: 13px; }
.notification-item small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.notification-read-all { margin-top: 10px; }

.workspace-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: calc(100vh - 48px);
  min-height: 0;
  overflow: hidden;
}
.workspace-title { padding-bottom: 12px; }
.workspace-title h2 { margin: 0; }
.workspace-tabs {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 0 4px 8px;
}
.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 210px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  font-size: 12px;
}
.workspace-tab.active { border-color: rgba(124, 92, 255, 0.7); color: var(--text); background: rgba(124, 92, 255, 0.13); }
.workspace-tab > span { display: grid; width: 16px; height: 16px; place-items: center; overflow: hidden; }
.workspace-tab > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tab i { margin-left: 2px; color: var(--muted); font-size: 17px; font-style: normal; line-height: 1; }
.workspace-tab i:hover { color: var(--danger-text); }
.workspace-empty { display: grid; place-items: center; align-content: center; gap: 7px; min-height: 360px; color: var(--muted); text-align: center; }
.workspace-empty[hidden] { display: none; }
.workspace-empty strong { color: var(--text); }
#workspace-frame { grid-row: 3; display: block; width: 100%; height: 100%; min-height: 0; border: 0; background: white; }

#app-form [name="desktop_app_key"] { display: none; }
#app-form:has([name="launch_mode"] option[value="desktop"]:checked) [name="desktop_app_key"] { display: block; }
.app-visibility-field { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
#app-shared-users { min-height: 124px; }

.chat-attachment-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
.chat-attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-chip > img { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 4px; object-fit: cover; background: var(--surface-subtle); }
.chat-attachment-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-attachment-chip button { min-width: 20px; min-height: 20px; padding: 0; border-radius: 4px; }

#chat-form {
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

#chat-form > input[type="file"] { display: none; }
#chat-form > input[name="message"] { min-width: 0; }
#chat-form #chat-attachment-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 6px;
}

#chat-form #stop-chat,
#chat-form button[type="submit"] {
  min-width: 58px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 6px;
}

@media (max-width: 620px) {
  #chat-form { grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 6px; padding-left: 12px; padding-right: 12px; }
  #chat-form #chat-attachment-button { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
  #chat-form #stop-chat,
  #chat-form button[type="submit"] { min-width: 48px; min-height: 34px; padding: 6px 8px; }
}

@media (max-width: 980px) {
  .notification-center { left: 18px; width: min(360px, calc(100vw - 36px)); }
  .workspace-panel { height: calc(100vh - 48px); }
}

.workfiles-panel { min-height: 0; }
.workfile-item[draggable="true"] { cursor: grab; }
.workfile-item.is-dragging { opacity: .45; }
.workfile-drop-target { transition: background-color .15s ease, outline-color .15s ease; }
.workfile-drop-target.is-drop-target { background: var(--accent-soft, #e8f1ff); outline: 2px dashed var(--accent, #4d7cff); outline-offset: -3px; }
.workfiles-panel > .section-title { align-items: flex-start; }
.workfiles-panel h2 { margin: 0; }
.workfile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.workfile-new-control { position: relative; }
.workfile-new-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 210px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px;
  background: var(--panel-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}
.workfile-new-menu[hidden] { display: none; }
.workfile-new-menu button { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 9px; min-height: 38px; border: 0; padding: 5px 8px; text-align: left; color: var(--text); background: transparent; box-shadow: none; }
.workfile-new-menu button:hover { background: var(--surface-subtle); }
.workfile-new-menu button span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 5px; font-size: 9px; font-weight: 700; }
.workfile-new-menu button strong { font-size: 12px; }
.workfile-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 14px 0 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 10px;
}
.workfile-breadcrumb button {
  border: 0;
  padding: 2px 3px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}
.workfile-breadcrumb button:hover { color: var(--text); }
.workfile-breadcrumb span { color: var(--muted); }
.workfile-browser-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}
.workfile-filter-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.workfile-filter-controls input { width: min(340px, 38vw); min-width: 210px; }
.workfile-filter-controls select { width: 132px; }
.workfile-summary { color: var(--muted); font-size: 12px; white-space: nowrap; }
.workfile-table-head,
.workfile-item {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) 90px 90px 156px minmax(230px, auto);
  align-items: center;
  gap: 10px;
}
.workfile-table-head {
  border-block: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
}
.workfile-table-head span:last-child { text-align: right; }
.workfile-list {
  display: grid;
  align-content: start;
  height: auto;
  max-height: var(--workfile-list-max-height, max(220px, calc(100vh - 500px)));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.workfile-item {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 7px 12px;
  background: transparent;
}
.workfile-item:hover { background: var(--surface-subtle); }
.workfile-open {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 9px;
  min-width: 0;
  padding: 0;
  text-align: left;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}
.workfile-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 40px; height: 36px; overflow: hidden; border-radius: 6px; color: var(--muted); background: rgba(255, 255, 255, 0.06); font-size: 9px; font-weight: 700; }
.workfile-icon.kind-folder,
.workfile-new-menu .kind-folder { color: #8a5b00; background: #f6c851; }
.workfile-icon.kind-excel,
.workfile-new-menu .kind-excel { color: #eafff1; background: #218c55; }
.workfile-icon.kind-word,
.workfile-new-menu .kind-word { color: #eff6ff; background: #2b6fca; }
.workfile-icon.kind-powerpoint,
.workfile-new-menu .kind-powerpoint { color: #fff5ee; background: #c85b32; }
.workfile-icon.kind-pdf { color: #fff1f2; background: #bc3f52; }
.workfile-icon.kind-archive { color: #f7efff; background: #7952a8; }
.workfile-icon.kind-text,
.workfile-new-menu .kind-text { color: #253246; background: #ccd5e2; }
.workfile-icon.kind-image { color: #edf9ff; background: #307f96; }
.workfile-thumbnail { width: 100%; height: 100%; object-fit: cover; }
.workfile-icon b { display: none; font-size: 8px; }
.workfile-icon.thumbnail-error img { display: none; }
.workfile-icon.thumbnail-error b { display: block; }
.workfile-open strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.workfile-open small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.workfile-type-cell,
.workfile-size-cell,
.workfile-time-cell { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.workfile-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.workfile-item-actions button { min-height: 28px; padding: 5px 7px; border-radius: 6px; font-size: 11px; }
.workfile-item-actions .danger { color: var(--danger-text); }
.workfile-empty { display: grid; place-items: center; align-content: center; min-height: 260px; gap: 7px; color: var(--muted); text-align: center; }
.workfile-empty strong { color: var(--text); }
.workfile-version-panel {
  margin-top: 14px;
  border: 1px solid rgba(124, 92, 255, 0.4);
  border-radius: 16px;
  padding: 12px;
  background: rgba(124, 92, 255, 0.08);
}
.workfile-version-list { display: grid; gap: 7px; }
.workfile-version-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; background: var(--surface-subtle); }
.workfile-version-item strong,
.workfile-version-item small { display: block; }
.workfile-version-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.workfile-version-item button { padding: 6px 8px; border-radius: 9px; font-size: 12px; }

@media (max-width: 980px) and (min-width: 621px) {
  .workfile-table-head,
  .workfile-item { grid-template-columns: minmax(220px, 1fr) 82px 140px minmax(210px, auto); }
  .workfile-table-head span:nth-child(2),
  .workfile-type-cell { display: none; }
}

@media (max-width: 620px) {
  .workfiles-panel > .section-title { flex-direction: column; }
  .workfile-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .workfile-actions button { width: 100%; min-height: 40px; }
  .workfile-new-control { width: 100%; }
  .workfile-new-menu { right: auto; left: 0; width: min(230px, calc(100vw - 44px)); }
  .workfile-browser-tools { align-items: stretch; flex-direction: column; }
  .workfile-filter-controls { display: grid; grid-template-columns: minmax(0, 1fr) 118px; }
  .workfile-filter-controls input { width: 100%; min-width: 0; }
  .workfile-filter-controls select { width: 100%; }
  .workfile-summary { white-space: normal; }
  .workfile-table-head { display: none; }
  .workfile-item { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding: 9px 4px; }
  .workfile-open { grid-column: 1 / -1; }
  .workfile-type-cell { display: none; }
  .workfile-size-cell,
  .workfile-time-cell { grid-row: 2; }
  .workfile-time-cell { text-align: right; }
  .workfile-item-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .workfile-list { max-height: var(--workfile-list-max-height, max(260px, calc(100vh - 480px))); }
}

@media (max-width: 420px) {
  .workfile-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.global-controls {
  position: fixed;
  z-index: 95;
  top: 16px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.notification-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  font-size: 17px;
}

.theme-toggle:hover,
.notification-button:hover { background: rgba(124, 92, 255, 0.14); }
.notification-button strong {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid var(--panel-strong);
  border-radius: 50%;
  background: #e8566b;
  font-size: 0;
}
.notification-center { top: 62px; right: 22px; left: auto; width: min(360px, calc(100vw - 44px)); }
.notification-center[hidden] { display: none; }

:root[data-theme="light"] .agent-workstation {
  background: radial-gradient(circle at 50% 12%, rgba(7, 141, 181, 0.12), transparent 46%), var(--surface-subtle);
}

:root[data-theme="light"] .agent-monitor {
  border-color: rgba(76, 99, 145, 0.34);
  color: #526684;
  background: #eaf0f8;
  box-shadow: inset 0 0 18px rgba(76, 99, 145, 0.14);
}

:root[data-theme="light"] .plan-task-card {
  background: linear-gradient(100deg, #ffffff, #f5f8fd);
}

:root[data-theme="light"] .plan-overview-card,
:root[data-theme="light"] .plan-group-title,
:root[data-theme="light"] .plan-row,
:root[data-theme="light"] .workspace-tab,
:root[data-theme="light"] .app-icon-paste,
:root[data-theme="light"] .workfile-icon.kind-other {
  background: var(--surface-raised);
}

:root[data-theme="light"] .tool-request-item {
  border-color: rgba(173, 117, 12, 0.3);
  background: rgba(244, 180, 43, 0.12);
}

:root[data-theme="light"] .login-error,
:root[data-theme="light"] .card-actions .danger,
:root[data-theme="light"] .session-actions .danger,
:root[data-theme="light"] .sales-actions .danger,
:root[data-theme="light"] .manage-item .danger,
:root[data-theme="light"] .workfile-item-actions .danger {
  color: var(--danger-text);
}

@media (max-width: 620px) {
  .global-controls { top: 10px; right: 12px; }
  .notification-center { top: 56px; right: 12px; width: calc(100vw - 24px); }
}

.shell[data-page="knowledge"] .agent-dock-panel { display: none; }
.knowledge-panel { min-height: calc(100vh - 64px); overflow: visible; }
.knowledge-heading { padding: 22px 116px 18px 24px; border-bottom: 1px solid var(--line); }
.knowledge-heading h2 { margin: 2px 0 3px; }
.knowledge-heading > div:first-child > span { display: block; color: var(--muted); font-size: 13px; }
.knowledge-heading-actions,
.knowledge-workspace-header > div:last-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.knowledge-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 640px; }
.knowledge-sidebar { min-width: 0; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--surface-subtle); }
.knowledge-sidebar-title,
.knowledge-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.knowledge-sidebar-title span,
.knowledge-section-title > span { color: var(--muted); font-size: 12px; }
.knowledge-space-list { display: grid; align-content: start; gap: 6px; margin-top: 14px; }
.knowledge-space-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; width: 100%; min-height: 60px; padding: 11px 12px; border: 1px solid transparent; border-radius: 6px; color: var(--text); text-align: left; background: transparent; box-shadow: none; }
.knowledge-space-item:hover { background: var(--surface-subtle); }
.knowledge-space-item.active { border-color: rgba(33, 212, 253, 0.42); background: rgba(33, 212, 253, 0.12); }
.knowledge-space-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-space-item small { grid-column: 1 / -1; color: var(--muted); }
.knowledge-empty { display: grid; place-items: center; align-content: center; min-width: 0; min-height: 520px; gap: 8px; padding: 40px; color: var(--muted); text-align: center; }
.knowledge-empty[hidden],
.knowledge-workspace[hidden] { display: none !important; }
.knowledge-empty strong { color: var(--text); font-size: 18px; }
.knowledge-workspace { min-width: 0; padding: 22px 24px 28px; }
.knowledge-workspace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.knowledge-workspace-header h3 { margin: 0; font-size: 22px; }
.knowledge-workspace-header p { margin: 5px 0 0; color: var(--muted); }
.knowledge-import-panel { margin-top: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); }
.knowledge-import-panel[hidden] { display: none !important; }
.knowledge-ragflow-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--info-text); border-radius: 6px; background: var(--surface-subtle); }
.knowledge-ragflow-panel[hidden] { display: none !important; }
.knowledge-ragflow-panel h3 { margin: 2px 0 3px; font-size: 15px; }
.knowledge-ragflow-panel span { color: var(--muted); font-size: 12px; }
.knowledge-ragflow-panel > div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.knowledge-import-heading,
.knowledge-import-heading > div:last-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.knowledge-import-heading h3 { margin: 2px 0 0; font-size: 15px; }
.knowledge-import-heading > div:last-child > span { color: var(--muted); font-size: 12px; }
.knowledge-import-heading button { min-height: 30px; padding: 5px 8px; font-size: 11px; }
.knowledge-import-progress { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 3px; background: var(--surface-raised); }
.knowledge-import-progress span { display: block; width: 0; height: 100%; background: var(--accent-2); transition: width .2s ease; }
.knowledge-import-summary { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.knowledge-import-summary span { display: grid; gap: 2px; color: var(--muted); font-size: 10px; }
.knowledge-import-summary strong { color: var(--text); font-size: 15px; }
.knowledge-import-errors { display: grid; gap: 5px; max-height: 150px; margin-top: 12px; overflow: auto; border-top: 1px solid var(--line); padding-top: 9px; }
.knowledge-import-errors[hidden] { display: none !important; }
.knowledge-import-errors div { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(200px, 1.3fr); gap: 10px; font-size: 11px; }
.knowledge-import-errors strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-import-errors span { color: var(--danger-text); }
.knowledge-overview { display: grid; grid-template-columns: minmax(260px, .72fr) minmax(420px, 1.65fr); align-items: start; gap: 24px; padding: 22px 0; }
.knowledge-structure-section,
.knowledge-documents-section { min-width: 0; }
.knowledge-structure-section { padding-right: 22px; border-right: 1px solid var(--line); }
.knowledge-section-title h3 { margin: 2px 0 0; font-size: 16px; }
.knowledge-taxonomy-filter { width: 100%; min-height: 36px; margin-top: 12px; }
.knowledge-taxonomy { display: grid; gap: 7px; margin-top: 10px; }
.knowledge-branch { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); }
.knowledge-branch summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; cursor: pointer; list-style: none; }
.knowledge-branch-children > .knowledge-branch { border-width: 0 0 1px; border-radius: 0; }
.knowledge-branch-children > .knowledge-branch:last-child { border-bottom: 0; }
.knowledge-branch.folder > summary { padding-left: calc(12px + var(--knowledge-indent, 0px)); }
.knowledge-branch.folder > summary strong::before { margin-right: 6px; color: var(--info-text); content: "目录"; font-size: 9px; font-weight: 500; }
.knowledge-branch summary::-webkit-details-marker { display: none; }
.knowledge-branch summary::before { content: "+"; grid-column: 2; grid-row: 1; width: 18px; color: var(--muted); text-align: center; }
.knowledge-branch[open] summary::before { content: "−"; }
.knowledge-branch summary > span { min-width: 0; }
.knowledge-branch summary strong,
.knowledge-branch summary small { display: block; }
.knowledge-branch summary small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.knowledge-branch summary em { grid-column: 2; grid-row: 1; margin-right: 24px; color: var(--muted); font-style: normal; font-size: 11px; white-space: nowrap; }
.knowledge-branch-children { display: grid; border-top: 1px solid var(--line); }
.knowledge-node { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px 8px calc(16px + var(--knowledge-indent, 0px)); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); text-align: left; background: var(--panel); box-shadow: none; }
.knowledge-node:hover { background: var(--surface-raised); transform: none; }
.knowledge-node:last-child { border-bottom: 0; }
.knowledge-node strong,
.knowledge-node small { display: block; }
.knowledge-node small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.knowledge-node em { display: grid; gap: 2px; color: var(--muted); text-align: right; font-style: normal; font-size: 11px; }
.knowledge-node em small { color: var(--info-text); }
.knowledge-branch-view { width: 100%; min-height: 34px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--info-text); text-align: left; background: transparent; box-shadow: none; }
.knowledge-branch-view:hover { background: var(--surface-raised); transform: none; }
.knowledge-branch.review { border-color: rgba(255, 178, 74, 0.48); }
.knowledge-node.review { background: rgba(255, 178, 74, 0.08); }
.knowledge-document-list { display: grid; gap: 0; margin-top: 12px; border-top: 1px solid var(--line); }
.knowledge-document-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; margin-top: 12px; }
.knowledge-document-toolbar input,
.knowledge-document-toolbar select { min-width: 0; min-height: 36px; }
.knowledge-server-import-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.knowledge-server-import-status span { display: flex; align-items: baseline; gap: 5px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; background: var(--surface-subtle); }
.knowledge-server-import-status strong { color: var(--text); font-size: 14px; }
.knowledge-product-search-section { padding-top: 8px; border-top: 1px solid var(--line); }
.knowledge-product-search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.knowledge-product-search-form input { min-height: 38px; }
.knowledge-product-search-results { margin-top: 12px; }
.knowledge-product-result-summary { display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: 12px; }
.knowledge-product-result-summary strong { color: var(--text); font-size: 15px; }
.knowledge-product-result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.knowledge-product-result-item { display: grid; gap: 5px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); }
.knowledge-product-result-item img, .knowledge-product-result-file { width: 100%; aspect-ratio: 1.35; object-fit: contain; border-radius: 4px; background: var(--surface-raised); }
.knowledge-product-result-file { display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.knowledge-product-result-item strong, .knowledge-product-result-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-product-result-item small { color: var(--muted); font-size: 10px; }
.knowledge-product-result-item a { color: var(--info-text); font-size: 11px; }
.knowledge-document-row { display: grid; grid-template-columns: minmax(150px, 1fr) 76px auto; align-items: center; gap: 8px; min-height: 72px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.knowledge-document-main { min-width: 0; }
.knowledge-document-main strong,
.knowledge-document-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-document-main small { margin-top: 4px; color: var(--muted); }
.knowledge-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.knowledge-status::before { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); content: ""; }
.knowledge-status.ready::before { background: var(--success); }
.knowledge-status.processing::before,
.knowledge-status.queued::before { background: var(--accent-2); }
.knowledge-status.failed::before { background: var(--danger); }
.knowledge-progress { height: 4px; margin-top: 6px; overflow: hidden; border-radius: 2px; background: var(--surface-raised); }
.knowledge-progress span { display: block; height: 100%; background: var(--accent-2); }
.knowledge-document-tags { display: flex; grid-column: 1 / -1; gap: 4px; overflow: hidden; }
.knowledge-document-tags span { padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); white-space: nowrap; font-size: 10px; }
.knowledge-document-actions { display: flex; justify-content: flex-end; gap: 5px; }
.knowledge-document-actions button,
.knowledge-document-actions a { min-height: 28px; padding: 5px 7px; border-radius: 5px; font-size: 11px; }
.knowledge-answer-section { padding-top: 20px; border-top: 1px solid var(--line); }
.knowledge-answer { min-height: 116px; max-height: 360px; margin-top: 14px; overflow: auto; padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); line-height: 1.65; }
.knowledge-answer p:first-child { margin-top: 0; }
.knowledge-source-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.knowledge-source-list a { padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--info-text); font-size: 11px; }
.knowledge-source-list .knowledge-image-source {
  width: 132px;
  padding: 5px;
  display: grid;
  gap: 5px;
  text-decoration: none;
  background: var(--panel);
}
.knowledge-image-source img {
  width: 120px;
  height: 90px;
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
}
.knowledge-image-source span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.knowledge-ask-form { display: grid; grid-template-columns: minmax(0, 1fr) 80px; align-items: stretch; gap: 8px; margin-top: 10px; }
.knowledge-ask-form textarea { min-height: 54px; resize: vertical; }
.knowledge-space-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-strong); box-shadow: 0 24px 70px var(--shadow-strong); }
.knowledge-space-dialog::backdrop,
.knowledge-node-dialog::backdrop { background: var(--overlay); }
.knowledge-space-dialog form { display: grid; gap: 13px; padding: 20px; }
.knowledge-space-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-heading h3 { margin: 2px 0 0; color: var(--text); }
.knowledge-node-dialog { width: min(860px, calc(100vw - 32px)); max-height: min(84vh, 820px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-strong); box-shadow: 0 24px 70px var(--shadow-strong); }
.knowledge-node-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.knowledge-node-dialog-header h3 { margin: 2px 0 3px; }
.knowledge-node-dialog-header span { color: var(--muted); font-size: 12px; }
.knowledge-node-dialog-header > div { flex: 1; min-width: 0; }
.knowledge-node-dialog-header input { width: min(440px, 100%); min-height: 34px; margin-top: 10px; }
.knowledge-node-evidence { display: grid; gap: 0; max-height: calc(min(84vh, 820px) - 88px); overflow-y: auto; padding: 0 20px 20px; }
.knowledge-evidence-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.knowledge-evidence-item > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.knowledge-evidence-item > header strong,
.knowledge-evidence-item > header small { display: block; }
.knowledge-evidence-item > header small { max-width: 620px; margin-top: 3px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.knowledge-evidence-item > header small b { margin-right: 6px; color: var(--info-text); font-weight: 500; }
.knowledge-evidence-item details { margin-top: 10px; }
.knowledge-evidence-item details summary { color: var(--info-text); cursor: pointer; font-size: 12px; }
.knowledge-evidence-item details p { margin: 8px 0 0; padding: 10px 12px; border-left: 2px solid var(--line-strong); color: var(--muted); background: var(--surface-subtle); line-height: 1.6; white-space: pre-wrap; }
.knowledge-evidence-tags,
.knowledge-evidence-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.knowledge-evidence-tags span { padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; }
.knowledge-review-state { flex: 0 0 auto; padding: 4px 7px; border-radius: 4px; color: var(--warning-text); background: rgba(255, 184, 77, 0.14); font-size: 11px; }
.knowledge-review-state.resolved { color: var(--success-text); background: rgba(67, 201, 137, 0.15); }
.knowledge-review-controls { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid rgba(255, 178, 74, 0.42); border-radius: 6px; background: rgba(255, 178, 74, 0.07); }
.knowledge-review-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.knowledge-review-controls textarea { resize: vertical; }
.knowledge-review-controls > div { display: flex; justify-content: flex-end; gap: 8px; }
.knowledge-review-controls > small { color: var(--muted); }

@media (max-width: 1050px) {
  .knowledge-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .knowledge-import-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .knowledge-overview { grid-template-columns: 1fr; }
  .knowledge-structure-section { padding-right: 0; padding-bottom: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .knowledge-heading,
  .knowledge-workspace-header { flex-direction: column; }
  .knowledge-heading-actions,
  .knowledge-workspace-header > div:last-child { width: 100%; }
  .knowledge-heading-actions button,
  .knowledge-workspace-header > div:last-child button { flex: 1; }
  .knowledge-layout { grid-template-columns: 1fr; }
  .knowledge-heading { padding: 62px 18px 18px; }
  .knowledge-sidebar { padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .knowledge-space-list { display: flex; overflow-x: auto; }
  .knowledge-space-item { min-width: 180px; }
  .knowledge-workspace { padding: 18px; }
  .knowledge-import-heading { align-items: flex-start; flex-direction: column; }
  .knowledge-import-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .knowledge-import-errors div { grid-template-columns: 1fr; gap: 2px; }
  .knowledge-document-row { grid-template-columns: minmax(0, 1fr) auto; }
  .knowledge-document-tags { grid-column: 1 / -1; }
  .knowledge-document-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .knowledge-ask-form { grid-template-columns: 1fr; }
  .knowledge-node-dialog-header { padding: 15px 16px; }
  .knowledge-node-evidence { padding: 0 16px 16px; }
  .knowledge-review-controls > div { align-items: stretch; flex-direction: column; }
}
