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

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

.hidden {
  display: none !important;
}

/* --- Login Screen --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e5e7eb;
  text-align: center;
}

.login-card .logo {
  margin-bottom: 4px;
}

.login-card .subtitle {
  margin-bottom: 28px;
}

.login-card .form-group {
  text-align: left;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: #2563eb;
}

.login-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: #16213e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button[type="submit"]:hover {
  background: #1a2942;
}

.login-card button[type="submit"]:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* --- Main App --- */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 30px 0 24px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: #16213e;
}

.subtitle {
  color: #6b7280;
  font-size: 0.95rem;
  margin-top: 6px;
}

.logout-btn {
  background: none;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

main {
  flex: 1;
}

form#callForm {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}

.form-group {
  margin-bottom: 22px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #374151;
}

.phone-input {
  display: flex;
  align-items: stretch;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.phone-input:focus-within {
  border-color: #2563eb;
}

.country-code {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: #f3f4f6;
  font-weight: 600;
  color: #4b5563;
  border-right: 2px solid #d1d5db;
  font-size: 1rem;
}

.phone-input input {
  flex: 1;
  padding: 12px 14px;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.hint {
  display: block;
  margin-top: 6px;
  color: #9ca3af;
  font-size: 0.8rem;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: #2563eb;
}

button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: #16213e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.5px;
}

button[type="submit"]:hover {
  background: #1a2942;
}

button[type="submit"]:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.status-panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px 28px;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.status-header h3 {
  font-size: 0.95rem;
  color: #374151;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.close-btn:hover {
  color: #374151;
}

.call-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.call-status.success .spinner {
  border-color: #10b981;
  border-top-color: #10b981;
  animation: none;
}

.call-status.error .spinner {
  border-color: #ef4444;
  border-top-color: #ef4444;
  animation: none;
}

.call-status.ended .spinner {
  border-color: #6b7280;
  border-top-color: #6b7280;
  animation: none;
}

#statusText {
  font-size: 0.95rem;
  color: #374151;
}

.history-panel {
  margin-top: 20px;
  background: #fff;
  border-radius: 12px;
  padding: 20px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}

.history-panel h3 {
  font-size: 0.95rem;
  color: #374151;
  margin-bottom: 12px;
}

.empty-state {
  color: #9ca3af;
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.9rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-number {
  font-weight: 600;
  color: #1a1a2e;
}

.history-time {
  color: #9ca3af;
  font-size: 0.8rem;
}

.history-status {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-status.queued {
  background: #fef3c7;
  color: #92400e;
}

.history-status.ringing,
.history-status.in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.history-status.ended {
  background: #d1fae5;
  color: #065f46;
}

.history-status.failed {
  background: #fee2e2;
  color: #991b1b;
}

footer {
  text-align: center;
  padding: 24px 0;
  color: #9ca3af;
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  header {
    padding: 20px 0 16px;
  }

  .logo {
    font-size: 1.8rem;
  }

  form#callForm {
    padding: 20px;
  }

  .header-row {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
}
