* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --green: #328400;        /* logo green */
  --green-dark: #276800;
  --green-light: #e3f2d6;  /* tint of the logo green */
  --gold: #e8c81c;         /* logo gold */
  --bg-app: #f0f2f5;
  --bg-chat: #efeae2;
  --bubble-out: #e3f2d6;
  --bubble-in: #ffffff;
  --bubble-bot: #e7f3ff;
  --text-1: #111b21;
  --text-2: #667781;
  --border: #e9edef;
  --blue: #53bdeb;
  --danger: #d33;
  --warn-bg: #fff8e1;
  --warn-fg: #7a5c00;
}
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, Tahoma, Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-1);
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }

/* ---------- login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--green-dark) 0 220px, var(--bg-app) 220px);
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px 36px;
  width: min(92vw, 380px); text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.logo-img { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto; }
.login-card h1 { font-size: 20px; margin: 10px 0 4px; }
.login-sub { color: var(--text-2); font-size: 14px; margin-bottom: 22px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px; outline: none;
}
.login-card input:focus { border-color: var(--green); }
.login-card button[type=submit] {
  width: 100%; padding: 12px; border: 0; border-radius: 8px;
  background: var(--green); color: #fff; font-size: 16px; cursor: pointer;
}
.login-card button[type=submit]:hover { background: var(--green-dark); }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-error { margin-top: 12px; color: var(--danger); font-size: 14px; }

/* ---------- layout ---------- */
#app { display: flex; height: 100vh; max-width: 1900px; margin: 0 auto; }
#sidebar {
  width: 400px; min-width: 300px; background: #fff;
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
}
#main { flex: 1; display: flex; flex-direction: column; background: var(--bg-chat); position: relative; min-width: 0; }
#infoPanel {
  width: 340px; min-width: 300px; background: #fff; border-inline-start: 1px solid var(--border);
  display: flex; flex-direction: column;
}

