:root {
  color-scheme: light;
  --canvas: #f7f7fb;
  --surface: #fff;
  --workspace-frame: #eee8f5;
  --workspace-inset: 10px;
  --workspace-radius: 18px;
  --ink: #252236;
  --label: #514d64;
  --muted: #6d687e;
  --line: #e7e5ee;
  --accent: #6042d2;
  --lavender: #f2eeff;
  --focus: #8268e7;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }
:where(a, button, textarea):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
::selection { background: #e2d7ff; color: #352478; }

.workspace {
  --nav-width: 150px;
  --chat-width: clamp(315px, 28vw, 394px);
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  padding-block: var(--workspace-inset);
  padding-inline-end: var(--workspace-inset);
  background: var(--workspace-frame);
}

.workspace-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--workspace-radius);
  background: var(--surface);
  box-shadow: 0 3px 16px #3e285c0b;
}

.chat-open .workspace-stage { grid-template-columns: minmax(0, 1fr) var(--chat-width); }

.workspace-page-inner {
  max-width: 1220px;
  margin-inline: auto;
  padding: 26px 30px 34px;
}

.workspace-page-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding-bottom: 17px;
  margin-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.workspace-page-header h1 {
  font-size: clamp(20px, 1.8vw, 25px);
  font-weight: 690;
  line-height: 1.3;
  letter-spacing: -.028em;
}

.workspace-page-lead {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar {
  --sidebar-inset: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  padding: 16px var(--sidebar-inset) 13px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-inline: 5px;
  border-radius: 7px;
  color: inherit;
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
  white-space: nowrap;
}

.brand img { flex: 0 0 auto; border-radius: 9px; }

.main-nav { display: grid; gap: 5px; }

.nav-item {
  --nav-item-fill: var(--workspace-frame);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--label);
  background: var(--nav-item-fill);
  text-align: start;
  text-decoration: none;
  font-size: 13px;
  font-weight: 570;
  white-space: nowrap;
}

.nav-item[aria-current="page"] {
  --nav-item-fill: var(--surface);
  border-color: #e8e0f2;
  color: #5338ba;
  font-weight: 680;
}

