:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #12213a;
  --muted: #64748b;
  --border: #dce4ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #087a55;
  --success-soft: #e8f8f1;
  --warning: #9a5b08;
  --warning-soft: #fff6dc;
  --danger: #c42b35;
  --danger-soft: #fff0f1;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
  --radius: 16px;
  --space-card: 22px;
  --space-grid: 18px;
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-width: 320px; font-size: 16px; line-height: 1.55; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(37, 99, 235, .32); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 2000; padding: 10px 14px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); }
.skip-link:focus { top: 16px; }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 24px 18px; background: #0d1b33; color: #d9e4f4; display: flex; flex-direction: column; z-index: 100; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 30px; text-decoration: none; color: white; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg, #48a7ff, #2563eb); box-shadow: 0 10px 24px rgba(37, 99, 235, .35); }
.brand-mark svg { width: 24px; fill: white; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { font-size: 17px; }.brand small { color: #8fa6c8; font-size: 13px; margin-top: 2px; }
nav { display: grid; gap: 5px; }
.nav-item { min-height: 46px; display: flex; gap: 12px; align-items: center; padding: 10px 13px; border-radius: 11px; color: #aebed4; text-decoration: none; font-size: 14px; font-weight: 600; transition: background .18s ease, color .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: #1e3a67; color: white; }
.nav-dot { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 3px; }
.nav-item.active .nav-dot { background: #60a5fa; border-color: #60a5fa; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.09); }
.admin-chip { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.admin-chip-main { flex: 1; min-width: 0; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; background: #244a80; border-radius: 50%; color: white; font-weight: 700; flex-shrink: 0; }
.admin-chip small, .admin-chip strong, .admin-chip .bot-meta { display:block; }
.admin-chip strong { font-size:13px; }
.admin-chip .bot-meta { color:#879bb9; font-size:11px; font-variant-numeric: tabular-nums; }
.main-column { min-width: 0; }
main { width: min(1480px, 100%); margin: 0 auto; padding: 34px 36px 64px; }
.mobile-header { display: none; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-header h1 { margin: 0; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.04em; line-height: 1.2; }
.page-header p { margin: 8px 0 0; color: var(--muted); max-width: 720px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 650; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.button:hover { border-color: #aabbd0; box-shadow: 0 5px 14px rgba(15,23,42,.07); }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--primary); border-color: var(--primary); color: white; }.button-primary:hover { background:var(--primary-dark); border-color:var(--primary-dark); }
.button-danger { color: var(--danger); border-color: #f0b9bd; }.button-danger:hover { background: var(--danger-soft); }
.button-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.15); }.button-full { width:100%; }
.button-small { min-height: 38px; padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.icon-button { width:44px; height:44px; display:grid; place-items:center; border:1px solid var(--border); background:white; border-radius:10px; cursor:pointer; }
.icon-button svg { width:22px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.grid { display:grid; gap:var(--space-grid); }
.grid-stats { display:flex; flex-wrap:wrap; gap:var(--space-grid); }
.grid-stats > .stat-card { flex:1 1 0; min-width:0; }
.grid-2 { grid-template-columns:repeat(2, minmax(0, 1fr)); align-items:stretch; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 1px 2px rgba(15,23,42,.02); display:flex; flex-direction:column; min-width:0; min-height:0; }
.card-header { padding:var(--space-card); border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:16px; flex-shrink:0; }
.grid-2 > .card > .card-header { min-height:88px; }
.card-header h2, .card-header h3 { margin:0; font-size:18px; letter-spacing:-.02em; }.card-header p { margin:3px 0 0; color:var(--muted); font-size:13px; }
.card-body { padding:var(--space-card); flex:1; display:flex; flex-direction:column; min-height:0; }
.card-body > .actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:auto; }
.card-body > .actions > .button, .card-body > .actions > form { flex:1 1 0; min-width:148px; margin:0; }
.card-body > .actions > form { display:flex; }
.card-body > .actions > form .button { width:100%; }
.card-body > .empty-state { flex:1; display:flex; flex-direction:column; justify-content:center; }
.stat-card { padding:var(--space-card); min-height:132px; }
.stat-label { color:var(--muted); font-size:13px; font-weight:650; }
.stat-value { font-size:32px; font-weight:750; letter-spacing:-.04em; margin-top:9px; }
.stat-meta { color:var(--muted); font-size:12px; line-height:1.35; margin-top:auto; min-height:2.7em; }
.stat-value-small { font-size:26px; }
.toolbar { display:flex; gap:10px; align-items:end; flex-wrap:wrap; padding:16px; background:var(--surface); border:1px solid var(--border); border-radius:14px; margin-bottom:16px; }
.toolbar .field { flex:1 1 190px; margin:0; }.toolbar .field.search { flex-basis:320px; }
.field { display:grid; gap:7px; margin-bottom:17px; }.field label, .fieldset-label { font-size:13px; font-weight:700; color:#334155; }
.field input, .field select, .field textarea, .input { width:100%; min-height:46px; border:1px solid #cbd7e5; border-radius:11px; padding:10px 13px; background:white; color:var(--text); }
.field textarea { min-height:120px; resize:vertical; }.field small, .help { color:var(--muted); font-size:12px; }
.field-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.checkbox { display:flex; gap:9px; align-items:flex-start; min-height:44px; padding:9px 0; }.checkbox input { width:18px; height:18px; margin-top:3px; accent-color:var(--primary); }
.fieldset { border:1px solid var(--border); border-radius:13px; padding:16px; margin:0 0 18px; }.fieldset legend { padding:0 8px; font-size:13px; font-weight:700; }
.check-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; max-height:360px; overflow:auto; padding-right:5px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th { padding:12px 16px; text-align:left; background:#f7f9fc; color:#52647d; font-size:11px; text-transform:uppercase; letter-spacing:.055em; border-bottom:1px solid var(--border); }
td { padding:15px 16px; border-bottom:1px solid #e9eef5; vertical-align:top; } tr:last-child td { border-bottom:0; }
.primary-text { font-weight:700; color:var(--text); }.secondary-text { color:var(--muted); font-size:12px; margin-top:2px; }
.badge { display:inline-flex; align-items:center; min-height:26px; padding:3px 9px; border-radius:999px; font-size:11px; font-weight:750; text-transform:capitalize; background:var(--surface-soft); color:#53657e; }
.badge-success { background:var(--success-soft); color:var(--success); }.badge-warning { background:var(--warning-soft); color:var(--warning); }.badge-danger { background:var(--danger-soft); color:var(--danger); }.badge-info { background:var(--primary-soft); color:var(--primary-dark); }
.alert { padding:13px 16px; border-radius:12px; margin-bottom:18px; border:1px solid; }.alert-success { background:var(--success-soft); border-color:#b6e8d4; color:#075d42; }.alert-error { background:var(--danger-soft); border-color:#f1bec2; color:#9f1f2a; }.alert-info { background:var(--primary-soft); border-color:#c6d8ff; color:#174ba4; }
.empty-state { padding:48px 24px; text-align:center; color:var(--muted); }.empty-state strong { display:block; color:var(--text); margin-bottom:6px; font-size:17px; }
.code { font-family:"SFMono-Regular", Consolas, monospace; font-size:12px; word-break:break-all; }
.split-layout { display:grid; grid-template-columns:minmax(0, 1fr) 330px; gap:18px; align-items:start; }.sticky-card { position:sticky; top:22px; }
.timeline { display:grid; gap:12px; }.message { max-width:780px; padding:14px 16px; border:1px solid var(--border); border-radius:14px; background:white; }.message.outbound { margin-left:auto; background:var(--primary-soft); border-color:#c8d8fb; }.message-meta { display:flex; justify-content:space-between; gap:15px; color:var(--muted); font-size:11px; margin-bottom:6px; }.message-body { white-space:pre-wrap; word-break:break-word; }
.message-actions { margin-top:10px; }
.tg-media-card { display:flex; align-items:center; gap:12px; max-width:360px; padding:10px 12px; border-radius:12px; background:linear-gradient(145deg,#1f4f86,#2563eb); color:#fff; text-decoration:none; box-shadow:0 8px 18px rgba(37,99,235,.22); transition:transform .15s ease, box-shadow .15s ease; }
.tg-media-card:hover { transform:translateY(-1px); box-shadow:0 12px 24px rgba(37,99,235,.28); color:#fff; }
.tg-media-card-compact { max-width:100%; margin-top:6px; }
.tg-media-thumb-wrap { position:relative; width:48px; height:48px; flex-shrink:0; border-radius:10px; overflow:hidden; background:rgba(255,255,255,.12); }
.tg-media-thumb { width:100%; height:100%; object-fit:cover; display:block; }
.tg-media-thumb-wrap-video .tg-media-play { position:absolute; inset:0; display:grid; place-items:center; background:rgba(15,23,42,.28); }
.tg-media-thumb-wrap-video .tg-media-play::before { content:''; width:0; height:0; border-top:7px solid transparent; border-bottom:7px solid transparent; border-left:11px solid #fff; margin-left:3px; }
.tg-media-icon { width:48px; height:48px; display:grid; place-items:center; flex-shrink:0; border-radius:10px; background:rgba(255,255,255,.14); color:#dbeafe; }
.tg-media-info { min-width:0; display:grid; gap:2px; }
.tg-media-name { font-size:14px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tg-media-size { font-size:12px; color:rgba(255,255,255,.78); }
.tg-media-caption { margin-top:8px; white-space:pre-wrap; word-break:break-word; }
.message.outbound .tg-media-card { background:linear-gradient(145deg,#1d4ed8,#3b82f6); }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
html:has(.messages-workspace),
body:has(.messages-workspace) {
  height:100dvh;
  max-height:100dvh;
  overflow:hidden;
}
.app-shell:has(.messages-workspace) {
  height:100dvh;
  max-height:100dvh;
  min-height:0;
  overflow:hidden;
}
.main-column:has(.messages-workspace) {
  display:flex;
  flex-direction:column;
  height:100dvh;
  max-height:100dvh;
  min-height:0;
  overflow:hidden;
}
main:has(.messages-workspace) {
  width:100%;
  max-width:none;
  margin:0;
  padding:0;
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  overflow:hidden;
}
main:has(.messages-workspace) .alert { margin:12px 16px 0; flex-shrink:0; }
.messages-workspace {
  display:grid;
  grid-template-columns:minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows:minmax(0, 1fr);
  flex:1;
  min-height:0;
  border:0;
  border-radius:0;
  overflow:hidden;
  background:#0e1621;
}
.messages-workspace > * { min-height:0; }
.messages-chat-list {
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  overflow:hidden;
  background:#17212b;
  color:#e8eef5;
  border-right:1px solid #0e1621;
}
.messages-search { padding:10px 12px; border-bottom:1px solid rgba(0,0,0,0.18); flex-shrink:0; }
.messages-search-inner { position:relative; display:flex; align-items:center; }
.messages-search-icon { position:absolute; left:12px; color:#6c7883; pointer-events:none; }
.messages-search input {
  width:100%;
  min-height:36px;
  border:0;
  border-radius:18px;
  padding:6px 14px 6px 36px;
  background:#242f3d;
  color:#f5f5f5;
  font-size:13.5px;
  outline:none;
  transition:background .15s ease, box-shadow .15s ease;
}
.messages-search input::placeholder { color:#6c7883; }
.messages-search input:focus { background:#1d2733; box-shadow:0 0 0 2px rgba(82,136,193,.4); }
.messages-chat-scroll { flex:1; overflow:auto; min-height:0; padding:4px 0; }
.messages-chat-row {
  display:flex;
  gap:11px;
  align-items:center;
  padding:10px 12px;
  text-decoration:none;
  color:inherit;
  border-bottom:0;
  border-radius:10px;
  margin:2px 6px;
  transition:background .15s ease;
}
.messages-chat-row:hover { background:#202b36; }
.messages-chat-row.is-active { background:#2b5278; }
.messages-avatar {
  width:48px;
  height:48px;
  border-radius:50%;
  display:grid;
  place-items:center;
  flex-shrink:0;
  background:#5288c1;
  color:#fff;
  font-weight:600;
  font-size:17px;
  text-transform:uppercase;
  user-select:none;
}
.messages-avatar-tone-0 { background:#5288c1; }
.messages-avatar-tone-1 { background:#e17076; }
.messages-avatar-tone-2 { background:#7fa851; }
.messages-avatar-tone-3 { background:#e0964d; }
.messages-avatar-tone-4 { background:#65aadd; }
.messages-avatar-tone-5 { background:#a67dcb; }
.messages-avatar-tone-6 { background:#d0709f; }
.messages-avatar-tone-7 { background:#4ca3a7; }
.messages-chat-copy { min-width:0; flex:1; display:grid; gap:2px; }
.messages-chat-top { display:flex; justify-content:space-between; gap:8px; align-items:baseline; }
.messages-chat-top strong { font-size:14.5px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.messages-chat-top time { color:#7f91a4; font-size:11.5px; font-weight:400; flex-shrink:0; }
.messages-chat-preview {
  color:#7f91a4;
  font-size:13px;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  margin-top:2px;
}
.messages-chat-row.is-active .messages-chat-preview,
.messages-chat-row.is-active .messages-chat-top time { color:#c9daf0; }
.messages-empty-list { padding:28px 18px; text-align:center; color:#7f91a4; font-size:13px; }
.messages-thread {
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  height:100%;
  overflow:hidden;
  background:#0e1621;
}
.messages-thread-header {
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px 18px;
  height:56px;
  background:#17212b;
  border-bottom:1px solid #0e1621;
  color:#e8eef5;
  flex-shrink:0;
}
.messages-thread-header .messages-avatar { width:40px; height:40px; font-size:15px; }
.messages-thread-title { min-width:0; }
.messages-thread-header h1 { margin:0; font-size:15px; font-weight:600; color:#fff; letter-spacing:-.01em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.messages-thread-header p { margin:1px 0 0; color:#7f91a4; font-size:12.5px; text-transform:capitalize; }
.messages-thread-actions { margin-left:auto; display:flex; gap:4px; }
.tg-header-btn {
  width:36px;
  height:36px;
  border:0;
  background:transparent;
  color:#7f91a4;
  border-radius:50%;
  display:grid;
  place-items:center;
  cursor:pointer;
  transition:color .15s ease, background .15s ease;
}
.tg-header-btn:hover { color:#fff; background:rgba(255,255,255,.08); }
.messages-thread-scroll {
  flex:1;
  overflow-x:auto;
  overflow-y:auto;
  min-height:0;
  min-width:0;
  padding:12px 16px 16px;
  display:flex;
  flex-direction:column;
  gap:0;
  background-color:#0e1621;
  background-image:radial-gradient(circle at 50% 50%, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size:20px 20px;
  scrollbar-color:#2a3947 transparent;
  scrollbar-width:thin;
  scrollbar-gutter:stable;
}
.messages-thread-scroll::-webkit-scrollbar { width:6px; height:6px; }
.messages-thread-scroll::-webkit-scrollbar-thumb { background:#2a3947; border-radius:3px; }
.messages-thread-end { height:0; width:100%; flex-shrink:0; overflow-anchor:none; }
.messages-day-chip { display:flex; justify-content:center; margin:10px 0 6px; position:sticky; top:0; z-index:10; }
.messages-day-chip span {
  background:rgba(24,37,51,.9);
  backdrop-filter:blur(8px);
  color:#7f91a4;
  font-size:12px;
  font-weight:600;
  padding:4px 12px;
  border-radius:12px;
  box-shadow:0 1px 3px rgba(0,0,0,.25);
}
.tg-message-row {
  display:flex;
  align-items:flex-end;
  gap:8px;
  width:100%;
  max-width:100%;
  min-width:0;
  margin-bottom:2px;
}
.tg-message-row.is-grouped { margin-bottom:1px; }
.tg-message-row-outbound { justify-content:flex-end; }
.tg-message-avatar {
  width:34px;
  height:34px;
  font-size:13px;
  flex-shrink:0;
  visibility:visible;
}
.tg-message-avatar.is-placeholder { visibility:hidden; }
.tg-bubble {
  max-width:min(68%, 480px);
  min-width:0;
  position:relative;
  color:#fff;
  overflow:clip;
}
.tg-bubble-inbound { align-self:flex-start; }
.tg-bubble-outbound { align-self:flex-end; }
.tg-bubble-body {
  position:relative;
  padding:6px 9px 5px;
  border-radius:12px;
  font-size:14px;
  line-height:1.4;
  word-break:break-word;
  color:#fff;
}
.tg-bubble-inbound .tg-bubble-body {
  background:#182533;
  box-shadow:0 1px 1px rgba(0,0,0,.14);
}
.tg-bubble-outbound .tg-bubble-body {
  background:#2b5278;
  box-shadow:0 1px 1px rgba(0,0,0,.14);
}
.tg-bubble-group-solo.tg-bubble-inbound .tg-bubble-body,
.tg-bubble-group-first.tg-bubble-inbound .tg-bubble-body {
  border-bottom-left-radius:4px;
}
.tg-bubble-group-solo.tg-bubble-outbound .tg-bubble-body,
.tg-bubble-group-first.tg-bubble-outbound .tg-bubble-body {
  border-bottom-right-radius:4px;
}
.tg-bubble-group-middle.tg-bubble-inbound .tg-bubble-body,
.tg-bubble-group-last.tg-bubble-inbound .tg-bubble-body {
  border-top-left-radius:4px;
  border-bottom-left-radius:4px;
}
.tg-bubble-group-middle.tg-bubble-outbound .tg-bubble-body,
.tg-bubble-group-last.tg-bubble-outbound .tg-bubble-body {
  border-top-right-radius:4px;
  border-bottom-right-radius:4px;
}
.tg-bubble-group-last.tg-bubble-inbound .tg-bubble-body { border-bottom-left-radius:4px; }
.tg-bubble-group-last.tg-bubble-outbound .tg-bubble-body { border-bottom-right-radius:4px; }
.tg-bubble-media .tg-bubble-body {
  padding:3px;
  overflow:hidden;
}
.tg-bubble-has-caption .tg-bubble-body { padding-bottom:6px; }
.tg-bubble-text { white-space:pre-wrap; display:inline; }
.tg-bubble-footer {
  float:right;
  display:inline-flex;
  align-items:center;
  gap:4px;
  margin:1px 0 -3px 12px;
  color:rgba(255,255,255,.55);
  font-size:11px;
  line-height:1;
  vertical-align:bottom;
  position:relative;
  top:4px;
  user-select:none;
}
.tg-bubble-status { color:#fbbf24; text-transform:capitalize; }
.tg-bubble-ticks { display:inline-flex; align-items:center; color:#64b5ef; margin-left:1px; }
.tg-bubble-ticks-pending { color:rgba(255,255,255,.55); }
.tg-bubble-delete-wrap {
  position:absolute;
  top:4px;
  right:4px;
  z-index:5;
  opacity:0;
  transition:opacity .15s ease, transform .15s ease;
  transform:scale(.8);
  pointer-events:none;
}
.tg-bubble:hover .tg-bubble-delete-wrap,
.tg-bubble:focus-within .tg-bubble-delete-wrap {
  opacity:1;
  transform:scale(1);
  pointer-events:auto;
}
.tg-bubble-delete {
  width:22px;
  height:22px;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#202b36;
  color:#f87171;
  cursor:pointer;
  padding:0;
  box-shadow:0 2px 6px rgba(0,0,0,.4);
}
.tg-bubble-delete svg { pointer-events:none; }
.tg-bubble-delete:hover { background:#dc2626; color:#fff; }
.tg-media-inline {
  display:block;
  max-width:100%;
  border-radius:8px;
  overflow:hidden;
  text-decoration:none;
  line-height:0;
  position:relative;
}
.tg-media-inline-img {
  display:block;
  max-width:100%;
  max-height:min(380px, 52vh);
  width:100%;
  height:auto;
  object-fit:cover;
  border-radius:8px;
}
.tg-media-inline-video .tg-media-inline-play {
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background:rgba(15,23,42,.35);
  pointer-events:none;
}
.tg-media-inline-video .tg-media-inline-play::before {
  content:'';
  width:0;
  height:0;
  border-top:9px solid transparent;
  border-bottom:9px solid transparent;
  border-left:14px solid #fff;
  margin-left:4px;
}
.tg-media-card-document {
  display:flex;
  align-items:center;
  gap:12px;
  max-width:100%;
  min-width:0;
  padding:6px 8px;
  border-radius:10px;
  background:rgba(0,0,0,.15);
  color:#fff;
  text-decoration:none;
  transition:background .15s ease;
}
.tg-media-card-document:hover { background:rgba(0,0,0,.25); }
.tg-media-icon {
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  flex-shrink:0;
  border-radius:50%;
  background:#3390ec;
  color:#fff;
}
.tg-media-thumb-wrap { position:relative; width:42px; height:42px; flex-shrink:0; border-radius:50%; overflow:hidden; }
.tg-media-thumb { width:100%; height:100%; object-fit:cover; display:block; }
.tg-media-info { min-width:0; display:flex; flex-direction:column; gap:2px; flex:1; }
.tg-media-name { font-size:13.5px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tg-media-size { font-size:12px; color:rgba(255,255,255,.65); }
.tg-media-caption { margin-top:6px; padding:0 4px 2px; white-space:pre-wrap; word-break:break-word; font-size:14px; line-height:1.4; color:#fff; }
.messages-composer {
  display:flex;
  gap:8px;
  align-items:flex-end;
  padding:8px 12px 10px;
  background:#17212b;
  border-top:1px solid #0e1621;
  flex-shrink:0;
}
.messages-attach-btn,
.messages-mic-btn,
.messages-emoji-btn {
  width:40px;
  height:40px;
  border:0;
  background:transparent;
  color:#7f91a4;
  border-radius:50%;
  display:grid;
  place-items:center;
  cursor:pointer;
  flex-shrink:0;
  transition:color .15s ease, background .15s ease;
}
.messages-attach-btn:disabled,
.messages-mic-btn:disabled,
.messages-emoji-btn:disabled {
  opacity:.45;
  cursor:default;
}
.messages-attach-btn:not(:disabled):hover,
.messages-mic-btn:not(:disabled):hover,
.messages-emoji-btn:not(:disabled):hover { color:#fff; background:rgba(255,255,255,.08); }
.messages-composer-field {
  flex:1;
  min-width:0;
  display:flex;
  align-items:flex-end;
  gap:4px;
  background:#242f3d;
  border-radius:20px;
  padding:4px 6px 4px 14px;
  min-height:40px;
}
.messages-composer-field textarea {
  flex:1;
  min-width:0;
  min-height:32px;
  max-height:140px;
  resize:none;
  border:0;
  padding:6px 0;
  background:transparent;
  color:#f5f5f5;
  font-size:14px;
  line-height:1.4;
  outline:none;
  field-sizing:content;
  overflow-y:auto;
}
.messages-composer-field textarea::placeholder { color:#7f91a4; }
.messages-composer-field .messages-emoji-btn {
  width:34px;
  height:34px;
  margin-bottom:1px;
}
.messages-send {
  width:40px;
  height:40px;
  flex-shrink:0;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#3390ec;
  color:#fff;
  cursor:pointer;
  transition:background .15s ease, transform .12s ease;
}
.messages-send:hover { background:#4da3f5; transform:scale(1.04); }
.messages-send[hidden],
.messages-mic-btn[hidden] { display:none !important; }
.messages-empty-thread {
  flex:1;
  display:grid;
  place-content:center;
  text-align:center;
  color:#7f91a4;
  padding:40px 24px;
}
.messages-empty-thread strong { color:#e8eef5; font-size:18px; margin-bottom:8px; }
.messages-empty-thread p { margin:0; max-width:360px; }
@media (max-width: 900px) {
  .messages-workspace { grid-template-columns:1fr; }
  .messages-chat-list { max-height:38vh; border-right:0; border-bottom:1px solid #0e1621; }
  .tg-bubble { max-width:min(82%, 480px); }
}
@media (max-width: 820px) {
  .main-column:has(.messages-workspace) {
    height:calc(100dvh - 64px);
    max-height:calc(100dvh - 64px);
    min-height:0;
  }
}
.section-gap { margin-top:var(--space-grid); }
.recent-item { padding:12px 0; min-height:68px; border-bottom:1px solid var(--border); }
.recent-item:last-child { border-bottom:0; }
.webhook-updates-summary { margin:0; color:var(--muted); font-size:13px; }
.webhook-updates-panel .card-header { padding:14px 18px; }
.webhook-table { border-top:1px solid var(--border); font-size:13px; }
.webhook-table-head, .webhook-row {
  display:grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) 150px;
  gap:12px;
  align-items:center;
  padding:10px 14px;
}
.webhook-table-head {
  background:#f7f9fc;
  color:#52647d;
  font-size:10px;
  font-weight:750;
  text-transform:uppercase;
  letter-spacing:.055em;
  border-bottom:1px solid var(--border);
}
.webhook-item { border-bottom:1px solid #e9eef5; }
.webhook-item:last-child { border-bottom:0; }
.webhook-row {
  width:100%;
  margin:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  text-align:left;
  cursor:pointer;
  font:inherit;
  min-height:44px;
  transition:background .12s ease;
}
.webhook-row:hover, .webhook-row:focus-visible { background:#f8fbff; outline:none; box-shadow:none; }
.webhook-row.is-expanded { background:#eef4ff; }
.webhook-cell-chat { display:grid; gap:2px; min-width:0; }
.webhook-content-cell { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.webhook-detail { padding:0 14px 14px; background:#f8fafc; }
.webhook-detail-error { margin:12px 0 0; }
.webhook-json { margin:12px 0 0; max-height:360px; overflow:auto; padding:12px 14px; background:#0f172a; color:#e2e8f0; border-radius:10px; white-space:pre-wrap; word-break:break-word; font-size:12px; line-height:1.45; }
.webhook-updates-sentinel, .webhook-updates-end { display:grid; place-items:center; padding:18px 0 8px; }
@media (max-width: 720px) {
  .webhook-table-head { display:none; }
  .webhook-row { grid-template-columns:1fr; gap:4px; padding:12px 14px; }
  .webhook-content-cell { white-space:normal; }
}
.error-card { margin-top:10vh; }
.progress { height:8px; background:#e7edf5; border-radius:99px; overflow:hidden; }.progress span { display:block; height:100%; background:var(--primary); }
.login-page { min-height:100dvh; display:grid; place-items:center; padding:24px; background:radial-gradient(circle at top left,#dbeafe 0,transparent 38%),var(--bg); }
.login-card { width:min(460px,100%); padding:34px; background:white; border:1px solid var(--border); border-radius:22px; box-shadow:var(--shadow); }.login-card .brand { color:var(--text); margin:0 0 28px; }.login-card .brand small { color:var(--muted); }
.sidebar-backdrop { position:fixed; inset:0; background:rgba(3,10,23,.55); z-index:90; }
.modal-root { position:fixed; inset:0; z-index:300; display:grid; place-items:center; padding:24px; }
.modal-backdrop { position:absolute; inset:0; background:rgba(3,10,23,.55); }
.modal-dialog { position:relative; width:min(480px,100%); background:white; border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); overflow:hidden; }
.modal-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 22px; border-bottom:1px solid var(--border); }
.modal-header h2 { margin:0; font-size:18px; letter-spacing:-.02em; }
.modal-body { padding:20px 22px; color:var(--text); white-space:pre-wrap; word-break:break-word; }
.modal-footer { padding:16px 22px 20px; display:flex; justify-content:flex-end; }
.modal-root.modal-success .modal-header h2 { color:var(--success); }
.modal-root.modal-error .modal-header h2 { color:var(--danger); }
body.modal-open { overflow:hidden; }
.muted { color:var(--muted); }.text-danger { color:var(--danger); }.text-success { color:var(--success); }.nowrap { white-space:nowrap; }.mt-0 { margin-top:0; }.mb-0 { margin-bottom:0; }
@media (max-width: 1100px) { .grid-stats > .stat-card { flex-basis:calc(50% - var(--space-grid) / 2); }.split-layout { grid-template-columns:1fr; }.sticky-card { position:static; } }
@media (max-width: 820px) {
  .app-shell { display:block; }.sidebar { position:fixed; inset:0 auto 0 0; width:min(292px,86vw); transform:translateX(-105%); transition:transform .2s ease-out; box-shadow:var(--shadow); }.sidebar.open { transform:translateX(0); }
  .mobile-header { height:64px; display:flex; align-items:center; gap:13px; padding:0 18px; border-bottom:1px solid var(--border); background:rgba(255,255,255,.96); position:sticky; top:0; z-index:50; font-weight:750; }
  main { padding:24px 18px 48px; }.page-header { flex-direction:column; }.page-header .actions { width:100%; }.page-header .actions .button { flex:1; }
  .field-row, .grid-2 { grid-template-columns:1fr; }.check-grid { grid-template-columns:1fr; }
}
@media (max-width: 520px) {
  .grid-stats > .stat-card { flex-basis:100%; }
  .card-header, .card-body { padding:17px; }
  .grid-2 > .card > .card-header { min-height:0; }
  .stat-card { min-height:0; }
  .stat-meta { min-height:0; }
  .toolbar { display:grid; }
  .button { width:100%; }
  .actions form, .card-body > .actions > form { flex:1; }
  .actions form .button, .card-body > .actions > form .button { width:100%; }
  .card-body > .actions > .button, .card-body > .actions > form { min-width:0; flex-basis:100%; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior:auto!important; transition:none!important; animation:none!important; } }
