:root {
  --bg: #f4f6f9;
  --fg: #1c2430;
  --muted: #5b6676;
  --card: #ffffff;
  --border: #d8dee8;
  --accent: #1f4e8c;
  --accent-fg: #ffffff;
  --error: #b42318;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --fg: #e6e9ee;
    --muted: #9aa4b2;
    --card: #1c2027;
    --border: #323a46;
    --accent: #8db4ec;
    --accent-fg: #0d1b2e;
    --error: #ff8a80;
  }
}

* { box-sizing: border-box; }

/* Hidden means hidden, whatever display a class gives (buttons, icon buttons). */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

body.page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 34rem;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

h1 { margin: 0 0 1rem; font-size: 1.5rem; }
h2 { margin: 2rem 0 .75rem; font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
pre { padding: .75rem 1rem; background: var(--bg); border-radius: 8px; overflow-x: auto; }

.muted { color: var(--muted); font-size: .875rem; }
.error { color: var(--error); font-weight: 600; }
.status:empty { display: none; }

label { display: block; margin-bottom: .25rem; font-weight: 600; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: 1rem 0; }

input[type="text"] {
  width: 100%;
  padding: .6rem .75rem;
  margin-bottom: 1rem;
  font: inherit;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .05em;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  background: var(--card);
}

/* The password sign-in form (LDAP directory). */
.login-form input[type="text"], .login-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: .6rem .75rem;
  margin-bottom: 1rem;
  font: inherit;
  letter-spacing: normal;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  background: var(--card);
}

button, .button {
  display: inline-block;
  padding: .6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

button:disabled { opacity: .6; cursor: progress; }
.button.secondary { color: var(--accent); background: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }


.actions form { margin: 0; }

.list { list-style: none; padding: 0; margin: 0 0 1rem; }
.list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.list form { margin: 0; }

.badge {
  display: inline-block;
  padding: 0 .4rem;
  font-size: .75rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
}

@media (max-width: 30rem) {
  .card { padding: 1.25rem; }
}

/* ------------------------------------------------------------------ */
/* Signed-in app: sidebar + main pane (prototype: jmapChat UI mockup). */

body.app {
  --app-accent: #9e1f1b;
  --app-accent-dark: #7a1714;
  --app-line: #f0dedc;
  --app-line-strong: #e7d3d1;
  --app-tint: #fff8f7;
  --app-chip: #f6e6e4;
  --app-mine: #fbe1de;
  --app-text: #1f1a1a;
  --app-muted: #6b5e5e;
  --app-sidebar: var(--app-accent);
  --app-bg: #ffffff;
  --app-surface: #ffffff;
  --app-icon: #3a2e2e;
  --app-shadow: rgba(60, 20, 20, .18);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--app-text);
  background: var(--app-bg);
}

