* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  display: flex; flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #0f172a; --bg2: #1e293b; --bg3: #0b1220; --text: #e2e8f0; --muted: #94a3b8;
  --border: #334155; --accent: #2563eb; --accent2: #1d4ed8; --mine-text: #fff;
  background: var(--bg); color: var(--text);
}
body[data-theme="light"] {
  --bg: #ffffff; --bg2: #f1f5f9; --bg3: #f8fafc; --text: #0f172a; --muted: #64748b;
  --border: #e2e8f0; --accent: #2563eb; --accent2: #1d4ed8; --mine-text: #fff;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.logo { font-weight: 700; color: var(--accent); }
.meta { font-size: 13px; color: var(--muted); }
.online { color: #4ade80; }
.theme-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  font-size: 11px; cursor: pointer; padding: 3px 8px; border-radius: 6px;
}
.theme-btn:hover { color: var(--text); }
.tabs { display: flex; background: var(--bg3); border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 8px 0; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
main { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.msg {
  max-width: 85%; padding: 6px 10px; border-radius: 12px;
  background: var(--bg2); align-self: flex-start; word-break: break-word;
}
.msg .who { font-size: 11px; margin-bottom: 2px; font-weight: 700; }
.msg .sid { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 5px; }
.msg .text { font-size: 14px; line-height: 1.35; }
.mine { align-self: flex-end; background: var(--accent); }
.mine .text { color: var(--mine-text); }
.mine .sid { color: rgba(255,255,255,.7); }
.sys { align-self: center; font-size: 12px; color: var(--muted); font-style: italic; text-align: center; }
footer { display: flex; gap: 8px; padding: 10px; background: var(--bg2); border-top: 1px solid var(--border); }
input, textarea {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); outline: none; font-family: inherit; font-size: 13px;
}
textarea { min-height: 64px; resize: vertical; }
button.send { padding: 8px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button.send:hover { background: var(--accent2); }
button.send:disabled { opacity: .5; cursor: default; }
/* reviews */
.rv { flex: 1; overflow-y: auto; padding: 14px; display: none; flex-direction: column; gap: 10px; }
.rv.open { display: flex; }
.rv h3 { font-size: 13px; }
.stars { display: flex; gap: 4px; }
.stars button {
  background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer;
  color: var(--border); padding: 0;
}
.stars button.on { color: #f59e0b; }
.stars button:disabled { cursor: default; }
.star-label { font-size: 12px; color: var(--muted); }
.counter { font-size: 11px; color: var(--muted); text-align: right; }
.rv-stats { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.rv-msg { font-size: 12px; color: var(--muted); font-style: italic; }
.rv-msg.ok { color: #22c55e; }
.rv-msg.err { color: #ef4444; }
.r-item { border-bottom: 1px solid var(--border); padding: 6px 0; font-size: 12px; }
.r-item .r-stars { color: #f59e0b; font-size: 13px; }
.r-item .r-who { font-weight: 700; font-size: 11px; }
.r-item .r-sid { font-size: 10px; color: var(--muted); margin-left: 5px; font-weight: 400; }
.r-item .r-when { float: right; color: var(--muted); font-size: 10px; }
.r-item .r-text { margin-top: 2px; word-break: break-word; }
