:root {
  color-scheme: light;
  --paper: #f3eee3;
  --paper-deep: #e9e0d0;
  --paper-raised: #fffdf7;
  --paper-inset: #ebe4d7;
  --ink: #19231f;
  --ink-soft: #4e5b54;
  --ink-muted: #7c857f;
  --ink-faint: #a9afa9;
  --jade: #286551;
  --jade-dark: #17483a;
  --jade-soft: #dbe8e1;
  --vermilion: #b44632;
  --vermilion-soft: #f3ded7;
  --brass: #a87f43;
  --brass-soft: #eee3cf;
  --line: rgba(25, 35, 31, 0.11);
  --line-strong: rgba(25, 35, 31, 0.2);
  --shadow-raised:
    0 0 0 1px rgba(25, 35, 31, 0.05),
    0 1px 2px -1px rgba(25, 35, 31, 0.08),
    0 12px 34px -20px rgba(25, 35, 31, 0.3);
  --shadow-float:
    0 0 0 1px rgba(25, 35, 31, 0.07),
    0 18px 55px -24px rgba(25, 35, 31, 0.4);
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --rail: 336px;
  --context: 292px;
  --topbar: 68px;
  --ease-enter: cubic-bezier(0.23, 1, 0.32, 1);
  --font-sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-display: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--jade);
}

::selection {
  color: var(--paper-raised);
  background: var(--jade);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  color: var(--paper-raised);
  background: var(--ink);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  color: var(--paper-raised);
  background: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
  animation: toast-in 220ms var(--ease-enter) both;
}

.toast.error {
  background: var(--vermilion);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--vermilion);
  background: var(--paper-raised);
  border: 1px solid currentColor;
  border-radius: 10px 4px 10px 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.eyebrow {
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-inverse {
  color: rgba(255, 253, 247, 0.42);
}

.mt-8 {
  margin-top: 8px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-11 {
  margin-top: 11px;
}

.button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 120ms var(--ease-enter);
}

.button:active:not(:disabled) {
  transform: scale(0.97);
}

.button-primary {
  color: #fffdf7;
  background: var(--jade);
}

.button-primary:hover:not(:disabled) {
  background: var(--jade-dark);
}

.button-secondary {
  color: var(--ink);
  background: var(--paper-raised);
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled) {
  background: var(--paper-deep);
}

.button-danger {
  color: var(--vermilion);
  background: var(--vermilion-soft);
  border-color: rgba(180, 70, 50, 0.2);
}

.button-quiet {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--ink-soft);
  background: transparent;
}

.button-quiet:hover:not(:disabled) {
  color: var(--ink);
  background: var(--paper-deep);
}

.button-wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.icon-button:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.input,
.select,
.textarea {
  width: 100%;
  color: var(--ink);
  background: var(--paper-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

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

.textarea {
  min-height: 76px;
  padding: 10px 12px;
  resize: none;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--line-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  background: var(--paper-raised);
  border-color: var(--jade);
  outline: none;
  box-shadow: 0 0 0 3px rgba(40, 101, 81, 0.12);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-faint);
}

.pill {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-jade {
  color: var(--jade-dark);
  background: var(--jade-soft);
}

.pill-red {
  color: var(--vermilion);
  background: var(--vermilion-soft);
}

.pill-brass {
  color: #71501f;
  background: var(--brass-soft);
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--ink-faint);
  border-radius: 50%;
}

.dot.online {
  background: #2c8063;
  box-shadow: 0 0 0 3px rgba(44, 128, 99, 0.12);
}

.dot.offline {
  background: var(--vermilion);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--paper-raised);
  background: var(--jade);
  border-radius: 12px 5px 12px 5px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.avatar.customer {
  color: var(--ink);
  background: var(--brass-soft);
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  min-height: 100dvh;
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: clamp(32px, 5vw, 76px);
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-raised);
}

.login-story::after {
  position: absolute;
  right: -5vw;
  bottom: -18vw;
  width: 44vw;
  height: 44vw;
  border: 1px solid rgba(255, 253, 247, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 7vw rgba(255, 253, 247, 0.025),
    0 0 0 14vw rgba(255, 253, 247, 0.018);
  content: "";
  pointer-events: none;
}

.login-story .brand-mark {
  color: #d08470;
  background: transparent;
  border-color: rgba(255, 253, 247, 0.35);
}

.login-story .brand-subtitle {
  color: rgba(255, 253, 247, 0.58);
}

.login-statement {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 10vh 0;
}

.login-statement h1 {
  max-width: 650px;
  margin: 14px 0 20px;
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 76px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-wrap: balance;
}

.login-statement p {
  max-width: 500px;
  margin: 0;
  color: rgba(255, 253, 247, 0.66);
  font-size: 15px;
  line-height: 1.8;
  text-wrap: pretty;
}

.handoff-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 34px;
}

