* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  line-height: 1.5;
  min-height: 100vh;
}

.portal-header {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.portal-header h1 {
  font-size: 18px;
  font-weight: 700;
}
.portal-header .user {
  font-size: 13px;
  opacity: 0.9;
}
.portal-header .btn-logout {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 12px;
}
.portal-header .btn-logout:hover {
  background: rgba(255,255,255,0.3);
}

.container {
  max-width: 920px;
  margin: 32px auto;
  padding: 0 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.card h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: #0f172a;
}
.card .lead {
  color: #64748b;
  margin-bottom: 20px;
  font-size: 14px;
}

.form-field {
  margin-bottom: 16px;
}
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-field textarea {
  min-height: 80px;
  resize: vertical;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: #1d4ed8;
}
.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}
.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}
.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.referral-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.referral-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.referral-card.green { border-left-color: #16a34a; }
.referral-card.yellow { border-left-color: #ca8a04; }
.referral-card.red { border-left-color: #dc2626; }

.referral-card .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.referral-card .case-num {
  font-family: monospace;
  font-size: 12px;
  color: #64748b;
}
.referral-card .status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
}
.referral-card .patient {
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
  margin-bottom: 4px;
}
.referral-card .meta {
  font-size: 12px;
  color: #64748b;
}

.activity-timeline {
  margin-top: 20px;
}
.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.activity-item .activity-date {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 2px;
}
.activity-item .activity-type {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  font-weight: 600;
  text-transform: uppercase;
}

.empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
  font-size: 14px;
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}
.brand .brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #1e40af;
}
.brand .brand-tagline {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.hint-link {
  font-size: 13px;
  color: #2563eb;
  cursor: pointer;
  margin-top: 12px;
  display: inline-block;
}
.hint-link:hover {
  text-decoration: underline;
}
