

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #16a34a;
  --inactive: #f97316;
  --chatcontrast: rgb(241, 241, 12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}



header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header .right {
  display: flex;
  gap: 12px;
  align-items: center;
}

main {
  display: flex;
  height: calc(100vh - 56px);
}

.sidebar {
  width: 360px;
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.chat-main-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.actions-container {
  width: 320px;
  border-left: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
}



.sidebar h2 {
  margin: 12px 0 8px;
  font-size: 16px;
}

li.chat {
  padding: 10px;
  margin-bottom: 6px;
  background: var(--chatcontrast);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left-width: 20px;
}

li.chat.bot-color-1 {
  border-left-color: #b1b1b1; 
}
li.chat.bot-color-2 {
  border-left-color: #a7f3d0; 
}
li.chat.bot-color-3 {
  border-left-color: #bae6fd; 
}
li.chat.bot-color-4 {
  border-left-color: #801aec; 
}

li.chat .meta {
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: auto;
  flex-shrink: 0;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--border);
}

.chat-info {
  flex-grow: 1;
  min-width: 0;
}

.chat-info-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-name-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.chat-time {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.chat-info-top strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-snippet {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}


#chatHeader {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  min-height: 56px;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 70%;
  white-space: normal;
  word-break: break-word;
}

.msg .time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

.msg.user {
  background: #e5f0ff;
  align-self: flex-start;
}

.msg.admin {
  background: #eaf7ea;
  align-self: flex-end;
}

.msg.system {
  background: #f3f4f6;
  color: #6b7280;
  align-self: center;
  font-size: 12px;
}

.msg-photo {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 0;
  display: block;
  cursor: pointer;
}

.msg-photo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(360px, 100%);
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}

.msg-doc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.msg-doc:hover {
  background-color: #1d4ed8;
}

.msg-doc svg {
  stroke: currentColor;
}

.msg-video-card {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: min(360px, 100%);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.msg-video-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.msg-video-card:disabled {
  cursor: not-allowed;
}

.msg-video-card:disabled .msg-video-preview {
  transform: none;
}

.msg-video-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #020617;
  pointer-events: none;
  transition: transform 0.25s ease;
}

.msg-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.15) 0%, rgba(2, 6, 23, 0.55) 100%);
  transition: background-color 0.2s ease;
  pointer-events: none;
}

.msg-video-card:hover .msg-video-overlay {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.08) 0%, rgba(2, 6, 23, 0.45) 100%);
}

.msg-video-card:hover .msg-video-preview {
  transform: scale(1.02);
}

.msg-video-card.is-error {
  border-color: #f59e0b;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.msg-video-card.is-error .msg-video-overlay {
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.2) 0%, rgba(120, 53, 15, 0.62) 100%);
}

.msg-video-play-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-video-play-icon svg {
  width: 28px;
  height: 28px;
  margin-left: 2px;
}

.msg-video-play-icon.is-loading {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(191, 219, 254, 0.52);
}

.msg-video-orbit-loader {
  position: relative;
  width: 34px;
  height: 34px;
  display: block;
}

.msg-video-orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid rgba(191, 219, 254, 0.4);
}

.msg-video-orbit-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  margin-left: -4px;
  border-radius: 999px;
  background: #dbeafe;
  box-shadow: 0 0 10px rgba(147, 197, 253, 0.9);
  transform: rotate(0deg) translateY(-13px);
  transform-origin: center center;
  animation: msg-video-orbit-spin 0.9s linear infinite;
}

@keyframes msg-video-orbit-spin {
  from {
    transform: rotate(0deg) translateY(-13px);
  }
  to {
    transform: rotate(360deg) translateY(-13px);
  }
}

.msg-video-play-icon.is-warning {
  background: rgba(120, 53, 15, 0.92);
  border-color: rgba(253, 186, 116, 0.85);
}

.msg-video-play-icon.is-warning svg {
  width: 24px;
  height: 24px;
  margin-left: 0;
  color: #fef3c7;
}

.msg-video-caption {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.msg-video-limit-note {
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(253, 186, 116, 0.75);
  background: rgba(120, 53, 15, 0.75);
  color: #fff7ed;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.msg-video-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-video-time {
  align-self: flex-end;
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

.msg-video-progress {
  position: relative;
  height: 4px;
  width: 100%;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.45);
  overflow: hidden;
}

.msg-video-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa 0%, #93c5fd 100%);
  transition: width 0.12s linear;
}

.msg-text {
  margin-top: 4px;
}

.payment-method-label {
  font-weight: 700;
  color: #000;
  font-size: 1.1em;
}

.msg-photo + .msg-text {
  margin-top: 8px;
}


#sendForm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.file-preview {
  display: none; 
  padding: 6px 10px;
  background-color: #f3f4f6;
  border-radius: 6px;
  font-size: 12px;
  justify-content: space-between;
  align-items: center;
}

.file-preview span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clear-file-btn {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.clear-file-btn:hover {
  color: var(--danger);
}

#msgText {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  overflow-y: auto;
  max-height: 120px;
  transition: border-color 0.2s;
}

