:root {
  --bg: #f5f6fa; --surface: #fff; --surface-2: #f8f9fc; --border: #e5e7ef; --border-2: #d6d9e4;
  --ink: #0f172a; --ink-2: #475569; --ink-3: #8a94a8;
  --primary: #4f46e5; --primary-ink: #fff; --primary-soft: rgba(79, 70, 229, .09);
  --good-soft: rgba(34, 197, 94, .12); --warn-soft: rgba(245, 158, 11, .14); --bad-soft: rgba(239, 68, 68, .12); --info-soft: rgba(56, 189, 248, .14);
  --good-ink: #15803d; --warn-ink: #b45309; --bad-ink: #b91c1c; --info-ink: #0369a1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .22);
  --sk-base: #eceef4; --sk-shine: rgba(255, 255, 255, .7);
  --side: 248px;
  color-scheme: light;
}

body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); }
.boot { height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #0ea5e9, #6366f1); animation: bootPulse 1s ease-in-out infinite alternate; }
@keyframes bootPulse { to { transform: scale(.85); opacity: .6; } }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, rgba(99, 102, 241, .18), transparent), radial-gradient(900px 500px at 110% 110%, rgba(14, 165, 233, .15), transparent), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); animation: pop .5s var(--ease-spring); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.login-card h1 { font-size: 22px; margin: 18px 0 4px; letter-spacing: -.02em; }
.login-card p { color: var(--ink-2); margin: 0 0 22px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--ink); }
.mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #0ea5e9, #6366f1); flex: none; }
.mark svg { width: 20px; height: 20px; fill: #fff; }
.side-brand b { display: block; font-size: 15px; }
.side-brand small { color: var(--ink-3); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav .badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--primary); color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.main { min-width: 0; padding: 24px clamp(16px, 3vw, 36px) 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--ink-2); }
.page { animation: fadeUp .4s var(--ease) both; }
.mobile-bar { display: none; }

/* ---------- primitives ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: none; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 14px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { color: var(--bad-ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; height: 42px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 14px; font-weight: 700; }
.card-title small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stat { padding: 16px 18px; }
.stat-label { color: var(--ink-2); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { color: var(--ink-3); font-size: 12px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .8s var(--ease); }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--border-2); transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease-spring); }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--info); outline-offset: 2px; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info-ink); border-color: transparent; }
.tag.primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: dotPulse 1.4s infinite; }
@keyframes dotPulse { 50% { opacity: .3; } }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--primary-soft); color: var(--primary); }
.tabs .count { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr.click { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; stroke: currentColor; fill: none; stroke-width: 1.5; margin-bottom: 8px; opacity: .7; }
.empty b { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 2px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; background: var(--warn-soft); color: var(--warn-ink); border: 1px solid transparent; font-weight: 500; }
.banner svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; }
.banner .btn { margin-left: auto; }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 13px; position: relative; }
.avatar.working::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--good); animation: ringA 1.4s infinite; }
@keyframes ringA { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }

/* agents */
.floor-group { margin-bottom: 18px; }
.floor-group-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.floor-chip { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #0b1220; }
.floor-group-head h3 { margin: 0; font-size: 15px; }
.agent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.agent { padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: transform .2s var(--ease), box-shadow .2s; }
.agent:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.agent-top { display: flex; gap: 12px; align-items: center; }
.agent-top b { display: block; font-size: 14.5px; }
.agent-top small { color: var(--ink-3); font-size: 12px; }
.agent-top .switch { margin-left: auto; }
.agent-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.agent-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.agent-stats div { background: var(--surface-2); border-radius: 10px; padding: 7px 9px; }
.agent-stats b { display: block; font-size: 13.5px; }
.agent-stats small { color: var(--ink-3); font-size: 11px; }
.agent-actions { display: flex; gap: 6px; }
.agent-actions .btn:first-child { flex: 1; }

/* content */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.content-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; animation: fadeUp .4s var(--ease) both; }
.content-card h4 { margin: 0; font-size: 14px; line-height: 1.35; }
.content-body { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; max-height: 220px; overflow: auto; line-height: 1.55; }
.content-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; }

/* markdown */
.md { line-height: 1.65; font-size: 14px; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; line-height: 1.3; letter-spacing: -.01em; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { margin: 8px 0 12px; border: 1px solid var(--border); border-radius: 8px; }

/* modal & toast */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 24, .5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px 16px; overflow-y: auto; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(640px, 100%); background: var(--surface); border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .35s var(--ease-spring); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
#toasts { position: fixed; z-index: 60; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: toastIn .4s var(--ease-spring); max-width: min(420px, calc(100vw - 32px)); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.toast.err i { background: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed time { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.floor-mini { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.floor-mini:last-child { border-bottom: 0; }
.floor-mini .people { margin-left: auto; display: flex; gap: 4px; }
.floor-mini .people i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-2); }
.floor-mini .people i.idle { background: var(--info); } .floor-mini .people i.working { background: var(--good); animation: dotPulse 1s infinite; }
.code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.skill { padding: 12px 14px; }
.skill b { font-size: 13.5px; display: block; }
.skill p { margin: 4px 0 0; color: var(--ink-3); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .mobile-bar b { font-size: 15px; }
  .main { padding-top: 18px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; } .stat-val { font-size: 21px; } .agent-list, .content-grid { grid-template-columns: 1fr; } }

