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

:root {
  --primary: #0066cc;
  --primary-dark: #0052a3;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --light: #f8f9fa;
  --dark: #212529;
  --border: #dee2e6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.16);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--dark);
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header {
  background: white;
  box-shadow: var(--shadow);
  padding: 1.5rem 0;
  border-bottom: 3px solid var(--primary);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}

.header h1 {
  font-size: 1.8rem;
  color: var(--dark);
}

.auth-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.user-status {
  font-size: 0.9rem;
  color: var(--secondary);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-small {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: white;
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--secondary);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-btn:hover {
  background: rgba(0, 102, 204, 0.1);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card h3 {
  margin-bottom: 1rem;
  color: var(--dark);
  font-size: 1.3rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--dark);
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.7rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.message {
  padding: 0.8rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  font-weight: 500;
}

.message:empty {
  display: none;
}

.plan-list,
.med-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.plan-item,
.med-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.plan-item:hover,
.med-item:hover {
  background: white;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.plan-item h4,
.med-item h4 {
  margin-bottom: 0.3rem;
  color: var(--primary);
  font-size: 1.05rem;
}

.plan-item p,
.med-item p {
  color: var(--secondary);
  font-size: 0.9rem;
}

.plan-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.metric {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--secondary);
}

.close:hover {
  color: var(--dark);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .tabs {
    flex-direction: column;
  }
}