:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f9fbfc;
  --line: #d9e1e7;
  --text: #17212b;
  --muted: #687784;
  --brand: #0c7c59;
  --brand-dark: #075e54;
  --danger: #bf2c34;
  --focus: rgba(12, 124, 89, .22);
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; }
button {
  border: 0;
  background: var(--brand);
  color: white;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}
button:hover { background: #096c4d; }
button.secondary { background: #edf2f5; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.icon { width: 36px; padding: 0; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  outline: none;
}
textarea { resize: none; min-height: 42px; max-height: 120px; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.login-screen { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 430px) 1fr; }
.login-panel { background: var(--panel); padding: 42px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.login-art { background: linear-gradient(rgba(7, 94, 84, .78), rgba(7, 94, 84, .78)), url("https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1600&q=80"); background-size: cover; background-position: center; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: white; font-weight: 800; }
.brand-name { font-size: 22px; font-weight: 750; }
.muted { color: var(--muted); }
.error { background: #fff0f1; color: var(--danger); border: 1px solid #f4c7cb; padding: 10px 12px; border-radius: 6px; margin: 12px 0; }
.app { height: 100%; display: grid; grid-template-columns: 220px 1fr; }
.nav { background: #10212c; color: #dbe7ee; padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.nav .brand { margin: 0 4px 12px; }
.nav .brand-name { color: white; font-size: 18px; }
.nav button { background: transparent; color: #dbe7ee; border-radius: 6px; text-align: left; display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.nav button.active, .nav button:hover { background: rgba(255,255,255,.1); }
.nav-spacer { flex: 1; }
.main { min-width: 0; display: grid; grid-template-rows: 58px 1fr; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.workspace { min-height: 0; overflow: hidden; }
.page { height: 100%; padding: 16px; overflow: auto; }
.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.metric { font-size: 28px; font-weight: 750; margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.chat { height: 100%; display: grid; grid-template-columns: 340px minmax(0, 1fr) 310px; background: var(--panel); }
.conversation-list { min-height: 0; border-right: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr; }
.conversation-search { padding: 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.conversation-items { overflow: auto; }
.conversation-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eef2f4; cursor: pointer; }
.conversation-item:hover, .conversation-item.active { background: #eef7f3; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: white; display: grid; place-items: center; font-weight: 750; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.badge { min-width: 20px; height: 20px; border-radius: 20px; background: var(--brand); color: white; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.message-panel { min-width: 0; display: grid; grid-template-rows: 58px 1fr auto; background: #e9eee9; }
.message-header { background: var(--brand-dark); color: white; display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.header-actions { margin-left: auto; display: flex; gap: 8px; }
.message-body { overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.bubble-wrap { display: flex; }
.bubble-wrap.me { justify-content: flex-end; }
.bubble { max-width: min(680px, 72%); border-radius: 8px; background: white; padding: 8px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08); overflow-wrap: anywhere; }
.bubble-wrap.me .bubble { background: #d9f6c7; }
.bubble-meta { color: var(--muted); font-size: 11px; text-align: right; margin-top: 4px; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; background: var(--panel-2); border-top: 1px solid var(--line); }
.side-panel { border-left: 1px solid var(--line); background: var(--panel); padding: 14px; overflow: auto; }
.kv { display: grid; gap: 4px; margin-bottom: 14px; }
.kv label { font-size: 12px; color: var(--muted); }
.empty { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 12px; font-size: 14px; }
.table th { background: var(--panel-2); color: var(--muted); font-weight: 650; }
.qr { max-width: 280px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 10px; }
.status-dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; background: #9aa6ad; margin-right: 6px; }
.status-dot.on { background: var(--brand); }
@media (max-width: 1000px) {
  .app { grid-template-columns: 70px 1fr; }
  .nav .brand-name, .nav span.label { display: none; }
  .chat { grid-template-columns: 300px minmax(0, 1fr); }
  .side-panel { display: none; }
}
@media (max-width: 720px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-spacer { display: none; }
  .chat { grid-template-columns: 1fr; }
  .conversation-list { display: none; }
}
