:root {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #172d29;
  background: #f3f6f4;
  font-synthesis: none;
  --ink: #172d29;
  --muted: #526762;
  --line: #dbe5e0;
  --green: #00664f;
  --light: #e2f3eb;
  --white: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #20a681; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1rem; letter-spacing: -.02em; }
p, small { line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #142d27; color: #f0f8f3; display: flex; flex-direction: column; padding: 27px 16px 20px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.035em; font-size: 1.12rem; white-space: nowrap; }
.brand-mark { display: grid; width: 39px; height: 39px; border-radius: 12px; place-items: center; background: #9de5c2; color: #164337; font-weight: 850; font-size: 1.42rem; }
.brand small { display: block; color: #a2bfb4; letter-spacing: .15em; font-weight: 650; font-size: .6rem; }
.nav { margin-top: 37px; display: grid; gap: 5px; }
.nav button, .quiet { text-align: left; background: transparent; color: #c5dbd1; border: 0; border-radius: 8px; padding: 11px; font-weight: 620; }
.nav button span { display: inline-block; width: 24px; color: #8fdcc1; }
.nav button:hover, .nav [aria-current="page"], .quiet:hover { background: #23473c; color: #fff; }
.sidebar-bottom { display: grid; gap: 10px; margin-top: auto; padding-top: 25px; }
.workspace-label { display: flex; gap: 9px; align-items: center; border-top: 1px solid #35534a; padding: 17px 5px 5px; min-width: 0; }
.workspace-label div { min-width: 0; }
.workspace-label strong, .workspace-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-label small { color: #adcbc0; }
.status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #87ddad; }
.topbar { min-height: 63px; border-bottom: 1px solid var(--line); background: #f9fbf9; padding: 12px clamp(16px, 3vw, 40px); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.breadcrumb { color: var(--muted); font-size: .85rem; }
.breadcrumb span { margin: 0 5px; opacity: .7; }
.breadcrumb strong { color: var(--ink); }
.pill { display: inline-block; background: var(--light); color: #145340; font-size: .73rem; font-weight: 680; border-radius: 20px; padding: 5px 9px; white-space: nowrap; }
.pill.human, .pill.paused { background: #f8ead9; color: #76430d; }
.pill.resolved { background: #e8eeeb; color: #536760; }
.content { margin: auto; max-width: 1550px; padding: 25px clamp(16px, 3vw, 40px) 32px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-heading p { margin-top: 7px; color: var(--muted); font-size: .91rem; }
.primary, .secondary { border: 1px solid transparent; border-radius: 8px; padding: 9px 13px; min-height: 37px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; white-space: nowrap; font-weight: 650; font-size: .86rem; }
.primary { background: var(--green); color: #fff; }
.primary:hover:not(:disabled) { background: #005540; }
.secondary { background: #fff; color: var(--ink); border-color: #ccdcd4; }
.secondary:hover:not(:disabled) { background: #edf5f0; }
.danger { color: #863127; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 17px; }
.metrics article, .card { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.metrics article { padding: 14px 15px; min-width: 0; }
.metrics span { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.metrics strong { display: block; margin-top: 3px; font-size: 1.78rem; letter-spacing: -.06em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.inbox { display: grid; grid-template-columns: minmax(245px, .85fr) minmax(0, 1.8fr); border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.queue { border-right: 1px solid var(--line); min-width: 0; }
.queue-top { padding: 15px 13px 12px; border-bottom: 1px solid var(--line); }
.search { display: block; margin: 10px 0; }
input, textarea, select { color: var(--ink); border: 1px solid #cbdad2; border-radius: 8px; width: 100%; background: #fff; padding: 9px 10px; min-width: 0; }
input::placeholder, textarea::placeholder { color: #657976; }
select { max-width: 100%; }
textarea { resize: vertical; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button { padding: 5px 7px; border: 0; border-radius: 5px; background: #fff; color: var(--muted); font-size: .73rem; font-weight: 650; }
.filters [aria-pressed="true"] { background: var(--light); color: #0b5641; }
.contacts { overflow: auto; max-height: 420px; }
.contact { display: grid; width: 100%; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; background: #fff; border: 0; border-bottom: 1px solid #ebf0ed; text-align: left; padding: 13px; color: var(--ink); }
.contact:hover { background: #f3f9f5; }
.contact[aria-current="true"] { background: #eaf6ee; box-shadow: inset 3px 0 var(--green); }
.avatar { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 12px; font-size: .77rem; font-weight: 760; background: #e1efe7; color: #245b48; }
.contact:nth-child(3n+2) .avatar { background: #eeeafa; color: #574579; }
.contact:nth-child(3n+3) .avatar { background: #f9eee0; color: #7e5424; }
.contact-text { min-width: 0; }
.contact-top { display: flex; align-items: baseline; gap: 5px; justify-content: space-between; }
.contact-top strong, .contact-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.contact-top strong { font-size: .84rem; }
.contact-top small { flex: none; color: var(--muted); font-size: .7rem; }
.contact-preview { display: block; color: var(--muted); font-size: .76rem; margin: 3px 0 4px; }
.thread { background: #f8fbf9; min-width: 0; }
.thread-body { min-height: 535px; display: grid; grid-template-rows: auto minmax(250px, 1fr) auto; }
.thread-header, .composer { background: #fff; padding: 13px 15px; }
.thread-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.thread-header select { font-size: .77rem; padding: 7px; width: auto; max-width: 148px; }
.thread-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }
.identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.identity h2 { overflow-wrap: anywhere; }
.identity small, .composer small { color: var(--muted); font-size: .76rem; }
.messages { display: flex; flex-direction: column; gap: 10px; max-height: min(47vh, 410px); overflow: auto; padding: 16px; }
.bubble { max-width: min(86%, 560px); background: #fff; border: 1px solid var(--line); border-radius: 5px 12px 12px; padding: 9px 11px; align-self: flex-start; min-width: 0; }
.bubble.out { background: var(--light); border-color: #cce6d8; align-self: flex-end; border-radius: 12px 5px 12px 12px; }
.bubble p, .draft p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; }
.bubble small { display: block; color: var(--muted); font-size: .7rem; margin-top: 5px; }
.bubble.failed, .bubble.uncertain { border-color: #d2a298; background: #fff8f6; }
.composer { border-top: 1px solid var(--line); }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; }
.draft { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid #b7dcca; border-radius: 8px; background: #f1f8f3; padding: 9px; margin-bottom: 9px; }
.draft strong { display: block; font-size: .73rem; margin-bottom: 3px; }
.notice { padding: 10px 12px; border: 1px solid #d6ddd6; border-radius: 7px; color: #274c42; background: #e8f7ef; margin-bottom: 13px; overflow-wrap: anywhere; }
.notice.error, #signin-error { background: #fff0eb; color: #7e3228; border-color: #efd0c6; }
.empty { text-align: center; color: var(--muted); padding: 26px 13px; }
.thread > .empty { display: grid; align-content: center; min-height: 535px; gap: 6px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-aside { display: grid; gap: 16px; }
.card { padding: 17px; }
.form { display: grid; gap: 13px; }
.form p { font-size: .85rem; color: var(--muted); }
.form label, #login-form label { display: grid; gap: 5px; font-size: .82rem; font-weight: 650; }
.form label input, .form label textarea, .form label select { font-weight: 400; }
.preview { padding: 10px; background: var(--light); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
#agent-details { display: grid; gap: 7px; }
.events, .service-list { margin: 0; padding: 0; list-style: none; }
.events li, .service-list div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.events time, .service-list dt { color: var(--muted); }
.service-list dd { font-weight: 650; text-align: right; margin: 0; }
#privacy p { margin-bottom: 6px; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 14px; background: radial-gradient(ellipse at 24% 15%, #e1f2e8, #f3f6f4 65%); }
.signin-card { width: min(100%, 450px); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px #16382b12; padding: clamp(20px, 6vw, 36px); }
.signin-card .brand { margin-bottom: 23px; }
.signin-card .brand small { color: #58746a; }
.signin-card h1 { font-size: 2rem; }
.signin-card p { color: var(--muted); margin: 9px 0 17px; }
#login-form { display: grid; gap: 12px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 163px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 9px; padding: 9px 12px; }
  .sidebar .brand { margin-right: auto; }
  .nav { display: flex; order: 3; width: 100%; margin-top: 0; }
  .nav button { flex: 1; text-align: center; font-size: .8rem; padding: 7px 3px; }
  .nav button span { width: auto; margin-right: 3px; }
  .workspace-label { display: none; }
  .sidebar-bottom { margin-top: 0; padding-top: 0; }
  .topbar { min-height: 48px; }
  .content { padding-top: 17px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 550px) {
  .page-heading { align-items: start; }
  .inbox { grid-template-columns: 1fr; }
  .queue { border-right: 0; border-bottom: 1px solid var(--line); }
  .contacts { max-height: 180px; }
  .thread-body, .thread > .empty { min-height: 360px; }
  .thread-body { grid-template-rows: auto minmax(150px, 1fr) auto; }
}
