:root {
  --bg: #f4f2ee; --panel: #ffffff; --side: #1f2a30; --side-text: #dfe6e8; --side-mute: #93a3a9;
  --side-hover: #2b3942; --text: #1d2428; --mute: #66727a; --line: #e2ded6;
  --accent: #0f7b6c; --accent-text: #ffffff; --mine: #e2f1ee; --danger: #b3321f; --warn-bg: #fdf0d5; --warn-text: #7a5200;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14191c; --panel: #1b2226; --side: #10161a; --side-hover: #1f2a30; --text: #e6ebed; --mute: #93a0a7;
    --line: #2b353b; --accent: #2fae9b; --accent-text: #08201c; --mine: #17322e; --danger: #e8735f; --warn-bg: #3a2e14; --warn-text: #f1cf8b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--mute); }
.error { color: var(--danger); font-size: 14px; }
.error.tiny { padding: 0 16px 10px; }

.primary { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 600; }
.primary:disabled { opacity: .6; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
.small { padding: 5px 10px; font-size: 14px; }
.danger { color: var(--danger); }
.icon { background: none; border: 0; width: 32px; height: 32px; font-size: 20px; line-height: 1; border-radius: 6px; flex: none; }

/* belépés */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.card.center { text-align: center; justify-items: center; }
.card h1 { font-size: 24px; }
.card label { display: grid; gap: 4px; font-size: 14px; color: var(--mute); }
.card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; color: var(--text); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 9px; padding: 3px; }
.tab { border: 0; background: none; padding: 7px; border-radius: 7px; color: var(--mute); }
.tab.on { background: var(--panel); color: var(--text); font-weight: 600; }

/* elrendezés */
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; justify-content: space-between; align-items: center; padding: 16px; font-size: 18px; }
.brand .icon, .group .icon { color: var(--side-text); }
.scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.group { margin-top: 12px; }
.group h2 { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--side-mute); padding: 0 8px; min-height: 32px; }
.group .icon { width: 26px; height: 26px; }
.group .icon:hover { background: var(--side-hover); }
.count { font-weight: 400; }
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--side-text); text-align: left; padding: 6px 8px; border-radius: 6px; }
.item:not(:disabled):hover { background: var(--side-hover); }
.item.on { background: var(--side-hover); font-weight: 600; }
.item:disabled { cursor: default; opacity: .75; }
.item .ellipsis { flex: 1; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 99px; border: 1px solid currentColor; opacity: .75; flex: none; }
.badge { background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; min-width: 20px; text-align: center; border-radius: 99px; padding: 0 6px; flex: none; }
.roomform { display: flex; gap: 6px; padding: 0 8px 8px; }
.roomform input { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--side-hover); background: var(--side-hover); color: var(--side-text); }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--side-hover); }
.me .ghost { border-color: var(--side-hover); color: var(--side-text); flex: none; }

.adminbox { padding: 0 16px 8px; }
.pause { width: 100%; padding: 12px; border: 0; border-radius: 8px; background: #c8402b; color: #fff; font-weight: 700; }
.pause.resume { background: #1c9c6b; }
.pause:disabled { opacity: .6; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 57px; }
.top h1 { font-size: 18px; flex: 1; }
.banner { background: var(--warn-bg); color: var(--warn-text); padding: 8px 16px; font-size: 14px; }
.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.empty { margin: auto; color: var(--mute); text-align: center; }
.msg { max-width: min(680px, 88%); align-self: flex-start; background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.msg.mine { align-self: flex-end; background: var(--mine); }
.head { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.who { background: none; border: 0; padding: 0; font-weight: 700; color: var(--accent); }
.who:not(:disabled):hover { text-decoration: underline; }
.who:disabled { cursor: default; color: var(--mute); }
.time { color: var(--mute); }
.del { background: none; border: 0; padding: 0; color: var(--danger); font-size: 12px; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { flex: 1; min-width: 0; resize: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; max-height: 140px; }

.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-block; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 20; transform: translateX(-100%); transition: transform .18s ease; }
  .side.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; }
  #openSide.alert { color: var(--danger); }
}
