:root {
  color-scheme: light;
  --porcelain: #f6f1f4;
  --porcelain-bright: #fffafb;
  --ink-plum: #241820;
  --ink-soft: #5d4c56;
  --lacquer-rose: #b01f4b;
  --lacquer-deep: #851638;
  --petal-mauve: #c786a0;
  --champagne: #d7b47a;
  --champagne-pale: #f0dfc2;
  --eau-cyan: #78c7c8;
  --line: rgb(36 24 32 / 12%);
  --line-strong: rgb(36 24 32 / 22%);
  --surface: rgb(255 250 251 / 82%);
  --surface-solid: #fffafb;
  --shadow-soft: 0 18px 60px rgb(54 20 38 / 9%);
  --shadow-panel: 0 30px 90px rgb(54 20 38 / 13%);
  --brand-display: "Bodoni 72", "Bodoni MT", STSong, SimSun, serif;
  --brand-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --display: var(--brand-display);
  --body: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  --mono: var(--brand-mono);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --ease: cubic-bezier(.2, .75, .25, 1);
  --masthead-height-desktop: 88px;
  --masthead-height-tablet: 76px;
  --masthead-height-mobile: 68px;
  --masthead-surface: rgb(249 245 248 / 86%);
  --masthead-border: rgb(36 24 32 / 8%);
  --masthead-blur: 24px;
  --panel-surface: rgb(255 250 251 / 82%);
  --panel-highlight: rgb(255 255 255 / 72%);
  --control-high-intent: 56px;
  --control-standard: 40px;
  --control-compact: 34px;
  --section-label-size: 14px;
  --evidence-copy-size: 17px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--porcelain);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-plum);
  background:
    radial-gradient(circle at 9% 14%, rgb(199 134 160 / 13%), transparent 24rem),
    radial-gradient(circle at 91% 86%, rgb(215 180 122 / 12%), transparent 30rem),
    var(--porcelain);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

.customer-page {
  --priority-label-size: 13px;
  --display: var(--body);
  --mono: var(--body);
  font-family: var(--body);
}

.customer-page .brand-name {
  font-family: var(--brand-display);
}

.customer-page .brand-subtitle {
  font-family: var(--brand-mono);
}

.customer-page .eyebrow,
.customer-page .panel-kicker,
.customer-page label {
  font-size: var(--priority-label-size);
  letter-spacing: .045em;
}

.customer-page .button,
.customer-page .text-button {
  font-size: var(--priority-label-size);
}

.customer-page .mono-badge,
.customer-page .conversation-meta,
.customer-page .message-author {
  font-size: 12px;
}

.customer-page .panel-intro,
.customer-page .composer-status,
.customer-page .context-note {
  font-size: var(--priority-label-size);
}

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

button,
a,
input,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
summary,
a {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .56;
}

:focus-visible {
  outline: 3px solid rgb(120 199 200 / 65%);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spectrum-rail {
  position: fixed;
  z-index: 100;
  inset: 0 0 0 auto;
  width: 6px;
  background: linear-gradient(180deg, var(--eau-cyan), var(--champagne) 44%, var(--petal-mauve));
  box-shadow: -4px 0 24px rgb(120 199 200 / 22%);
  pointer-events: none;
  transition: filter .35s ease, background .35s ease;
}

.spectrum-rail::after {
  position: absolute;
  inset: 0 1px;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 9px,
    rgb(255 255 255 / 64%) 9px 10px,
    transparent 10px 18px
  );
  content: "";
  opacity: .72;
  pointer-events: none;
}

