:root {
  --chatnox-accent: #F38313;
  --chatnox-bg: #ffffff;
  --chatnox-text: #1f2937;
  --chatnox-muted: #6b7280;
  --chatnox-border: #e5e7eb;
}

.chatnox_btn_orange,
#chatnox-widget-root .chatnox_btn_orange {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 16px;
  background: var(--chatnox-accent);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(0,0,0,.08);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}

#chatnox-widget-root {
  position: fixed;
  bottom: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
}
#chatnox-widget-root.chatnox-position-right {
  right: 24px;
  align-items: flex-end;
}
#chatnox-widget-root.chatnox-position-left {
  left: 24px;
  align-items: flex-start;
}

.chatnox-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: var(--chatnox-accent);
  color: #fff;
  padding: 14px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  cursor: pointer;
}
.chatnox-toggle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 4px rgba(255,255,255,.18);
}
.chatnox-toggle-label { font-weight: 700; }

.chatnox-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  width: min(360px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 110px));
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.06);
}
#chatnox-widget-root.chatnox-position-right .chatnox-panel {
  right: 0;
}
#chatnox-widget-root.chatnox-position-left .chatnox-panel {
  left: 0;
}
.chatnox-header {
  color: #fff;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.chatnox-title { font-size: 18px; font-weight: 700; }
.chatnox-subtitle { font-size: 13px; opacity: .9; margin-top: 2px; }
.chatnox-minimize {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.chatnox-body {
  padding: 16px;
  background: #f9fafb;
  overflow-y: auto;
}
.chatnox-welcome {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.chatnox-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.chatnox-message { display: flex; }
.chatnox-message-visitor { justify-content: flex-end; }
.chatnox-message-admin { justify-content: flex-start; }
.chatnox-message-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--chatnox-border);
  color: var(--chatnox-text);
}
.chatnox-message-visitor .chatnox-message-bubble {
  background: var(--chatnox-accent);
  color: #fff;
  border-color: transparent;
}
.chatnox-message-author {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: .9;
}
.chatnox-start-form,
.chatnox-message-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chatnox-start-form input,
.chatnox-start-form textarea,
.chatnox-message-form textarea,
.chatnox-admin-reply-form textarea {
  width: 100%;
  border: 1px solid var(--chatnox-border);
  border-radius: 10px;
  padding: 10px 12px;
  box-sizing: border-box;
  resize: vertical;
  font-size: 14px;
}

.chatnox-admin-wrap .chatnox-admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(500px, 1fr);
  gap: 20px;
  margin-top: 20px;
}
.chatnox-admin-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.04);
}
.chatnox-inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chatnox-inbox-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}
.chatnox-conversation-list {
  max-height: 600px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;
  background: #f9fafb;
}
.chatnox-conversation-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.chatnox-conversation-item strong,
.chatnox-conversation-item span,
.chatnox-conversation-item small { display: block; }
.chatnox-conversation-item span { color: #6b7280; margin-top: 4px; }
.chatnox-conversation-item small { color: #9ca3af; margin-top: 6px; }
.chatnox-thread-pane {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  background: #f9fafb;
}
.chatnox-thread-meta {
  color: #374151;
  font-weight: 600;
  margin-bottom: 12px;
}
.chatnox-thread-messages {
  min-height: 360px;
  max-height: 480px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}
.chatnox-thread-message { display: flex; margin-bottom: 12px; }
.chatnox-thread-message-admin { justify-content: flex-end; }
.chatnox-thread-bubble {
  max-width: 78%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 10px 12px;
}
.chatnox-thread-message-admin .chatnox-thread-bubble {
  background: #fff7ed;
  border-color: #fed7aa;
}
.chatnox-thread-bubble small {
  display: block;
  color: #9ca3af;
  margin-top: 6px;
}
.chatnox-thread-actions {
  margin: 12px 0;
}
.chatnox-admin-reply-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 1100px) {
  .chatnox-admin-wrap .chatnox-admin-grid,
  .chatnox-inbox-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .chatnox-panel { width: min(360px, calc(100vw - 16px)); }
  #chatnox-widget-root.chatnox-position-right { right: 8px; }
  #chatnox-widget-root.chatnox-position-left { left: 8px; }
  #chatnox-widget-root { bottom: 8px; }
}
