:root {
  --brand-a: #A855F7;
  --brand-b: #EC4899;
  --grad: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  --grad-soft: linear-gradient(135deg, rgba(168, 85, 247, .14) 0%, rgba(236, 72, 153, .12) 100%);
  --bg: #F7F5FB;
  --panel: #FFFFFF;
  --line: rgba(24, 24, 27, .10);
  --text: #18181B;
  --muted: #52525B;
  --accent: #6D28D9;
  --ok: #15803D;
  --bad: #B91C1C;
  --shadow: 0 8px 28px rgba(88, 28, 135, .08);
  --shadow-sm: 0 2px 10px rgba(24, 24, 27, .06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1000px 560px at 100% -10%, rgba(168, 85, 247, .10), transparent 55%),
    radial-gradient(900px 500px at -10% 110%, rgba(236, 72, 153, .08), transparent 50%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
.wrap { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: rgba(255, 255, 255, .96);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  box-shadow: var(--shadow-sm);
}
.side h1 {
  font-size: 16px; margin: 0 0 16px; padding: 0 8px;
  color: var(--accent); font-weight: 800;
}
.side a {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); margin-bottom: 4px; font-weight: 700;
  text-decoration: none;
}
.side a.active, .side a:hover {
  background: var(--grad-soft); color: var(--accent);
  text-decoration: none;
}
.main { padding: 22px; color: var(--text); }
h2 { margin: 0 0 14px; font-size: 22px; color: var(--text); font-weight: 800; }
h3 { color: var(--text); }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { color: var(--muted); font-weight: 600; text-decoration: none; display: block; }
.stat b {
  display: block; font-size: 22px; margin-top: 6px;
  color: var(--accent); font-weight: 800;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text); }