/* ---------- sidebar ---------- */
.side-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-app); min-height: 60px;
}
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.side-user-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 12px; color: var(--text-2); display: inline-block; margin-inline-end: 6px; }
.provider-select {
  display: block; margin-top: 4px; max-width: 200px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 12.5px; color: var(--text-1); outline: none; cursor: pointer;
}
.provider-select:focus { border-color: var(--green); }
.provider-chip { font-size: 10.5px; padding: 1px 7px; border-radius: 10px; background: #eef2f5; color: var(--text-2); white-space: nowrap; }
.provider-chip.meta { background: #e7f3ff; color: #1b74b9; }
.side-actions { display: flex; align-items: center; gap: 4px; position: relative; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.badge-on { background: var(--green-light); color: var(--green-dark); }
.badge-off { background: #fde3e1; color: #c0392b; }
.badge-admin { background: #e7f3ff; color: #1b74b9; }
.badge-emp { background: #f0f2f5; color: var(--text-2); }
.badge-bot { background: #e7f3ff; color: #1b74b9; }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.icon-btn {
  border: 0; background: none; color: #54656f; cursor: pointer;
  padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.active { background: var(--green-light); color: var(--green-dark); }
.menu {
  position: absolute; top: 110%; inset-inline-start: 0; z-index: 30;
  background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.2);
  min-width: 220px; overflow: hidden;
}
.menu-end { inset-inline-start: auto; inset-inline-end: 0; }
.menu button, .menu a {
  display: block; width: 100%; text-align: start; padding: 12px 16px;
  border: 0; background: none; font-size: 14px; cursor: pointer; color: inherit; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--bg-app); }
.menu .danger { color: var(--danger); }
.search-wrap { padding: 8px 12px; background: #fff; display: flex; gap: 6px; align-items: center; }
.search-wrap input {
  flex: 1; padding: 9px 14px; border: 0; border-radius: 8px;
  background: var(--bg-app); font-size: 14px; outline: none;
}
.filters { display: flex; gap: 6px; padding: 4px 12px 6px; background: #fff; flex-wrap: wrap; }
.filters button {
  border: 0; background: var(--bg-app); color: var(--text-2); padding: 5px 12px; border-radius: 14px;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.filters button.active { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.filters .count { background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.label-filter { display: flex; gap: 6px; padding: 0 12px 8px; background: #fff; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.label-filter:empty { display: none; }
.label-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  background: var(--chip-bg, #eee); color: var(--chip-fg, #333); white-space: nowrap;
}
.label-chip.on { outline: 2px solid var(--chip-fg, #333); outline-offset: 1px; font-weight: 600; }
.label-chip.tiny { font-size: 10.5px; padding: 1px 7px; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  cursor: pointer; border-bottom: 1px solid #f5f6f6;
}
.chat-item:hover { background: var(--bg-app); }
.chat-item.active { background: var(--bg-app); }
.chat-item.needs-human { border-inline-start: 3px solid var(--gold); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: #dfe5e7;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; overflow: hidden;
}
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.chat-item-name {
  font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-name .pin { font-size: 12px; color: var(--text-2); margin-inline-start: 4px; }
.chat-item-time { font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.chat-item-time.unread { color: var(--green); font-weight: 600; }
.chat-item-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; gap: 6px; }
.chat-item-preview {
  font-size: 13.5px; color: var(--text-2); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-meta { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.chat-item-labels { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.assigned-chip {
  font-size: 11px; background: #e7f3ff; color: #1b74b9; padding: 1px 8px; border-radius: 10px;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.human-chip { font-size: 11px; background: var(--warn-bg); color: var(--warn-fg); padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.unread-badge {
  background: var(--green); color: #fff; font-size: 12px; min-width: 20px; height: 20px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  padding: 0 6px; flex-shrink: 0;
}
.list-empty { padding: 40px 20px; text-align: center; color: var(--text-2); font-size: 14px; line-height: 1.8; }
.sync-banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px;
  background: var(--warn-bg); color: var(--warn-fg); border-bottom: 1px solid #f3e4b0;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; flex-shrink: 0; }
.search-hit { display: block; padding: 10px 14px; border-bottom: 1px solid #f5f6f6; cursor: pointer; }
.search-hit:hover { background: var(--bg-app); }
.search-hit .sh-top { display: flex; justify-content: space-between; font-size: 13px; }
.search-hit .sh-name { font-weight: 600; }
.search-hit .sh-text { font-size: 13.5px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit mark { background: #fff3a8; padding: 0 1px; }

/* ---------- ticks ---------- */
.ticks { display: inline-flex; vertical-align: middle; margin-inline-end: 3px; }
.ticks svg { width: 16px; height: 11px; }
.ticks.t0, .ticks.t1, .ticks.t2 { color: #8696a0; } .ticks.t3 { color: var(--blue); }

/* ---------- chat area ---------- */
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-2); background: var(--bg-app); text-align: center; padding: 20px;
}
.empty-state h2 { font-weight: 500; color: #41525d; }
.empty-state h3 { font-weight: 400; color: var(--text-2); font-size: 16px; }
.empty-logo { width: 150px; height: 150px; object-fit: contain; opacity: .9; }
#chatView { display: flex; flex-direction: column; height: 100%; }
.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--bg-app); min-height: 60px; border-inline-start: 1px solid var(--border);
}
.back-btn { display: none; }
.chat-header-info { flex: 1; min-width: 0; cursor: pointer; }
.chat-header-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-sub { font-size: 12.5px; color: var(--text-2); }
.chat-header-sub .typing { color: var(--green-dark); font-weight: 600; }
.chat-header-actions { display: flex; align-items: center; gap: 4px; position: relative; }
.bot-toggle { font-size: 20px; filter: grayscale(1); opacity: .5; }
.bot-toggle.on { filter: none; opacity: 1; background: #e7f3ff; }
.viewing-badge { font-size: 11.5px; background: var(--warn-bg); color: var(--warn-fg); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.assign-wrap { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.assign-wrap select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; outline: none; max-width: 150px;
}
.human-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--warn-bg); color: var(--warn-fg); padding: 8px 16px; font-size: 13.5px; border-bottom: 1px solid #f3e4b0;
}
.messages {
  flex: 1; overflow-y: auto; padding: 20px 6%;
  display: flex; flex-direction: column; gap: 3px;
  background:
    linear-gradient(rgba(239,234,226,.93), rgba(239,234,226,.93)),
    repeating-linear-gradient(45deg, #d9d3c8 0 2px, transparent 2px 24px);
}
.day-divider {
  align-self: center; background: #fff; color: var(--text-2);
  font-size: 12px; padding: 5px 12px; border-radius: 8px; margin: 10px 0 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.sys-divider { align-self: center; background: var(--warn-bg); color: var(--warn-fg); font-size: 12px; padding: 4px 12px; border-radius: 8px; margin: 6px 0; }
.msg {
  max-width: 65%; padding: 6px 9px 8px; border-radius: 8px; position: relative;
  font-size: 14.2px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.08);
  word-wrap: break-word; white-space: pre-wrap;
}
.msg-in { background: var(--bubble-in); align-self: flex-start; border-start-start-radius: 0; }
.msg-out { background: var(--bubble-out); align-self: flex-end; border-start-end-radius: 0; }
.msg-out.msg-bot { background: var(--bubble-bot); }
.msg-sender { font-size: 12.5px; font-weight: 600; color: var(--green-dark); margin-bottom: 2px; }
.msg-agent { font-size: 11.5px; color: #1b74b9; margin-bottom: 2px; font-weight: 600; }
.msg-quote {
  border-inline-start: 3px solid var(--green); background: rgba(0,0,0,.05); padding: 5px 8px; border-radius: 6px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; white-space: normal; max-height: 60px; overflow: hidden;
}
.msg-meta { font-size: 11px; color: var(--text-2); float: left; margin-top: 6px; margin-inline-end: -2px; margin-inline-start: 8px; white-space: nowrap; }
.msg img.msg-image, .msg video {
  max-width: 320px; max-height: 320px; width: 100%; border-radius: 6px; display: block;
  cursor: pointer; margin-bottom: 4px; object-fit: cover;
}
.msg audio { max-width: 280px; display: block; }
.doc-card {
  display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.04);
  padding: 10px 12px; border-radius: 8px; text-decoration: none; color: inherit; margin-bottom: 4px;
}
.doc-card:hover { background: rgba(0,0,0,.08); }
.doc-icon { font-size: 26px; }
.doc-name { font-size: 13.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-pending { color: var(--text-2); font-size: 13px; }
.msg a { color: #027eb5; }

/* ---------- composer ---------- */
.composer {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 8px 12px; background: var(--bg-app); position: relative;
}
.composer textarea {
  flex: 1; border: 0; border-radius: 8px; padding: 11px 14px;
  font-size: 15px; resize: none; outline: none;
  max-height: 140px; background: #fff;
}
.send-btn { color: var(--green-dark); }
.mic-btn.recording { color: #fff; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.rec-bar {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #fff; border-radius: 8px; font-size: 14px;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-bar button { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.rec-bar .rec-send { color: var(--green-dark); font-weight: 600; }
.rec-bar .rec-cancel { color: var(--danger); }
.quick-popover {
  position: absolute; bottom: 64px; inset-inline-start: 12px; inset-inline-end: 12px; z-index: 20;
  background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-height: 260px; overflow-y: auto;
}
.quick-item { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f5f6f6; }
.quick-item:hover, .quick-item.sel { background: var(--bg-app); }
.quick-item .q-title { font-size: 13.5px; font-weight: 600; }
.quick-item .q-title code { font-weight: 400; color: var(--green-dark); background: #e8f5f0; padding: 0 5px; border-radius: 4px; font-size: 12px; }
.quick-item .q-text { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- info panel ---------- */
.panel-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 60px; background: var(--bg-app); font-weight: 600; }
.info-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.info-avatar { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto; background: #dfe5e7; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 42px; color: #fff; }
.info-avatar img { width: 100%; height: 100%; object-fit: cover; }
.info-name { text-align: center; font-size: 18px; font-weight: 600; border: 0; border-bottom: 1px dashed var(--border); padding: 6px; outline: none; background: none; width: 100%; }
.info-name:focus { border-bottom-color: var(--green); }
.info-phone { text-align: center; color: var(--text-2); font-size: 14px; margin-top: -8px; }
.info-section { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.info-section h4 { font-size: 13px; color: var(--text-2); font-weight: 600; }
.info-section input, .info-section textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; outline: none; width: 100%; resize: vertical; }
.info-section input:focus, .info-section textarea:focus { border-color: var(--green); }
.label-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--green); }
.note-add { display: flex; gap: 6px; align-items: flex-end; }
.note-add textarea { flex: 1; }
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note { background: #fffbe6; border: 1px solid #f3e4b0; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; white-space: pre-wrap; }
.note .note-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.note .note-meta button { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 11.5px; }

/* ---------- overlays / modals ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(17,27,33,.75); z-index: 100;
  display: flex; justify-content: center; padding: 20px; overflow-y: auto;
}
.overlay-card {
  background: #fff; border-radius: 12px; padding: 28px 32px; text-align: center;
  width: min(94vw, 460px); position: relative; margin: auto;
}
.overlay-card.wide { width: min(96vw, 760px); text-align: start; }
.overlay-card h2 { margin-bottom: 10px; font-size: 20px; }
.overlay-card p { color: var(--text-2); font-size: 14px; line-height: 1.7; }
.overlay-close { position: absolute; top: 10px; inset-inline-start: 10px; }
#qrBox { margin: 18px auto; min-height: 300px; display: flex; align-items: center; justify-content: center; }
#qrBox img { width: 300px; height: 300px; }
.overlay-note { font-size: 12.5px !important; }
.spinner {
  width: 44px; height: 44px; border: 4px solid var(--border); border-top-color: var(--green);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#lightbox { cursor: zoom-out; align-items: center; }
#lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }

.form { text-align: start; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.form label { font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.form input, .form select, .form textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; width: 100%; resize: vertical;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--green); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.btn {
  padding: 9px 18px; border: 0; border-radius: 8px; font-size: 14px; cursor: pointer; background: var(--bg-app); color: var(--text-1);
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); filter: none; }
.btn-danger { background: #fde3e1; color: #c0392b; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.form-error { color: var(--danger); font-size: 13px; }
.form-ok { color: var(--green-dark); font-size: 13px; }
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%);
  background: #111b21; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: 90vw;
}
[dir=rtl] .toast { transform: translateX(50%); }
.toast.warn { background: #7a5c00; }

/* ---------- admin page ---------- */
.admin-body { min-height: 100vh; background: var(--bg-app); }
.admin-top {
  background: var(--green-dark); color: #fff; padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.admin-top h1 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.admin-top h1 small { font-weight: 400; font-size: 13px; opacity: .85; }
.top-logo { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.admin-top a, .admin-top button { color: #fff; text-decoration: none; font-size: 14px; background: rgba(255,255,255,.15); border: 0; padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.admin-top .top-actions { display: flex; gap: 8px; align-items: center; }
.admin-tabs { display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.admin-tabs button { border: 0; background: none; padding: 14px 16px; font-size: 14.5px; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-tabs button.active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 600; }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; display: flex; flex-direction: column; gap: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.card { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card .num { font-size: 28px; font-weight: 700; color: var(--green-dark); }
.card .lbl { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.panel { background: #fff; border-radius: 12px; padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { font-size: 17px; font-weight: 600; }
.panel-head .sub { font-size: 13px; color: var(--text-2); font-weight: 400; }
.wa-status { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.wa-status .qr img { width: 240px; height: 240px; border: 1px solid var(--border); border-radius: 8px; }
.wa-status .info { flex: 1; min-width: 240px; line-height: 1.9; font-size: 14.5px; }
.wa-status .info b { font-weight: 600; }
table.users, table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th, table.users td, table.tbl th, table.tbl td { padding: 10px 8px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.users th, table.tbl th { color: var(--text-2); font-weight: 600; font-size: 13px; }
table.users tr.inactive td { opacity: .5; }
table.users td .actions, .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.per-user { display: flex; flex-wrap: wrap; gap: 8px; }
.per-user span { background: var(--bg-app); padding: 6px 12px; border-radius: 16px; font-size: 13px; }
.per-user b { color: var(--green-dark); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ccc; margin-inline-end: 6px; }
.online-dot.on { background: var(--green); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.settings-grid label, .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); }
.settings-grid input, .settings-grid select, .settings-grid textarea, .field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; width: 100%; color: var(--text-1); resize: vertical;
}
.settings-grid input:focus, .settings-grid select:focus, .settings-grid textarea:focus { border-color: var(--green); }
.full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.switch-big { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.switch-big input { width: 20px; height: 20px; accent-color: var(--green); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { flex-direction: row; align-items: center; gap: 4px; background: var(--bg-app); padding: 5px 10px; border-radius: 8px; cursor: pointer; color: var(--text-1); }
.days input { width: 16px; height: 16px; accent-color: var(--green); }
.test-chat { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg-chat); max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.test-chat .msg { max-width: 85%; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-stack { width: 100%; max-width: 40px; display: flex; flex-direction: column-reverse; height: 110px; justify-content: flex-start; }
.bar-stack div { width: 100%; }
.bar-in { background: var(--green); } .bar-out { background: #1b74b9; } .bar-bot { background: #9b59b6; }
.bar-lbl { font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 4px; vertical-align: middle; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; margin-inline-end: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #infoPanel { position: fixed; inset-inline-end: 0; top: 0; bottom: 0; z-index: 50; box-shadow: -4px 0 20px rgba(0,0,0,.15); }
}
@media (max-width: 760px) {
  #sidebar { width: 100%; min-width: 0; }
  #app.chat-open #sidebar { display: none; }
  #app:not(.chat-open) #main { display: none; }
  .back-btn { display: flex; }
  .messages { padding: 14px 4%; }
  .msg { max-width: 85%; }
  #infoPanel { width: 100%; }
  .assign-wrap { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- providers (admin) ---------- */
.providers-list { display: flex; flex-direction: column; gap: 12px; }
.provider-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.provider-card .p-main { flex: 1; min-width: 260px; }
.provider-card .p-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15.5px; flex-wrap: wrap; }
.provider-card .p-type { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: #eef2f5; color: var(--text-2); }
.provider-card .p-type.meta { background: #e7f3ff; color: #1b74b9; }
.provider-card .p-info { font-size: 13.5px; color: var(--text-2); line-height: 1.9; margin-top: 4px; }
.provider-card .p-qr img { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 8px; }
.provider-card .p-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.provider-card.disabled { opacity: .6; }
code.inline { background: var(--bg-app); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; direction: ltr; unicode-bidi: embed; }