.handoff-step {
  display: flex;
  gap: 7px;
  align-items: center;
  color: rgba(255, 253, 247, 0.55);
  font-size: 11px;
  font-weight: 600;
}

.handoff-step::before {
  width: 22px;
  height: 1px;
  background: rgba(255, 253, 247, 0.25);
  content: "";
}

.handoff-step:first-child::before {
  display: none;
}

.login-footnote {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 20px;
  color: rgba(255, 253, 247, 0.42);
  font-size: 11px;
}

.login-panel {
  display: grid;
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  background: var(--paper);
}

.login-card {
  width: min(100%, 420px);
  margin: 0 auto;
}

.login-card h2 {
  margin: 9px 0 8px;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 28px;
  color: var(--ink-muted);
}

.login-form {
  display: grid;
  gap: 17px;
}

.demo-accounts {
  display: grid;
  gap: 7px;
  padding: 12px;
  margin-top: 20px;
  background: rgba(255, 253, 247, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.demo-account {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
}

.demo-account:hover {
  background: var(--paper-raised);
}

.demo-account strong {
  display: block;
  font-size: 12px;
}

.demo-account span {
  color: var(--ink-muted);
  font-size: 11px;
}

.customer-link {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}

.staff-page {
  display: grid;
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  height: 100dvh;
  padding: 10px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  gap: 14px;
  align-items: center;
}

.channel-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--paper-deep);
  border-radius: 11px;
}

.channel-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
}

.channel-button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper-raised);
  box-shadow: 0 1px 4px rgba(25, 35, 31, 0.08);
}

.sync-state {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 11px;
}

.agent-chip {
  display: flex;
  gap: 9px;
  align-items: center;
}

.agent-chip-copy {
  line-height: 1.2;
}

.agent-chip-name {
  font-size: 12px;
  font-weight: 700;
}

.agent-chip-role {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--context);
  min-height: 0;
  overflow: hidden;
  background: var(--paper-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}

.queue-panel,
.context-panel {
  min-width: 0;
  min-height: 0;
}

.queue-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
}

.queue-head {
  padding: 20px 18px 15px;
}

.queue-title-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.queue-title {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.daily-rhythm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 15px 18px 12px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.daily-stat {
  padding: 10px 11px 9px;
  background: var(--paper);
}

.daily-stat strong {
  display: block;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.daily-stat span {
  display: block;
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 10px;
}

.queue-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 18px 10px;
}

.filter-tabs {
  display: flex;
  flex: 1;
  gap: 3px;
  padding: 3px;
  background: var(--paper);
  border-radius: var(--radius-sm);
}

.filter-tab {
  flex: 1;
  min-height: 30px;
  padding: 4px 8px;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.filter-tab[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper-raised);
  box-shadow: 0 1px 3px rgba(25, 35, 31, 0.08);
}

.conversation-list {
  min-height: 0;
  padding: 0 9px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-deep) transparent;
}

.conversation-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  padding: 12px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  transition:
    background-color 130ms ease,
    border-color 130ms ease;
}

.conversation-card::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 2px;
  background: transparent;
  border-radius: 999px;
  content: "";
}

.conversation-card:hover {
  background: var(--paper);
}

.conversation-card.active {
  background: var(--jade-soft);
  border-color: rgba(40, 101, 81, 0.13);
}

.conversation-card.active::before {
  background: var(--jade);
}

.conversation-main {
  min-width: 0;
}

.conversation-topline {
  display: flex;
  gap: 7px;
  align-items: center;
}

.conversation-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.conversation-preview {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.conversation-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.channel-mini {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 9px;
}

.unread-badge {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: #fffdf7;
  background: var(--vermilion);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty-list {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 30px;
  color: var(--ink-muted);
  text-align: center;
}

.empty-list strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 17px;
}

.empty-list-full {
  min-height: 100%;
}

.conversation-panel {
  min-width: 0;
  min-height: 0;
  background: var(--paper-raised);
}

.conversation-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 40px;
  text-align: center;
}

.conversation-empty-inner {
  width: min(420px, 100%);
}

.conversation-empty-mark {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  color: var(--jade);
  background: var(--jade-soft);
  border-radius: 21px 8px 21px 8px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.conversation-empty h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 24px;
}

.conversation-empty p {
  margin: 0;
  color: var(--ink-muted);
}

.conversation-thread {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.thread-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px 19px;
  border-bottom: 1px solid var(--line);
}

