* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fa;
  color: #1a2744;
  min-height: 100vh;
}

/* Header */
.header {
  background: #1a2744;
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.1rem; font-weight: 600; }
.header .subtitle { font-size: 0.75rem; opacity: 0.7; }
.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: center;
  width: 100%;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-success { background: #16a34a; color: white; }
.btn-danger { background: #dc2626; color: white; }
.btn-secondary { background: #6b7280; color: white; }
.btn-outline {
  background: white;
  border: 1.5px solid #2563eb;
  color: #2563eb;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Scenario box */
.scenario-box {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.scenario-box .label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #2563eb;
  margin-bottom: 4px;
}
.scenario-box p { font-size: 0.9rem; line-height: 1.5; }

/* Chat */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.bubble.customer {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.bubble.pm {
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.bubble-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.6;
}
.bubble.customer .bubble-label { color: #6b7280; }
.bubble.pm .bubble-label { color: rgba(255,255,255,0.7); }

.chat-input-area {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input-area textarea {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
}
.chat-input-area .btn-send {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 12px;
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-input-area .btn-send:disabled { opacity: 0.5; }

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Submit area */
.submit-area {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: white;
}

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 480px) { .admin-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card .stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: #2563eb;
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 4px;
}

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: #f9fafb; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 1px solid #e5e7eb; }
td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; }
tr:hover td { background: #f9fafb; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-scored { background: #dcfce7; color: #166534; }
.badge-reviewed { background: #ede9fe; color: #5b21b6; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #eff6ff; color: #1e40af; }

/* Spacing */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.text-sm { font-size: 0.85rem; }
.text-gray { color: #6b7280; }
.text-center { text-align: center; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
