/* WhatsApp CRM - clean design system
   No external fonts, scripts, or images. All icons are inline SVG. */

:root {
  --brand-color: #4338ca;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eef2ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --sidebar: #0b1220;
  --sidebar-soft: #131d31;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 16px 38px rgba(15, 23, 42, 0.11);
  --font: "Noto Sans Bengali", "SolaimanLipi", "FreeSans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-color); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }
::selection { background: var(--brand-color); color: #fff; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-color) 40%, transparent); outline-offset: 2px; }

.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 700; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ---------- Loader ---------- */
.page-loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .4s var(--ease), visibility .4s var(--ease);
}
.page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-box { display: grid; justify-items: center; gap: 14px; }
.loader-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--brand-color);
  animation: spin .8s linear infinite;
}
.loader-label { color: var(--muted); font-size: .85rem; letter-spacing: .02em; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes softPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-soft) 25%, #eef2f7 50%, var(--surface-soft) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.side-overlay {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(2, 6, 23, .5);
  opacity: 0; visibility: hidden;
  transition: opacity .28s var(--ease), visibility .28s var(--ease);
}
.side-overlay.is-open { opacity: 1; visibility: visible; }
.side-nav {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: 268px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
  transition: transform .3s var(--ease);
}
.side-nav__brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-color); color: #fff;
  display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 8px 18px rgba(67,56,202,.35);
}
.brand-name { display: block; color: #fff; font-weight: 750; line-height: 1.2; }
.brand-tagline { display: block; color: #94a3b8; font-size: .74rem; margin-top: 3px; }
.side-nav__links { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 12px; color: #cbd5e1; text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); text-decoration: none; }
.nav-link.is-active { background: var(--brand-color); color: #fff; box-shadow: 0 8px 20px rgba(67,56,202,.3); }
.nav-link__label { font-weight: 600; font-size: .92rem; }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: #ef4444; color: #fff;
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
}
.nav-badge--warn { background: #f59e0b; }
.side-nav__foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); }

.main-area { margin-left: 268px; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 72px; padding: 0 28px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
}
.topbar__toggle { display: none; }
.topbar__title { font-weight: 750; font-size: 1.02rem; line-height: 1.2; }
.topbar__sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.topbar__meta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--line);
  color: var(--ink-2); font-size: .78rem; font-weight: 600;
}
.topbar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: softPulse 2.4s ease-in-out infinite; }
.content { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px; flex: 1; }
.app-footer {
  border-top: 1px solid var(--line); background: #fff;
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  color: var(--muted); font-size: .82rem;
}
.app-footer strong { color: var(--ink-2); }

.bottom-nav { display: none; }