/* detail views */
.kv-grid { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: 13.5px; align-items: baseline; }
.kv-grid > div:nth-child(odd) { color: var(--ink-3); }
.detail-body { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; max-height: 50vh; overflow: auto; }
.cell-clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .kv-grid { grid-template-columns: 1fr; gap: 2px; } .kv-grid > div:nth-child(even) { margin-bottom: 8px; } .cell-clip { max-width: 180px; } }

/* ---------- inbox (WhatsApp / Messenger style) ---------- */
.inbox { display: grid; grid-template-columns: 360px 1fr; height: calc(100dvh - 120px); min-height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.ib-side { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.ib-tools { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--border); }
.ib-search { height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 12px; width: 100%; font: inherit; }
.ib-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ib-chips button { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.ib-chips button.on { background: #dcf8c6; border-color: #b7e4a0; color: #075e54; }
.ib-chips button:disabled { opacity: .5; cursor: not-allowed; }
.ib-list { flex: 1; overflow-y: auto; }
.ib-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.ib-item:hover { background: var(--surface-2); }
.ib-item.on { background: #f0f2f5; }
.ib-av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; position: relative; flex: none; }
.ib-av .ch { position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-size: 10px; }
.ib-item b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item .pv { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item .meta { text-align: right; font-size: 11.5px; color: var(--ink-3); display: grid; gap: 4px; justify-items: end; }
.ib-item.unread .meta { color: #25d366; font-weight: 700; }
.ib-item.unread b { font-weight: 800; }
.ib-unread { min-width: 20px; height: 20px; border-radius: 99px; background: #25d366; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }
.ib-flag { font-size: 10.5px; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 99px; padding: 1px 7px; }
.ib-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #efeae2; background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 18px 18px; }
.ib-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #f0f2f5; border-bottom: 1px solid var(--border); }
.ib-head .ib-av { width: 40px; height: 40px; }
.ib-head b { display: block; font-size: 15px; }
.ib-head small { color: var(--ink-2); font-size: 12px; }
.ib-head .acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 2px; }
.ib-day { align-self: center; background: #fff; color: var(--ink-2); font-size: 12px; padding: 4px 10px; border-radius: 8px; margin: 10px 0; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.bub { max-width: min(65%, 560px); padding: 7px 10px 6px; border-radius: 10px; font-size: 14px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word; position: relative; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); margin-top: 6px; }
.bub + .bub.same { margin-top: 2px; }
.bub.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.bub.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.bub.out.bot { background: #e7e3ff; }
.bub.failed { background: #fee2e2; }
.bub .t { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: #667781; }
.bub .who { display: block; font-size: 11.5px; font-weight: 700; margin-bottom: 2px; color: #6d28d9; }
.bub.out:not(.bot) .who { color: #075e54; }
.bub .subj { display: block; font-weight: 700; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.bub a { color: #027eb5; }
.ib-comp { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; background: #f0f2f5; border-top: 1px solid var(--border); }
.ib-comp textarea { flex: 1; resize: none; border: 0; outline: none; border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 14.5px; max-height: 160px; background: #fff; }
.ib-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.ib-send:disabled { background: #b3d9d0; cursor: default; }
.ib-send svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.ib-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink-2); padding: 30px; background: #f8f9fa; }
.ib-empty b { display: block; font-size: 22px; color: var(--ink); margin: 14px 0 6px; font-weight: 600; }
.ib-banner { margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; background: #fff7d6; color: #8a5a00; display: flex; gap: 10px; align-items: center; }
.ib-banner .btn { margin-left: auto; }
.ib-back { display: none; }
.ch-web { background: #0084ff; } .ch-email { background: #ea4335; } .ch-wa { background: #25d366; } .ch-threads { background: #000; } .ch-instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); } .ch-tiktok { background: #111; }
.set-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 16px; }
.set-tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; }
.set-tabs button.on { color: var(--primary); border-color: var(--primary); }
.ch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ch-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.ch-card .ib-av { width: 34px; height: 34px; font-size: 14px; }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: calc(100dvh - 140px); }
  .inbox.chat .ib-side { display: none; }
  .inbox:not(.chat) .ib-main { display: none; }
  .ib-back { display: inline-flex; }
  .ib-msgs { padding: 14px 10px; }
  .bub { max-width: 85%; }
  .ch-grid { grid-template-columns: 1fr 1fr; }
}
