:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #17273d;
  background: #f2f5f9;
  --navy: #10233d;
  --red: #ad283e;
  --line: #dbe4ee;
  --muted: #52647a;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: white; color: var(--navy); border-radius: 8px; padding: 9px 13px; }
button:hover { background: #eef3f8; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #398fea; outline-offset: 2px; }
.primary { background: var(--red); border-color: var(--red); color: white; font-weight: 600; }
.primary:hover { background: #8e1d30; }
.login { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(ellipse at top left, #254263, #101f33 65%); }
.login-card { background: #fff; width: min(100%, 420px); border-radius: 18px; padding: 34px; box-shadow: 0 24px 64px #0004; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand div > span { display: block; }
.brand div > span { font-size: .85rem; opacity: .8; margin-top: 2px; }
.mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--red); color: white; font-size: 1.3rem; font-weight: 700; }
.login h1 { font-size: 1.4rem; margin: 32px 0 18px; }
form { display: grid; gap: 14px; }
label { font-size: .9rem; font-weight: 600; display: grid; gap: 6px; }
input, textarea { color: inherit; background: white; border: 1px solid #bac9d9; border-radius: 8px; padding: 9px 11px; min-width: 0; width: 100%; }
.feedback { color: #9b2336; font-size: .88rem; margin-bottom: 0; }
.feedback:empty { display: none; }
.app { height: 100dvh; display: grid; grid-template-columns: minmax(190px, 245px) minmax(0, 1fr); }
.sidebar { min-height: 0; display: flex; flex-direction: column; color: #f0f5fa; background: var(--navy); padding: 22px 16px 15px; }
.sidebar .brand { margin: 0 4px 24px; }
.sidebar nav { overflow-y: auto; flex: 1; }
.nav-label { font-size: .78rem; color: #bdcad9; margin: 18px 7px 6px; font-weight: 600; }
.conversation { width: 100%; display: flex; align-items: center; gap: 9px; text-align: left; padding: 8px 7px; margin-bottom: 2px; }
.conversation span:last-child { overflow-wrap: anywhere; }
.sidebar button { background: transparent; border-color: transparent; color: inherit; }
.sidebar button:hover, .sidebar button[aria-current="true"] { background: #2a4565; }
.avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px; background: #415b77; color: white; font-size: .78rem; font-weight: 600; }
.avatar.public { font-size: 1.1rem; }
.no-people { color: #bdcad9; padding-left: 8px; font-size: .85rem; }
.sidebar footer { border-top: 1px solid #3c5672; display: grid; padding-top: 10px; }
.sidebar footer strong { padding: 5px 8px; overflow-wrap: anywhere; }
.sidebar footer button { text-align: left; padding: 6px 8px; font-size: .86rem; }
.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.chat header { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 20px clamp(14px, 4vw, 46px); background: white; border-bottom: 1px solid var(--line); }
.chat h1 { overflow-wrap: anywhere; margin: 0; font-size: 1.28rem; }
.chat header p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.chat #connection { color: #9b2336; }
.chat #connection:empty { display: none; }
#messages { overflow-y: auto; padding: 20px clamp(14px, 4vw, 46px); }
.empty { text-align: center; color: var(--muted); margin: 32px 0; }
.message { max-width: min(85%, 740px); margin: 0 auto 14px 0; width: fit-content; }
.message.own { margin-right: 0; margin-left: auto; }
.message-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .78rem; margin: 0 0 4px; }
.own .message-meta { justify-content: flex-end; }
.bubble { margin: 0; border: 1px solid #d9e3ee; background: white; padding: 9px 12px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.own .bubble { background: #dfeaf8; border-color: #ccdcf0; }
.composer { padding: 12px clamp(14px, 4vw, 46px) 16px; border-top: 1px solid var(--line); background: white; gap: 6px; }
.compose-row { display: flex; align-items: end; gap: 8px; }
textarea { resize: vertical; min-height: 45px; max-height: 25dvh; }
dialog { color: inherit; border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(94%, 460px); }
dialog::backdrop { background: #0d1d32aa; }
.dialog-heading, .account-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.dialog-heading { margin-bottom: 18px; }
.dialog-heading h2 { font-size: 1.14rem; margin: 0; }
.account-row { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 12px; font-size: .88rem; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .app { grid-template-columns: minmax(108px, 26vw) minmax(0, 1fr); }
  .sidebar { padding: 14px 5px 10px; }
  .sidebar .brand { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .sidebar .brand strong { font-size: .8rem; }
  .sidebar .brand div > span, .nav-label { font-size: .72rem; }
  .sidebar button, .sidebar footer button, .sidebar footer strong { font-size: .76rem; }
  .conversation { gap: 5px; }
  .avatar { width: 23px; height: 23px; font-size: .67rem; }
  .compose-row { flex-wrap: wrap; justify-content: flex-end; }
}

.direct-alert, .general-alert {
  position: fixed;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 12px;
  background: white;
  box-shadow: 0 14px 48px #10233d45;
  padding: clamp(12px, 4vmin, 22px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.direct-alert {
  z-index: 12;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(410px, 92vw, 92dvh);
  aspect-ratio: 1;
}
.general-alert { z-index: 10; bottom: 18px; right: 18px; width: min(320px, calc(100vw - 36px)); }
.alert-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.alert-heading h2 { font-size: 1.03rem; margin: 3px 0; overflow-wrap: anywhere; }
.alert-kind { color: var(--muted); font-size: .8rem; margin: 0; font-weight: 600; }
.alert-close { font-size: 1.2rem; line-height: 1; padding: 5px 8px; }
.alert-body { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.direct-alert .alert-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; background: #f2f5f9; border-radius: 8px; }
.direct-alert form { gap: 8px; }
.general-alert .alert-body { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.general-alert > button { align-self: flex-end; }