body[data-ws-state="connected"] .spectrum-rail {
  background: linear-gradient(180deg, #5ab7b9, var(--eau-cyan) 72%, #a7ded9);
}

body[data-ws-state="connecting"] .spectrum-rail {
  background: linear-gradient(180deg, #ead4aa, var(--champagne) 66%, #c99552);
}

body[data-ws-state="disconnected"] .spectrum-rail {
  background: linear-gradient(180deg, #91868c, var(--petal-mauve), #6b5b64);
  filter: saturate(.45);
}

body.is-message-pulse .spectrum-rail {
  animation: spectrum-pulse 900ms var(--ease);
}

@keyframes spectrum-pulse {
  0%, 100% { box-shadow: -4px 0 24px rgb(120 199 200 / 22%); }
  36% { box-shadow: -20px 0 48px rgb(176 31 75 / 42%); background: var(--lacquer-rose); }
}

.panel {
  background: var(--panel-surface);
  border: 1px solid var(--panel-highlight);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px);
}

.eyebrow,
.panel-kicker {
  display: block;
  color: var(--lacquer-rose);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
  line-height: 1.3;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: var(--control-standard);
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
  transition: transform .2s var(--ease), box-shadow .2s ease, background .2s ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--lacquer-rose);
  box-shadow: 0 9px 22px rgb(176 31 75 / 20%);
}

.button-primary:not(:disabled):hover {
  background: var(--lacquer-deep);
  box-shadow: 0 12px 28px rgb(176 31 75 / 28%);
}

.button-secondary {
  color: var(--ink-plum);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.button-secondary:not(:disabled):hover {
  background: rgb(255 255 255 / 58%);
}

.button-full {
  width: 100%;
}

.text-button {
  padding: 4px;
  color: var(--lacquer-rose);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.text-button:hover {
  color: var(--lacquer-deep);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(255 255 255 / 54%);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 58%);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

input {
  min-height: 42px;
  padding: 9px 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgb(176 31 75 / 52%);
  outline: 0;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 0 0 4px rgb(176 31 75 / 8%);
}

label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}

label > input,
label > textarea {
  display: block;
  margin-top: 5px;
}

.stack-form,
.editor-form,
.queue-filters {
  display: grid;
  gap: 10px;
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field input {
  min-width: 0;
}

.connection-pill {
  display: inline-flex;
  min-height: var(--control-standard);
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 58%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .02em;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a89da3;
  box-shadow: 0 0 0 3px rgb(168 157 163 / 13%);
}

.connection-pill[data-connection="connected"] .connection-dot {
  background: var(--eau-cyan);
  box-shadow: 0 0 0 3px rgb(120 199 200 / 18%);
}

.connection-pill[data-connection="connecting"] .connection-dot {
  background: var(--champagne);
  animation: dot-breathe 1.2s ease infinite;
}

.connection-pill[data-connection="disconnected"] .connection-dot {
  background: var(--petal-mauve);
}

@keyframes dot-breathe {
  50% { transform: scale(.7); opacity: .55; }
}

.conversation-list {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--petal-mauve) transparent;
}

.conversation-item {
  position: relative;
  display: grid;
  min-width: 0;
  width: 100%;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
  background: transparent;
  transition: background .2s ease, border-color .2s ease;
}

.conversation-item:hover {
  border-color: var(--line);
  background: rgb(255 255 255 / 55%);
}

.conversation-item.is-active {
  border-color: rgb(215 180 122 / 42%);
  background: linear-gradient(105deg, rgb(255 255 255 / 86%), rgb(240 223 194 / 34%));
  box-shadow: 0 9px 28px rgb(55 25 42 / 7%);
}

.conversation-item.is-active::before {
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 2px;
  background: var(--lacquer-rose);
  content: "";
}

.conversation-title {
  overflow: hidden;
  color: var(--ink-plum);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.empty-compact {
  padding: 20px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.chat-empty-state {
  display: grid;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  padding: 40px;
  text-align: center;
}

.chat-empty-state h2 {
  margin: 12px 0 7px;
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.05;
}

.chat-empty-state p {
  max-width: 380px;
  margin: 0;
  color: var(--ink-soft);
}

.empty-orbit {
  position: relative;
  width: 82px;
  height: 82px;
  margin-bottom: 22px;
  border: 1px solid rgb(176 31 75 / 20%);
  border-radius: 50%;
}

.empty-orbit::before,
.empty-orbit::after {
  position: absolute;
  border: 1px solid rgb(215 180 122 / 45%);
  border-radius: 50%;
  content: "";
  transform: rotate(-24deg);
}

.empty-orbit::before { inset: 11px -8px; }
.empty-orbit::after { inset: -8px 11px; transform: rotate(26deg); }
.empty-orbit span { position: absolute; inset: 31px; border-radius: 50%; background: var(--lacquer-rose); box-shadow: 0 0 32px rgb(176 31 75 / 32%); }

.chat-view {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

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

.chat-header h2 {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.015em;
}

.mono-badge {
  max-width: 190px;
  overflow: hidden;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
}

.message-timeline {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 28px clamp(18px, 3vw, 44px);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--petal-mauve) transparent;
}

.message-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  animation: message-enter 420ms var(--ease) both;
}

.message-row.is-own {
  align-items: flex-end;
}

@keyframes message-enter {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-author {
  display: flex;
  gap: 8px;
  margin: 0 8px 5px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .025em;
}

.message-bubble {
  max-width: min(78%, 620px);
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 6px 18px 18px 18px;
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 9px 26px rgb(45 23 35 / 6%);
}

.message-row.is-own .message-bubble {
  color: #fff;
  border-color: transparent;
  border-radius: 18px 6px 18px 18px;
  background: linear-gradient(135deg, var(--ink-plum), #4a2739);
  box-shadow: 0 12px 30px rgb(36 24 32 / 18%);
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-media {
  display: block;
  max-width: min(100%, 480px);
  margin-top: 8px;
  border-radius: 12px;
}

img.message-media,
video.message-media {
  max-height: 360px;
  object-fit: contain;
  background: rgb(36 24 32 / 7%);
}

audio.message-media {
  width: min(360px, 100%);
}

.file-message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 10px;
  text-decoration: none;
  opacity: .88;
}

.message-composer {
  position: relative;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: rgb(255 250 251 / 78%);
  backdrop-filter: blur(16px);
}

.composer-row {
  display: grid;
  align-items: end;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.composer-row textarea {
  min-height: 44px;
  max-height: 150px;
  resize: none;
}

.attachment-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-plum);
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  font-weight: 300;
}

.send-button {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 10px 17px;
  border-radius: 999px;
  color: #fff;
  background: var(--lacquer-rose);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 9px 22px rgb(176 31 75 / 20%);
}

.send-button:hover {
  background: var(--lacquer-deep);
}

.attachment-preview {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 48px 9px;
  padding: 7px 11px;
  border: 1px solid rgb(215 180 122 / 45%);
  border-radius: 9px;
  background: rgb(240 223 194 / 28%);
  font-size: 11px;
}

.attachment-preview:not([hidden]) {
  display: flex;
}

.composer-status {
  margin: 7px 50px 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.composer-status.is-error {
  color: var(--lacquer-rose);
}

.segmented-control {
  display: grid;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(36 24 32 / 4%);
  grid-template-columns: 1fr 1fr;
}

.customer-business .segmented-control {
  grid-template-columns: repeat(3, 1fr);
}

.public-after-sales-card strong {
  color: #347054;
}

.segment {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.segment.is-active {
  color: var(--ink-plum);
  background: var(--surface-solid);
  box-shadow: 0 5px 16px rgb(36 24 32 / 8%);
}

.business-tab {
  min-height: 0;
  padding-top: 16px;
}

.business-tab.is-active {
  display: grid;
  align-content: start;
  gap: 12px;
}

.search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.search-field input {
  border-radius: 12px 0 0 12px;
}

.search-field button {
  padding: 0 14px;
  border-radius: 0 12px 12px 0;
  color: #fff;
  background: var(--ink-plum);
  font-size: 11px;
}

.filter-grid {
  display: grid;
  gap: 9px;
}

.data-list {
  display: grid;
  align-content: start;
  gap: 9px;
}

.product-list-controls {
  display: flex;
  justify-content: flex-end;
  min-height: 22px;
}

.customer-product-list {
  grid-auto-rows: max-content;
  max-height: min(48vh, 520px);
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--petal-mauve) var(--porcelain-bright);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.customer-product-list::-webkit-scrollbar {
  width: 9px;
}

.customer-product-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--porcelain-bright);
}

.customer-product-list::-webkit-scrollbar-thumb {
  min-height: 38px;
  border: 2px solid var(--porcelain-bright);
  border-radius: 999px;
  background: var(--petal-mauve);
}

.customer-product-list::-webkit-scrollbar-button:single-button {
  display: block;
  width: 9px;
  height: 12px;
  background-color: var(--porcelain-bright);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 7px 6px;
}

.customer-product-list::-webkit-scrollbar-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='6' viewBox='0 0 7 6'%3E%3Cpath fill='%23c786a0' d='M3.5 1 7 6H0z'/%3E%3C/svg%3E");
}

.customer-product-list::-webkit-scrollbar-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='6' viewBox='0 0 7 6'%3E%3Cpath fill='%23c786a0' d='M0 0h7L3.5 5z'/%3E%3C/svg%3E");
}

.customer-product-list .data-card h3 {
  display: grid;
  min-height: 36px;
  place-items: center;
  overflow-wrap: anywhere;
  text-align: center;
}

.data-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 58%);
  overflow: hidden;
}

