body { background: var(--canvas); }
.app-shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 24px 14px 16px; display: flex; flex-direction: column;
  color: #f6f3ff; background: #19172b; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 9px; }
.brand strong { display: block; font-size: 1.3rem; font-weight: 780; letter-spacing: -.055em; line-height: 1.1; }
.brand-period { color: #b49bff; }
.brand small { display: block; margin-top: 4px; color: #bfb8d1; font-size: .75rem; }
.side-nav { margin-top: 46px; display: grid; gap: 5px; }
.side-link {
  width: 100%; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: #c7c1d9;
  padding: 12px 10px; border-radius: 9px; text-align: left; font-size: .875rem; font-weight: 600;
}
.side-link:hover { background: #302a46; color: #fff; }
.side-link.current { background: #352a53; color: #f3ecff; }
.side-link.current svg { color: #bfaaff; }
.nav-count { margin-left: auto; background: #b79dfd; color: #25154a; border-radius: 5px; min-width: 21px; padding: 2px 5px; text-align: center; font-size: .75rem; }
.side-bottom { display: grid; gap: 12px; margin-top: auto; }
.side-profile { min-width: 0; border-top: 1px solid #373149; display: flex; align-items: center; gap: 9px; padding: 14px 3px 0; }
.staff-avatar { width: 33px; height: 33px; border-radius: 10px; background: #d9c9fd; }
.profile-copy { min-width: 0; display: grid; gap: 5px; }
.profile-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8125rem; }
.profile-copy small { color: #bdb5d2; font-size: .75rem; }
.logout { color: #d9cfee; margin-left: auto; }
.logout:hover { background: #352a53; }
.work { min-width: 0; }
.topbar {
  height: 61px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 28px;
  background: #fff; border-bottom: 1px solid var(--hairline);
}
.breadcrumbs { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .875rem; }
.breadcrumbs strong { color: var(--text); }
.separator { color: #9699ab; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.demo-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 670; color: #6548aa; background: #f1ebff; border-radius: 7px; padding: 5px 7px; }
.demo-label svg { width: .92rem; height: .92rem; }
.availability {
  display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8125rem; font-weight: 690;
  padding: 7px 9px; background: white; border: 1px solid var(--hairline); border-radius: 8px; white-space: nowrap;
}
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #85889c; }
.availability[aria-pressed="true"] { color: #236b50; border-color: #d6eee2; }
.availability[aria-pressed="true"] .presence-dot { background: #288663; }
.main { padding: 24px 26px 28px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 19px; }
.heading h1 { font-size: clamp(1.85rem, 3vw, 2.35rem); line-height: 1.12; letter-spacing: -.05em; }
.heading p { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.preview-link { min-height: 40px; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { display: flex; gap: 11px; align-items: center; border: 1px solid var(--hairline); background: #fff; border-radius: 13px; padding: 11px 14px; min-width: 0; }
.metric-icon { width: 39px; height: 39px; border-radius: 10px; }
.metric-icon.amber { color: #9b601c; background: #fff1da; }
.metric-icon.violet { color: #6847c5; background: #eee8ff; }
.metric-icon.teal { color: #207657; background: #e7f6ef; }
.metric div { display: grid; gap: 1px; }
.metric div span { color: var(--muted); font-size: .8125rem; font-weight: 600; }
.metric strong { font-size: 1.35rem; line-height: 1.15; }
.workbench {
  display: grid; grid-template-columns: minmax(256px, 1.03fr) minmax(310px, 1.64fr) minmax(214px, .9fr);
  min-height: 530px; height: calc(100dvh - 264px); background: #fff; border-radius: 14px;
  border: 1px solid var(--hairline); overflow: hidden;
}
.queue, .conversation, .details { min-width: 0; min-height: 0; }
.queue { display: flex; flex-direction: column; border-right: 1px solid var(--hairline); }
.queue-head { display: grid; gap: 11px; padding: 14px 13px 11px; }
.queue-title { display: flex; gap: 8px; align-items: center; }
.queue-title h2, .details h2 { font-size: 1rem; letter-spacing: -.02em; }
.queue-title span { font-size: .75rem; font-weight: 700; color: var(--muted); background: #f1f1f7; padding: 2px 6px; border-radius: 5px; }
.search {
  display: flex; align-items: center; gap: 7px; background: #f8f8fc; min-height: 35px;
  border: 1px solid var(--hairline); border-radius: 7px; padding: 3px 8px; color: var(--muted);
}
.search svg { width: .94rem; height: .94rem; }
.search input { width: 100%; min-width: 0; padding: 2px 0; border: 0; background: transparent; outline: 0; font-size: .875rem; }
.search:focus-within { outline: 2px solid #ae97f3; outline-offset: 1px; }
.filters { display: flex; gap: 3px; flex-wrap: wrap; }
.filter { border: 0; background: transparent; border-radius: 6px; padding: 5px 6px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.filter.selected { color: #5a39ac; background: #eee8fe; }
.filter:hover:not(.selected) { background: #f5f4fa; }
.queue-list { flex: 1; min-height: 0; overflow: auto; padding: 0 7px 8px; }
.chat-row {
  position: relative; width: 100%; display: grid; grid-template-columns: 37px minmax(0,1fr); gap: 8px; text-align: left;
  padding: 10px 7px; background: white; border: 1px solid transparent; border-bottom-color: #f2f2f7;
  border-radius: 8px; min-height: 78px;
}
.chat-row:hover { background: #faf8fe; }
.chat-row.selected { border-color: #e8defc; background: #f3effd; }
.chat-row .avatar { width: 36px; height: 36px; }
.chat-row-copy { min-width: 0; display: grid; align-content: center; gap: 4px; }
.chat-row-top { min-width: 0; display: flex; gap: 6px; justify-content: space-between; align-items: baseline; }
.chat-row strong { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row time, .chat-row-preview { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.chat-row-preview { overflow: hidden; text-overflow: ellipsis; }
.chat-row-copy .status-pill { justify-self: start; }
.thread { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.thread-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 18px; text-align: center; color: var(--muted); }
.thread-empty strong { color: var(--text); }
.thread-empty svg { width: 30px; height: 30px; color: #876acb; }
.thread-head { min-height: 65px; padding: 12px 15px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--hairline); }
.thread-identity { display: grid; gap: 4px; flex: 1; min-width: 0; }
.thread-identity strong { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.thread-identity small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-button { display: none; }
.transcript { flex: 1; min-height: 100px; overflow: auto; background: #fbfafc; padding: 15px 15px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.transcript time { color: var(--muted); font-size: .72rem; }
.thread-date { align-self: center; color: var(--muted); font-size: .75rem; font-weight: 630; }
.message { max-width: min(90%, 36rem); display: grid; gap: 4px; }
.message .byline { color: var(--muted); font-size: .75rem; font-weight: 640; }
.message .bubble { border: 1px solid #e8e7ef; background: white; padding: 8px 10px; border-radius: 3px 10px 10px 10px; color: var(--text); font-size: .875rem; white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.message.assistant, .message.manager { align-self: flex-end; }
.message.assistant .byline, .message.manager .byline, .message.assistant time, .message.manager time { justify-self: end; }
.message.assistant .bubble { background: #f0ebff; border-color: #eae0fe; border-radius: 10px 3px 10px 10px; }
.message.manager .bubble { background: #eaf4f0; border-color: #e0f0e9; border-radius: 10px 3px 10px 10px; }
.system-note { align-self: center; text-align: center; color: var(--muted); font-size: .75rem; padding: 5px 9px; border-radius: 7px; background: #f0eff5; }
.thread-footer { padding: 10px 12px; border-top: 1px solid var(--hairline); }
.thread-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.thread-actions .action-text { font-size: .8rem; color: var(--muted); margin-left: 3px; }
.thread-actions button { min-height: 33px; padding: 7px 9px; font-size: .8125rem; }
.composer { display: flex; align-items: end; margin-top: 8px; gap: 8px; border: 1px solid var(--hairline); border-radius: 9px; padding: 6px; }
.composer textarea { flex: 1; min-width: 0; resize: vertical; min-height: 38px; max-height: 130px; padding: 4px; border: 0; outline: 0; font-size: .875rem; }
.composer:focus-within { border-color: #b69bea; }
.send { width: 37px; padding: 0; }
.details { border-left: 1px solid var(--hairline); overflow: auto; padding: 15px 13px; }
.details-top { display: grid; gap: 5px; padding-bottom: 13px; }
.details-top p { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.detail-block { border-top: 1px solid var(--hairline); padding: 12px 0; display: grid; gap: 8px; }
.detail-block h3 { font-size: .875rem; }
.detail-line { display: grid; grid-template-columns: minmax(66px,.9fr) minmax(0,1.25fr); gap: 5px; margin: 0; line-height: 1.4; font-size: .8rem; }
.detail-line dt, .detail-note { color: var(--muted); }
.detail-line dd { margin: 0; font-weight: 570; overflow-wrap: anywhere; }
.detail-note { font-size: .8rem; line-height: 1.4; overflow-wrap: anywhere; }
.integration { display: grid; gap: 4px; }
.integration-name { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 30px; }
.integration-name strong { font-size: .8125rem; }
.provider-name { display: flex; gap: 6px; align-items: center; }
.provider-icon { display: inline-grid; place-items: center; border-radius: 6px; width: 23px; height: 23px; background: #e4f6fe; color: #106d98; font-size: .68rem; font-weight: 800; }
.provider-icon.calltouch { background: #e8f4eb; color: #246444; }
.integration .button { justify-self: start; }
.secondary-page { max-width: 880px; display: grid; gap: 12px; }
.settings-card { border: 1px solid var(--hairline); border-radius: 13px; background: #fff; padding: 18px; display: grid; gap: 10px; }
.settings-card h2 { font-size: 1.1rem; }
.settings-card p { color: var(--muted); line-height: 1.5; font-size: .9rem; }
.settings-card code { overflow-wrap: anywhere; white-space: normal; color: #4f378f; background: #f5f0ff; padding: 10px; border-radius: 8px; font-size: .85rem; }
.settings-card .integration-name { justify-content: flex-start; gap: 12px; }
dialog { border: 1px solid var(--hairline); border-radius: 16px; padding: 0; width: min(91vw, 410px); color: var(--text); }
dialog::backdrop { background: #161329b0; }
.login { display: grid; gap: 13px; padding: 22px; }
.login h2 { font-size: 1.35rem; }
.login label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.login input { border: 1px solid var(--hairline); border-radius: 8px; padding: 8px; }
@media (min-width: 1450px) { .main { padding-inline: 32px; } .queue-head, .details { padding-inline: 16px; } }
@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 182px minmax(0, 1fr); }
  .main { padding-inline: 15px; }
  .topbar { padding-inline: 16px; }
  .workbench { grid-template-columns: minmax(205px,.85fr) minmax(266px,1.35fr) minmax(196px,.75fr); }
  .queue-head, .details { padding-inline: 9px; }
}
@media (max-width: 990px) {
  .app-shell { grid-template-columns: 58px minmax(0,1fr); }
  .sidebar { padding: 13px 8px; align-items: stretch; }
  .brand { margin: 0 2px; }
  .brand > span:nth-child(2), .profile-copy, .side-preview, .nav-count, .logout { display: none !important; }
  .side-link { padding: 9px; font-size: 0; gap: 0; justify-content: center; }
  .side-nav { margin-top: 25px; }
  .side-profile { display: grid; place-items: center; }
}
@media (max-width: 810px) {
  .workbench { grid-template-columns: minmax(180px, .7fr) minmax(270px, 1fr); min-height: 500px; height: auto; }
  .conversation { height: 560px; }
  .details { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--hairline); padding: 13px; }
  .detail-line { grid-template-columns: 130px 1fr; }
}
@media (max-width: 580px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; position: static; flex-direction: row; justify-content: space-between; gap: 10px; padding: 9px 12px; }
  .brand .brand-icon { width: 33px; height: 33px; border-radius: 9px; }
  .side-nav { margin: 0; display: flex; align-items: center; }
  .side-bottom { margin: 0; }
  .side-profile { border-top: 0; padding: 0; }
  .topbar { height: 46px; padding: 0 10px; }
  .breadcrumbs span { display: none; }
  .main { padding: 13px 9px 18px; }
  .heading { margin-bottom: 12px; }
  .heading h1 { font-size: 1.7rem; }
  .preview-link { font-size: .75rem; padding-inline: 7px; }
  .preview-link svg { display: none; }
  .metrics { gap: 5px; margin-bottom: 9px; }
  .metric { border-radius: 8px; padding: 6px; gap: 5px; }
  .metric-icon { display: none; }
  .metric div span { font-size: .72rem; }
  .metric strong { font-size: 1.13rem; }
  .workbench { grid-template-columns: minmax(0,1fr); min-height: 390px; }
  .queue { border: 0; }
  .conversation, .details { display: none; }
  .workbench.narrow-open .queue { display: none; }
  .workbench.narrow-open .conversation, .workbench.narrow-open .details { display: block; }
  .conversation { height: min(75dvh, 580px); min-height: 440px; }
  .back-button { display: inline-flex; color: var(--muted); }
}