#msgText:focus {
  outline: none;
  border-color: var(--accent);
}


.actions-container h3 {
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.actions form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions button,
.actions select,
.actions input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 5px;
}

.logout {
  color: var(--danger);
  text-decoration: none;
  font-weight: 600;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}

.icon-button:hover {
  background-color: #f1f5f9;
  color: var(--accent);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

#sendForm .input-row button {
  background: var(--accent);
  color: white;
}

#sendForm .input-row .icon-button {
  align-self: flex-end;
  margin: 0;
}

#sendForm .input-row button:hover {
  background: #1d4ed8;
}


.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ccc;
  border-radius: 28px;
  transition: .2s;
}

.slider:before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

input:checked + .slider {
  background: var(--success);
}

input:checked + .slider:before {
  transform: translateX(22px);
}


.error {
  color: var(--danger);
  margin-bottom: 8px;
}

.status-label {
  font-size: 12px;
  color: var(--muted);
}



.tabs-container {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px; 
}

.tabs {
  display: flex;
  flex-wrap: wrap; 
  gap: 4px; 
}

.tab-button {
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}


.users-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.users-header button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
}

.table-container {
  margin-top: 12px;
  overflow-x: auto;
}

#usersTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#usersTable th, #usersTable td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

#usersTable th {
  background-color: #f9fafb;
}

.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--inactive); font-weight: 600; }

.edit-user-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
}


#qaLogList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qa-item {
  font-size: 13px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
}
.qa-time {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}
.qa-text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}



.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
}


#successModal .modal-content {
  text-align: center;
}
#successModal .modal-content p {
  margin: 0 0 16px;
  font-size: 16px;
}
#successModal .modal-content button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
}


#userModal .modal-content h3 {
  margin-top: 0;
}
#userModal form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 4px;
  font-weight: 600;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
}
.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.modal-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.modal-actions button[type="submit"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.actions button,
.actions select,
.actions input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#reassignAdminSelect {
  max-height: 150px;
}



#btnWaiting {
  background-color: var(--text);
  color: white;
  border: none;
}

#reassignForm button {
  background-color: var(--chatcontrast);
  color: var(--text);
  font-weight: 600;
  border-color: #e0ca0d;
}

#closeForm button {
  background-color: var(--danger);
  color: white;
  border: none;
}

#paymentForm button {
  background-color: var(--success);
  color: white;
  border: none;
}


#waitingChats li.chat {
  background-color: var(--text); 
  color: white; 
  border-color: #4a5568;
}

#waitingChats li.chat .meta {
  color: #a0aec0; 
}


#closedChats li.chat,
#closedByMeChats li.chat {
  background-color: #f3f4f6;
  color: var(--muted);
  border-color: #e5e7eb;
}

#closedChats li.chat strong,
#closedByMeChats li.chat strong {
  color: var(--text);
}


.activity-admin {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden; 
}

.activity-admin.clickable .activity-admin-header {
  cursor: pointer;
}

.activity-admin.clickable .activity-admin-header:hover {
  background-color: #f9fafb;
}

.activity-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  transition: background-color 0.2s;
}

.activity-admin-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.activity-admin-header span:first-child {
  font-weight: 600;
}

.activity-open-count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #eef2ff;
  color: #3730a3;
  font-weight: 600;
}

.status-online, .status-offline {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-online {
  background-color: #dcfce7;
  color: #15803d;
}

.status-offline {
  background-color: #f3f4f6;
  color: var(--muted);
}

.activity-log-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #f9fafb;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid transparent; 
}

.activity-admin.open .activity-log-details {
  max-height: 500px; 
  transition: max-height 0.4s ease-in;
  border-top-color: var(--border); 
}

.activity-log-details ul {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-log-details li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.log-ts {
  color: var(--text);
  flex-shrink: 0;
}

.log-action {
  text-align: right;
}




.template-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: grab;
  user-select: none;
}

.template-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.template-info strong {
  display: block;
  margin-bottom: 4px;
}

.template-info p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.template-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.template-actions button {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--border);
}

.template-actions .delete-template-btn {
  color: var(--danger);
}
.template-actions .delete-template-btn:hover {
  background-color: var(--danger);
  color: white;
}

#templateModal textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
}

.message-templates-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.template-button {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #f9fafb;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}

.template-button:hover {
  background-color: #f3f4f6;
}

.msg {
  position: relative;
}

.reply-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.msg:hover .reply-btn {
  display: flex;
}

.reply-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
}

.reply-btn:hover {
  background-color: var(--accent);
}
.reply-btn:hover svg {
  stroke: white;
}


.msg-reply {
  padding: 4px 8px;
  margin-bottom: 4px;
  background-color: rgba(0, 0, 0, 0.05);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
}

.msg-reply strong {
  color: var(--accent);
  display: block;
  margin-bottom: 2px;
}

