/* ---------------------------------------------------------------------------
   Safeguarding CMS — anne healthcare house-style demo.
   Self-contained stylesheet. Tokens match the dashboard, vault, and hub.
--------------------------------------------------------------------------- */

:root {
  --cta:            #1a67cc;
  --cta-dark:       #14509f;
  --accent:         #18d6c4;
  --accent-dark:    #13a89a;
  --cream:          #f4eed7;
  --cream-border:   #e9ddaf;
  --cool:           #e5eef8;
  --dark:           #333;
  --grey:           #4d4d4d;
  --grey-soft:      #676767;
  --grey-line:      #e0e0e0;
  --light:          #fff;
  --danger:         #c12727;

  --font-heading:   "Inter", system-ui, sans-serif;
  --font-body:      "DM Sans", system-ui, sans-serif;

  --radius-sm:      0.5rem;
  --radius-md:      1.5rem;
  --radius-pill:    100em;
  --shadow-soft:    0 3px 6px 0 rgba(0, 0, 0, 0.06);
  --shadow-lift:    0 12px 32px -16px rgba(20, 80, 159, 0.22),
                    0  3px  6px  0   rgba(0, 0, 0, 0.06);

  --content-max:    112rem;
  --gutter:         clamp(2rem, 5vw, 6rem);

  /* Status colours */
  --status-green-bg:  #e8f5e9;
  --status-green-fg:  #2e7d32;
  --status-amber-bg:  #fff8e1;
  --status-amber-fg:  #e65100;
  --status-red-bg:    #fdecea;
  --status-red-fg:    #c12727;
  --status-blue-bg:   #e5eef8;
  --status-blue-fg:   #1a67cc;
  --status-grey-bg:   #f5f5f5;
  --status-grey-fg:   #676767;
}

/* 10px rem base */
html { font-size: 62.5%; -webkit-text-size-adjust: 100%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 1.7rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse 90rem 50rem at 8% -10%,  rgba(229, 238, 248, 0.9), transparent 60%),
    radial-gradient(ellipse 70rem 40rem at 100% 5%,  rgba(244, 238, 215, 0.65), transparent 55%);
  background-repeat: no-repeat;
}

a { color: var(--cta); text-decoration: none; }
a:hover { color: var(--cta-dark); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin: 0;
  line-height: 1.25;
}


/* --- Header --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.4rem var(--gutter);
  max-width: var(--content-max);
  margin: 0 auto;
}
.brand { display: inline-flex; }
.brand img { height: 3.6rem; width: auto; display: block; }

.brand-group { display: flex; flex-direction: column; gap: 0.6rem; }
.back-links { display: flex; gap: 1.2rem; }


.back-link {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--grey-soft);
  text-decoration: none;
}
.back-link:hover { color: var(--cta); text-decoration: none; }

.chip {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--cream);
  color: var(--cta-dark);
  border: 1px solid var(--cream-border);
  white-space: nowrap;
}


/* --- Main layout ---------------------------------------------------------- */

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem var(--gutter) 8rem;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}


/* --- Alert banner --------------------------------------------------------- */

.alert-banner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.6rem 2.4rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--danger);
  background: var(--status-red-bg);
  color: var(--danger);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
}
.alert-banner svg {
  flex-shrink: 0;
}


/* --- Metrics strip -------------------------------------------------------- */

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.6rem;
}

.metric-card {
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 2rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric-card__value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 3.2rem;
  line-height: 1.1;
  color: var(--dark);
}

.metric-card__label {
  font-size: 1.4rem;
  color: var(--grey-soft);
  font-weight: 500;
}

.metric-card--danger .metric-card__value { color: var(--danger); }
.metric-card--warn .metric-card__value { color: var(--status-amber-fg); }


/* --- Section headings ----------------------------------------------------- */

.section-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2.2rem;
  color: var(--dark);
  margin: 1.2rem 0 0;
}


/* --- Case list ------------------------------------------------------------ */

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

.case-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem 2.4rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  opacity: 0;
  transform: translateY(0.6rem);
  animation: card-in 0.45s cubic-bezier(.22, 1, .36, 1) forwards;
}
.case-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

@keyframes card-in { to { opacity: 1; transform: none; } }

.case-card__avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--cool);
  border: 2px solid var(--cta);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cta);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.8rem;
}

.case-card__body {
  flex: 1;
  min-width: 0;
}

.case-card__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.8rem;
  color: var(--dark);
  margin: 0;
  line-height: 1.3;
}

.case-card__meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
  font-size: 1.4rem;
  color: var(--grey-soft);
}

.case-card__meta span::before {
  content: "";
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--grey-soft);
  vertical-align: middle;
  margin-right: 0.6rem;
}
.case-card__meta span:first-child::before {
  display: none;
}

.case-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  flex-shrink: 0;
}

.case-card__review-date {
  font-size: 1.3rem;
  color: var(--grey-soft);
  white-space: nowrap;
}


/* --- Status badges -------------------------------------------------------- */

.badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 1.1rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge--on-track  { background: var(--status-green-bg); color: var(--status-green-fg); }
.badge--review-due { background: var(--status-amber-bg); color: var(--status-amber-fg); }
.badge--overdue   { background: var(--status-red-bg);   color: var(--status-red-fg); }
.badge--new       { background: var(--status-blue-bg);  color: var(--status-blue-fg); }
.badge--pending   { background: var(--status-amber-bg); color: var(--status-amber-fg); }
.badge--complete  { background: var(--status-green-bg); color: var(--status-green-fg); }


/* --- Case detail ---------------------------------------------------------- */

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--grey-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.4rem;
}
.detail-back:hover { color: var(--cta); }