.data-card::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--champagne);
  content: "";
}

.data-card h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.data-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.data-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.data-price {
  color: var(--lacquer-rose);
  font-family: var(--display);
  font-size: 18px;
}

.context-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--champagne);
  color: var(--ink-soft);
  background: rgb(215 180 122 / 10%);
  font-size: 10px;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100vw - 44px));
  gap: 9px;
}

.toast {
  padding: 12px 15px;
  border: 1px solid rgb(255 255 255 / 46%);
  border-radius: 13px;
  color: #fff;
  background: rgb(36 24 32 / 94%);
  box-shadow: var(--shadow-panel);
  animation: toast-enter .3s var(--ease) both;
  font-size: 12px;
}

.toast.is-error {
  background: rgb(133 22 56 / 96%);
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}

/* Customer */
.customer-shell {
  display: grid;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  grid-template-rows: var(--masthead-height-desktop) minmax(0, 1fr);
}

.customer-topbar {
  position: relative;
  z-index: 80;
  display: flex;
  height: var(--masthead-height-desktop);
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--masthead-border);
  background: var(--masthead-surface);
  backdrop-filter: blur(var(--masthead-blur));
}

.brand-lockup {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  color: var(--ink-plum);
  text-decoration: none;
}

.brand-name {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.035em;
}

.brand-subtitle {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .22em;
}

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

.mobile-business-toggle,
.business-close {
  display: none;
}

.customer-workspace {
  display: grid;
  min-height: 0;
  gap: 14px;
  padding: 14px 18px 18px;
  grid-template-columns: 270px minmax(380px, 1fr) 410px;
}