.thread-head-left {
  display: flex;
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.thread-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-subline {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 10px;
}

.handoff-track {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 9px;
}

.handoff-node {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.handoff-node::before {
  width: 16px;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.handoff-node:first-child::before {
  display: none;
}

.handoff-node.done {
  color: var(--jade);
}

.handoff-node.current {
  color: var(--vermilion);
  font-weight: 700;
}

.thread-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.message-scroll {
  min-height: 0;
  padding: 24px clamp(18px, 4vw, 54px);
  overflow-y: auto;
  background:
    linear-gradient(rgba(25, 35, 31, 0.026) 1px, transparent 1px) 0 0 / 100% 36px,
    var(--paper-raised);
  scrollbar-width: thin;
  scrollbar-color: var(--paper-deep) transparent;
}

.message-day {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0 22px;
  color: var(--ink-faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.message-day::before,
.message-day::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.message-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  max-width: 660px;
  margin-bottom: 17px;
  animation: message-in 190ms var(--ease-enter) both;
}

.message-row.agent {
  grid-template-columns: minmax(0, 1fr) 30px;
  margin-left: auto;
}

.message-row.system {
  display: flex;
  justify-content: center;
  max-width: none;
}

.message-row .avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px 3px 9px 3px;
  font-size: 11px;
}

.message-body-wrap {
  min-width: 0;
}

.message-row.agent .message-body-wrap {
  text-align: right;
}

.message-author {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 5px;
  color: var(--ink-muted);
  font-size: 9px;
}

.message-row.agent .message-author {
  justify-content: flex-end;
}

.message-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 10px 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px 13px 13px 13px;
  font-size: 13px;
  line-height: 1.65;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.agent .message-bubble {
  color: var(--paper-raised);
  background: var(--jade);
  border-color: var(--jade);
  border-radius: 13px 4px 13px 13px;
}

.message-status {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 9px;
}

.message-status.failed {
  color: var(--vermilion);
}

.system-note {
  max-width: 520px;
  padding: 6px 11px;
  color: var(--ink-muted);
  background: var(--paper-deep);
  border-radius: 999px;
  font-size: 9px;
  text-align: center;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.composer {
  padding: 13px clamp(14px, 3vw, 26px) 16px;
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
}

.composer-box {
  padding: 7px 7px 7px 12px;
  background: var(--paper-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition:
    border-color 140ms ease,
    background-color 140ms ease;
}

.composer-box:focus-within {
  background: var(--paper-raised);
  border-color: var(--jade);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 35px;
  max-height: 130px;
  padding: 5px 3px;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
}

.composer-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
}

.composer-hint {
  color: var(--ink-faint);
  font-size: 9px;
}

.send-button {
  min-width: 82px;
}

.context-panel {
  padding: 18px 16px;
  overflow-y: auto;
  background: var(--paper);
  border-left: 1px solid var(--line);
}

.context-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.context-section:first-child {
  padding-top: 4px;
}

.context-section:last-child {
  border-bottom: 0;
}

.customer-summary {
  display: flex;
  gap: 11px;
  align-items: center;
}

.customer-summary-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.customer-summary-meta {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 10px;
}

.detail-list {
  display: grid;
  gap: 11px;
  margin: 13px 0 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.detail-row dt {
  color: var(--ink-muted);
  font-size: 10px;
}

.detail-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  text-align: right;
}

.context-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.agent-list {
  display: grid;
  gap: 6px;
}

.agent-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-radius: var(--radius-sm);
}

.agent-row.current {
  background: var(--jade-soft);
}

.agent-row-copy {
  min-width: 0;
}

.agent-row-name {
  font-size: 11px;
  font-weight: 700;
}

.agent-row-state {
  color: var(--ink-muted);
  font-size: 9px;
}

.transfer-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.channel-card {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 9px 0;
}

.channel-card + .channel-card {
  border-top: 1px dashed var(--line);
}

.channel-card strong {
  display: block;
  font-size: 11px;
}

.channel-card span {
  display: block;
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 9px;
}

.mobile-queue-button {
  display: none;
}

.customer-page {
  min-height: 100dvh;
  padding: clamp(0px, 3vw, 28px);
  background: var(--paper-deep);
}

.customer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 520px);
  height: min(860px, calc(100dvh - clamp(0px, 6vw, 56px)));
  min-height: 600px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper-raised);
  border-radius: 26px;
  box-shadow: var(--shadow-float);
}

.customer-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.customer-head-copy {
  flex: 1;
}

.customer-head h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.2;
}

.customer-sla {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--jade);
  font-size: 9px;
  font-weight: 700;
}

.customer-body {
  min-height: 0;
  overflow-y: auto;
  background:
    linear-gradient(rgba(25, 35, 31, 0.024) 1px, transparent 1px) 0 0 / 100% 36px,
    var(--paper-raised);
}

.customer-welcome {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 30px;
  text-align: center;
}

.customer-welcome-inner {
  width: min(350px, 100%);
}

.customer-welcome h2 {
  margin: 18px 0 7px;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.2;
}

.customer-welcome p {
  margin: 0 0 24px;
  color: var(--ink-muted);
  font-size: 12px;
}

