


: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;
  justify-content: space-between;
  align-items: center;
}

li.chat .meta {
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: 8px;
  display: inline-block;
}


#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: pre-wrap;
  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 {
  max-width: 100%;
  max-height: 250px;
  border-radius: 6px;
  display: block;
  cursor: pointer;
}

.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-text {
  margin-top: 4px;
}

.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: 0;
}

.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;
}

.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;
  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 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 {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.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 {
  background-color: #f3f4f6;
  color: var(--muted);
  border-color: #e5e7eb;
}

#closedChats li.chat strong {
  color: var(--text);
}
