:root {
  color-scheme: light;
  font: 15px/1.5 system-ui, sans-serif;
  color: #182335;
  background: #f4f6fa;
  --brand: #1e40af;
  --line: #dce4ee;
  --surface: #fff;
  --muted: #53647a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0 0 .65rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.08rem; }
button, input, select, textarea { font: inherit; }
button {
  padding: .55rem .9rem;
  color: #fff;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: .55rem;
  cursor: pointer;
  font-weight: 650;
}
button:disabled { opacity: .48; cursor: default; }
button.secondary { color: #233a64; background: #edf2fa; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #5178e0;
  outline-offset: 2px;
}
input, textarea, select {
  width: 100%;
  min-width: 0;
  border: 1px solid #aebcd0;
  background: #fff;
  color: inherit;
  border-radius: .5rem;
  padding: .45rem .6rem;
}
input[type=color] { height: 2.6rem; }
textarea { resize: vertical; }
label { display: grid; gap: .25rem; font-weight: 620; }
form { display: grid; gap: .75rem; }
form button { justify-self: start; align-self: end; }
.top {
  background: #142444;
  color: #fff;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: .85rem clamp(.8rem,3vw,2.5rem);
  flex-wrap: wrap;
}
.logo { font-size: 1.25rem; letter-spacing: -.04em; }
.top nav { display: flex; gap: .35rem; flex: 1; flex-wrap: wrap; }
.top nav button { background: transparent; color: #ecf2fd; }
.top nav button[aria-current] { background: #324876; }
#identity { color: #cddaf1; }
.content { max-width: 1080px; margin: auto; padding: 1.5rem 1rem; }
.card { padding: 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; margin-bottom: 1rem; }
.auth { max-width: 420px; margin: min(12vh,6rem) auto 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: .75rem; }
.grid h2, .wide { grid-column: 1 / -1; }
ul { padding-left: 1.25rem; }
li { margin: .5rem 0; overflow-wrap: anywhere; }
.key-setting { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.key-setting span { min-width: 11rem; }
kbd { padding: .2rem .4rem; background: #f2f5fa; border: 1px solid var(--line); border-radius: .3rem; min-width: 8rem; }
.inbox { display: grid; grid-template-columns: minmax(220px,300px) minmax(0,1fr); min-height: calc(100vh - 65px); }
aside { padding: 1rem; background: #eef2f8; border-right: 1px solid var(--line); }
aside details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 650; }
.queue-heading, .chat-head, .actions { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.queue-heading h2 { margin: 0; }
#queue, #closed { display: grid; gap: .35rem; margin: .7rem 0; max-height: 50vh; overflow: auto; }
.chat-item { background: white; color: #243959; border-color: var(--line); text-align: left; overflow-wrap: anywhere; }
.chat-item[aria-selected=true] { background: #dfe9ff; border-color: #7794d2; }
.work { background: #fff; min-width: 0; }
#tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
#tabs:empty { display: none; }
#tabs button { flex: 0 0 auto; max-width: 19rem; }
.chat-head { padding: .9rem 1rem; border-bottom: 1px solid var(--line); align-items: start; flex-wrap: wrap; }
.chat-head p, .muted { color: var(--muted); }
.actions button { white-space: nowrap; }
.empty, #history { padding: 1rem; }
#history { height: clamp(190px,56vh,720px); overflow: auto; }
.bubble {
  padding: .55rem .8rem; border-radius: .75rem; width: fit-content; max-width: 88%;
  margin: .4rem 0; white-space: pre-wrap; overflow-wrap: anywhere; background: #edf1f5;
}
.bubble.staff { margin-left: auto; background: #e2ecff; }
#send { grid-template-columns: minmax(0,1fr) auto; padding: .8rem 1rem; border-top: 1px solid var(--line); }
.dashboard #notice { position: fixed; bottom: 1rem; right: 1rem; max-width: calc(100vw - 2rem); padding: .65rem .9rem; background: #1e3c6c; color: white; border-radius: .55rem; }
.dashboard #notice[data-error=true] { background: #8c232b; }
.widget { display: flex; flex-direction: column; height: 100dvh; background: #fff; }
.widget header { padding: .7rem 1rem; background: var(--brand); color: white; overflow-wrap: anywhere; }
.widget #feed { flex: 1; min-height: 0; overflow: auto; padding: .4rem .75rem; }
.widget .bubble.staff { margin-left: 0; }
.widget .bubble.visitor { margin-left: auto; background: #e2ecff; }
.widget form { border-top: 1px solid var(--line); padding: .65rem; gap: .35rem; }
.widget #notice { margin: .15rem .65rem .35rem; font-size: .9rem; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .inbox { display: block; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); }
  #queue, #closed { max-height: 28vh; }
  #history { height: 38vh; }
  .auth { margin-inline: 1rem; }
}