.customer-identity,
.customer-business,
.chat-stage {
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.customer-identity {
  display: grid;
  align-content: start;
  grid-template-rows: auto auto auto auto auto minmax(90px, 1fr) auto;
  padding: 26px 20px 20px;
}

.customer-identity h1 {
  margin: 11px 0 10px;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.2;
}

.panel-intro {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.compact-heading {
  margin: 24px 2px 10px;
}

.section-heading h2,
.business-header h2,
.data-panel-header h2 {
  margin: 3px 0 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.customer-page .eyebrow,
.customer-page .panel-kicker {
  font-size: var(--section-label-size);
  font-weight: 700;
  line-height: 1.45;
}

.customer-page .inline-field input,
.customer-page .inline-field .button {
  min-height: var(--control-high-intent);
}

.customer-page .inline-field .button {
  min-width: 104px;
  padding-inline: 18px;
  white-space: nowrap;
}

.new-conversation-form {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-stage {
  display: grid;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 72%), rgb(255 250 251 / 56%)),
    var(--surface);
}

.customer-business {
  padding: 24px 18px;
  overflow-y: auto;
}

.business-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* Customer Service */
.service-page {
  background: #eae4e8;
}

.service-shell {
  display: grid;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  grid-template-columns: 82px 300px minmax(420px, 1fr) 370px;
}

.service-nav {
  position: relative;
  z-index: 4;
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  padding: 22px 10px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 10%, rgb(176 31 75 / 23%), transparent 12rem),
    var(--ink-plum);
}

.service-monogram {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(215 180 122 / 65%);
  border-radius: 50%;
  color: var(--champagne);
  font-family: var(--display);
  font-size: 25px;
  text-decoration: none;
}

.service-nav-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.service-nav-copy span {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .09em;
}

.service-nav-copy small {
  color: rgb(255 255 255 / 52%);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .2em;
}

.service-docs-link {
  margin-top: auto;
  color: rgb(255 255 255 / 62%);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-decoration: none;
}

.service-queue {
  display: grid;
  height: 100vh;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 24px 16px 16px;
  border-right: 1px solid var(--line);
  background: rgb(246 241 244 / 88%);
}

.queue-header {
  padding: 0 5px 17px;
}

.heading-with-count {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.queue-header h1 {
  margin: 8px 0 3px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
}

.heading-with-count span {
  color: var(--lacquer-rose);
  font-family: var(--display);
  font-size: 24px;
}

.queue-header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.queue-filters {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 52%);
}

.queue-filters input {
  min-height: 36px;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.service-conversation-list {
  margin-top: 12px;
}

.service-chat {
  position: relative;
  display: grid;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  background:
    radial-gradient(circle at 95% 0, rgb(199 134 160 / 10%), transparent 20rem),
    var(--porcelain-bright);
}

.service-statusbar {
  position: absolute;
  z-index: 5;
  inset: 17px 20px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.service-statusbar > * {
  pointer-events: auto;
}

.role-chip,
.truth-badge {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 58%);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
}

.service-chat .chat-empty-state {
  padding-top: 82px;
}

.service-chat .chat-view {
  padding-top: 63px;
}

.service-chat-header {
  min-height: 96px;
}

.header-metadata {
  display: grid;
  max-width: 220px;
  justify-items: end;
  color: var(--ink-soft);
  font-size: 9px;
}

.header-metadata strong {
  color: var(--ink-plum);
  font-family: var(--mono);
  font-size: 12px;
}

.header-metadata small {
  max-width: 190px;
  overflow: hidden;
  font-family: var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-composer {
  background: rgb(255 250 251 / 94%);
}

.service-data {
  height: 100vh;
  min-height: 0;
  padding: 24px 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: rgb(246 241 244 / 96%);
}

.data-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.truth-badge {
  border-color: rgb(120 199 200 / 46%);
  color: #2f7576;
  background: rgb(120 199 200 / 11%);
}

.service-data > .context-note {
  margin: 14px 0 16px;
}

.service-data-list {
  max-height: 260px;
  overflow-y: auto;
}

.data-editor {
  border-top: 1px solid var(--line);
}

.data-editor summary {
  position: relative;
  padding: 13px 2px;
  color: var(--ink-plum);
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.data-editor summary::-webkit-details-marker {
  display: none;
}

.data-editor summary::after {
  position: absolute;
  right: 4px;
  content: "+";
  color: var(--lacquer-rose);
  font-size: 17px;
  font-weight: 400;
}

.data-editor[open] summary::after {
  content: "−";
}

.editor-form {
  padding: 3px 2px 16px;
}

.editor-form input,
.editor-form textarea {
  min-height: 36px;
  background: rgb(255 255 255 / 66%);
}

.form-columns {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1320px) {
  .service-shell {
    grid-template-columns: 74px 270px minmax(390px, 1fr) 330px;
  }
}

@media (max-width: 1260px) {
  .customer-workspace {
    grid-template-columns: 250px minmax(360px, 1fr) 370px;
  }
}

@media (max-width: 1100px) {
  .customer-shell {
    grid-template-rows: var(--masthead-height-tablet) minmax(0, 1fr);
  }

  .customer-topbar {
    height: var(--masthead-height-tablet);
  }

  .mobile-business-toggle,
  .business-close {
    display: inline-grid;
  }

  .customer-workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .customer-business {
    position: fixed;
    z-index: 80;
    inset: 12px 12px 12px auto;
    width: min(380px, calc(100vw - 24px));
    transform: translateX(calc(100% + 30px));
    transition: transform .36s var(--ease);
  }

  body.business-open .customer-business {
    transform: translateX(0);
    box-shadow: var(--shadow-panel);
  }

  .service-shell {
    height: auto;
    min-height: auto;
    overflow: visible;
    grid-template-columns: 74px 280px minmax(0, 1fr);
    grid-template-rows: minmax(690px, 100vh) auto;
  }

  .service-nav,
  .service-queue,
  .service-chat {
    height: auto;
    min-height: 690px;
  }

  .service-data {
    display: grid;
    height: auto;
    min-height: auto;
    align-content: start;
    gap: 0 18px;
    border-top: 1px solid var(--line);
    border-left: 0;
    grid-column: 2 / 4;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
  }

  .service-data > .context-note,
  .service-data > .segmented-control {
    grid-column: 1 / 3;
  }

  .service-data > .business-tab {
    grid-column: 1 / 3;
  }
}

@media (max-width: 760px) {
  .spectrum-rail {
    width: 3px;
  }

  .customer-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .customer-topbar {
    height: var(--masthead-height-mobile);
    min-height: var(--masthead-height-mobile);
    padding: 0 15px;
  }

  .customer-page .brand-name {
    font-size: 24px;
  }

  .brand-subtitle,
  .topbar-actions .connection-pill {
    display: none;
  }

  .customer-workspace {
    display: block;
    padding: 9px;
  }

  .customer-identity {
    min-height: auto;
    margin-bottom: 9px;
    padding: 20px 16px;
  }

  .customer-identity h1 {
    font-size: 27px;
  }

  .customer-identity .conversation-list {
    max-height: 210px;
  }

  .chat-stage {
    height: min(720px, calc(100vh - 92px));
    min-height: 580px;
  }

  .chat-header {
    min-height: 74px;
    padding: 14px 16px;
  }

  .chat-header h2 {
    font-size: 22px;
  }

  .mono-badge,
  .header-metadata small {
    display: none;
  }

  .message-timeline {
    padding: 20px 13px;
  }

  .message-bubble {
    max-width: 88%;
  }

  .message-composer {
    padding: 10px;
  }

  .composer-row {
    gap: 7px;
    grid-template-columns: 38px minmax(0, 1fr) 46px;
  }

  .attachment-button {
    width: 38px;
    height: 38px;
  }

  .send-button {
    min-width: 44px;
    padding: 10px 13px;
  }

  .send-button span:first-child {
    display: none;
  }

  .composer-status {
    margin-left: 45px;
  }

  .customer-business {
    inset: 7px 7px 7px auto;
    width: calc(100vw - 14px);
  }

  .service-shell {
    display: block;
  }

  .service-nav {
    height: auto;
    min-height: 62px;
    flex-direction: row;
    justify-content: space-between;
    padding: 9px 14px;
  }

  .service-monogram {
    width: 40px;
    height: 40px;
  }

  .service-nav-copy {
    margin: 0;
    writing-mode: initial;
    transform: none;
  }

  .service-nav-copy small {
    display: none;
  }

  .service-docs-link {
    margin: 0;
  }

  .service-queue,
  .service-chat {
    height: auto;
    min-height: auto;
  }

  .service-queue {
    padding: 18px 14px;
  }

  .service-conversation-list {
    max-height: 310px;
  }

  .service-chat {
    height: 720px;
  }

  .service-statusbar {
    inset: 12px;
  }

  .role-chip {
    display: none;
  }

  .service-chat .chat-view {
    padding-top: 52px;
  }

  .service-data {
    display: block;
    height: auto;
    padding: 22px 14px;
  }

  .form-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .customer-page .brand-name {
    font-size: 22px;
  }
}

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

/* Customer Service Workspace v0.2 */
.service-v02 {
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 5%, rgb(199 134 160 / 14%), transparent 28rem),
    #eee8ec;
}

.workspace-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 218px minmax(0, 1fr);
}

.workspace-nav {
  position: relative;
  z-index: 50;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0, rgb(176 31 75 / 34%), transparent 18rem),
    linear-gradient(165deg, #2c1b25, #1c141a);
  box-shadow: 12px 0 38px rgb(36 24 32 / 12%);
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
}

.workspace-brand .service-monogram {
  flex: 0 0 auto;
}

.workspace-brand > span:last-child {
  display: grid;
  gap: 3px;
}

.workspace-brand strong {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .08em;
}

.workspace-brand small,
.workspace-nav-foot {
  color: rgb(255 255 255 / 48%);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .13em;
}

.workspace-links {
  display: grid;
  gap: 7px;
  margin-top: 48px;
}

.workspace-links a {
  position: relative;
  display: grid;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: rgb(255 255 255 / 66%);
  grid-template-columns: 34px minmax(0, 1fr);
  text-decoration: none;
  transition: .25s var(--ease);
}

.workspace-links a:hover,
.workspace-links a.is-active {
  color: #fff;
  border-color: rgb(215 180 122 / 22%);
  background: rgb(255 255 255 / 8%);
  transform: translateX(2px);
}

.workspace-links a.is-active::before {
  position: absolute;
  inset: 12px auto 12px -16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--champagne);
  content: "";
}

.nav-glyph {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 11px;
  color: var(--champagne);
  font-family: var(--display);
}

.workspace-links a > span:nth-child(2) {
  display: grid;
  gap: 2px;
  font-size: 12px;
  font-weight: 650;
}

.workspace-links small {
  color: rgb(255 255 255 / 34%);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: .08em;
}

.workspace-links b {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--lacquer-rose);
  font-family: var(--mono);
  font-size: 8px;
  text-align: center;
}

