:root {
  --bg: #0a0b0e;
  --bg2: #0f1115;
  --panel: #13151a;
  --panel2: #181b21;
  --card: #1c1f26;
  --hover: #21252d;
  --line: #262a33;
  --line2: #323743;
  --text: #eef0f4;
  --text2: #b6bbc7;
  --muted: #858c9b;
  --accent: #ff8a2b;
  --accent2: #ffb067;
  --accent-bg: #2c1d12;
  --accent-line: #6b3f1c;
  --green: #22c97a;
  --green-bg: #10291e;
  --blue: #2aa7f0;
  --blue-bg: #0f2433;
  --red: #f0566b;
  --red-bg: #2e1218;
  --yellow: #f3c34d;
  --yellow-bg: #2c2410;
  --wa: #25d366;
  --tg: #2aa7f0;
  --radius: 12px;
  --shadow: 0 12px 40px #0007;
  --font:
    Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent2);
}
[hidden] {
  display: none !important;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a2e38;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.08s;
}
.btn:hover:not(:disabled) {
  background: var(--hover);
  border-color: #3d4351;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1b0f04;
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent2);
  border-color: var(--accent2);
}
.btn.danger {
  background: var(--red-bg);
  border-color: #6a2430;
  color: #ffc4cc;
}
.btn.danger:hover:not(:disabled) {
  background: #3d1820;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text2);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}
.btn.sm {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.btn.icon {
  width: 38px;
  padding: 0;
}
.btn.sm.icon {
  width: 30px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
textarea.input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #ff8a2b26;
}
.input::placeholder {
  color: #6b7280;
}
label.field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  user-select: none;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .tr {
  width: 38px;
  height: 22px;
  border-radius: 20px;
  background: #2b2f39;
  border: 1px solid var(--line2);
  position: relative;
  transition: background 0.15s;
  flex: none;
}
.switch .tr:after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cfd3db;
  transition: transform 0.15s;
}
.switch input:checked + .tr {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .tr:after {
  transform: translateX(16px);
  background: #fff;
}
.switch input:focus-visible + .tr {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: #262a33;
  color: var(--text2);
  white-space: nowrap;
}
.badge.green {
  background: var(--green-bg);
  color: #7ee7b2;
}
.badge.blue {
  background: var(--blue-bg);
  color: #8fd0f7;
}
.badge.red {
  background: var(--red-bg);
  color: #ff9aa8;
}
.badge.yellow {
  background: var(--yellow-bg);
  color: #f5d47e;
}
.badge.orange {
  background: var(--accent-bg);
  color: var(--accent2);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  display: inline-block;
  flex: none;
}
.dot.wa {
  background: var(--wa);
}
.dot.tg {
  background: var(--tg);
}
.dot.on {
  background: var(--green);
  box-shadow: 0 0 0 3px #22c97a22;
}
.dot.off {
  background: #4b5160;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.xs {
  font-size: 11px;
}
.mono {
  font-family: ui-monospace, Consolas, monospace;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.stack {
  display: grid;
  gap: 12px;
}
.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 70% 10%, #2a170a55, transparent),
    radial-gradient(700px 500px at 10% 90%, #0e2a3a44, transparent), var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.4px;
}
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ffb35f, #ff7a1a);
  color: #1d1005;
  font-weight: 900;
  font-size: 17px;
  box-shadow: 0 6px 20px #ff8a2b35;
  flex: none;
}
.login-card h1 {
  font-size: 22px;
  margin: 26px 0 4px;
  letter-spacing: -0.4px;
}
.login-card .btn {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
}
.login-err {
  color: #ff9aa8;
  font-size: 13px;
  min-height: 20px;
}

/* shell */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100vh;
}
.side {
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side .logo {
  padding: 20px 18px 18px;
}
.nav {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}
.nav .sec {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #5f6675;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--text2);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
}
.nav a:hover {
  background: var(--hover);
  color: var(--text);
}
.nav a.active {
  background: var(--accent-bg);
  color: var(--accent2);
}
.nav a.active:before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.nav svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.9;
}
.nav .count {
  margin-left: auto;
  background: var(--accent);
  color: #1b0f04;
  font-size: 11px;
  font-weight: 800;
  border-radius: 20px;
  padding: 0 7px;
  min-width: 20px;
  text-align: center;
}
.me {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
}
.me:hover {
  background: var(--panel);
}
.me .who {
  min-width: 0;
  flex: 1;
}
.me .who b {
  display: block;
  font-size: 13px;
}
.ws-state {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.menu {
  position: absolute;
  z-index: 50;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 210px;
}
.menu button {
  display: flex;
  width: 100%;
  gap: 9px;
  align-items: center;
  padding: 9px 11px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text);
}
.menu button:hover {
  background: var(--hover);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 5px 2px;
}
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 26px 40px;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.4px;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -0.2px;
}
.grid {
  display: grid;
  gap: 14px;
}
.g2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.g3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
}
.kpi .l {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.kpi .v {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-top: 4px;
}
.kpi .h {
  font-size: 11.5px;
  color: var(--muted);
}
.kpi.accent {
  border-color: var(--accent-line);
  background: linear-gradient(160deg, #2a1a0e, var(--panel) 70%);
}
.kpi.warn .v {
  color: var(--yellow);
}
.kpi.bad .v {
  color: var(--red);
}
.kpi.good .v {
  color: var(--green);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tr:last-child td {
  border-bottom: 0;
}
.tbl tr:hover td {
  background: #16181e;
}
.tbl-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg {
  width: 42px;
  height: 42px;
  opacity: 0.5;
  margin-bottom: 8px;
}

/* bars */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 6px 0 0;
}
.bars .b {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  height: 100%;
  position: relative;
  min-width: 0;
}
.bars .b i {
  display: block;
  border-radius: 4px 4px 0 0;
  min-height: 0;
}
.bars .b i.in {
  background: var(--accent);
}
.bars .b i.out {
  background: #4b5568;
}
.bars .b span {
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
}
.bars-wrap {
  padding-bottom: 22px;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}

/* inbox */
.inbox {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr) 320px;
}
.inbox.no-details {
  grid-template-columns: 350px minmax(0, 1fr);
}
.list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg2);
}
.list-head {
  padding: 16px 14px 10px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.list-head .title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.list-head .title h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.3px;
  flex: 1;
}
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px #0005;
}
.seg button .n {
  font-size: 10.5px;
  color: var(--accent2);
  margin-left: 3px;
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--text2);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover {
  border-color: #454b59;
  color: var(--text);
}
.chip.on {
  background: var(--accent-bg);
  border-color: var(--accent-line);
  color: var(--accent2);
}
.search {
  position: relative;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}
