:root {
  color-scheme: light;
  --ink: #17203a;
  --muted: #68718a;
  --soft-muted: #8991a7;
  --line: #e4e7ef;
  --canvas: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --navy: #172c56;
  --navy-hover: #0f234a;
  --violet: #7279b7;
  --violet-soft: #eef0fb;
  --blue: #286bd6;
  --green: #17956f;
  --green-soft: #e8f7f1;
  --amber: #a66b0a;
  --amber-soft: #fff5dc;
  --red: #c4424e;
  --red-soft: #fff0f1;
  --shadow: 0 18px 50px rgb(28 39 68 / 12%);
  --focus: 0 0 0 3px rgb(49 106 210 / 22%);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
}

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

button {
  border: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

.sr-only {
  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;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.login-shell {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 32px 20px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 15%, rgb(117 125 185 / 18%) 0, transparent 31%),
    radial-gradient(circle at 88% 80%, rgb(40 107 214 / 12%) 0, transparent 33%),
    linear-gradient(145deg, #f8f9fd 0%, #eef1f8 100%);
}

.login-shell::before,
.login-shell::after {
  position: fixed;
  width: 210px;
  height: 210px;
  border: 1px solid rgb(114 121 183 / 12%);
  border-radius: 44px;
  content: "";
  pointer-events: none;
  transform: rotate(22deg);
}

.login-shell::before {
  top: -85px;
  right: 7%;
}

.login-shell::after {
  bottom: -115px;
  left: 5%;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  padding: 36px;
  border: 1px solid rgb(218 222 233 / 86%);
  border-radius: 22px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, var(--violet), #58639e);
  box-shadow: 0 7px 16px rgb(89 99 158 / 24%);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
}

.brand-mark svg path:first-child {
  fill: rgb(255 255 255 / 8%);
}

.login-heading {
  margin: 40px 0 28px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--violet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.login-heading h1,
.queue-heading h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.login-heading p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

#login-form label,
.call-dialog label {
  display: block;
  margin: 18px 0 7px;
  color: #343d55;
  font-size: 12px;
  font-weight: 700;
}

#login-form input,
#login-form select,
.call-dialog textarea {
  width: 100%;
  border: 1px solid #d8dce7;
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

#login-form input {
  height: 46px;
  padding: 0 13px;
}

#login-form select {
  width: 100%;
  height: 46px;
  padding: 0 38px 0 13px;
  border: 1px solid #d8dce7;
  border-radius: 10px;
  outline: 0;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #747c91 50%) calc(100% - 17px) 20px / 5px 5px no-repeat,
    linear-gradient(135deg, #747c91 50%, transparent 50%) calc(100% - 12px) 20px / 5px 5px no-repeat,
    #fff;
}

#login-form select:focus {
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.optional-label {
  margin-left: 4px;
  color: var(--soft-muted);
  font-size: 9px;
  font-weight: 550;
}

#login-form input:hover,
.call-dialog textarea:hover {
  border-color: #bcc2d1;
}

#login-form input:focus,
.call-dialog textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.token-field {
  position: relative;
}

.token-field input {
  padding-right: 46px !important;
}

.reveal-button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.reveal-button:hover {
  color: var(--navy);
  background: var(--surface-soft);
}

.reveal-button svg {
  width: 19px;
  height: 19px;
}

.reveal-button .eye-closed,
.reveal-button.is-visible .eye-open {
  display: none;
}

.reveal-button.is-visible .eye-closed {
  display: block;
}

.primary-button,
.secondary-button,
.resolve-button,
.close-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 750;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-button {
  color: #fff;
  background: var(--navy);
}

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

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.resolve-button:not(:disabled):active,
.close-button:not(:disabled):active {
  transform: translateY(1px);
}

.secondary-button {
  border: 1px solid #d9dde7;
  color: #37415a;
  background: #fff;
}

.secondary-button:not(:disabled):hover {
  border-color: #bdc3d1;
  background: #f8f9fc;
}

.login-button {
  width: 100%;
  height: 48px;
  margin-top: 24px;
}

.button-spinner,
.large-spinner {
  display: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button-spinner {
  width: 16px;
  height: 16px;
}

.is-loading > span:not(.button-spinner),
.send-button.is-loading svg {
  visibility: hidden;
}

.is-loading .button-spinner {
  position: absolute;
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-error,
.composer-error {
  margin: 9px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 650;
}

.session-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 24px 0 0;
  color: var(--soft-muted);
  font-size: 11px;
}

.session-note svg {
  width: 15px;
  height: 15px;
}

.workspace {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: 370px minmax(0, 1fr);
  background: var(--surface);
}

.sidebar {
  position: relative;
  z-index: 3;
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

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

.brand-lockup--compact {
  gap: 9px;
  font-size: 15px;
}

.brand-lockup--compact .brand-mark {
  width: 33px;
  height: 33px;
  border-radius: 10px;
}

.agent-menu {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.agent-avatar,
.customer-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-avatar {
  width: 33px;
  height: 33px;
  color: #fff;
  background: linear-gradient(145deg, #2b6bc7, #5d80b6);
  font-size: 12px;
}

.agent-identity {
  display: flex;
  max-width: 96px;
  min-width: 0;
  flex-direction: column;
}

.agent-identity strong {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-identity span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9.5px;
}

.presence-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.queue-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 23px 20px 13px;
}

.queue-heading h1 {
  font-size: 26px;
}

.refresh-button.is-refreshing svg {
  animation: spin 700ms linear infinite;
}

.connection-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  margin: 0 20px 12px;
  padding: 6px 9px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a5acbd;
}

.connection-summary.is-online .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(23 149 111 / 12%);
}

.connection-summary.is-error {
  color: var(--red);
  background: var(--red-soft);
}

.connection-summary.is-error .connection-dot {
  background: var(--red);
}

.filter-strip {
  display: flex;
  gap: 4px;
  padding: 0 17px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-strip::-webkit-scrollbar {
  display: none;
}

.filter-button {
  display: flex;
  height: 31px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.filter-button span {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  color: #72798d;
  background: #eff1f6;
  font-size: 9px;
  text-align: center;
}

.filter-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.filter-button.is-active {
  color: var(--navy);
  background: var(--violet-soft);
}

.filter-button.is-active span {
  color: #fff;
  background: var(--violet);
}

.department-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.department-strip::-webkit-scrollbar {
  display: none;
}

.department-strip > span {
  margin-right: 3px;
  color: var(--soft-muted);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.department-button {
  height: 26px;
  flex: 0 0 auto;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 9.5px;
  font-weight: 700;
}

.department-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.department-button.is-active {
  border-color: #daddf0;
  color: #4f5993;
  background: #f1f2fa;
}

.queue-search {
  position: relative;
  margin: 0 20px 12px;
}

.queue-search svg {
  position: absolute;
  top: 10px;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--soft-muted);
}

.queue-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 35px;
  border: 1px solid transparent;
  border-radius: 9px;
  outline: 0;
  background: #f3f5f9;
  font-size: 11.5px;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.queue-search input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: var(--focus);
}

.ticket-list-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  border-top: 1px solid var(--line);
}

.ticket-list {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d8dce6 transparent;
  scrollbar-width: thin;
}

.ticket-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100px;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid #eef0f4;
  color: inherit;
  background: #fff;
  text-align: left;
  transition: background 140ms ease;
}

.ticket-card:hover {
  background: #fafbfe;
}

.ticket-card.is-selected {
  background: #f2f4fc;
}

.ticket-card.is-selected::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--violet);
  content: "";
}

.ticket-card.is-urgent {
  background: linear-gradient(90deg, #fff6f6 0, #fff 54%);
}

.ticket-card.is-urgent:not(.is-selected)::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--red);
  content: "";
}

