* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* Header */
.header {
  background: #1a1a2e;
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 18px; font-weight: 600; }
.header .user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.header button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.header button:hover { background: rgba(255,255,255,0.25); }

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 380px;
}
.login-box h1 {
  text-align: center;
  margin-bottom: 8px;
  color: #1a1a2e;
  font-size: 24px;
}
.login-box p {
  text-align: center;
  color: #666;
  margin-bottom: 24px;
  font-size: 14px;
}
.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.login-box input:focus { outline: none; border-color: #1a1a2e; }
.login-box .btn-login {
  width: 100%;
  padding: 12px;
  background: #1a1a2e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.login-box .btn-login:hover { background: #16213e; }
.login-error {
  color: #e74c3c;
  text-align: center;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

/* Main container */
.container { max-width: 900px; margin: 0 auto; padding: 20px; }

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 8px 16px;
  border: 2px solid #ddd;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: #1a1a2e; }
.filter-btn.active { background: #1a1a2e; color: white; border-color: #1a1a2e; }

/* Message cards */
.message-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #3498db;
  transition: transform 0.1s;
}
.message-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.message-card.sent { border-left-color: #2ecc71; opacity: 0.6; }
.message-card.skipped { border-left-color: #95a5a6; opacity: 0.5; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.lead-info h3 { font-size: 16px; margin-bottom: 4px; }
.lead-info .phone {
  color: #3498db;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.lead-info .phone:hover { text-decoration: underline; }
.send-time {
  background: #eef6ff;
  color: #2980b9;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.appointment-info {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.message-text {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.message-type {
  display: inline-block;
  background: #e8e8e8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #555;
  margin-bottom: 8px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-copy { background: #3498db; color: white; }
.btn-copy:hover { background: #2980b9; }
.btn-sent { background: #2ecc71; color: white; }
.btn-sent:hover { background: #27ae60; }
.btn-skip { background: #ecf0f1; color: #666; }
.btn-skip:hover { background: #ddd; }
.btn-whatsapp { background: #25d366; color: white; }
.btn-whatsapp:hover { background: #1da851; }

/* Voice note badge */
.voice-badge {
  background: #f0e6ff;
  color: #7c3aed;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.voice-badge::before { content: '\uD83C\uDFA4 '; }

/* Meeting link box */
.meeting-link-box {
  background: #eef9ee;
  border: 1px solid #c3e6c3;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.meeting-link-label {
  font-size: 12px;
  color: #555;
  display: block;
  margin-bottom: 4px;
}
.meeting-link-url {
  font-size: 13px;
  color: #2980b9;
  word-break: break-all;
  margin-bottom: 8px;
  font-weight: 500;
}
.btn-link-copy {
  background: #27ae60;
  color: white;
  padding: 6px 14px;
  font-size: 12px;
}
.btn-link-copy:hover { background: #219a52; }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.status-sent { background: #d5f5e3; color: #27ae60; }
.status-skipped { background: #f0f0f0; color: #888; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}
.empty-state h2 { font-size: 20px; margin-bottom: 8px; color: #aaa; }

/* Settings */
.settings-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: none;
}
.settings-panel.open { display: block; }
.settings-panel h2 { font-size: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #1a1a2e; }
.btn-save { background: #1a1a2e; color: white; padding: 10px 24px; }
.btn-save:hover { background: #16213e; }

/* Admin */
.admin-table {
  width: 100%;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.admin-table th {
  background: #1a1a2e;
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
}
.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.admin-table tr:hover td { background: #f8f9fa; }

.template-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.template-help {
  font-size: 13px;
  color: #666;
  margin-bottom: 14px;
  line-height: 1.45;
}
.template-card {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fcfcfd;
}
.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.template-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}
.template-card-offset {
  font-size: 12px;
  color: #4f46e5;
  background: #eef2ff;
  border-radius: 999px;
  padding: 2px 8px;
}
.template-textarea {
  width: 100%;
  min-height: 115px;
  resize: vertical;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}
.template-textarea:focus {
  outline: none;
  border-color: #1a1a2e;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 16px; font-size: 18px; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #ecf0f1; color: #333; }
.btn-secondary:hover { background: #ddd; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2ecc71;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 300;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #e74c3c; }

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .message-card { padding: 14px; }
  .card-header { flex-direction: column; gap: 8px; }
  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; text-align: center; }
}
