:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #192c32;
  background: #f5f7f6;
  --line: #dfe8e5;
  --muted: #52676c;
  --accent: #0b6256;
  --tint: #e5f2ec;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button, select, input, textarea { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
button, select, input { padding: .45rem .65rem; }
button:hover:not(:disabled) { border-color: #a0bcb4; }
:focus-visible { outline: 2px solid #14756b; outline-offset: 2px; }
.top { height: 62px; display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; background: #102d34; color: white; }
.brand { display: flex; align-items: center; gap: .65rem; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #bfe5d8; border-radius: 9px 9px 9px 3px; color: #dcf6ed; font-weight: 700; }
.app-name { border-left: 1px solid #587078; padding-left: 1rem; color: #ddebe8; }
.top a { margin-left: auto; color: #e4f5f0; white-space: nowrap; font-size: .86rem; }
.preview-flag { background: #34525a; border-radius: 12px; padding: .2rem .6rem; font-size: .74rem; }
.top #manage-access { margin-left: auto; background: #284b49; border-color: #577776; color: #fff; font-size: .8rem; }
.top #manage-access:not([hidden]) + a { margin-left: 0; }
.sign-in { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
.sign-in section { width: min(100%, 27rem); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; }
.sign-in p, #access-dialog p { margin: .7rem 0; color: var(--muted); }
.sign-in a { color: var(--accent); font-weight: 650; }
#access-dialog { width: min(calc(100vw - 2rem), 34rem); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; color: inherit; }
#access-dialog::backdrop { background: #102d3477; }
.access-heading, #access-form > div, #access-members li { display: flex; align-items: center; gap: .65rem; justify-content: space-between; }
.access-heading h2 { font-size: 1.05rem; }
#access-email { min-width: 0; flex: 1; }
#access-members { list-style: none; padding: 0; }
#access-members li { border-top: 1px solid var(--line); padding: .65rem 0; overflow-wrap: anywhere; }
main { display: grid; grid-template-columns: 174px minmax(230px, 285px) minmax(330px, 1fr) minmax(204px, 258px); height: calc(100dvh - 62px); min-height: 530px; margin-inline: auto; max-width: 1920px; }
.rail, .queue, .workspace, #contact-panel { min-height: 0; min-width: 0; }
.rail { display: flex; flex-direction: column; background: #f3f7f5; border-right: 1px solid var(--line); padding: 1.2rem .65rem .7rem; }
.section-label { margin: 0 .55rem .5rem; color: var(--muted); font-size: .72rem; font-weight: 650; }
.rail-item { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .55rem .5rem; text-align: left; border-color: transparent; background: transparent; font-size: .84rem; }
.rail-item span { color: var(--accent); width: 16px; text-align: center; }
.rail-item[aria-pressed="true"] { background: #dcedea; color: #084e47; font-weight: 650; }
#unread-count { margin-left: auto; }
.channel-label { margin-top: 1.55rem; }
.channel { display: flex; align-items: center; gap: .5rem; padding-inline: .55rem; font-size: .77rem; }
.channel span { width: .48rem; height: .48rem; border-radius: 50%; background: #168664; flex-shrink: 0; }
.account { display: flex; align-items: center; gap: .55rem; margin-top: auto; padding: .7rem .25rem 0; border-top: 1px solid var(--line); font-size: .8rem; }
.account small { display: block; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 11px; background: #d7ece7; color: #1b5e54; font-size: .77rem; font-weight: 700; flex-shrink: 0; }
.queue { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; }
.queue-head { padding: .95rem .8rem 0; }
.queue-title { display: flex; justify-content: space-between; gap: .3rem; align-items: center; }
.queue-title h1 { font-size: 1.02rem; }
.queue-title select { background: #f3f7f5; font-size: .75rem; padding: .28rem .32rem; }
#search { width: 100%; margin: .75rem 0 .45rem; padding-inline: .55rem; background: #f7faf8; font-size: .8rem; }
.scopes { display: flex; gap: .25rem; }
.scopes button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; font-size: .75rem; padding: .5rem .3rem; }
.scopes button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
#queue { overflow: auto; border-top: 1px solid var(--line); }
.entry { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 0; padding: .7rem .65rem; }
.entry:hover, .entry[aria-current="true"] { background: #edf6f2; }
.entry[aria-current="true"] { border-left-color: var(--accent); }
.entry .avatar { width: 1.95rem; height: 1.95rem; }
.entry-name, .entry-preview { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-name { font-size: .84rem; }
.entry-preview, .entry-meta { color: var(--muted); font-size: .75rem; }
.entry-preview { margin: .12rem 0 .25rem; }
.entry-meta { display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.badge { background: #167365; color: white; font-size: .7rem; min-width: 1.15rem; text-align: center; border-radius: 1rem; padding: .08rem .25rem; }
.queue-empty { padding: 1rem; color: var(--muted); font-size: .85rem; }
.workspace { display: flex; flex-direction: column; background: #f3f7f5; }
#thread { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.empty { margin: auto; padding: 1rem; text-align: center; }
.empty h2 { font-size: 1rem; margin-bottom: .4rem; }
.empty p { color: var(--muted); font-size: .86rem; }
.person { display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.person-name { margin-right: auto; min-width: 0; }
.person h2 { font-size: 1rem; overflow-wrap: anywhere; }
.person-name span, #window, .meta, .profile > span:not(.avatar) { font-size: .75rem; color: var(--muted); }
#resolve { font-size: .8rem; white-space: nowrap; }
#messages { display: flex; flex: 1; flex-direction: column; gap: .7rem; min-height: 0; overflow: auto; padding: 1.15rem clamp(.8rem, 3vw, 2.3rem); }
.bubble { align-self: flex-start; width: fit-content; max-width: min(83%, 40rem); background: white; border: 1px solid #e1eae6; border-radius: 4px 14px 14px; padding: .65rem .8rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .89rem; }
.bubble.outgoing, .bubble.phone { align-self: flex-end; background: #d9eee5; border-radius: 14px 4px 14px 14px; }
.bubble.note { background: #fff4d8; border-color: #eddbad; border-radius: 10px; align-self: center; }
.meta { white-space: normal; margin-top: .35rem; }
#composer { margin: .55rem .75rem .75rem; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.compose-tools, .send { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; justify-content: space-between; }
.segmented { display: flex; gap: .16rem; padding: .15rem; background: #edf3ef; border-radius: 8px; }
.segmented button { border: 0; background: transparent; font-size: .76rem; padding: .32rem .46rem; }
.segmented button[aria-pressed="true"] { background: #fff; color: #0c5a51; box-shadow: 0 1px 3px #14393222; font-weight: 650; }
#draft { padding: .32rem .45rem; border: 0; background: #edf6f3; font-size: .77rem; color: #124e45; }
#body { width: 100%; display: block; resize: vertical; max-height: 170px; min-height: 58px; padding: .55rem .35rem; margin: .35rem 0; border: 0; background: #fff; font-size: .86rem; }
#submit { background: #0b6256; color: white; font-size: .8rem; font-weight: 650; margin-left: auto; }
#feedback { color: #284b49; font-size: .81rem; padding-inline: .9rem; }
#feedback:not(:empty) { padding-bottom: .7rem; }
#contact-panel { background: #fff; border-left: 1px solid var(--line); overflow: auto; }
.panel-heading, .panel-section { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.panel-heading, .panel-section h2, .panel-section summary { font-size: .85rem; font-weight: 650; }
.profile { display: grid; justify-items: start; gap: .35rem; padding: .95rem 1rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.profile .avatar { width: 2.6rem; height: 2.6rem; font-size: .89rem; margin-bottom: .2rem; }
.profile strong { font-size: .91rem; }
.profile button { margin-top: .2rem; font-size: .75rem; }
.panel-section label, .panel-section h3 { display: block; margin: .7rem 0 .25rem; font-size: .76rem; color: var(--muted); }
.panel-section select { width: 100%; font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.chip { border: 0; background: #e8f3ef; padding: .14rem .38rem; font-size: .7rem; overflow-wrap: anywhere; border-radius: 5px; max-width: 100%; }
.chip.urgent { background: #ffe4de; color: #823028; }
.chip.high { background: #fff1ce; color: #683f0d; }
#label-form { display: flex; margin-top: .45rem; gap: .3rem; font-size: .75rem; }
#label-input { flex: 1; min-width: 0; padding-inline: .4rem; }
.quick summary { cursor: pointer; }
.quick button { display: block; margin-top: .45rem; width: 100%; text-align: left; font-size: .75rem; }
@media (max-width: 1130px) {
  main { grid-template-columns: 135px minmax(208px, 235px) minmax(300px, 1fr) 200px; }
}
@media (max-width: 940px) {
  main { grid-template-columns: minmax(205px, 245px) minmax(290px, 1fr) 195px; grid-template-rows: auto minmax(0, 1fr); }
  .rail { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .25rem; padding: .3rem .65rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-item { width: auto; }
  .rail .section-label, .rail .channel { display: none; }
  .account { margin: 0 0 0 auto; padding: 0; border: 0; }
}
@media (max-width: 700px) {
  main { height: auto; grid-template-columns: 1fr; grid-template-rows: auto; }
  .rail { grid-column: auto; }
  .account { display: none; }
  .queue { border-right: 0; border-bottom: 1px solid var(--line); }
  #queue { max-height: 26vh; }
  #messages { height: 44vh; min-height: 225px; flex: auto; }
  #contact-panel { border-left: 0; border-top: 1px solid var(--line); }
  .app-name { font-size: .84rem; }
}
@media (max-width: 440px) { .top { padding-inline: .65rem; gap: .45rem; } .app-name { padding-left: .45rem; } .preview-flag { display: none; } }