.customer-welcome-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.customer-message-scroll {
  min-height: 100%;
  padding: 20px 18px;
}

.customer-message-row {
  display: flex;
  margin-bottom: 14px;
}

.customer-message-row.agent {
  justify-content: flex-start;
}

.customer-message-row.customer {
  justify-content: flex-end;
}

.customer-message-row.system {
  justify-content: center;
}

.customer-bubble {
  max-width: 82%;
  padding: 9px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px 13px 13px 13px;
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.customer-message-row.customer .customer-bubble {
  color: var(--paper-raised);
  background: var(--jade);
  border-color: var(--jade);
  border-radius: 13px 4px 13px 13px;
}

.customer-message-row.system .customer-bubble {
  max-width: 92%;
  color: var(--ink-muted);
  background: var(--paper-deep);
  border: 0;
  border-radius: 999px;
  font-size: 10px;
  text-align: center;
}

.customer-composer {
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.customer-composer-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 6px 6px 6px 12px;
  background: var(--paper-inset);
  border: 1px solid transparent;
  border-radius: 15px;
}

.customer-composer-inner:focus-within {
  background: var(--paper-raised);
  border-color: var(--jade);
}

.customer-composer textarea {
  flex: 1;
  min-height: 34px;
  max-height: 108px;
  padding: 6px 0;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
}

.customer-send {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--paper-raised);
  background: var(--jade);
  border: 0;
  border-radius: 11px;
}

.customer-send:hover {
  background: var(--jade-dark);
}

.customer-note {
  margin: 7px 4px 0;
  color: var(--ink-faint);
  font-size: 9px;
  text-align: center;
}

.loading-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

.loading-card {
  display: grid;
  place-items: center;
  padding: 38px;
  color: var(--ink-muted);
}

.loading-lines {
  display: grid;
  gap: 7px;
  width: 180px;
  margin-top: 18px;
}

.loading-line {
  height: 5px;
  background: var(--paper-deep);
  border-radius: 99px;
  animation: loading-pulse 1.2s ease-in-out infinite alternate;
}

.loading-line:nth-child(2) {
  width: 72%;
  animation-delay: 120ms;
}

@keyframes loading-pulse {
  to {
    opacity: 0.35;
    transform: scaleX(0.88);
    transform-origin: left;
  }
}

@media (max-width: 1180px) {
  :root {
    --rail: 310px;
    --context: 250px;
  }

  .channel-switcher {
    display: none;
  }
}

@media (max-width: 960px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-story {
    min-height: 380px;
    padding: 30px;
  }

  .login-statement {
    margin: 50px 0 20px;
  }

  .login-statement h1 {
    max-width: 580px;
    font-size: clamp(38px, 8vw, 62px);
  }

  .login-footnote {
    display: none;
  }

  .workspace {
    grid-template-columns: var(--rail) minmax(0, 1fr);
  }

  .context-panel {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    background: var(--paper-raised);
  }

  .staff-page {
    display: block;
    height: 100dvh;
    padding: 0;
  }

  .topbar {
    height: 60px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
  }

  .topbar .brand-subtitle,
  .sync-state,
  .agent-chip-role {
    display: none;
  }

  .topbar .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }

  .topbar .brand-name {
    font-size: 16px;
  }

  .agent-chip .avatar {
    width: 32px;
    height: 32px;
  }

  .workspace {
    position: relative;
    display: block;
    height: calc(100dvh - 60px);
    border-radius: 0;
    box-shadow: none;
  }

  .queue-panel {
    position: absolute;
    inset: 0 18% 0 0;
    z-index: 30;
    display: grid;
    background: var(--paper-raised);
    border: 0;
    box-shadow: 22px 0 48px -30px rgba(25, 35, 31, 0.55);
    transform: translateX(-105%);
    transition: transform 220ms var(--ease-enter);
  }

  .queue-panel.open {
    transform: translateX(0);
  }

  .conversation-panel,
  .conversation-thread {
    height: 100%;
  }

  .thread-head {
    padding: 10px 12px;
  }

  .handoff-track {
    display: none;
  }

  .thread-actions .button-secondary {
    display: none;
  }

  .message-scroll {
    padding: 18px 14px;
  }

  .composer {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .mobile-queue-button {
    display: inline-grid;
  }

  .customer-page {
    padding: 0;
    background: var(--paper-raised);
  }

  .customer-shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .login-story {
    min-height: 300px;
    padding: 22px;
  }

  .login-statement {
    margin: 38px 0 10px;
  }

  .login-statement h1 {
    margin-bottom: 12px;
    font-size: 38px;
  }

  .login-statement p {
    font-size: 13px;
  }

  .handoff-line {
    margin-top: 20px;
  }

  .login-panel {
    padding: 28px 20px 40px;
  }

  .queue-panel {
    right: 8%;
  }
}

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