:root {
  --bg: #0f1412;
  --side: #121a17;
  --card: #1a2420;
  --line: #2a3a34;
  --text: #e8efe9;
  --muted: #8aa396;
  --accent: #25d366;
  --accent-2: #1da851;
  --warn: #e7b549;
  --danger: #e25c5c;
  --in: #1f3d32;
  --out: #163028;
  --font: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--accent); text-decoration: none; }
.app { display: flex; min-height: 100vh; height: 100%; overflow: hidden; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.side { width: 240px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; }
.brand { font-weight: 700; letter-spacing: .04em; color: var(--accent); margin-bottom: 22px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; }
.side nav a.on, .side nav a:hover { background: #1c2b25; color: var(--text); }
.hat-side { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.hat-nav { display: flex; flex-direction: column; gap: 2px; max-height: 42vh; overflow: auto; margin-bottom: 12px; }
.hat-nav a { color: var(--muted); padding: 7px 10px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.hat-nav a.on, .hat-nav a:hover { background: #1c2b25; color: var(--text); }
.hat-nav .pill { margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #44554c; }
.dot-on { background: var(--accent); }
.dot-wait { background: var(--warn); }
.dot-off { background: #44554c; }
.hat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.hat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; background: var(--card); }
.hat-chip.on { border-color: var(--accent-2); color: var(--text); background: #163028; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.who { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.who strong { color: var(--text); font-size: 13px; }
.top { padding: 16px 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.top h1 { margin: 0; font-size: 18px; font-weight: 600; }
.page { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 40px; }
.page-fill { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.muted { color: var(--muted); }
.btn { display: inline-block; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; background: #2a3a34; color: var(--text); }
.btn.primary { background: var(--accent-2); color: #06210f; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: #5a2424; }
input, select, textarea { width: 100%; background: #0d1411; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 11px; font: inherit; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
.alert { background: #3a2222; color: #ffd0d0; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.ok { background: #1d3328; color: #b8f0c8; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #2a3a34; }
.pill.on { background: #14532d; color: #bbf7d0; }
.pill.wait { background: #4a3a12; color: #fde68a; }
.pill.err { background: #4a1c1c; color: #fecaca; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(380px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-mark { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.split { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.page:not(.page-fill) .split { min-height: calc(100vh - 70px); margin: -18px -22px -40px; border-top: 1px solid var(--line); }
.list { border-right: 1px solid var(--line); overflow: auto; min-height: 0; background: #111b21; }
.list a.row { display: block; padding: 12px 14px; color: inherit; border-bottom: 1px solid var(--line); }
.list a.row:hover, .list a.row.on { background: #1c2b25; }
.list-search { padding: 8px 10px; position: sticky; top: 0; background: #111b21; z-index: 1; border-bottom: 1px solid #222d34; }
.list-search input { border-radius: 8px; background: #202c33; border-color: transparent; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: inherit; border-bottom: 1px solid #222d34; }
.chat-item:hover { background: #202c33; }
.chat-item.on { background: #2a3942; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #6a7175; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.chat-item-body { min-width: 0; flex: 1; }
.chat-item-top, .chat-item-bot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-item-top strong { color: #e9edef; font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { font-size: 12px; color: #8696a0; flex-shrink: 0; }
.chat-item-preview { color: #8696a0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-tabs { display: flex; gap: 4px; padding: 6px 10px 8px; background: #111b21; border-bottom: 1px solid #222d34; }
.list-tabs a { font-size: 13px; color: #8696a0; padding: 5px 10px; border-radius: 99px; }
.list-tabs a.on { background: #202c33; color: #e9edef; }
.flag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.flag-arch { background: #2a3942; color: #9cb6c4; }
.flag-del { background: #5a2424; color: #fecaca; }
.chat-item.is-arch { opacity: .92; }
.chat-item.is-del .chat-item-preview { color: #f5b5b5; }
.chat-alert { flex-shrink: 0; font-size: 13px; padding: 8px 14px; }
.chat-alert.arch { background: #1c2c33; color: #9cb6c4; }
.chat-alert.del { background: #3a2222; color: #fecaca; }
.bubble.deleted { border: 1px dashed #e25c5c; background: #2a1c1c !important; }
.bubble.deleted .txt { text-decoration: line-through; opacity: .85; }
.thread { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: #0b141a; }
.thread-empty { flex: 1; display: grid; place-items: center; color: #8696a0; }
.chat-head { padding: 8px 14px; border-bottom: 1px solid #222d34; flex-shrink: 0; display: flex; align-items: center; gap: 12px; background: #202c33; }
.chat-head-txt { min-width: 0; flex: 1; }
.chat-head h2 { margin: 0; font-size: 16px; font-weight: 500; color: #e9edef; }
.head-act { margin: 0; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; background-color: #0b141a; background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px); background-size: 18px 18px; }
.msgs-inner { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 12px 8% 16px; width: 100%; }
.msg-row { display: flex; width: 100%; }
.msg-row.in { justify-content: flex-start; }
.msg-row.out { justify-content: flex-end; }
.day-sep { align-self: center; font-size: 12px; color: #8696a0; background: #182229; padding: 5px 12px; border-radius: 8px; margin: 10px 0 8px; box-shadow: 0 1px 1px rgba(0,0,0,.2); }
.older-link { align-self: center; font-size: 12px; margin: 4px 0 8px; }
.bubble { display: inline-block; width: fit-content; max-width: min(75%, 520px); padding: 6px 8px 5px 9px; border-radius: 8px; font-size: 14.2px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; box-sizing: border-box; box-shadow: 0 1px 0.5px rgba(0,0,0,.13); }
.bubble.out { background: #005c4b; color: #e9ffef; border-radius: 8px 8px 0 8px; }
.bubble.in { background: #202c33; color: #e9edef; border-radius: 8px 8px 8px 0; }
.bubble .txt { display: inline; }
.bubble .meta { display: inline-block; float: right; margin: 6px 0 -1px 10px; font-size: 11px; color: #8696a0; line-height: 1; white-space: nowrap; }
.bubble::after { content: ""; display: table; clear: both; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 10px; border-top: 0; flex-shrink: 0; background: #202c33; }
.composer textarea { min-height: 42px; max-height: 120px; resize: none; border-radius: 21px; background: #2a3942; border: 0; padding: 10px 16px; }
.send-btn { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #00a884; color: #fff; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.bubble.has-media { padding: 4px 5px 5px; max-width: min(78%, 280px); }
.media-pic { display: block; }
.media-pic img { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; }
.media-audio { width: 230px; max-width: 100%; height: 36px; margin: 4px 2px; vertical-align: middle; }
.media-video { display: block; max-width: 100%; max-height: 280px; border-radius: 6px; }
.media-file { display: inline-block; margin: 4px 0; }
.media-miss { font-size: 13px; color: var(--muted); font-style: italic; padding: 4px 2px; }
.bubble.has-media .txt { display: block; padding: 4px 6px 0; }
.del-banner { font-size: 11px; font-weight: 700; color: #fecaca; background: #4a1c1c; display: inline-block; padding: 2px 8px; border-radius: 99px; margin-bottom: 6px; }
.wall-item.deleted .wall-preview { color: #f5b5b5; }
.pair-box { background: #111; border-radius: 16px; padding: 22px; text-align: center; }
.pair-code { display: flex; justify-content: center; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.pair-code span { width: 42px; height: 52px; background: #fff; color: #111; border-radius: 8px; display: grid; place-items: center; font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.pair-code .dash { width: 12px; background: transparent; color: #fff; }
.wall { display: flex; flex-direction: column; gap: 2px; }
.wall-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 4px 6px; font-weight: 650; }
.wall-head a { color: var(--text); }
.wall-item { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 12px; align-items: center; padding: 7px 10px; background: var(--card); border: 1px solid transparent; border-radius: 8px; font-size: 13px; color: inherit; }
.wall-item:hover { border-color: var(--line); }
.wall-item.hit { border-color: var(--danger); }
.wall-item.sla { border-color: var(--warn); }
.wall-who { font-weight: 600; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-time { white-space: nowrap; font-size: 12px; }
.note-list { font-size: 13px; }
.note-list li { margin-bottom: 8px; }
@media (max-width: 800px) {
  .app { flex-direction: column; height: auto; overflow: auto; }
  .side { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .split { grid-template-columns: 1fr; }
  .page-fill .split { grid-template-rows: 34vh 1fr; min-height: 80vh; }
}