th { color: var(--muted); font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 12px; border-radius: 10px; border: 0;
  cursor: pointer; font-weight: 700;
}
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 18px rgba(168, 85, 247, .25);
}
.btn-ok { background: #ECFDF5; color: #14532D; border: 1px solid #86EFAC; }
.btn-bad { background: #FEF2F2; color: #7F1D1D; border: 1px solid #FECACA; }
.btn-ghost { background: #F3F0F8; color: var(--text); border: 1px solid var(--line); }
.btn-warn {
  background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D;
}
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn-ok-solid {
  background: #16A34A; color: #fff; border: 0;
  box-shadow: 0 8px 16px rgba(22, 163, 74, .25);
}
.btn-ok-solid:hover { filter: brightness(1.05); }
.btn-bad-solid {
  background: #DC2626; color: #fff; border: 0;
  box-shadow: 0 8px 16px rgba(220, 38, 38, .22);
}
.btn-warn-solid {
  background: #D97706; color: #fff; border: 0;
  box-shadow: 0 8px 16px rgba(217, 119, 6, .22);
}
.muted { color: var(--muted); }

/* Дашборд */
.dash-section { margin-bottom: 18px; }
.dash-h { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--text); }
.dash-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
a.stat { color: var(--muted); }
a.stat:hover { text-decoration: none; border-color: rgba(109, 40, 217, .35); }
.stat-sub {
  display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.35;
}
.dash-two {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start;
}
.dash-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px;
}
.dash-card-head h3 { margin: 0; font-size: 15px; }
.dash-card-head a { font-size: 12px; font-weight: 700; }
.dash-table { font-size: 12.5px; }
.dash-table th, .dash-table td { padding: 8px 6px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.offer-form-card[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); padding: 8px 10px;
}
.field input::placeholder, .field textarea::placeholder { color: #71717A; opacity: 1; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: rgba(109, 40, 217, .45);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash-ok { background: #ECFDF5; color: #14532D; border: 1px solid #86EFAC; }
.flash-err { background: #FEF2F2; color: #7F1D1D; border: 1px solid #FECACA; }
.login {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(700px 420px at 90% 0%, rgba(168, 85, 247, .14), transparent 55%),
    radial-gradient(640px 380px at 0% 100%, rgba(236, 72, 153, .10), transparent 50%),
    var(--bg);
  color: var(--text);
}
.login .card { width: min(400px, 92vw); box-shadow: var(--shadow); color: var(--text); }
.login h2 { color: var(--accent); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #EDE9FE; color: #5B21B6; font-weight: 800;
}
/* Список офферов: лого + цветные бейджи (как на основе) */
.offers-list-table .offers-col-logo { width: 48px; padding-right: 4px; vertical-align: middle; }
.offers-list-table td { vertical-align: middle; }
.offer-list-logo {
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: #F4F4F8;
  overflow: hidden; display: grid; place-items: center;
  flex-shrink: 0;
}
.offer-list-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.offer-list-logo-letter {
  color: #fff; font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .02em;
  border: 0;
}
.badge-cat, .badge-status {
  display: inline-flex; align-items: center;
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  font-weight: 800; line-height: 1.2; white-space: nowrap;
}
.badge-cat-mfo {
  background: rgba(16, 185, 129, .12); color: #059669;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .28);
}
.badge-cat-debit {
  background: rgba(14, 165, 233, .12); color: #0284C7;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .28);
}
.badge-cat-other {
  background: #F4F4F5; color: #52525B;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, .10);
}
.badge-status-active {
  background: rgba(16, 185, 129, .12); color: #059669;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .28);
}
.badge-status-hidden {
  background: rgba(245, 158, 11, .12); color: #B45309;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .30);
}
.badge-status-archived {
  background: rgba(113, 113, 122, .12); color: #52525B;
  box-shadow: inset 0 0 0 1px rgba(113, 113, 122, .25);
}
.side a .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  height: 1.35em;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #DC2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}
.side a.active .nav-badge {
  background: #B91C1C;
  color: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-cell { min-width: 220px; }
.actions-cell .btn { margin: 2px 0; }
.filters { display: grid; grid-template-columns: 1fr 180px auto; gap: 12px; align-items: end; }
.filters .btn { width: auto; min-width: 120px; }
.stack-form { display: grid; gap: 4px; }
.inline-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-row input { min-height: 34px; border-radius: 8px; border: 1px solid var(--line); padding: 4px 8px; background: #fff; color: var(--text); }
textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); padding: 8px 10px; font: inherit; resize: vertical;
}
@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .wrap { grid-template-columns: 1fr; }
  .side { display: flex; flex-wrap: wrap; gap: 4px; }
}

/* Офферы: компактная форма + подсказки «?» */
.offer-form-card { padding: 16px; overflow: visible; }
.offer-form-head { margin-bottom: 12px; }
.offer-form-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.offer-form-sub { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.offer-sec {
  margin: 0 0 14px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #FAFAFC;
  overflow: visible;
}
.offer-sec:last-of-type { margin-bottom: 0; }
.offer-sec-title {
  margin: 0 0 10px; font-size: 12px; font-weight: 800;
  letter-spacing: .02em; text-transform: uppercase; color: var(--accent);
}
.offer-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px;
}
.offer-grid-3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px;
}
.offer-form .field { margin-bottom: 10px; }
.offer-form .field:last-child { margin-bottom: 0; }
.offer-form textarea { min-height: 78px; }
.offer-random-box {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #F4F4F8;
}
.offer-random-title { margin: 0 0 4px; font-size: 13px; font-weight: 800; color: var(--text); }
.offer-random-hint { margin: 0 0 10px; font-size: 12px; line-height: 1.4; }
.offer-random-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; background: #E8E8EE; padding: 1px 5px; border-radius: 4px;
}
.lbl-plain { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.offer-check {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 12px; padding: 12px;
  border: 1px solid #BFDBFE; border-radius: 12px; background: #EFF6FF;
  cursor: pointer;
}
.offer-check-ins {
  border-color: #93C5FD;
  background: #DBEAFE;
}
.offer-check input { margin-top: 3px; width: 16px; height: 16px; flex: 0 0 auto; }
.offer-check strong { display: block; font-size: 13px; font-weight: 800; color: var(--text); }
.offer-check .muted { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; }
.offer-logo-row {
  display: flex; flex-wrap: wrap; gap: 16px 20px;
  align-items: flex-start; margin-bottom: 14px;
}
.offer-logo-col {
  flex: 0 0 auto; width: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.offer-logo-fields { flex: 1 1 220px; min-width: 0; }
.offer-logo-preview {
  width: 88px; height: 88px; border-radius: 999px;
  border: 2px dashed var(--line); background: #F4F4F8;
  display: grid; place-items: center; overflow: hidden;
}
.offer-logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.offer-logo-ph { color: var(--muted); display: grid; place-items: center; }
.offer-logo-ph svg { width: 32px; height: 32px; opacity: .55; }
.offer-logo-upload-btn { width: 100%; justify-content: center; cursor: pointer; }
.offer-money-box {
  margin: 12px 0; padding: 12px;
  border: 1px solid #F5D0FE; border-radius: 12px; background: #FDF4FF;
}
@media (max-width: 640px) {
  .offer-logo-row { flex-direction: column; align-items: stretch; }
  .offer-logo-col { width: 100%; align-items: flex-start; }
  .offer-grid-2, .offer-grid-3 { grid-template-columns: 1fr; }
}
.offer-instr-box {
  margin-top: 4px; padding: 12px;
  border: 1px dashed #A78BFA; border-radius: 12px; background: #F5F3FF;
}
.offer-instr-head {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between;
  margin-bottom: 10px;
}
.offer-instr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.offer-instr-box textarea {
  width: 100%; min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.45;
}
.hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.lbl-spacer { display: block; min-height: 18px; margin-bottom: 4px; }
.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px; flex: 0 0 auto;
  background: #EDE9FE; color: #5B21B6; font-size: 11px; font-weight: 800;
  line-height: 1; cursor: help; user-select: none;
}
.tip-pop {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 10px;
  background: #18181B; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.35;
  text-align: left; white-space: normal; box-shadow: 0 10px 24px rgba(24,24,27,.22);
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 40;
  transition: opacity .12s ease, visibility .12s ease;
}
.tip-pop::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #18181B;
}
.tip:hover .tip-pop,
.tip:focus .tip-pop,
.tip:focus-within .tip-pop {
  opacity: 1; visibility: visible;
}
.field label .lbl { display: inline-flex; }
/* подсказка не обрезается родителями */
.main, .card, .offer-form { overflow: visible; }
@media (max-width: 820px) {
  .offer-grid-2, .offer-grid-3 { grid-template-columns: 1fr; }
  .tip-pop { left: 0; transform: none; max-width: min(260px, 70vw); }
  .tip-pop::after { left: 10px; transform: none; }
}