.workspace-nav-foot {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding: 14px 8px 3px;
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.workspace-nav-foot a {
  color: var(--champagne);
  text-decoration: none;
}

.workspace-content {
  display: grid;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  grid-template-rows: 78px minmax(0, 1fr);
}

.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgb(250 247 249 / 74%);
  backdrop-filter: blur(18px);
}

.workspace-topbar h1 {
  margin: 3px 0 0;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 500;
}

.workspace-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
}

.mobile-nav-toggle { display: none; }

.workspace-view {
  min-width: 0;
  min-height: 0;
}

.chat-workspace {
  display: grid;
  grid-template-columns: 294px minmax(410px, 1fr) 318px;
  overflow: hidden;
}

.conversation-desk,
.context-rail {
  min-height: 0;
  padding: 19px 15px;
  overflow-y: auto;
  background: rgb(248 244 247 / 86%);
}

.conversation-desk { border-right: 1px solid var(--line); }
.context-rail { border-left: 1px solid var(--line); }

.desk-heading,
.context-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 14px;
}

.desk-heading h2,
.context-heading h2 {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
}

.desk-heading > strong {
  color: var(--lacquer-rose);
  font-family: var(--display);
  font-size: 27px;
  font-weight: 500;
}

.workspace-filter,
.management-filters {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 56%);
}