.msg-reply p {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


#replyPreview {
  display: none;
  padding: 8px 12px;
  background-color: #f3f4f6;
  border-top: 1px solid var(--border);
  font-size: 13px;
  justify-content: space-between;
  align-items: center;
}

#replyPreview.visible {
  display: flex;
}

#replyPreviewContent {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

#cancelReplyBtn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}



.image-modal .image-modal-content {
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modalImage {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.video-modal .video-modal-content {
  width: auto;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.75);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modalVideo {
  width: auto;
  height: auto;
  max-width: calc(100vw - 44px);
  max-height: calc(100vh - 44px);
  object-fit: contain;
  border-radius: 10px;
  background: #000;
  outline: none;
}

.image-modal-close {
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 40px;
  font-weight: bold;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  z-index: 1001;
  line-height: 1;
  margin: 0;
}

.video-modal-close {
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 40px;
  font-weight: bold;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  z-index: 1001;
  line-height: 1;
  margin: 0;
}

@media (max-width: 768px) {
  .video-modal .video-modal-content {
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    padding: 8px;
    border-radius: 10px;
  }

  #modalVideo {
    max-width: calc(100vw - 26px);
    max-height: calc(100vh - 26px);
  }

  .video-modal-close {
    top: 8px;
    right: 12px;
    font-size: 34px;
  }
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  border: none;
}

.btn-danger:hover {
  background-color: #dc2626;
}


.block-form {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.block-form input {
  flex-grow: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.block-form button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background-color: var(--danger);
  color: white;
  cursor: pointer;
}

#blacklistTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#blacklistTable th, #blacklistTable td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

#blacklistTable th {
  background-color: #f9fafb;
}

.unblock-client-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-success {
  background-color: var(--success);
  color: white;
  border: none;
}

.btn-success:hover {
  background-color: #15803d;
}



.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.msg-content-wrapper {
  flex-grow: 1;
}

.msg-meta {
  flex-shrink: 0;
}

.msg-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.msg:hover .msg-buttons {
  opacity: 1;
}

.msg-buttons button {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.msg-buttons button svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
}

.msg-buttons button:hover {
  background-color: var(--accent);
}
.msg-buttons button:hover svg {
  stroke: white;
}

.msg.user .msg-buttons {
  order: -1; 
}

.msg-edit-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-edit-textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 50px;
}

.msg-edit-textarea:focus {
  outline: none;
}

.msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.msg-edit-actions button {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.msg-edit-actions .msg-edit-save {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.delete-user-btn {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.delete-user-btn:hover {
  background: var(--danger);
  color: white;
}

#usersTable td:last-child {
  display: flex;
  gap: 4px;
}



#chatSearchInput {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pagination-controls button {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-controls span {
  font-size: 13px;
  color: var(--muted);
}

#broadcast-tab-content {
  gap: 12px;
}

#broadcast-tab-content.active {
  display: flex;
  flex-direction: column;
}

.broadcast-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 12px;
}

.broadcast-card h2 {
  margin: 0 0 10px;
}

.broadcast-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#broadcastText {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
}

#broadcastDelay {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.broadcast-file-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.broadcast-file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.broadcast-file-trigger {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.broadcast-file-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

.broadcast-file-clear {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.broadcast-file-clear:not(:disabled):hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.broadcast-form.is-locked .broadcast-file-trigger {
  pointer-events: none;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.broadcast-delay-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-bot-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.broadcast-bot-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.broadcast-estimate {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-image-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-image-hint {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.broadcast-btn {
  min-height: 44px;
  border-radius: 12px;
  border: none;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.broadcast-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.broadcast-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.broadcast-btn-start {
  color: #fff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 14px rgba(5, 150, 105, 0.28);
}

.broadcast-btn-start:not(:disabled):hover {
  filter: brightness(1.05);
}

.broadcast-btn-stop {
  color: #fff;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.24);
}

.broadcast-btn-stop:not(:disabled):hover {
  filter: brightness(1.06);
}

.broadcast-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.broadcast-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.broadcast-badge.idle {
  background: #f3f4f6;
  color: var(--muted);
  border-color: #e5e7eb;
}

.broadcast-badge.running {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.broadcast-badge.completed {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.broadcast-badge.stopped {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.broadcast-badge.failed {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.broadcast-progress-wrap {
  margin-bottom: 12px;
}

.broadcast-eta-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}

.broadcast-eta-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.broadcast-eta-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.broadcast-eta-hint {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.broadcast-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
  transition: width 0.2s ease;
}

.broadcast-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.broadcast-metric {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.broadcast-metric-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.broadcast-metric-value {
  font-size: 18px;
  font-weight: 700;
}

.broadcast-metric-value.success {
  color: var(--success);
}

.broadcast-metric-value.danger {
  color: var(--danger);
}

.broadcast-meta {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.broadcast-reason-list,
.broadcast-failure-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 10px;
}

.broadcast-reason-list li,
.broadcast-failure-list li {
  font-size: 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  word-break: break-word;
}

.broadcast-empty {
  color: var(--muted);
  font-style: italic;
}