/* Админ: чаты — мессенджер */
.chat-page-head { margin-bottom: 4px; }
.chat-filters {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 12px;
  align-items: end;
}
.chat-filters .field { margin: 0; }
.chat-filters-q { min-width: 0; }
.chat-admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 180px);
}
.chat-admin-list {
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
}
.chat-list-head {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 4px 8px 10px;
  display: flex;
  justify-content: space-between;
}
.chat-list-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.chat-admin-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 10px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.chat-admin-item:hover { background: #F3F0F8; text-decoration: none; }
.chat-admin-item.on {
  background: #EDE9FE;
  border-color: rgba(109,40,217,.28);
  box-shadow: inset 3px 0 0 #7C3AED;
}
.chat-admin-item.needs { border-color: rgba(234,88,12,.28); }
.chat-admin-item.needs:not(.on) { background: #FFF7ED; }
.chat-admin-item.unread .chat-admin-item-top b { font-weight: 900; }
.chat-item-av {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg,#A855F7,#EC4899);
  color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.chat-item-body { min-width: 0; }
.chat-admin-item-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.chat-admin-item-top b {
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-when { font-size: 11px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.chat-item-offer {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chat-pill {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800; line-height: 1.2;
  background: #F4F4F5; color: #52525B;
}
.chat-pill.is-pending { background: #FFEDD5; color: #C2410C; }
.chat-pill.is-work { background: #EDE9FE; color: #6D28D9; }
.chat-pill.is-ok { background: #DCFCE7; color: #15803D; }
.chat-pill.is-bad { background: #FEE2E2; color: #B91C1C; }
.chat-pill.is-muted { background: #F4F4F5; color: #71717A; }
.chat-pill.is-alert {
  background: #EA580C; color: #fff;
  animation: chatPulse 1.6s ease-in-out infinite;
}
.chat-pill.is-unread { background: #7C3AED; color: #fff; }
@keyframes chatPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.chat-admin-thread {
  margin-bottom: 0;
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.chat-admin-thread.is-empty { place-content: center; }
.chat-empty-pane {
  text-align: center; padding: 48px 24px; max-width: 360px; margin: 0 auto;
}
.chat-empty-ico {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(168,85,247,.18), rgba(236,72,153,.16));
  position: relative;
}
.chat-empty-ico::before {
  content: ""; position: absolute; inset: 14px 12px 18px;
  border-radius: 10px; border: 2px solid #7C3AED; opacity: .7;
}
.chat-empty-ico::after {
  content: ""; position: absolute; right: 12px; bottom: 12px;
  width: 10px; height: 10px; border-radius: 3px; background: #EC4899; opacity: .8;
}
.chat-empty-pane b { display: block; font-size: 16px; margin-bottom: 6px; }
.chat-empty-pane p { margin: 0; font-size: 13px; line-height: 1.45; }

.chat-thread-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff 0%, #FAFAFC 100%);
  display: grid;
  gap: 10px;
}
.chat-rd-offer { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-rd-logo {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 44px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
}
.chat-rd-logo-img { object-fit: cover; background: #fff; display: block; }
.chat-rd-mid { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-rd-name {
  font-weight: 800; font-size: 16px; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-rd-sub {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  font-size: 12.5px; color: var(--muted);
}
.chat-user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--text);
}
.chat-user-chip i {
  width: 18px; height: 18px; border-radius: 6px;
  background: #EDE9FE; color: #6D28D9;
  display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 800;
}
.chat-mail { color: var(--muted); }
.chat-thread-aside {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.chat-rd-pay {
  padding: 6px 12px; border-radius: 999px;
  background: rgba(124,58,237,.10); color: #7C3AED;
  font-weight: 800; font-size: 13px; white-space: nowrap;
}
.chat-head-links { display: flex; gap: 6px; margin-left: auto; }
.chat-rd-steps {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  display: grid; gap: 6px;
}
.chat-rd-bar {
  height: 5px; border-radius: 999px; background: rgba(12,12,22,.07); overflow: hidden;
}
.chat-rd-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(135deg,#7C3AED,#9333EA 55%,#DB2777);
}

.chat-decide-slot { padding: 0 12px; margin-top: 12px; }
.btn-decide-open {
  min-height: 32px; padding: 0 12px; border-radius: 9px; border: 0;
  background: #EA580C; color: #fff; font-weight: 800; font-size: 12.5px;
  box-shadow: 0 6px 14px rgba(234, 88, 12, .28);
  animation: chatPulse 1.6s ease-in-out infinite;
}
.btn-decide-open:hover { filter: brightness(1.06); }
.chat-decide-modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 16px;
}
.chat-decide-modal[hidden] { display: none !important; }
body.chat-decide-open { overflow: hidden; }
.chat-decide-backdrop {
  position: absolute; inset: 0; background: rgba(24, 24, 27, .45);
  backdrop-filter: blur(2px);
}
.chat-decide-dialog {
  position: relative; z-index: 1;
  width: min(440px, 100%);
  background: #fff; border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(24, 24, 27, .28);
  padding: 16px 16px 14px;
}
.chat-decide-dialog-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 12px;
}
.chat-decide-x {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line);
  background: #F4F4F5; color: #52525B; font-size: 20px; line-height: 1; cursor: pointer;
}
.chat-admin-decide {
  margin: 0;
  display: grid;
  gap: 12px;
}
.chat-decide-left { display: grid; gap: 6px; min-width: 0; }
.chat-admin-decide-title { font-weight: 800; font-size: 16px; color: #9A3412; }
.chat-decide-hint { margin: 4px 0 0; font-size: 12.5px; color: #9A3412; opacity: .85; line-height: 1.35; }
.chat-admin-decide input[name="reason"] {
  width: 100%; border-radius: 12px; border: 1px solid #FDBA74;
  padding: 11px 12px; font: inherit; background: #FFF7ED;
}
.chat-decide-actions {
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
.chat-decide-actions .btn { min-height: 42px; width: 100%; }
.chat-admin-status {
  margin: 0;
  padding: 8px 14px;
  border-radius: 0;
  background: #F4F4F5;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.chat-admin-status-inline { flex: 0 0 auto; }

.chat-admin-msgs {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(168,85,247,.06), transparent 60%),
    #F3F2F7;
  min-height: 220px;
}
.chat-msgs-empty { text-align: center; padding: 28px 8px; font-size: 13px; }
.chat-rd-msg { display: flex; gap: 8px; max-width: 78%; }
.chat-rd-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.chat-rd-av {
  width: 30px; height: 30px; border-radius: 10px; flex: 0 0 30px; align-self: flex-end;
  background: linear-gradient(135deg,#A855F7,#EC4899); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
}
.chat-rd-bub {
  padding: 10px 13px 8px; border-radius: 16px; font-size: 14px; line-height: 1.45;
  background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px;
  box-shadow: 0 8px 20px -14px rgba(34,16,82,.28); overflow-wrap: anywhere;
}
.chat-rd-msg.me .chat-rd-bub {
  background: linear-gradient(135deg,#7C3AED,#9333EA 55%,#DB2777); color: #fff; border: 0;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 6px;
}
.chat-who {
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
  text-transform: uppercase; color: #A1A1AA; margin-bottom: 4px;
}
.chat-rd-msg.me .chat-who { color: rgba(255,255,255,.72); }
.chat-rd-bub .t { display: block; font-size: 10.5px; color: #A8A8BA; margin-top: 5px; text-align: right; }
.chat-rd-msg.me .chat-rd-bub .t { color: rgba(255,255,255,.7); }
.chat-rd-bub.shot img { max-width: 220px; border-radius: 12px; display: block; margin-top: 6px; }
.chat-shot-link {
  display: grid; gap: 6px; margin-top: 8px; text-decoration: none; color: inherit;
}
.chat-shot-link img { max-width: 220px; border-radius: 12px; display: block; border: 1px solid var(--line); }
.chat-shot-link span {
  font-size: 12px; font-weight: 800; color: #6D28D9;
}
.chat-rd-sys {
  align-self: center; text-align: center; font-size: 12.5px; font-weight: 700;
  padding: 8px 14px; border-radius: 999px; background: rgba(5,150,105,.10); color: #047857;
  max-width: 92%; line-height: 1.35;
}
.chat-rd-sys.info { background: rgba(124,58,237,.12); color: #6D28D9; }
.chat-rd-sys-card {
  align-self: center; width: min(520px, 94%);
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 0; overflow: hidden;
}
.chat-rd-sys-card summary {
  cursor: pointer; list-style: none; padding: 10px 14px;
  font-size: 12.5px; font-weight: 800; color: #52525B; background: #FAFAFC;
}
.chat-rd-sys-card summary::-webkit-details-marker { display: none; }
.chat-rd-sys-card summary::after { content: " ▾"; color: #A1A1AA; }
.chat-rd-sys-card[open] summary::after { content: " ▴"; }
.chat-rd-sys-body {
  padding: 12px 14px 14px; font-size: 13px; line-height: 1.5; color: var(--text);
  border-top: 1px solid var(--line); white-space: pre-wrap;
}

.chat-composer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.chat-admin-reply { display: grid; gap: 8px; margin: 0; }
.chat-rd-reply { grid-template-columns: 1fr auto; align-items: end; }
.chat-admin-reply textarea {
  width: 100%; min-height: 52px; max-height: 140px;
  border-radius: 14px; border: 1px solid var(--line);
  padding: 12px 14px; font: inherit; resize: vertical; background: #F8F7FB;
}
.chat-admin-reply textarea:focus {
  outline: none; border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.chat-rd-send { min-height: 52px; min-width: 120px; }
#chatAjaxFlash { margin-top: 8px; }

.apps-status-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px;
}
.apps-status-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; color: inherit; background: #fff; font-size: 13px;
}
.apps-status-tab:hover { text-decoration: none; background: var(--grad-soft, #F3F0F8); }
.apps-status-tab.on {
  background: #EDE9FE; border-color: rgba(109,40,217,.3); font-weight: 600;
}
@media (max-width: 900px) {
  .chat-filters { grid-template-columns: 1fr; }
  .chat-admin-layout { grid-template-columns: 1fr; min-height: 0; }
  .chat-admin-list { max-height: 260px; }
  .chat-admin-thread { min-height: 560px; max-height: none; }
  .chat-admin-decide { grid-template-columns: 1fr; }
  .chat-decide-actions { grid-template-columns: 1fr; }
  .chat-decide-actions .btn { flex: 1; }
  .chat-rd-reply { grid-template-columns: 1fr; }
  .chat-head-links { margin-left: 0; }
  .chat-rd-msg { max-width: 92%; }
}

