* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --accent: #eff6ff;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 25%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

a {
  color: inherit;
}

button, input, select, textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.logo {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-btn {
  background: var(--primary);
  color: white !important;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
}

.btn-primary,
.btn-secondary,
.secondary-btn,
button {
  border-radius: 12px;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn-primary,
.btn-secondary,
.secondary-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.18);
  padding: 14px 22px;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary,
.secondary-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  padding: 12px 18px;
}

.btn-secondary:hover,
.secondary-btn:hover {
  background: var(--surface-soft);
}

button {
  border: none;
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 24px 48px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
}

.hero-content h2 {
  margin: 0 0 18px;
  font-size: 3.2rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.hero-text {
  max-width: 680px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-panel {
  display: flex;
  justify-content: center;
}

.status-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.status-label {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.status-card h3 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.status-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  font-size: 0.88rem;
}

.features,
.security {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.section-header {
  margin-bottom: 24px;
}

.section-tag {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.section-header h3,
.security-card h3 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card,
.security-card,
.panel,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.card h4 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.security-card {
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.security-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.footer {
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.footer-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 32px 28px;
}

.auth-card h1 {
  margin: 0 0 10px;
  text-align: center;
}

.auth-card .subtitle {
  margin: 0 0 20px;
  text-align: center;
  color: var(--muted);
}

.auth-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.auth-card input {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  font: inherit;
}

.auth-card input:focus,
.panel input:focus,
.panel select:focus,
.panel textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}

.auth-help {
  margin-bottom: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
}

#googleLoginBtn {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 700;
}

#googleLoginBtn:hover {
  background: var(--primary-dark);
}

#authMessage {
  margin-top: 14px;
  min-height: 20px;
  color: var(--muted);
  text-align: center;
}

.small-link {
  margin-top: 18px;
  text-align: center;
}

.small-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.small-link a:hover {
  text-decoration: underline;
}

.dashboard-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.dashboard-header h1 {
  margin: 0 0 8px;
  font-size: 2.2rem;
  line-height: 1.1;
}

.dashboard-header p {
  margin: 0;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  padding: 24px;
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

.panel h3 {
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.panel input,
.panel select,
.panel textarea {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
}

.panel textarea {
  min-height: 120px;
  resize: vertical;
}

.panel button {
  padding: 12px 18px;
}

.inline-label {
  margin-top: 12px;
}

#createAssignmentBtn,
#saveLinksBtn,
.save-member-role-btn,
.yes-btn {
  background: var(--primary);
  color: white;
}

#createAssignmentBtn:hover,
#saveLinksBtn:hover,
.save-member-role-btn:hover,
.yes-btn:hover {
  background: var(--primary-dark);
}

.no-btn,
#logoutBtn {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.no-btn:hover,
#logoutBtn:hover {
  background: var(--surface-soft);
}

#assignmentsList,
#memberList {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel.assignments-panel,
.panel.members-panel {
  height: 520px;
  display: flex;
  flex-direction: column;
}

.panel.assignments-panel #assignmentsList,
.panel.members-panel #memberList {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.panel.assignments-panel #assignmentsList::-webkit-scrollbar,
.panel.members-panel #memberList::-webkit-scrollbar {
  width: 8px;
}

.panel.assignments-panel #assignmentsList::-webkit-scrollbar-thumb,
.panel.members-panel #memberList::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.panel.assignments-panel #assignmentsList::-webkit-scrollbar-track,
.panel.members-panel #memberList::-webkit-scrollbar-track {
  background: transparent;
}

.list-item {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 16px;
}

.list-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.list-item p {
  margin: 6px 0;
  line-height: 1.6;
}

.member-role-select {
  margin-top: 8px;
}

.auth-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

#caregiverCheckboxList {
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

#caregiverCheckboxList label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 500;
}

#caregiverCheckboxList label:last-child {
  margin-bottom: 0;
}

#caregiverCheckboxList input[type="checkbox"] {
  width: auto;
  margin: 0;
}

#assignmentMessage,
#linkMessage {
  margin-top: 12px;
  min-height: 20px;
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 900px) {
  .hero,
  .security-card,
  .feature-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hero-content h2 {
    font-size: 2.4rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .nav-container {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-content h2 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary,
  .nav-btn,
  .secondary-btn,
  .panel button,
  #logoutBtn,
  .yes-btn,
  .no-btn,
  #createAssignmentBtn,
  #saveLinksBtn,
  .save-member-role-btn {
    width: 100%;
    text-align: center;
  }

  .dashboard-page {
    padding: 28px 16px 48px;
  }

  .dashboard-header h1 {
    font-size: 1.8rem;
  }

  .auth-buttons {
    flex-direction: column;
  }

  .auth-card {
    padding: 24px 20px;
  }
}

#patientAssignmentsWrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

#pendingAssignmentsList,
#completedAssignmentsList {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.split-heading {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

#patientAssignmentsWrapper.hidden {
  display: none !important;
}

#assignmentsList.hidden {
  display: none !important;
}

.grid-2 {
  align-items: stretch;
}

.panel.assignments-panel {
  min-height: 620px;
  display: flex;
  flex-direction: column;
}

.panel.assignments-panel #assignmentsList,
.panel.assignments-panel #pendingAssignmentsList,
.panel.assignments-panel #completedAssignmentsList {
  flex: 1;
}

.grid-2 {
  align-items: stretch;
}

.panel.assignments-panel {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.assignments-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.assignments-panel-header h2 {
  margin: 0;
}

#exportAssignmentsPdfBtn {
  background: var(--primary);
  color: white;
}

#exportAssignmentsPdfBtn:hover {
  background: var(--primary-dark);
}

#patientAssignmentsWrapper.hidden {
  display: none !important;
}

#assignmentsList.hidden {
  display: none !important;
}