.ticket-card.is-urgent.is-selected {
  background: linear-gradient(90deg, #fff1f2 0, #f2f4fc 62%);
}

.ticket-card.is-urgent .ticket-avatar::after {
  background: var(--red);
}

.ticket-avatar {
  position: relative;
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 50%;
  color: #4e5772;
  background: #e9edf5;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.ticket-avatar::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

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

.ticket-title-row,
.ticket-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-title-row strong {
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-time {
  flex: 0 0 auto;
  color: var(--soft-muted);
  font-size: 9.5px;
  font-weight: 600;
}

.ticket-preview {
  display: -webkit-box;
  min-height: 32px;
  margin: 5px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-reason {
  display: block;
  margin: -3px 0 7px;
  overflow: hidden;
  color: #8a5260;
  font-size: 9.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-badge,
.status-badge,
.department-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 750;
  white-space: nowrap;
}

.call-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #9a4a60;
  background: #faecf1;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  white-space: nowrap;
}

.department-badge {
  padding: 3px 8px;
  color: #536079;
  background: #edf0f5;
  font-size: 8px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.department-badge.billing {
  color: #7c52a1;
  background: #f4edfb;
}

.department-badge.delivery {
  color: #236f8a;
  background: #e9f6fa;
}

.department-badge.general {
  color: #566078;
  background: #edf0f5;
}

.mini-badge.department {
  margin-left: 4px;
  color: #626b82;
  background: #f3f4f7;
}

.mini-badge.priority {
  color: #a83946;
  background: var(--red-soft);
}

.mini-badge {
  padding: 2px 7px;
  color: var(--muted);
  background: #f0f2f6;
  font-size: 8.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mini-badge.waiting,
.status-badge.waiting {
  color: var(--amber);
  background: var(--amber-soft);
}

.mini-badge.active,
.status-badge.active {
  color: #3762a3;
  background: #edf3fd;
}

.mini-badge.call,
.status-badge.call {
  color: #9a4a60;
  background: #faecf1;
}

.mini-badge.resolved,
.status-badge.resolved {
  color: var(--green);
  background: var(--green-soft);
}

.unread-count {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 5px;
  border-radius: 9px;
  color: #fff;
  background: var(--blue);
  font-size: 9px;
  font-weight: 800;
}

.queue-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.queue-state[hidden] {
  display: none;
}

.queue-state .large-spinner {
  display: block;
  width: 25px;
  height: 25px;
  margin-bottom: 14px;
  color: var(--violet);
}

.queue-state strong {
  color: var(--ink);
  font-size: 12px;
}

.queue-state p {
  max-width: 230px;
  margin: 5px 0 0;
  font-size: 11px;
}

.queue-state .state-icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 12px;
  color: var(--violet);
  background: var(--violet-soft);
  font-size: 18px;
  font-weight: 800;
}

.queue-state .retry-link {
  margin-top: 12px;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--blue);
  background: #eef4fe;
  font-size: 10.5px;
  font-weight: 750;
}

.conversation-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(rgb(255 255 255 / 84%), rgb(255 255 255 / 84%)),
    radial-gradient(circle at 70% 10%, #eef0fa 0, transparent 34%);
}

.conversation-empty {
  display: flex;
  width: min(440px, calc(100% - 48px));
  height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: auto;
  text-align: center;
}

.empty-illustration {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 30px;
  background: linear-gradient(145deg, #f1f3fb, #e8ebf6);
}

.empty-illustration svg {
  width: 54px;
  height: 54px;
  color: var(--violet);
  stroke-width: 1.5;
}

.empty-illustration svg path:first-child {
  fill: rgb(114 121 183 / 6%);
}

.empty-illustration span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cfd4e7;
}

.empty-illustration span:nth-child(1) { top: 9px; right: 1px; }
.empty-illustration span:nth-child(2) { bottom: 2px; left: 5px; width: 5px; height: 5px; }
.empty-illustration span:nth-child(3) { top: 25px; left: -8px; width: 4px; height: 4px; }

.conversation-empty h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.conversation-empty p {
  max-width: 390px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.mobile-open-queue {
  display: none;
  margin-top: 20px;
}

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

.conversation-header {
  display: flex;
  min-width: 0;
  min-height: 75px;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.mobile-back {
  display: none;
}

.customer-avatar {
  width: 42px;
  height: 42px;
  color: #4c5780;
  background: linear-gradient(145deg, #e8ebf6, #dfe4f2);
  font-size: 13px;
}

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

.title-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.title-line h2 {
  overflow: hidden;
  margin: 0;
  font-size: 14.5px;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  padding: 3px 8px;
  color: var(--muted);
  background: #f0f2f6;
  font-size: 8.5px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.conversation-identity p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--soft-muted);
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.stream-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a5acbd;
}

.stream-indicator.is-live {
  color: var(--green);
}

.stream-indicator.is-live i {
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(23 149 111 / 11%);
}

.stream-indicator.is-reconnecting i {
  background: var(--amber);
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.conversation-actions {
  display: flex;
  gap: 8px;
  margin-left: 7px;
}

.conversation-actions svg {
  width: 16px;
  height: 16px;
}

.resolve-button {
  color: #fff;
  background: var(--green);
}

.resolve-button:not(:disabled):hover {
  background: #117e5e;
}

.close-button {
  color: #fff;
  background: var(--navy);
}

.close-button:not(:disabled):hover {
  background: var(--navy-hover);
}

.ticket-notice {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 22px;
  border-bottom: 1px solid #f0e4bd;
  background: #fffbef;
}

.ticket-notice strong {
  color: #6f4b0f;
  font-size: 11.5px;
}

.ticket-notice p {
  margin: 2px 0 0;
  color: #98743c;
  font-size: 10px;
}

.ticket-notice .primary-button {
  min-height: 36px;
}

.ticket-context {
  display: grid;
  min-height: 58px;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 9px max(22px, calc((100% - 900px) / 2));
  border-bottom: 1px solid #e6e9f0;
  background: #f7f8fb;
}

.context-priority {
  display: flex;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: #626b80;
  background: #e9ecf2;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.priority-pill.is-urgent {
  color: #a53543;
  background: #ffe6e8;
  box-shadow: 0 0 0 1px rgb(196 66 78 / 10%);
}

.context-reason {
  min-width: 0;
}

.context-reason span,
.knowledge-score span {
  display: block;
  margin-bottom: 2px;
  color: var(--soft-muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.context-reason strong {
  display: block;
  overflow: hidden;
  color: #4c556d;
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-score {
  min-width: 92px;
  padding-left: 17px;
  border-left: 1px solid #dfe3eb;
  text-align: right;
}

.knowledge-score strong {
  color: var(--navy);
  font-size: 13px;
}

.transcript {
  min-height: 0;
  padding: 28px max(24px, calc((100% - 780px) / 2));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f9fafc;
  scrollbar-color: #d4d8e3 transparent;
  scrollbar-width: thin;
}

.transcript-state {
  display: flex;
  height: 100%;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.transcript-state .large-spinner {
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: 12px;
  color: var(--violet);
}

.transcript-state strong {
  color: var(--ink);
  font-size: 12px;
}

.transcript-state p {
  margin: 4px 0 0;
  font-size: 10.5px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 13px 0 22px;
  color: var(--soft-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.date-divider::before,
.date-divider::after {
  height: 1px;
  flex: 1;
  background: #e6e9ef;
  content: "";
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin: 0 0 20px;
}

.message.is-agent {
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  margin-bottom: 19px;
  border-radius: 50%;
  color: #59617a;
  background: #e6eaf2;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.message.is-ai .message-avatar {
  color: #fff;
  background: var(--violet);
}

.message.is-agent .message-avatar {
  color: #fff;
  background: var(--navy);
}

.message-body {
  max-width: min(72%, 600px);
}

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

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

.message-author strong {
  color: #424b64;
  font-size: 10px;
}

.actor-chip {
  padding: 1px 5px;
  border-radius: 7px;
  color: #59629b;
  background: var(--violet-soft);
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message-bubble {
  padding: 10px 13px;
  border: 1px solid #e1e5ed;
  border-radius: 6px 14px 14px 14px;
  color: #30394f;
  background: #fff;
  box-shadow: 0 2px 5px rgb(29 39 68 / 3%);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.is-ai .message-bubble {
  border-color: #e1e2ef;
  background: #f1f2fa;
}

.message.is-agent .message-bubble {
  border-color: var(--navy);
  border-radius: 14px 6px 14px 14px;
  color: #fff;
  background: var(--navy);
}

.message.is-pending {
  opacity: 0.65;
}

.message.is-system {
  justify-content: center;
  margin: 12px 0 18px;
}

.message.is-system .message-avatar,
.message.is-system .message-author {
  display: none;
}

.message.is-system .message-body {
  max-width: 88%;
}

.message.is-system .message-bubble {
  padding: 6px 11px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: #eceff5;
  box-shadow: none;
  font-size: 9.5px;
  text-align: center;
}

.composer-region {
  position: relative;
  padding: 13px max(22px, calc((100% - 780px) / 2)) 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-error {
  margin: 0 0 7px;
}

.composer {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 7px 6px 13px;
  border: 1px solid #d9dde7;
  border-radius: 12px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer:focus-within {
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.composer textarea {
  width: 100%;
  max-height: 130px;
  min-height: 34px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 7px 67px 5px 0;
  background: transparent;
  font-size: 12.5px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #969db0;
}

.character-count {
  position: absolute;
  right: 57px;
  bottom: 17px;
  color: var(--soft-muted);
  font-size: 8px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.composer:focus-within .character-count {
  opacity: 1;
}

.send-button {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--navy);
}

.send-button:hover:not(:disabled) {
  background: var(--navy-hover);
}

.send-button svg {
  width: 18px;
  height: 18px;
}

.composer-hint {
  margin: 7px 2px 0;
  color: var(--soft-muted);
  font-size: 8.5px;
  text-align: right;
}

kbd {
  font: inherit;
}

.call-dialog {
  width: min(92vw, 470px);
  padding: 0;
  border: 1px solid #dfe2ea;
  border-radius: 17px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 26px 80px rgb(20 29 55 / 28%);
}

.call-dialog::backdrop {
  background: rgb(20 28 50 / 48%);
  backdrop-filter: blur(3px);
}

.call-dialog form {
  padding: 25px;
}

.dialog-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: #98536a;
  background: #faecf1;
}

.dialog-icon svg {
  width: 21px;
  height: 21px;
}

.dialog-heading {
  margin: 14px 0 18px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.dialog-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.call-dialog label {
  margin-top: 0;
}

.call-dialog textarea {
  min-height: 88px;
  padding: 11px 12px;
  resize: vertical;
  font-size: 12.5px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.toast-region {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(360px, calc(100vw - 40px));
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 12px 13px;
  border: 1px solid #dfe3ec;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 35px rgb(23 32 58 / 18%);
  animation: toast-in 180ms ease both;
  pointer-events: auto;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.toast.is-error .toast-dot {
  background: var(--red);
}

.toast span {
  font-size: 11.5px;
  font-weight: 650;
}

.toast button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 17px;
}

.toast button:hover {
  background: var(--surface-soft);
}

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

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .agent-identity {
    display: none;
  }

  .conversation-header {
    padding-inline: 16px;
  }

  .conversation-actions .secondary-button span,
  .conversation-actions .resolve-button span,
  .conversation-actions .close-button span {
    display: none;
  }

  .conversation-actions .secondary-button,
  .conversation-actions .resolve-button,
  .conversation-actions .close-button {
    width: 38px;
    padding: 0;
  }

  .stream-indicator span {
    display: none;
  }
}

@media (max-width: 700px) {
  .workspace {
    position: relative;
    display: block;
    overflow: hidden;
  }

  .sidebar,
  .conversation-panel {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    transition: transform 220ms ease, visibility 220ms step-end;
  }

  .sidebar {
    transform: translateX(0);
  }

  .conversation-panel {
    z-index: 4;
    transform: translateX(100%);
    visibility: hidden;
  }

  .workspace.has-selection .sidebar {
    transform: translateX(-22%);
    visibility: hidden;
  }

  .workspace.has-selection .conversation-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 220ms ease, visibility 0s;
  }

  .agent-identity {
    display: flex;
  }

  .ticket-card {
    min-height: 96px;
  }

  .mobile-back {
    display: grid;
  }

  .mobile-open-queue {
    display: inline-flex;
  }

  .conversation-header {
    min-height: 69px;
    gap: 8px;
    padding: 9px 10px;
  }

  .customer-avatar {
    width: 36px;
    height: 36px;
  }

  .status-badge,
  .department-badge,
  .call-status-badge,
  .stream-indicator {
    display: none;
  }

  .conversation-actions {
    gap: 5px;
    margin-left: auto;
  }

  .conversation-actions .secondary-button,
  .conversation-actions .resolve-button,
  .conversation-actions .close-button {
    width: 36px;
    min-height: 36px;
  }

  .ticket-notice {
    padding-inline: 14px;
  }

  .ticket-notice p {
    display: none;
  }

  .ticket-notice .primary-button {
    padding-inline: 11px;
    font-size: 10.5px;
  }

  .ticket-context {
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 8px 13px;
  }

  .knowledge-score {
    display: none;
  }

  .transcript {
    padding: 20px 13px;
  }

  .message-body {
    max-width: 82%;
  }

  .message-avatar {
    width: 26px;
    height: 26px;
  }

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

  .composer-hint {
    display: none;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-width: 460px) {
  .login-shell {
    padding: 0;
    background: #fff;
  }

  .login-card {
    width: 100%;
    min-height: 100%;
    padding: 28px 22px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-heading {
    margin-top: 52px;
  }

  .sidebar-header {
    padding-inline: 15px;
  }

  .agent-identity {
    display: none;
  }

  .queue-heading,
  .filter-strip,
  .department-strip {
    padding-inline: 15px;
  }

  .connection-summary,
  .queue-search {
    margin-inline: 15px;
  }

  .ticket-card {
    padding-inline: 15px;
  }

  .conversation-identity p {
    max-width: 126px;
  }

  .call-dialog form {
    padding: 21px;
  }
}

@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;
  }
}