.detail-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2.4rem 3rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.detail-header__avatar {
  width: 6.4rem;
  height: 6.4rem;
  border-radius: 50%;
  background: var(--cool);
  border: 2.5px solid var(--cta);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cta);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.4rem;
}

.detail-header__info {
  flex: 1;
  min-width: 0;
}

.detail-header__name {
  font-weight: 600;
  font-size: 2.6rem;
  color: var(--dark);
  line-height: 1.2;
}

.detail-header__meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
  font-size: 1.4rem;
  color: var(--grey-soft);
}

.detail-header__meta span::before {
  content: "";
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--grey-soft);
  vertical-align: middle;
  margin-right: 0.6rem;
}
.detail-header__meta span:first-child::before {
  display: none;
}


/* --- Detail sections (cards) ---------------------------------------------- */

.detail-section {
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 2.4rem 3rem;
}

.detail-section__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--dark);
  margin: 0 0 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--grey-line);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.detail-section__title svg {
  color: var(--cta);
  flex-shrink: 0;
}

/* Info grid inside sections */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
  gap: 1.8rem 3rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.info-item__label {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-soft);
}

.info-item__value {
  font-size: 1.6rem;
  color: var(--dark);
  font-weight: 500;
}

.info-item__value--pending {
  color: var(--status-amber-fg);
  font-style: italic;
}

.info-item__value--na {
  color: #aaa;
  font-style: italic;
}


/* --- Timeline ------------------------------------------------------------- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 3.2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 1rem;
  bottom: 1rem;
  width: 2px;
  background: var(--grey-line);
}

.timeline-entry {
  position: relative;
  padding: 1.4rem 0;
  border-bottom: 1px solid #f5f5f5;
}
.timeline-entry:last-child {
  border-bottom: none;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -2.55rem;
  top: 2.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--cta);
  border: 2px solid var(--light);
  box-shadow: 0 0 0 2px var(--grey-line);
}

.timeline-entry__date {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--grey-soft);
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.timeline-entry__text {
  font-size: 1.55rem;
  color: var(--dark);
  line-height: 1.5;
  margin: 0;
}

.timeline-entry__author {
  font-size: 1.2rem;
  color: #aaa;
  margin-top: 0.3rem;
}

.timeline-entry--new::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent); }
  50%      { box-shadow: 0 0 0 5px rgba(24, 214, 196, 0.25); }
}


/* --- Add timeline entry form ---------------------------------------------- */

.add-entry-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--grey-line);
}

.add-entry-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.add-entry-form textarea {
  font-family: var(--font-body);
  font-size: 1.5rem;
  padding: 1.2rem 1.4rem;
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 8rem;
  color: var(--dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.add-entry-form textarea:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: 0 0 0 3px rgba(26, 103, 204, 0.18);
}
.add-entry-form textarea::placeholder {
  color: #aaa;
}

.add-entry-form__row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.form-label {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--grey-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  font-family: var(--font-body);
  font-size: 1.5rem;
  padding: 0.8rem 1.2rem;
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-sm);
  color: var(--dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: 0 0 0 3px rgba(26, 103, 204, 0.18);
}


/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  padding: 1rem 2.2rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0); }

.btn--primary {
  color: var(--light);
  background: var(--cta);
  box-shadow: var(--shadow-soft);
}
.btn--primary:hover {
  background: var(--cta-dark);
  transform: translateY(-1px);
}

.btn--ghost {
  color: var(--grey-soft);
  background: transparent;
  border: 1.5px solid var(--grey-line);
}
.btn--ghost:hover {
  border-color: var(--cta);
  color: var(--cta);
}

.btn--sm {
  font-size: 1.3rem;
  padding: 0.7rem 1.6rem;
}


/* --- Scheduled reviews ---------------------------------------------------- */

.review-card {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 1.4rem 2rem;
  background: var(--cool);
  border: 1px solid rgba(26, 103, 204, 0.15);
  border-radius: 1rem;
}

.review-card__icon {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  background: var(--cta);
  color: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-card__body {
  flex: 1;
}

.review-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--dark);
  line-height: 1.3;
}

.review-card__meta {
  font-size: 1.3rem;
  color: var(--grey-soft);
  margin-top: 0.2rem;
}


/* --- Notes area ----------------------------------------------------------- */

.notes-area {
  background: #fafbfc;
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-sm);
  padding: 1.4rem 1.6rem;
  font-size: 1.5rem;
  color: var(--grey);
  line-height: 1.6;
  font-style: italic;
}


/* --- Toast ---------------------------------------------------------------- */

.toast-area {
  position: fixed;
  bottom: 2.4rem;
  right: 2.4rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: none;
}
.toast {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--light);
  background: var(--dark);
  padding: 1.2rem 2rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  animation: toast-in 0.35s cubic-bezier(.22, 1, .36, 1) forwards;
  max-width: 40rem;
}
.toast--success { background: var(--status-green-fg); }
.toast--out { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(0.5rem) scale(0.96); }
}


/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--grey-line);
  padding: 3rem var(--gutter) 4rem;
  max-width: var(--content-max);
  margin: 4rem auto 0;
  color: var(--grey-soft);
  font-size: 1.35rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--cta); }
.site-footer a:hover { color: var(--cta-dark); }


/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .case-card,
  .timeline-entry--new::before,
  .toast {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}


/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .metrics-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.4rem;
    padding: 2rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .metrics-strip {
    grid-template-columns: 1fr;
  }

  .case-card {
    flex-wrap: wrap;
    gap: 1.2rem;
    padding: 1.6rem;
  }

  .case-card__right {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .detail-section {
    padding: 2rem;
  }

  .add-entry-form__row {
    flex-direction: column;
    align-items: stretch;
  }
}