.search .input {
  padding-left: 34px;
  min-height: 38px;
}
.convs {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.conv {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid #1d2027;
  cursor: pointer;
  position: relative;
  align-items: center;
}
.conv:hover {
  background: #15171c;
}
.conv.sel {
  background: #1d1712;
}
.conv.sel:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.conv .nm {
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.conv .nm span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv .pv {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.conv.unread .pv {
  color: var(--text2);
  font-weight: 600;
}
.conv .meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  align-self: start;
  padding-top: 1px;
}
.conv .tm {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.conv.unread .tm {
  color: var(--accent2);
  font-weight: 700;
}
.conv .ub {
  background: var(--accent);
  color: #1b0f04;
  font-size: 11px;
  font-weight: 800;
  border-radius: 20px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
}
.conv .sub {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
}
.conv .sub .lbl {
  padding: 0 6px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 10.5px;
  white-space: nowrap;
}
.wait {
  color: var(--yellow) !important;
}
.av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2b2017;
  color: var(--accent2);
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  position: relative;
  flex: none;
  border: 1px solid #3d2a1b;
}
.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.av .ch {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg2);
}
.av .ch.wa {
  background: var(--wa);
}
.av .ch.tg {
  background: var(--tg);
}
.av.lg {
  width: 84px;
  height: 84px;
  font-size: 30px;
}
.av.md {
  width: 38px;
  height: 38px;
  font-size: 14px;
}
.more {
  padding: 14px;
  text-align: center;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-height: 64px;
}
.chat-head .t {
  min-width: 0;
  flex: 1;
}
.chat-head .t b {
  display: block;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head .t span {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  background: radial-gradient(800px 400px at 50% 0, #14161c, transparent);
}
.day-sep {
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 12px;
  margin: 12px 0 8px;
}
.msg {
  max-width: min(72%, 620px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.msg.in {
  align-self: flex-start;
}
.msg.out {
  align-self: flex-end;
  align-items: flex-end;
}
.msg.note {
  align-self: center;
  max-width: min(80%, 640px);
}
.bub {
  padding: 9px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
}
.msg.in .bub {
  background: var(--card);
  border: 1px solid var(--line2);
  border-bottom-left-radius: 4px;
}
.msg.out .bub {
  background: linear-gradient(150deg, #a9480f, #d86a1c);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.out.auto .bub {
  background: #262a34;
  color: var(--text2);
  border: 1px dashed #454b59;
}
.msg.out.phone .bub {
  background: #3a2716;
  color: #ffe3c9;
}
.msg.out.failed .bub {
  background: var(--red-bg);
  border: 1px solid #6a2430;
  color: #ffd0d6;
}
.msg.note .bub {
  background: var(--yellow-bg);
  border: 1px solid #5b4a17;
  color: #f8e3a3;
  border-radius: 10px;
}
.msg .mt {
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 4px;
}
.tick {
  font-size: 11px;
  letter-spacing: -3px;
  margin-right: 2px;
}
.tick.read {
  color: var(--blue);
}
.media {
  margin-top: 6px;
}
.media img,
.media video {
  display: block;
  max-width: min(320px, 100%);
  max-height: 300px;
  border-radius: 10px;
  background: #000;
  cursor: zoom-in;
}
.media audio {
  display: block;
  width: 260px;
  max-width: 100%;
}
.file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #00000030;
  border: 1px solid #ffffff1a;
  text-decoration: none;
  color: inherit;
  max-width: 300px;
}
.file svg {
  width: 26px;
  height: 26px;
  flex: none;
  opacity: 0.85;
}
.file b {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}
.chat-empty svg {
  width: 64px;
  height: 64px;
  opacity: 0.35;
  margin-bottom: 10px;
}
.composer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 14px 12px;
}
.comp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.comp-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.comp-tabs button.on {
  background: var(--card);
  color: var(--text);
}
.comp-tabs button.on.note {
  background: var(--yellow-bg);
  color: #f5d47e;
}
.comp-box {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 6px;
}
.comp-box.note {
  border-color: #5b4a17;
  background: #1d190c;
}
.comp-box textarea {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 180px;
  padding: 8px 6px;
  line-height: 1.45;
  color: var(--text);
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: 9px;
  padding: 5px 8px 5px 10px;
  font-size: 12px;
  margin-bottom: 8px;
  max-width: 100%;
}
.attach-chip b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.qr-pop {
  position: absolute;
  z-index: 40;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
  min-width: 300px;
  max-width: 520px;
}
.qr-pop button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.qr-pop button:last-child {
  border-bottom: 0;
}
.qr-pop button:hover,
.qr-pop button.on {
  background: var(--hover);
}
.qr-pop b {
  color: var(--accent2);
  font-size: 12.5px;
}
.qr-pop small {
  display: block;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.typing-off {
  opacity: 0.6;
}

.details {
  border-left: 1px solid var(--line);
  background: var(--bg2);
  overflow-y: auto;
  min-height: 0;
}
.det-top {
  padding: 22px 18px 18px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.det-top .av {
  margin: 0 auto 10px;
}
.det-top h3 {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.det-sec {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.det-sec h4 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 12.5px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.lbls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lbl-t {
  border: 1px solid var(--line2);
  background: transparent;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lbl-t i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.lbl-t.on {
  color: #fff;
}

/* channels */
.ch-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ch-top {
  display: flex;
  gap: 12px;
  align-items: center;
}
.ch-ic {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.ch-ic.wa {
  background: #0f2a1b;
  color: var(--wa);
}
.ch-ic.tg {
  background: var(--blue-bg);
  color: var(--tg);
}
.ch-ic svg {
  width: 22px;
  height: 22px;
}
.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  width: 240px;
  max-width: 100%;
  align-self: center;
}
.qr-box img {
  width: 100%;
  display: block;
}
.steps {
  font-size: 12.5px;
  color: var(--text2);
  margin: 0;
  padding-left: 18px;
}

/* modal + toast */
.modal-bg {
  position: fixed;
  inset: 0;
  background: #000a;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.12s;
}
.modal {
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal.wide {
  width: min(720px, 100%);
}
.modal h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.modal .acts {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: grid;
  gap: 8px;
}
.toast {
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 11px 15px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 380px;
  animation: up 0.18s;
}
.toast.err {
  border-left-color: var(--red);
}
.toast.ok {
  border-left-color: var(--green);
}
.lightbox {
  position: fixed;
  inset: 0;
  background: #000e;
  z-index: 150;
  display: grid;
  place-items: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 8px;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.spin {
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff30;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sp 0.7s linear infinite;
  display: inline-block;
}
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}
.back-btn {
  display: none;
}

@media (max-width: 1280px) {
  .inbox {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .inbox .details {
    display: none;
  }
  .inbox.show-details {
    grid-template-columns: 320px minmax(0, 1fr) 300px;
  }
  .inbox.show-details .details {
    display: block;
  }
}
@media (max-width: 960px) {
  .shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .side .logo span:not(.logo-mark),
  .nav .sec,
  .nav a span,
  .me .who,
  .nav .count {
    display: none;
  }
  .side .logo {
    padding: 16px 14px;
    justify-content: center;
  }
  .nav a {
    justify-content: center;
    padding: 10px;
  }
  .me {
    justify-content: center;
  }
  .inbox,
  .inbox.show-details {
    grid-template-columns: 1fr;
  }
  .inbox .chat,
  .inbox .details {
    display: none;
  }
  .inbox.has-conv .list {
    display: none;
  }
  .inbox.has-conv .chat {
    display: flex;
  }
  .inbox.has-conv.show-details .chat {
    display: none;
  }
  .inbox.has-conv.show-details .details {
    display: block;
  }
  .back-btn {
    display: inline-flex;
  }
  .page {
    padding: 16px;
  }
}
@media (max-width: 560px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 58px;
  }
  .side {
    grid-row: 2;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .side .logo,
  .me .who {
    display: none;
  }
  .nav {
    display: flex;
    flex-direction: row;
    padding: 4px;
    overflow-x: auto;
    gap: 2px;
  }
  .nav a {
    padding: 8px 12px;
  }
  .nav a.active:before {
    display: none;
  }
  .me {
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 8px 12px;
  }
  .main {
    grid-row: 1;
  }
  .msg {
    max-width: 88%;
  }
  .chat-actions .lbl-txt {
    display: none;
  }
  .msgs {
    padding: 12px;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .g2,
  .g3 {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