/* Dark theme, following the system setting. */
@media (prefers-color-scheme: dark) {
  body.app {
    --app-accent: #b8322c;
    --app-accent-dark: #962722;
    --app-line: #352a29;
    --app-line-strong: #4a3a38;
    --app-tint: #181313;
    --app-chip: #3a2826;
    --app-mine: #4d1f1c;
    --app-text: #f2eaea;
    --app-muted: #b5a7a5;
    --app-sidebar: #4a1512;
    --app-bg: #120e0e;
    --app-surface: #241c1b;
    --app-icon: #eadedd;
    --app-shadow: rgba(0, 0, 0, .55);
  }
  .a0 { background: #5a1f1c; color: #ffd9d4; }
  .a1 { background: #5a3a10; color: #ffe2b8; }
  .a2 { background: #283266; color: #dce2ff; }
  .a3 { background: #1d4a35; color: #ccf0dd; }
  .a4 { background: #45255c; color: #f0dcfb; }
  .a5 { background: #164a52; color: #d3f1f4; }
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.app { display: flex; flex-direction: column; }
.app-shell { display: flex; flex: 1 1 auto; min-height: 0; }

/* The admins' announcement, above the app. */
.announcement { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px 10px 20px; color: var(--app-text); background: var(--app-chip); border-bottom: 1px solid var(--app-line-strong); }
.announcement p { flex: 1; margin: 0; white-space: pre-line; overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto; }
.announcement[hidden] { display: none; }
.announcement .icon-button { flex: none; color: var(--app-icon); }

.sidebar {
  flex: 0 0 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  background: var(--app-sidebar);
}

.icon-button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.icon-button.light { color: #ffffff; border-color: rgba(255, 255, 255, .35); }
.icon-button.light:hover { background: rgba(255, 255, 255, .12); }
.icon-button.bordered { width: 44px; height: 44px; color: var(--app-icon); border-color: var(--app-line-strong); background: var(--app-surface); }
.icon-button.bordered[aria-expanded="true"] { color: #ffffff; border-color: var(--app-accent); background: var(--app-accent); }
.icon-button.bordered:hover { background: var(--app-tint); }

.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 14px 10px 12px; }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 12px;
  text-decoration: none;
}
.tab:hover { background: rgba(255, 255, 255, .1); }
.tab.active { background: rgba(255, 255, 255, .18); font-weight: 600; }

/* The new chat menu next to search. */
.new-menu { position: relative; }
.new-menu summary { list-style: none; }
.new-menu summary::-webkit-details-marker { display: none; }
.new-menu[open] summary { background: rgba(255, 255, 255, .18); }
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  padding: 6px;
  color: var(--app-text);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 12px;
  box-shadow: 0 10px 28px var(--app-shadow);
}
.dropdown ul { list-style: none; margin: 0; padding: 0; }
.dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: inherit;
  text-decoration: none;
}
body.app .sidebar .dropdown a { color: var(--app-text); }
.dropdown a:hover, .dropdown a:focus-visible { background: var(--app-tint); }
.dropdown span { flex: 1; }
.search-row { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; }
.search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-size: 14px;
  letter-spacing: normal;
}
.search input::placeholder { color: rgba(255, 255, 255, .8); }
.search:focus-within { outline: 2px solid rgba(255, 255, 255, .7); }

.sidebar-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
.list-heading { margin: 4px 10px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.list-empty, .no-matches { margin: 8px 12px; font-size: 14px; opacity: .9; }

.chat-list { list-style: none; margin: 0 0 8px; padding: 0; }
.chat-list form { margin: 0; }
.chat-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: none;
  border-radius: 12px;
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.chat-item:hover { background: rgba(255, 255, 255, .1); }
.chat-item.active { background: rgba(255, 255, 255, .18); }
.item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-time { flex: 0 0 auto; font-size: 12px; opacity: .85; }
.item-preview { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--app-sidebar);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

button.small { padding: .35rem .8rem; font-size: 13px; }
button.on-accent { color: var(--app-accent); background: #ffffff; border-color: #ffffff; }

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, .22);
}
.me-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: #ffffff; }
.me-name a { color: inherit; text-decoration: none; }
.me-name strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* One's own status, on the account page. */
.status-settings { margin: 0 0 20px; }
.status-settings h2 { margin: 0 0 8px; font-size: 16px; }
.status-form { max-width: 20rem; margin: 0; }

/* Presence: a dot on the avatar's corner. */
.avatar { position: relative; }
.dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--app-bg);
  border-radius: 50%;
  background: #9aa0a6;
}
.sidebar .dot, .me .dot { border-color: var(--app-sidebar); }
.dot.online { background: #2fb344; }
.dot.away { background: #f2b01e; }
.dot.busy { background: #d93025; }
.dot.offline { background: transparent; border-color: transparent; }
.avatar.large .dot { width: 18px; height: 18px; right: 2px; bottom: 2px; }
.item-icon { flex: 0 0 auto; opacity: .8; vertical-align: -2px; }
.item-title + span { display: inline-flex; }
.count.muted-count { color: #ffffff; background: rgba(255, 255, 255, .3); }

/* Message search results under the chat list. */
.search-results { flex: 1 1 auto; border-top: 1px solid rgba(255, 255, 255, .22); padding-top: 8px; }
.search-results[hidden] { display: none; }
.sidebar.searching #sidebar-list { flex: 0 1 auto; max-height: 40%; }
.search-item .item-preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-sender { font-weight: 600; }
.search-results mark { padding: 0 1px; border-radius: 3px; color: var(--app-accent); background: #ffffff; }
.msg.flash .bubble, .msg:target .bubble { animation: flash 1.6s ease-out; }

.info-settings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 8px; }
.setting-form { margin: 0; }

.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.avatar.round { border-radius: 50%; }
.avatar.small { width: 36px; height: 36px; font-size: 13px; }
.avatar.on-accent { width: 40px; height: 40px; color: var(--app-sidebar); background: #ffffff; }
.avatar.large { width: 88px; height: 88px; font-size: 30px; border-radius: 22px; }
.avatar.large.round { border-radius: 50%; }
.a0 { background: #ffe3df; color: #7a1714; }
.a1 { background: #fde7c8; color: #6b3a00; }
.a2 { background: #e3e8ff; color: #26338a; }
.a3 { background: #d9f2e6; color: #0f5132; }
.a4 { background: #efe3f7; color: #5a2280; }
.a5 { background: #dff1f3; color: #0b4f58; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--app-bg); }
.empty-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; color: var(--app-muted); background: var(--app-tint); text-align: center; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--app-line);
}
.chat-title { flex: 1; min-width: 0; }
.chat-title h1 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title p { margin: 2px 0 0; font-size: 13px; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button.back { display: none; color: var(--app-icon); }
.icon-button.back.always { display: inline-flex; }

.pane-notice { padding: 12px 20px 0; }
.pane-notice p { margin-bottom: 0; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; background: var(--app-tint); }
.empty-chat { margin: 2rem 0; color: var(--app-muted); text-align: center; }
.message-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.day {
  align-self: center;
  padding: 4px 12px;
  border-radius: 12px;
  color: var(--app-muted);
  background: var(--app-chip);
  font-size: 12px;
  font-weight: 600;
}
.msg { display: flex; gap: 10px; max-width: min(640px, 85%); }
.msg-content { min-width: 0; }
.msg-meta { font-size: 13px; }
.msg-meta time { color: var(--app-muted); }
.bubble {
  margin-top: 4px;
  padding: 10px 14px;
  border: 1px solid var(--app-line);
  border-radius: 4px 14px 14px 14px;
  background: var(--app-surface);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine .bubble { border-color: transparent; border-radius: 14px 4px 14px 14px; background: var(--app-mine); text-align: left; }
.edited { color: var(--app-muted); font-size: 12px; }

/* Reactions under a bubble, and the tools (react, edit, delete) shown on hover or focus. */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg.mine .reactions, .msg.mine .msg-tools { justify-content: flex-end; }
.reactions form, .picker form, .msg-tools form { margin: 0; }
.reaction {
  display: inline-block;
  padding: 1px 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  color: inherit;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 12px;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", system-ui, sans-serif;
}
.reaction.mine { background: var(--app-chip); border-color: var(--app-accent); }
.msg-tools { display: flex; align-items: flex-start; gap: 10px; margin-top: 2px; font-size: 12px; opacity: 0; transition: opacity .1s; }
.msg:hover .msg-tools, .msg-tools:focus-within, .msg-tools details[open] { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: 1; } }
.msg-menu summary { list-style: none; cursor: pointer; color: var(--app-muted); }
.msg-menu summary::-webkit-details-marker { display: none; }
.msg-menu summary:hover, .msg-menu summary:focus-visible { color: var(--app-accent); }
.picker { display: flex; gap: 4px; margin-top: 4px; padding: 4px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 10px; }
/* Accent tiles; emoji fonts without colour glyphs draw them white. */
button.emoji {
  padding: 2px 6px;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #ffffff;
  background: var(--app-accent);
  border: 0;
  border-radius: 6px;
}
button.emoji:hover, button.emoji:focus-visible { background: var(--app-accent-dark); }
button.link { padding: 0; font-size: 12px; font-weight: 400; color: var(--app-muted); background: none; border: 0; }
button.link:hover, button.link:focus-visible { color: var(--app-accent); text-decoration: underline; }
.edit-menu[open] { flex-basis: 100%; }
.edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.edit-form textarea { min-width: min(420px, 70vw); font: inherit; font-size: 14px; padding: 8px 10px; color: inherit; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 8px; resize: vertical; }
.edit-buttons { display: flex; justify-content: flex-end; gap: 6px; }
.msg-tools:has(.edit-menu[open]) { flex-wrap: wrap; }

/* Replies, mentions, files and read receipts. */
.quote {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin-top: 4px;
  padding: 4px 10px;
  border-left: 3px solid var(--app-accent);
  border-radius: 6px;
  background: var(--app-chip);
  color: var(--app-text);
  font-size: 12px;
  text-align: left;
  text-decoration: none;
}
.quote strong { font-size: 12px; }
.quote span { color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.mine .quote { margin-left: auto; }
.mention { padding: 0 2px; border-radius: 4px; font-weight: 600; color: var(--app-accent); background: var(--app-chip); }
.msg.mentions-me .bubble { border-color: var(--app-accent); box-shadow: inset 3px 0 0 var(--app-accent); }
.msg.flash .bubble { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--app-chip); box-shadow: 0 0 0 3px var(--app-accent); } }
.files { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.bubble > .files:first-child { margin-top: 0; }
.file-image img { display: block; max-width: min(320px, 100%); max-height: 320px; border-radius: 8px; }
.file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  color: inherit;
  background: var(--app-surface);
  text-decoration: none;
  white-space: normal;
}
.file:hover { border-color: var(--app-accent); }
.file-name { min-width: 0; overflow-wrap: anywhere; }
.file-size { flex: 0 0 auto; color: var(--app-muted); font-size: 12px; }
.seen { margin: 2px 0 0; font-size: 11px; color: var(--app-muted); }

.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.reply-bar, .file-list {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 6px 6px 12px;
  border-left: 3px solid var(--app-accent);
  border-radius: 8px;
  background: var(--app-tint);
  font-size: 13px;
}
.reply-bar[hidden], .file-list[hidden] { display: none; }
.reply-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button.small-icon { width: 28px; height: 28px; color: var(--app-muted); }
.file-list { flex-wrap: wrap; list-style: none; border-left-color: var(--app-line-strong); }
.file-list li { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; border-radius: 6px; background: var(--app-surface); border: 1px solid var(--app-line); }
.file-list button.link { padding: 0 4px; font-size: 16px; }
.icon-button.attach { width: 44px; height: 44px; color: var(--app-muted); }
.icon-button.attach:hover, .icon-button.attach:focus-within { color: var(--app-accent); background: var(--app-tint); }
.attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mention-list {
  position: absolute;
  left: 20px;
  bottom: calc(100% - 4px);
  z-index: 5;
  min-width: 220px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: var(--app-surface);
  box-shadow: 0 8px 24px var(--app-shadow);
}
.mention-list[hidden] { display: none; }
.mention-list li { padding: 6px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.mention-list li.active, .mention-list li:hover { background: var(--app-chip); }
a.link { font-size: 12px; color: var(--app-muted); text-decoration: none; }
a.link:hover, a.link:focus-visible { color: var(--app-accent); text-decoration: underline; }

/* Fixed height so the composer does not jump when someone starts or stops typing. */
.typing { margin: 0; padding: 0 20px; height: 22px; line-height: 22px; font-size: 13px; font-style: italic; color: var(--app-muted); background: var(--app-tint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--app-line);
  background: var(--app-bg);
}
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 200px;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1px solid var(--app-line-strong);
  border-radius: 14px;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: inherit;
  background: var(--app-surface);
  resize: none;
}
.composer textarea:focus { outline: 2px solid var(--app-accent); outline-offset: -1px; }
.send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border-color: var(--app-accent);
  background: var(--app-accent);
}
.send:hover { background: var(--app-accent-dark); }

body.app .pane { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; max-width: 44rem; }
body.app .pane h2 { margin: 1.75rem 0 .75rem; font-size: 16px; }
body.app .pane h2:first-of-type { margin-top: .5rem; }
body.app button:not(.chat-item):not(.icon-button):not(.send):not(.on-accent):not(.secondary):not(.danger):not(.link):not(.emoji):not(.reaction) { color: #ffffff; background: var(--app-accent); border-color: var(--app-accent); }
body.app button.secondary, body.app .button.secondary { color: var(--app-accent); border-color: var(--app-accent); background: transparent; }
/* Link buttons in the app's colours (the page theme's blue is for the sign-in pages). */
body.app .button:not(.secondary):not(.call-join) { color: #ffffff; background: var(--app-accent); border-color: var(--app-accent); }
body.app .button:not(.secondary):not(.call-join):hover { background: var(--app-accent-dark); border-color: var(--app-accent-dark); }
@media (prefers-color-scheme: dark) {
  body.app button.secondary, body.app .button.secondary, body.app .badge, body.app a:not(.button) { color: #ff9d95; }
  body.app button.secondary, body.app .button.secondary, body.app .badge { border-color: #ff9d95; }
  body.app .sidebar a, body.app .icon-button { color: inherit; }
  body.app .chat-head .icon-button.bordered { color: var(--app-icon); }
  body.app .chat-head .icon-button.bordered[aria-expanded="true"] { color: #ffffff; }
  body.app .quote, body.app .file { color: var(--app-text); }
  body.app a.link { color: var(--app-muted); }
}
body.app .pane input[type="text"], body.app .pane input[type="password"] { max-width: 28rem; }
.people { list-style: none; margin: 0 0 1rem; padding: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--app-line); }
.people form { margin: 0; }
.person { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person .muted { font-size: 13px; }
.inline-row { display: flex; gap: 8px; align-items: flex-start; max-width: 28rem; }
.inline-row input { flex: 1; }
.account-card { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; }
body.app .badge { color: var(--app-accent); border-color: var(--app-accent); }

/* Info column: the other person, or a group chat's members. */
.info {
  flex: 0 0 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--app-line);
  background: var(--app-bg);
}
.info[hidden] { display: none; }
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--app-line); }
.info-head h2 { margin: 0; font-size: 16px; }
.info-close { color: var(--app-icon); }
.info-close:hover { background: var(--app-tint); }
.info-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
.info-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 16px; text-align: center; }
.info-card h3 { margin: 8px 0 0; font-size: 18px; overflow-wrap: anywhere; }
.info-card p { margin: 0 0 8px; overflow-wrap: anywhere; }
.info-section { margin: 1.25rem 0 .5rem; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); }
.info .inline-row select { min-width: 0; }
.leave-form { margin-top: 1.25rem; }

/* Medium screens: the info column lies over the conversation. */
@media (max-width: 1100px) {
  .info { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; width: min(360px, 100%); box-shadow: -8px 0 24px var(--app-shadow); }
}

/* Narrow screens: the list and the open pane are separate screens. */
@media (max-width: 760px) {
  .sidebar { flex: 1 1 auto; }
  body.app.has-main .sidebar { display: none; }
  body.app:not(.has-main) .main { display: none; }
  .icon-button.back { display: inline-flex; }
  .chat-head { padding: 10px 12px; }
  .messages { padding: 14px 12px; }
  .composer { padding: 10px 12px 12px; }
  .msg { max-width: 92%; }
}

/* Member picker (new group chat) and the add-member select. */
fieldset.pick { border: 0; padding: 0; margin: 1rem 0; }
fieldset.pick legend { font-weight: 600; margin-bottom: .25rem; }
label.check.pick-person { margin: .35rem 0; }
.pick-person .person { display: flex; flex-direction: column; }
.inline-row select { flex: 1; min-width: 0; font: inherit; padding: .5rem; border-radius: 8px; border: 1px solid var(--app-line-strong, #ccc); background: inherit; color: inherit; }
p.composer.closed { color: var(--app-muted); justify-content: center; }
.bubble.deleted { font-style: italic; opacity: .7; }
/* A call written to the chat; missed and declined ones in red. */
.call-log { display: inline-flex; align-items: center; gap: 8px; }
.call-log svg { flex: none; }
.call-log.missed svg, .call-log.declined svg { color: #c5221f; }
@media (prefers-color-scheme: dark) {
  .call-log.missed svg, .call-log.declined svg { color: #ff8a80; }
}

/* Calls: buttons in the chat header, the incoming call card, and the call window. */
.call-buttons { display: flex; align-items: center; gap: 8px; }
.call-buttons [hidden] { display: none; }
.call-join { display: inline-flex; align-items: center; gap: 6px; padding: .45rem .9rem; font-size: 14px; color: #ffffff; background: #1e8e3e; border-color: #1e8e3e; }
.call-join:hover { background: #18742f; }

.round-button {
  width: 52px;
  height: 52px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: #3c4043;
  border: none;
}
.round-button:hover { filter: brightness(1.15); }
.round-button.accept { background: #1e8e3e; }
.round-button.decline { background: #d93025; }
.round-button.off { color: #202124; background: #f1f3f4; }
.round-button.active { background: #1a73e8; }
.round-button .icon-off, .round-button.off .icon-on { display: none; }
.round-button.off .icon-off { display: inline; }
.round-button[hidden] { display: none; }

.incoming-call {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  color: var(--app-text);
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 16px;
  box-shadow: 0 16px 40px var(--app-shadow);
  animation: incoming 1.2s ease-in-out infinite alternate;
}
.incoming-call[hidden] { display: none; }
.incoming-avatar { width: 48px; height: 48px; color: #ffffff; background: var(--app-accent); }
.incoming-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.incoming-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incoming-text span { font-size: 13px; color: var(--app-muted); }
.incoming-actions { display: flex; gap: 10px; }
.incoming-actions .round-button { width: 46px; height: 46px; }
@keyframes incoming { from { box-shadow: 0 16px 40px var(--app-shadow); } to { box-shadow: 0 16px 40px var(--app-shadow), 0 0 0 4px rgba(30, 142, 62, .35); } }
@media (max-width: 30rem) {
  .incoming-call { right: 16px; bottom: 16px; }
  .call-join span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .incoming-call { animation: none; } }

body.call-window { margin: 0; color: #e8eaed; background: #202124; }
.call { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
/* The call and, beside it, the app in a frame (below the call on narrow screens, where the call
   shrinks to a bar). */
.call-shell { display: flex; height: 100vh; height: 100dvh; }
.call-shell .call { flex: 1; min-width: 0; height: auto; }
.call-app { flex: 0 0 420px; border: 0; border-left: 1px solid #3c4043; background: #ffffff; }
.call-app[hidden], .call-shell:not(.with-chat):not(.call-over) .call-app { display: none; }
.call-shell.call-over .call { display: none; }
.call-shell.call-over .call-app { flex: 1; border-left: 0; }
.round-button[aria-pressed="true"]#call-chat { color: #202124; background: #8ab4f8; }
@media (max-width: 1099px) {
  .call-shell.with-chat { flex-direction: column; }
  .call-shell.with-chat .call { flex: 0 0 auto; }
  .call-shell.with-chat .stage, .call-shell.with-chat .call-error { display: none; }
  .call-shell.with-chat .call-head { padding: 8px 12px 4px; }
  .call-shell.with-chat .call-controls { padding: 4px 12px 8px; gap: 10px; }
  .call-shell.with-chat .round-button { width: 42px; height: 42px; }
  .call-shell.with-chat .call-devices { top: calc(100% + 4px); bottom: auto; }
  .call-shell.with-chat .device-caret { width: 20px; height: 20px; }
  .call-shell.with-chat .call-app { flex: 1; min-height: 0; border-left: 0; border-top: 1px solid #3c4043; }
}
.call-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.call-head h1 { flex: 1; min-width: 0; margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-timer { font-variant-numeric: tabular-nums; color: #bdc1c6; }
.call-safety { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; color: #81c995; cursor: help; }
.call-safety[hidden] { display: none; }
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  padding: 0 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.stage[data-count="1"], .stage[data-count="2"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.call-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #202124;
}
.call-placeholder[hidden] { display: none; }
.avatar.big { width: 112px; height: 112px; font-size: 38px; border-radius: 28px; }
.avatar.big.round { border-radius: 50%; }
.call-status { margin: 0; font-size: 18px; color: #e8eaed; }
.tile {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #3c4043;
  outline: 3px solid transparent;
  transition: outline-color .2s;
}
.tile.speaking { outline-color: #8ab4f8; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: none; }
.tile.screen video { object-fit: contain; background: #000000; }
.tile.local:not(.screen) video { transform: scaleX(-1); }
.tile.has-video video { display: block; }
.tile.has-video .tile-avatar { display: none; }
.tile-avatar {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 600;
  color: #ffffff;
  background: #5f6368;
}
.tile-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 3px 10px;
  overflow: hidden;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, .55);
}
.tile.mic-off .tile-name::after { content: " 🔇"; }
/* Someone whose connection broke, on their way back. */
.tile.away .tile-avatar { opacity: .45; animation: tile-away 1.6s ease-in-out infinite; }
@keyframes tile-away { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .tile.away .tile-avatar { animation: none; } }
.call-error { margin: 10px 16px 0; padding: 8px 12px; border-radius: 8px; color: #ffffff; background: #8c1d18; }
.call-error[hidden] { display: none; }
.call-controls { position: relative; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px; }
/* The microphone and camera buttons carry a small arrow that opens the device panel. */
.control-pair { position: relative; display: inline-flex; }
.control-pair [hidden] { display: none; }
.device-caret {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #5f6368;
  border: 2px solid #202124;
  border-radius: 50%;
}
.device-caret:hover { background: #80868b; }
.device-caret[aria-expanded="true"] { color: #202124; background: #8ab4f8; }
.device-caret[aria-expanded="true"] svg { transform: rotate(180deg); }
/* The microphone, speaker and camera to use, above the controls. */
.call-devices {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: min(340px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #303134;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.call-devices label { display: grid; gap: 4px; font-size: 13px; color: #bdc1c6; }
.call-devices select {
  width: 100%;
  padding: 7px 8px;
  font: inherit;
  font-size: 14px;
  color: #e8eaed;
  background: #202124;
  border: 1px solid #5f6368;
  border-radius: 6px;
}
.call-controls .secondary { color: #e8eaed; background: transparent; border-color: #5f6368; }
.call-controls [hidden] { display: none; }

/* Admin panel: the disk's fill level and the shared contact list. */
meter.disk { display: block; width: 100%; max-width: 28rem; height: 12px; margin: 0 0 .5rem; }
body.app .badge.quiet { color: var(--app-muted); border-color: var(--app-muted); }
.admin .people li.frozen .avatar, .admin .people li.frozen .person > span:first-child { opacity: .6; }
.admin section + section { margin-top: 2rem; }
.admin .stats { border-collapse: collapse; margin: 0 0 .5rem; }
.admin .stats th, .admin .stats td { padding: 6px 16px 6px 0; text-align: left; font-weight: 400; border-bottom: 1px solid var(--app-line); }
.admin .stats thead th { font-size: 13px; color: var(--app-muted); }
.admin .stats tbody th { color: var(--app-muted); }
.admin h3 { margin: 1.5rem 0 .25rem; font-size: 15px; }
.admin .month-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: .5rem 0 .75rem; }
.admin .month-pick select { font: inherit; font-size: 14px; padding: 4px 6px; color: inherit; background: var(--app-surface); border: 1px solid var(--app-line-strong); border-radius: 6px; }
.admin .charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px 20px; margin: .75rem 0 0; }
.admin figure.chart { margin: 0; }
.admin .chart figcaption { font-size: 13px; color: var(--app-muted); margin: 0 0 2px; }
.admin .chart svg { display: block; width: 100%; height: auto; }
.admin .chart .bar { fill: var(--app-accent); }
.admin .chart .peak { fill: var(--app-accent); opacity: .28; }
.admin .chart .axis { stroke: var(--app-line); stroke-width: 1; }
.admin .chart text { fill: var(--app-muted); font-size: 9px; font-family: inherit; }
.admin .error .why { font-weight: 400; overflow-wrap: anywhere; }
.admin form { margin: 0; }
.admin .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.admin .current-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 1rem; padding: 10px 12px; background: var(--app-chip); border-radius: 8px; }
.admin .current-banner p { flex: 1; margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.admin .announce-form textarea { display: block; width: 100%; max-width: 36rem; font: inherit; padding: 8px 10px; color: inherit; background: var(--app-surface); border: 1px solid var(--app-line-strong); border-radius: 8px; resize: vertical; }
.admin .choice { border: 0; padding: 0; margin: .5rem 0 .75rem; }
.admin .choice label.check { margin: .35rem 0; }
.admin table.call-rules { border-collapse: collapse; margin: 0 0 1rem; width: 100%; max-width: 40rem; }
.admin .call-rules th, .admin .call-rules td { padding: 6px 10px 6px 0; text-align: left; font-weight: 400; border-bottom: 1px solid var(--app-line); vertical-align: middle; }
.admin .call-rules thead th { font-size: 13px; color: var(--app-muted); }
.admin .call-rules tbody th { overflow-wrap: break-word; }
.admin .call-rules input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.admin .call-rules select { max-width: 100%; font: inherit; font-size: 14px; padding: 4px 6px; color: inherit; background: var(--app-surface); border: 1px solid var(--app-line-strong); border-radius: 6px; }
.admin .call-rules h3 { margin: 1rem 0 .25rem; font-size: 15px; }
@media (max-width: 760px) {
  .admin .people li { flex-wrap: wrap; }
  .admin .row-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
}

/* Notifications and installing, on the account page. */
.notification-settings, .install-settings { margin: 0 0 20px; }
.notification-settings h2, .install-settings h2 { margin: 0 0 8px; font-size: 16px; }
.notification-settings .actions { margin: .5rem 0; }
.notification-text label.check { margin: .75rem 0 .25rem; }
.notification-text .muted { margin: .35rem 0 0; }
.install-hints { margin: .25rem 0 0; padding-left: 1.2rem; }
.install-hints li + li { margin-top: .35rem; }
