* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, sans-serif; background: #f5f7fb; color: #1f2937; }
.container { width: min(1200px, 92vw); margin: 0 auto; }
.topbar { background: linear-gradient(135deg, #0b4f6c, #11698e); color: #fff; padding: 14px 0; margin-bottom: 20px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 700; letter-spacing: 0.4px; }
.menu a { color: #fff; text-decoration: none; margin-left: 14px; }
.panel { background: #fff; border: 1px solid #dbe3ef; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.warn { border-left: 4px solid #dc2626; background: #fff7f7; padding: 10px; margin-bottom: 8px; border-radius: 8px; }
.info { color: #4b5563; font-size: 14px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.badge-open { background: #fef08a; color: #111827; }
.badge-work { background: #bfdbfe; color: #0f172a; }
.badge-closed { background: #bbf7d0; color: #14532d; }
.btn { border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.btn-green { background: #16a34a; color: #fff; }
.btn-red { background: #dc2626; color: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e5e7eb; padding: 10px 8px; text-align: left; vertical-align: top; }
.muted { color: #6b7280; font-size: 13px; }
.critical { color: #b91c1c; font-weight: 700; }
form.inline { display: inline-block; margin: 0 4px 0 0; }
.api-message-deleted-note {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
.api-message-deleted-icon {
  font-size: 12px;
  line-height: 1;
  opacity: 0.8;
}
.api-message-deleted-label {
  color: #c9707d;
  font-weight: 600;
}
.api-message-delivery-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  min-width: 32px;
  height: 28px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  width: fit-content;
}
.api-message-delivery-status.delivered {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.api-message-delivery-status.read {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.api-message-delivery-status.pending {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.api-message-quote {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid #93c5fd;
  background: #eff6ff;
  border-radius: 10px;
}
.api-message-quote-author {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
}
.api-message-quote-text {
  font-size: 13px;
  color: #374151;
  white-space: pre-wrap;
}
.api-message-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.api-message-footer-left,
.api-message-footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.api-message-footer-left {
  color: #6b7280;
  font-size: 12px;
}
.api-message-time {
  font-size: 12px;
  color: #6b7280;
}
.api-message-reply-btn,
.api-message-delete-btn {
  margin: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background: #f8fafc;
  color: #1f2937;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.api-message-delete-btn {
  border-color: #fca5a5;
  color: #b91c1c;
}
.api-message-reply-btn:hover,
.api-message-delete-btn:hover {
  background: #e2e8f0;
}
.api-message-reply-btn:focus,
.api-message-delete-btn:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.api-message-deleted-note {
  margin-top: 0;
}
.api-message-delivery-status.read {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.api-message-delivery-status.delivered {
  background: #f0f9ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.api-message-delivery-status.pending {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.reply-preview {
  display: none;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}
.reply-preview-line {
  font-size: 13px;
  color: #475569;
  margin-bottom: 4px;
}
.reply-preview-text {
  font-size: 14px;
  color: #0f172a;
  white-space: pre-wrap;
}
.reply-preview-clear {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 16px;
  cursor: pointer;
  align-self: start;
}
.reply-preview-clear:hover {
  color: #111827;
}
@media (max-width: 760px) {
  th:nth-child(4), td:nth-child(4) { display: none; }
}