/* ---------- Page ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin-bottom: 22px; animation: fadeUp .45s var(--ease) both;
}
.page-head h1 { margin: 0; font-size: clamp(1.4rem, 2.2vw, 1.8rem); letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
  animation: fadeUp .45s var(--ease) both;
}
.panel:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.panel--flush { padding: 0; overflow: hidden; }
.panel--tint { background: linear-gradient(180deg, var(--surface-tint), #fff 55%); border-color: color-mix(in srgb, var(--brand-color) 22%, var(--line)); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel__head h2 { margin: 0; font-size: 1.06rem; }
.panel__desc { margin: -6px 0 16px; color: var(--muted); font-size: .88rem; }
.panel__foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: grid; gap: 14px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field__label { font-size: .84rem; font-weight: 650; color: var(--ink-2); }
.field__hint { font-size: .76rem; color: var(--muted); }
.control {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.control:hover { border-color: color-mix(in srgb, var(--brand-color) 45%, var(--line-strong)); }
.control:focus { outline: none; border-color: var(--brand-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-color) 14%, transparent); }
.control[readonly] { background: var(--surface-soft); color: var(--ink-2); }
textarea.control { min-height: 96px; resize: vertical; line-height: 1.5; }
select.control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type="color"].control { padding: 6px; height: 44px; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-color); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-row--3 { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.form-row .field { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: var(--radius-sm); padding: 10px 16px;
  font-weight: 650; cursor: pointer; text-decoration: none;
  overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), filter .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15,23,42,.1); border-color: var(--brand-color); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--brand-color); border-color: var(--brand-color); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-soft); color: var(--ink); border-color: var(--line); }
.btn--sm { padding: 7px 11px; font-size: .82rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
.btn--send { width: 46px; height: 46px; padding: 0; border-radius: 12px; flex: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn:not(.btn--primary).is-loading::after { border-color: rgba(15,23,42,.18); border-top-color: var(--brand-color); }

/* ---------- Tags / notices ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--line);
  color: var(--ink-2); font-size: .74rem; font-weight: 650; white-space: nowrap;
}
.tag--ok { background: var(--success-soft); border-color: #bbf7d0; color: var(--success); }
.tag--danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.tag--warn { background: var(--warn-soft); border-color: #fde68a; color: var(--warn); }
.tag--info { background: var(--info-soft); border-color: #bae6fd; color: var(--info); }

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-soft); color: var(--ink-2); font-size: .9rem;
  animation: fadeUp .4s var(--ease) both;
}
.notice .i { width: 19px; height: 19px; margin-top: 2px; }
.notice--ok { background: var(--success-soft); border-color: #bbf7d0; color: var(--success); }
.notice--err { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.notice--warn { background: var(--warn-soft); border-color: #fde68a; color: var(--warn); }
.notice--info { background: var(--info-soft); border-color: #bae6fd; color: var(--info); }

/* ---------- Stats / steps ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  display: flex; align-items: center; gap: 14px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
  animation: fadeUp .45s var(--ease) both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-tint); color: var(--brand-color); display: grid; place-items: center; flex: none; }
.stat-value { font-size: 1.45rem; font-weight: 750; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .8rem; margin-top: 3px; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.step { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.step:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.step.is-done { background: var(--success-soft); border-color: #bbf7d0; }
.step.is-todo { background: var(--warn-soft); border-color: #fde68a; }
.step b { display: block; font-size: .88rem; }
.step span { display: block; color: var(--muted); font-size: .76rem; margin-top: 3px; }

/* ---------- Tables / lists ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--surface-soft); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .18s var(--ease); }
.data-table tbody tr:hover { background: var(--surface-tint); }
.definition-list { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; margin: 0; font-size: .9rem; }
.definition-list dt { color: var(--muted); font-weight: 600; }
.definition-list dd { margin: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-soft); }
.empty-state { padding: 32px 18px; text-align: center; color: var(--muted); }
.code-block { background: #0b1220; color: #e2e8f0; padding: 16px; border-radius: 12px; overflow: auto; font-size: .8rem; line-height: 1.5; max-height: 420px; white-space: pre-wrap; word-break: break-word; }

/* ---------- User rows ---------- */
.user-list { display: grid; }
.user-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); transition: background .2s var(--ease); }
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: var(--surface-soft); }
.user-row__name { font-weight: 750; font-size: 1rem; }
.user-row__meta { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.user-row__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.user-row__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: flex-start; }
.user-row__actions form { margin: 0; }
.user-row__extra { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 12px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form .control { width: auto; min-width: 120px; flex: 0 1 180px; }
.inline-form .control--wide { flex: 1 1 240px; }

details.disclosure { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
details.disclosure > summary { cursor: pointer; font-weight: 650; font-size: .86rem; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 8px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s var(--ease); }
details.disclosure[open] > summary::after { transform: rotate(-135deg); }
details.disclosure > div { margin-top: 12px; }

/* ---------- Brand preview ---------- */
.brand-preview { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.brand-preview__card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.brand-preview__bar { background: var(--sidebar); color: #fff; padding: 16px; display: flex; align-items: center; gap: 10px; }
.brand-preview__mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-color); display: grid; place-items: center; font-weight: 800; }
.brand-preview__body { padding: 18px; }
.brand-preview__title { font-weight: 750; font-size: 1.1rem; }
.brand-preview__sub { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.brand-preview__foot { border-top: 1px solid var(--line); padding: 12px 18px; color: var(--muted); font-size: .76rem; }

/* ---------- Auth / standalone ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(circle at 15% 10%, var(--surface-tint), transparent 38%), var(--bg); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 28px 16px; }
.auth-card { width: min(100%, 420px); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-hover); padding: 28px; animation: fadeUp .5s var(--ease) both; }
.auth-card__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-card h1 { margin: 0; font-size: 1.35rem; }
.auth-card__sub { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.auth-footer { padding: 16px; text-align: center; color: var(--muted); font-size: .8rem; }

/* ---------- Confirm modal / toast ---------- */
.confirm-modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 18px; background: rgba(2,6,23,.5); }
.confirm-modal__box { width: min(100%, 420px); background: #fff; border-radius: 16px; box-shadow: var(--shadow-hover); padding: 22px; animation: fadeUp .25s var(--ease) both; }
.confirm-modal__title { font-weight: 750; font-size: 1.05rem; margin-bottom: 8px; }
.confirm-modal__text { color: var(--ink-2); font-size: .9rem; margin-bottom: 20px; }
.confirm-modal__actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px); z-index: 160; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-hover); font-size: .86rem; opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s var(--ease); max-width: min(90vw, 460px); }
.toast.is-visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--danger); }