.nav-item:hover:not([aria-current]) { --nav-item-fill: #f8f4fc; }

.nav-icon {
  position: relative;
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.nav-icon::before, .nav-icon::after { position: absolute; content: ""; }
.nav-icon--home::before {
  inset: 6px 2.5px 1px;
  border: 1.3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}
.nav-icon--home::after {
  inset: 3px auto auto 3px;
  width: 10px;
  height: 10px;
  border: solid currentColor;
  border-width: 1.3px 0 0 1.3px;
  border-radius: 1px 0 0;
  transform: rotate(45deg);
}
.nav-icon--people::before {
  inset: 0 auto auto 5px;
  width: 6px;
  height: 6px;
  border: 1.3px solid currentColor;
  border-radius: 50%;
}
.nav-icon--people::after {
  inset: 8px 2px 1px;
  border: 1.3px solid currentColor;
  border-radius: 5px 5px 2px 2px;
}
.nav-icon--community::before {
  inset: 1px 1px 4px;
  border: 1.3px solid currentColor;
  border-radius: 4px;
}
.nav-icon--community::after {
  inset: 9px auto auto 4px;
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 0 1.3px 1.3px;
  background: var(--nav-item-fill);
  transform: rotate(-25deg) skewY(-13deg);
}
.nav-icon--customers::before { inset: 1px 1px 1px 2px; border: 1.3px solid currentColor; border-radius: 3px; }
.nav-icon--customers::after {
  inset: 5px 4px auto 5px;
  height: 1px;
  background: currentColor;
  box-shadow: 0 3px currentColor, 0 6px currentColor;
}
.nav-icon--events::before {
  inset: 3px 1px 1px;
  border: 1.3px solid currentColor;
  border-radius: 3px;
  background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1px no-repeat;
}
.nav-icon--events::after {
  inset: 1px auto auto 5px;
  width: 1.3px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 5px 0 currentColor;
}
.nav-icon--management::before {
  inset: 4px 1px auto;
  height: 1.3px;
  background: currentColor;
  box-shadow: 0 6px currentColor;
}
.nav-icon--management::after {
  inset: 2px auto auto 4px;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 6px 6px currentColor;
}
.preview-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-inline: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.preview-label > span { width: 6px; height: 6px; border-radius: 50%; background: #9274e7; }

.roster { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }

.filter-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; }

.filter-button {
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--label);
  font-size: 12px;
  font-weight: 570;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.filter-button:hover { color: var(--accent); background: #eeebf8; }
.filter-button[aria-pressed="true"] {
  color: #533bb5;
  background: #eee8ff;
  border-color: #e8deff;
  font-weight: 650;
}

.employee-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.chat-open .employee-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.employee-item { min-width: 0; }

.employee-card {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 2px 3px #25213f06;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.employee-card:hover { transform: translateY(-2px); border-color: #c9bce9; box-shadow: 0 6px 13px #39246b10; }
.employee-card[aria-pressed="true"] { border-color: #977ae9; box-shadow: 0 0 0 1px #977ae9, 0 5px 16px #45268e17; }

.card-media {
  display: block;
  height: clamp(107px, 14vh, 143px);
  overflow: hidden;
  background: var(--surface);
}

.card-media img {
  width: 100%;
  height: calc(100% + 42px);
  object-fit: contain;
  object-position: center top;
}

.card-labels {
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 61px;
  padding: 8px 11px 10px;
  border-top: 1px solid #f2f0f7;
}

.employee-card[aria-pressed="true"] .card-labels { background: #f8f5ff; border-top-color: #efe9ff; }
.card-name { font-weight: 680; font-size: 15px; }
.card-metadata { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; color: var(--muted); font-size: 12px; }
.card-skill { color: #6047a2; }
.card-skill::before { content: "·"; margin-right: 6px; color: #8c7cad; }

.card-marker {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  visibility: hidden;
}

.employee-card[aria-pressed="true"] .card-marker { visibility: visible; }
.card-marker::after {
  content: "";
  width: 8px;
  height: 5px;
  margin-top: -2px;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--canvas);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 73px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-person { display: flex; align-items: center; gap: 10px; min-width: 0; }

.chat-avatar {
  flex: 0 0 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid #ebe8f2;
  border-radius: 10px;
  background: #fbf9ff;
}

.chat-avatar img { width: 100%; height: 115%; object-fit: cover; object-position: center top; }
.chat-person h2 { font-size: 16px; font-weight: 710; line-height: 1.4; }
.chat-person p { color: var(--muted); font-size: 12px; }

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 33px;
  width: 33px;
  height: 33px;
  padding: 0 0 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover { background: #f3f1f8; color: var(--ink); }

.chat-history {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-messages { display: flex; flex-direction: column; gap: 15px; padding: 19px 16px 20px; }

.message { display: grid; gap: 4px; align-self: start; max-width: 92%; min-width: 0; }
.message-author { color: var(--muted); font-size: 11px; }
.message-bubble {
  padding: 9px 11px;
  border: 1px solid #eeebf3;
  border-radius: 3px 11px 11px;
  background: var(--surface);
  color: var(--label);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message--user { align-self: end; }
.message--user .message-author { text-align: end; }
.message--user .message-bubble { border-color: #ebe4fc; border-radius: 11px 3px 11px 11px; background: var(--lavender); color: #44346f; }
.message--sample .message-bubble { white-space: normal; }
.sample-title { color: var(--ink); font-weight: 670; margin-bottom: 6px; }
.sample-items { padding-left: 17px; list-style: disc; }
.sample-items li + li { margin-top: 3px; }
.sample-items li::marker { color: #9375e8; }

.chat-footer { display: grid; gap: 8px; padding: 8px 16px 14px; }
.chat-footer > p { padding-inline: 4px; font-size: 11px; color: var(--muted); }

.chat-form {
  display: grid;
  gap: 4px;
  padding: 11px 10px 9px 13px;
  border: 1px solid #e7e5f1;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 6px 24px #58619b13, 0 1px 4px #434d8908;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.chat-form:focus-within {
  border-color: #c4b8ef;
  box-shadow: 0 8px 25px #7563d519, 0 1px 4px #434d8908;
}

.chat-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 1px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.65;
}
.chat-form textarea:focus-visible { outline: none; }
.chat-form textarea::placeholder { color: #777286; }

.chat-controls { display: flex; align-items: center; justify-content: flex-end; }

.chat-send {
  min-height: 30px;
  padding: 4px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(115deg, #596adf, #8151d5);
  box-shadow: 0 4px 12px #7866e320;
  color: white;
  font-size: 12px;
  font-weight: 640;
}
.chat-send:hover:not(:disabled) { background: linear-gradient(115deg, #5866db, #7a50e2); }
.chat-send:disabled { background: #efe9fd; box-shadow: none; color: #766398; cursor: default; }

@media (max-width: 1120px) {
  .workspace { --nav-width: 136px; --chat-width: 318px; }
  .chat-open .employee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
  .workspace-page-inner { padding-inline: 18px; }
}

@media (max-width: 940px) {
  .workspace { --nav-width: 124px; --chat-width: 300px; }
  .employee-grid { gap: 10px; }
}

@media (max-width: 790px) {
  :root { --workspace-inset: 6px; --workspace-radius: 13px; }
  .workspace { --nav-width: 57px; --chat-width: 286px; }
  .sidebar { --sidebar-inset: 7px; align-items: stretch; }
  .brand { padding-inline: 4px; }
  .brand > span, .nav-text, .preview-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .nav-item { justify-content: center; padding-inline: 0; }
}

@media (max-width: 650px) {
  .workspace-page-inner { padding: 21px 11px 26px; }
}

@media (max-width: 635px) {
  .chat-open .workspace-stage { grid-template-columns: minmax(0, 1fr); }
  .workspace .employee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-panel {
    position: absolute;
    z-index: 2;
    inset: 0 0 0 max(0px, calc(100% - 355px));
    background: var(--surface);
    box-shadow: -9px 0 24px #29203314;
  }
  .card-labels { padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