.compact-fields {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
}

.message-search-panel {
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
}

.message-search-panel summary {
  padding: 10px 3px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.search-results {
  display: grid;
  max-height: 240px;
  gap: 6px;
  padding: 8px 0;
  overflow-y: auto;
}

.search-results button {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgb(255 255 255 / 58%);
  text-align: left;
}

.search-results span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-results small { color: var(--ink-soft); font-family: var(--mono); font-size: 8px; }

.enriched-conversation {
  display: grid;
  gap: 7px;
}

.conversation-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.workspace-chat-stage {
  height: 100%;
  min-height: 0;
}

.workspace-chat-stage .chat-view { padding-top: 46px; }
.workspace-chat-stage .service-statusbar { inset: 12px 16px auto; justify-content: flex-end; }

.relation-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8px;
}

.relation-breadcrumb a { color: var(--lacquer-rose); text-decoration: none; }
.relation-breadcrumb i { opacity: .45; }

.context-heading {
  display: block;
}

.context-heading p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.context-card {
  display: grid;
  gap: 7px;
  margin-bottom: 9px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 62%);
  box-shadow: 0 10px 24px rgb(45 23 35 / 4%);
}

.context-card h3 { margin: 0; font-size: 13px; }
.context-card p { margin: 0; color: var(--ink-soft); font-size: 10px; }
.context-label { color: var(--ink-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.context-empty { padding: 7px 0; color: var(--ink-soft); font-size: 10px; }
.context-link { display: flex; justify-content: space-between; color: var(--lacquer-rose); font-size: 10px; font-weight: 700; text-decoration: none; }

.status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(36 24 32 / 3%);
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.is-active { color: #2f6976; border-color: rgb(78 142 157 / 28%); background: rgb(78 142 157 / 9%); }
.status-badge.is-success { color: #347054; border-color: rgb(72 145 101 / 25%); background: rgb(72 145 101 / 9%); }
.status-badge.is-warning { color: #9a5e22; border-color: rgb(188 126 59 / 28%); background: rgb(215 180 122 / 14%); }

.message-row.is-system { align-items: center; }
.message-row.is-system .message-author { color: var(--ink-soft); }
.message-row.is-system .message-bubble { max-width: 82%; border-radius: 12px; background: rgb(215 180 122 / 13%); box-shadow: none; font-size: 10px; }

.management-view {
  padding: 25px 28px 28px;
  overflow: auto;
}

.management-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.management-hero h2 {
  margin: 5px 0;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 500;
}

.management-hero p { margin: 0; color: var(--ink-soft); font-size: 11px; }

.metric-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  grid-template-columns: repeat(3, 1fr);
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgb(255 255 255 / 62%);
}

.metric-card span { color: var(--ink-soft); font-size: 9px; }
.metric-card strong { font-family: var(--display); font-size: 25px; font-weight: 500; }
.metric-card small { color: var(--ink-soft); font-size: 8px; }

.management-filters {
  align-items: end;
  margin-bottom: 13px;
  padding: 10px;
  grid-template-columns: minmax(220px, 1.5fr) 1fr 1fr auto;
}

.compact-management-filter { grid-template-columns: minmax(240px, 1fr) auto; }

.management-table-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 65%);
  overflow: auto;
}

.management-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.management-table th {
  padding: 11px 13px;
  color: var(--ink-soft);
  background: rgb(36 24 32 / 3%);
  font-size: 8px;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.management-table td {
  padding: 12px 13px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.management-table tbody tr { cursor: pointer; transition: background .2s ease; }
.management-table tbody tr:hover { background: rgb(199 134 160 / 7%); }
.management-table td strong,
.management-table td small { display: block; }
.management-table td small { margin-top: 4px; color: var(--ink-soft); font-size: 8px; }

.table-footer {
  display: flex;
  justify-content: flex-end;
  min-height: 34px;
  align-items: center;
  padding: 7px 3px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8px;
}

.type-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  padding-bottom: 3px;
  overflow-x: auto;
}

.type-tabs button {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 42%);
  font-size: 9px;
}

.type-tabs button.is-active { color: #fff; border-color: var(--ink-plum); background: var(--ink-plum); }

.product-grid {
  display: grid;
  gap: 11px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.product-management-card {
  position: relative;
  display: grid;
  min-height: 190px;
  align-content: end;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(255 255 255 / 64%);
  overflow: hidden;
  text-align: left;
}

.product-management-card:hover { border-color: rgb(176 31 75 / 25%); box-shadow: 0 14px 30px rgb(45 23 35 / 7%); transform: translateY(-2px); }
.product-management-card h3 { z-index: 1; margin: 0; font-family: var(--display); font-size: 20px; font-weight: 500; }
.product-management-card p { z-index: 1; display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 9px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-management-card strong { z-index: 1; color: var(--lacquer-rose); font-family: var(--display); font-size: 18px; }
.product-management-card small { z-index: 1; color: var(--ink-soft); font-size: 8px; }
.product-swatch { position: absolute; top: -38px; right: -30px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f3d8df, #b0204b 63%, #5f1932); opacity: .17; }

.record-drawer {
  position: fixed;
  z-index: 120;
  inset: 0 0 0 auto;
  width: min(450px, 94vw);
  padding: 34px 30px;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fbf7f9;
  box-shadow: -24px 0 60px rgb(36 24 32 / 16%);
  transform: translateX(105%);
  transition: transform .36s var(--ease);
}

.record-drawer.is-open { transform: translateX(0); }
.record-drawer h2 { margin: 8px 0 12px; font-family: var(--display); font-size: 29px; font-weight: 500; overflow-wrap: anywhere; }
.drawer-close { position: absolute; top: 16px; right: 18px; width: 34px; height: 34px; border-radius: 50%; color: var(--ink-soft); background: rgb(36 24 32 / 5%); font-size: 22px; }
.drawer-scrim { position: fixed; z-index: 110; inset: 0; background: rgb(36 24 32 / 22%); backdrop-filter: blur(2px); }
.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-lead { margin: 18px 0; padding: 13px; border-left: 2px solid var(--champagne); color: var(--ink-soft); background: rgb(215 180 122 / 9%); font-size: 11px; }
.detail-list { display: grid; grid-template-columns: 112px minmax(0, 1fr); margin: 20px 0; border-top: 1px solid var(--line); }
.detail-list dt,
.detail-list dd { margin: 0; padding: 10px 3px; border-bottom: 1px solid var(--line); font-size: 10px; overflow-wrap: anywhere; }
.detail-list dt { color: var(--ink-soft); }
.drawer-actions { display: grid; gap: 8px; margin-top: 18px; }
.status-update-form { display: grid; gap: 8px; margin: 20px 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.timeline-list { display: grid; gap: 8px; margin-top: 15px; }
.timeline-list article { display: grid; gap: 3px; padding: 10px 12px; border-left: 2px solid var(--petal-mauve); background: rgb(255 255 255 / 55%); }
.timeline-list span { color: var(--ink-soft); font-size: 9px; }
.timeline-list small { color: var(--ink-soft); font-family: var(--mono); font-size: 8px; }

.workspace-dialog {
  width: min(560px, calc(100vw - 30px));
  max-height: 88vh;
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 23px;
  color: var(--ink-plum);
  background: #fbf7f9;
  box-shadow: var(--shadow-panel);
}

.workspace-dialog::backdrop { background: rgb(36 24 32 / 42%); backdrop-filter: blur(4px); }
.workspace-dialog h2 { margin: 7px 0; font-family: var(--display); font-size: 28px; font-weight: 500; }
.workspace-dialog > p { margin: 0 0 18px; color: var(--ink-soft); font-size: 10px; }
.dialog-close-row { position: absolute; top: 13px; right: 14px; }
.dialog-close-row button { width: 32px; height: 32px; border-radius: 50%; background: rgb(36 24 32 / 5%); font-size: 19px; }
.import-form { display: grid; gap: 10px; }
.file-drop { display: grid; gap: 8px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 15px; color: var(--ink-soft); text-align: center; }
.import-result { display: grid; gap: 10px; margin-top: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; }
.import-result.is-ready { border-color: rgb(72 145 101 / 30%); background: rgb(72 145 101 / 6%); }
.import-result.is-invalid { border-color: rgb(176 31 75 / 26%); background: rgb(176 31 75 / 5%); }
.import-result h3,
.import-result p { margin: 0; }
.import-result p { color: var(--ink-soft); font-size: 9px; }
.import-counts { display: grid; gap: 7px; grid-template-columns: repeat(3, 1fr); }
.import-counts span { display: grid; padding: 9px; border-radius: 11px; background: rgb(255 255 255 / 62%); color: var(--ink-soft); font-size: 8px; text-align: center; }
.import-counts strong { color: var(--ink-plum); font-family: var(--display); font-size: 20px; font-weight: 500; }

@media (max-width: 1180px) {
  .workspace-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .workspace-nav { align-items: center; padding-inline: 10px; }
  .workspace-brand > span:last-child,
  .workspace-links a > span:nth-child(2),
  .workspace-nav-foot span { display: none; }
  .workspace-links a { grid-template-columns: 34px; }
  .workspace-links b { top: 4px; right: 1px; }
  .workspace-nav-foot { text-align: center; }
  .chat-workspace { grid-template-columns: 270px minmax(0, 1fr); overflow-y: auto; }
  .workspace-chat-stage { min-height: 690px; }
  .context-rail { display: grid; align-items: start; gap: 9px; grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 0; }
  .context-heading { grid-column: 1 / -1; }
  .context-card { min-height: 132px; margin: 0; }
  .context-rail > .button { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .service-v02 { overflow: auto; }
  .workspace-shell { display: block; }
  .workspace-nav { position: fixed; z-index: 160; inset: 0 auto 0 0; width: 218px; align-items: stretch; transform: translateX(-105%); transition: transform .3s var(--ease); }
  body.nav-open .workspace-nav { transform: translateX(0); }
  .workspace-brand > span:last-child,
  .workspace-links a > span:nth-child(2),
  .workspace-nav-foot span { display: grid; }
  .workspace-links a { grid-template-columns: 34px minmax(0, 1fr); }
  .workspace-content { height: auto; min-height: 100vh; grid-template-rows: 66px auto; }
  .workspace-topbar { position: sticky; z-index: 40; top: 0; padding: 9px 13px; }
  .workspace-topbar h1 { font-size: 22px; }
  .workspace-status .truth-badge { display: none; }
  .mobile-nav-toggle { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--ink-plum); color: #fff; }
  .workspace-topbar > div:nth-child(2) { margin-right: auto; }
  .chat-workspace { display: block; overflow: visible; }
  .conversation-desk { min-height: auto; border-right: 0; }
  .service-conversation-list { max-height: 330px; }
  .workspace-chat-stage { height: 720px; min-height: 620px; border-top: 1px solid var(--line); }
  .context-rail { display: grid; grid-template-columns: 1fr 1fr; }
  .context-heading { grid-column: 1 / -1; }
  .context-rail > .button { grid-column: 1 / -1; }
  .management-view { padding: 19px 13px; }
  .management-hero { align-items: flex-start; }
  .management-hero h2 { font-size: 27px; }
  .metric-strip { grid-template-columns: 1fr; }
  .management-filters { grid-template-columns: 1fr 1fr; }
  .management-filters .button { grid-column: 1 / -1; }
  .management-table th:nth-child(3),
  .management-table td:nth-child(3),
  .management-table th:nth-child(6),
  .management-table td:nth-child(6),
  .management-table th:nth-child(7),
  .management-table td:nth-child(7),
  .management-table th:nth-child(8),
  .management-table td:nth-child(8) { display: none; }
}

@media (max-width: 520px) {
  .workspace-status #workspaceClock { display: none; }
  .conversation-desk { padding: 16px 11px; }
  .workspace-chat-stage { height: calc(100vh - 66px); }
  .context-rail { display: block; padding: 16px 11px; }
  .context-card { min-height: 0; margin-bottom: 8px; }
  .management-hero { display: grid; }
  .management-filters { grid-template-columns: 1fr; }
  .management-filters .button { grid-column: auto; }
  .product-grid { grid-template-columns: 1fr; }
  .record-drawer { width: 100vw; padding: 30px 20px; }
  .detail-list { grid-template-columns: 94px minmax(0, 1fr); }
}