/* ---------- Chat / inbox ---------- */
.chat-page .content { padding-bottom: 24px; }
.inbox { display: grid; grid-template-columns: 330px minmax(0,1fr); height: calc(100vh - 190px); min-height: 520px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.inbox__side { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.inbox__head { padding: 18px; border-bottom: 1px solid var(--line); }
.inbox__head h2 { margin: 0; font-size: 1.05rem; }
.inbox__head p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.inbox__search { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.inbox__list { flex: 1; overflow-y: auto; }
.chat-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; transition: background .2s var(--ease), transform .2s var(--ease); }
.chat-item:hover { background: var(--surface-soft); transform: translateX(2px); text-decoration: none; }
.chat-item.is-active { background: var(--surface-tint); }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 750; flex: none; }
.chat-item__body { min-width: 0; flex: 1; }
.chat-item__top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item__time { color: var(--muted); font-size: .72rem; flex: none; }
.chat-item__snippet { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chat-item__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.unread-dot { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: var(--brand-color); color: #fff; display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.inbox__main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.thread-back { display: none; }
.thread-title { font-weight: 750; line-height: 1.2; }
.thread-sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.thread-body { flex: 1; overflow-y: auto; padding: 22px; background: var(--surface-soft); display: flex; flex-direction: column; gap: 10px; }
.day-sep { align-self: center; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: .74rem; padding: 5px 12px; border-radius: 999px; margin: 6px 0; }
.bubble { max-width: min(78%, 560px); padding: 11px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(15,23,42,.05); font-size: .92rem; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.bubble--in { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble--out { align-self: flex-end; background: var(--brand-color); color: #fff; border-color: var(--brand-color); border-bottom-right-radius: 4px; }
.bubble--failed { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.bubble__who { font-size: .72rem; font-weight: 700; opacity: .78; margin-bottom: 4px; }
.bubble__meta { display: flex; justify-content: flex-end; gap: 8px; font-size: .68rem; opacity: .7; margin-top: 6px; }
.bubble__img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16); padding: 8px 10px; border-radius: 8px; font-size: .82rem; }
.bubble--in .file-chip { background: var(--surface-soft); }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line-strong); border-radius: 12px; padding: 11px 14px; min-height: 46px; max-height: 140px; line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--brand-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-color) 14%, transparent); }
.thread-info { position: absolute; inset: 0 0 0 auto; width: min(100%, 380px); background: #fff; border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .3s var(--ease); z-index: 5; display: flex; flex-direction: column; box-shadow: -12px 0 30px rgba(15,23,42,.12); }
.thread-info.is-open { transform: translateX(0); }
.thread-info__head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-weight: 750; }
.thread-info__body { padding: 16px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.inbox-empty { margin: auto; text-align: center; color: var(--muted); padding: 32px; }
.inbox-empty .i { width: 42px; height: 42px; color: var(--line-strong); margin-bottom: 10px; }
.profile-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1023px) {
  .side-nav { transform: translateX(-100%); box-shadow: 12px 0 30px rgba(2,6,23,.25); }
  .side-nav.is-open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar__toggle { display: inline-flex; }
  .topbar__meta { display: none; }
  .content { padding: 18px 14px 96px; }
  .app-footer { padding: 14px 16px 84px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    height: 68px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); display: flex;
  }
  .bottom-nav a, .bottom-nav button { flex: 1; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 3px; font-size: .68rem; font-weight: 650; text-decoration: none; cursor: pointer; }
  .bottom-nav a.is-active, .bottom-nav button.is-active { color: var(--brand-color); }
  .bottom-nav .i { width: 20px; height: 20px; }
  .inbox { height: calc(100vh - 168px); min-height: 460px; }
}
@media (max-width: 900px) {
  .grid-3, .grid-2, .form-row, .form-row--3, .brand-preview { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.is-thread .inbox__side { display: none; }
  .inbox.is-thread .inbox__main { display: flex; }
  .thread-back { display: inline-flex; }
  .page-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 720px) {
  .panel { padding: 18px 16px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 12px; border-bottom: 1px solid var(--line); }
  .data-table td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; }
  .data-table td::before { content: attr(data-label); font-weight: 650; color: var(--muted); font-size: .74rem; }
  .definition-list { grid-template-columns: 1fr; gap: 4px; }
  .definition-list dd { margin-bottom: 8px; }
  .user-row { grid-template-columns: 1fr; }
  .user-row__actions { justify-content: flex-start; }
  .stat-grid, .steps, .grid-4 { grid-template-columns: 1fr; }
  .inline-form .control, .inline-form .control--wide { flex: 1 1 100%; width: 100%; }
  .app-footer { font-size: .76rem; }
  .thread-body { padding: 16px 12px; }
  .bubble { max-width: 92%; }
}
@media (max-width: 420px) {
  .topbar__sub { display: none; }
  .auth-card { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
