@font-face {
  font-family: 'Great Vibes';
  src: url('/fonts/great-vibes.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src: url('/fonts/lato-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src: url('/fonts/lato-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --teal: #0e5e67;
  --teal-dark: #0a474e;
  --teal-tint: #e7f1f2;
  --white: #ffffff;
  /* Banner height drives the lighthouse size and the title position. */
  --hero-h: clamp(240px, 30vw, 440px);
  /* The lighthouse and its light beams span ~92% of the banner height in width. */
  --lighthouse-w: calc(var(--hero-h) * 0.92);
}

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

html,
body {
  margin: 0;
  background: var(--white);
  color: var(--teal);
  font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Banner ---------- */
.hero {
  position: relative;
  padding-top: 12px;
}

.hero__art {
  display: block;
  width: 100%;
  height: var(--hero-h);
}

.hero__title {
  position: absolute;
  top: calc(12px + var(--hero-h) * 0.05);
  left: calc(var(--lighthouse-w) + 2vw);
  right: 16px;
  height: calc(var(--hero-h) * 0.67); /* the open space above the waves, level with the lighthouse */
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center; /* centered in the open space right of the lighthouse */
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  /* As large as the space allows: capped by the banner height, and by the width
     available beside the lighthouse (the script text is about 4em wide). */
  font-size: min(
    calc(var(--hero-h) * 0.44),
    calc((100vw - var(--lighthouse-w) - 2vw - 48px) / 4.2)
  );
  line-height: 1;
  white-space: nowrap;
  color: var(--teal);
}

/* ---------- Login ---------- */
.content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 56px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  border: 1px solid #cfe1e3;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 6px 24px rgba(14, 94, 103, 0.08);
}

.login-card h2 {
  margin: 0 0 20px;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.login-card p {
  text-align: center;
}

.login-card__error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fbeaea;
  color: #9b2226;
  font-size: 0.95rem;
}

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

.login-form label {
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.login-form input {
  margin-bottom: 18px;
  padding: 11px 12px;
  border: 1px solid #9fc3c7;
  border-radius: 6px;
  font: inherit;
  color: var(--teal);
  background: var(--white);
}

.login-form input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 94, 103, 0.18);
}

.login-form button {
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.login-form button:hover,
.login-form button:focus-visible {
  background: var(--teal-dark);
}

/* ---------- Footer ---------- */
.footer {
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
}

.footer p {
  margin: 0;
}

/* ---------- Small screens: title moves below the banner ---------- */
@media (max-width: 640px) {
  :root {
    --hero-h: 220px;
  }

  /* Too narrow for one line beside the lighthouse, so "Jireh" and "Care" stack in the
     open space above the waves. Each word is about 2.3em wide. */
  .hero__title {
    right: 12px;
    left: calc(var(--lighthouse-w) + 4px);
    white-space: normal;
    text-align: center;
    line-height: 0.95;
    font-size: min(
      calc(var(--hero-h) * 0.3),
      calc((100vw - var(--lighthouse-w) - 16px) / 2.3)
    );
  }

  .content {
    padding-top: 24px;
  }
}

.login-card__intro {
  margin: 0 0 20px;
  line-height: 1.5;
}

.login-form__hint {
  margin: -12px 0 18px;
  font-size: 0.85rem;
  text-align: left !important;
  opacity: 0.85;
}

.login-card__alt {
  margin: 18px 0 0;
  font-size: 0.95rem;
}

.login-card a,
.dash a {
  color: var(--teal);
  font-weight: 700;
}

.login-card__notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--teal-tint);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: left !important;
}

/* ---------- Admin dashboard ---------- */
.dash {
  background: #f5f9f9;
}

.dash-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: var(--white);
  border-bottom: 1px solid #d7e6e8;
}

.dash-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.dash-bar__name {
  font-family: 'Great Vibes', cursive;
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1;
}

.dash-bar__badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--teal-tint);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dash-bar__user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
}

.dash-bar__user form {
  margin: 0;
}

.btn {
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn--ghost {
  border: 1px solid #9fc3c7;
  background: var(--white);
  color: var(--teal);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  border-color: var(--teal);
  background: var(--teal-tint);
}

.dash-layout {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 200px;
  flex-shrink: 0;
  padding: 28px 16px;
}

.dash-nav a {
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.dash-nav a:hover {
  background: var(--teal-tint);
}

.dash-nav a[aria-current='page'] {
  background: var(--teal);
  color: var(--white);
}

.dash-main {
  flex: 1;
  min-width: 0;
  padding: 28px 24px 56px;
}

.dash-title {
  margin: 0 0 6px;
  font-size: 1.75rem;
}

.dash-sub {
  margin: 0 0 24px;
  line-height: 1.5;
  max-width: 640px;
}

.dash-heading {
  margin: 32px 0 14px;
  font-size: 1.15rem;
}

.panel .dash-heading {
  margin-top: 0;
}

.stat-grid,
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.stat,
.module,
.panel {
  padding: 18px 20px;
  border: 1px solid #d7e6e8;
  border-radius: 12px;
  background: var(--white);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat__label {
  font-size: 0.9rem;
}

.stat__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat__value--small {
  font-size: 1.05rem;
}

.module {
  border-top: 4px solid var(--teal);
}

.module h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.module p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #d7e6e8;
  border-radius: 12px;
  background: var(--white);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

.table th {
  background: var(--teal-tint);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.table tr + tr td {
  border-top: 1px solid #e3eeef;
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0 0 24px;
}

.details dt {
  font-weight: 700;
}

.details dd {
  margin: 0;
}

.panel {
  max-width: 440px;
}

@media (max-width: 760px) {
  .dash-bar {
    padding: 10px 16px;
  }

  .dash-bar__user span {
    display: none;
  }

  .dash-layout {
    flex-direction: column;
  }

  .dash-nav {
    flex-direction: row;
    width: auto;
    padding: 12px 16px 0;
    overflow-x: auto;
  }

  .dash-nav a {
    white-space: nowrap;
  }

  .dash-main {
    padding: 20px 16px 48px;
  }
}

/* ---------- Shared additions ---------- */
/* Hidden elements stay hidden even when a class gives them a display style. */
[hidden] {
  display: none !important;
}

.dash-bar__name,
.dash-bar .btn {
  white-space: nowrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a.btn {
  display: inline-block;
  text-decoration: none;
}

.btn--primary {
  border: 1px solid var(--teal);
  background: var(--teal);
  color: var(--white);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--teal-dark);
}

.btn--small {
  padding: 5px 10px;
  font-size: 0.88rem;
}

.btn--danger {
  border-color: #e3b5b7;
  color: #9b2226;
}

.btn--danger:hover,
.btn--danger:focus-visible {
  border-color: #9b2226;
  background: #fbeaea;
}

.login-card--wide {
  max-width: 460px;
}

.login-card__alt--small {
  margin-top: 8px;
  font-size: 0.85rem;
}

.login-form select,
.login-form textarea {
  margin-bottom: 18px;
  padding: 11px 12px;
  border: 1px solid #9fc3c7;
  border-radius: 6px;
  font: inherit;
  color: var(--teal);
  background: var(--white);
}

.login-form textarea {
  resize: vertical;
}

.login-form select:focus,
.login-form textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 94, 103, 0.18);
}

.optional {
  font-weight: 400;
  opacity: 0.8;
}

/* ---------- Client organizer ---------- */
.org {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 56px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.crumbs a {
  color: var(--teal);
  font-weight: 700;
}

.org-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid #d7e6e8;
  border-radius: 12px;
  background: var(--white);
}

.org-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  max-width: 420px;
}

.org-picker label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.org-picker select {
  padding: 10px 12px;
  border: 1px solid #9fc3c7;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  color: var(--teal);
  background: var(--white);
}

.org-bar .btn--primary {
  padding: 10px 20px;
  font-size: 1rem;
}

.org-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.card {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid #d7e6e8;
  border-top: 4px solid var(--teal);
  border-radius: 12px;
  background: var(--white);
}

.card--wide {
  grid-column: 1 / -1;
}

.card__title {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.card__head .card__title {
  margin: 0;
}

.card__sub {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.card__sub + .items {
  margin-bottom: 18px;
}

/* Calendar */
.cal {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 24px;
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal__label {
  font-weight: 700;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal__dow {
  padding: 4px 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.cal__day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--teal);
  cursor: pointer;
}

.cal__day:hover,
.cal__day:focus-visible {
  border-color: #9fc3c7;
}

.cal__day--busy {
  background: var(--teal-tint);
  font-weight: 700;
}

.cal__day--today {
  border-color: var(--teal);
}

.cal__day--selected {
  background: var(--teal);
  color: var(--white);
}


/* Lists of appointments, medications and notes */
.items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.items__empty {
  padding: 8px 0;
  font-size: 0.92rem;
  opacity: 0.8;
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
}

.item + .item {
  border-top: 1px solid #e3eeef;
}

.item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-wrap: anywhere;
}

.item__line {
  font-size: 0.92rem;
}

.item__meta {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--teal-tint);
  font-size: 0.78rem;
  font-weight: 700;
}

.item__body {
  margin: 4px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.item__remove {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  font-size: 1.2rem;
  line-height: 1;
  color: #9b2226;
  cursor: pointer;
}

.item__remove:hover,
.item__remove:focus-visible {
  border-color: #e3b5b7;
  background: #fbeaea;
}

/* Pop-up forms */
.modal {
  width: calc(100% - 32px);
  max-width: 460px;
  max-height: calc(100vh - 32px);
  padding: 28px;
  border: 1px solid #cfe1e3;
  border-radius: 12px;
  color: var(--teal);
  box-shadow: 0 12px 40px rgba(14, 94, 103, 0.25);
}

.modal::backdrop {
  background: rgba(10, 71, 78, 0.45);
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.modal .login-card__intro {
  margin-top: -6px;
  font-size: 0.92rem;
}

.modal__fields {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 0;
}

#add-case-wrap {
  display: flex;
  flex-direction: column;
}

.modal__buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.login-form .modal__buttons button {
  margin-top: 0;
  padding: 10px 18px;
}

.login-form .modal__buttons .btn--ghost {
  background: var(--white);
  color: var(--teal);
}

@media (max-width: 760px) {
  .org {
    padding: 16px 16px 48px;
  }

  .dash-bar__user {
    gap: 8px;
  }

  .dash-bar .btn {
    padding: 6px 10px;
    font-size: 0.88rem;
  }

  .dash-bar__name {
    font-size: 1.8rem;
  }

  .org-grid,
  .cal {
    grid-template-columns: 1fr;
  }

  .org-picker {
    max-width: none;
  }

  .modal {
    padding: 22px 18px;
  }
}

/* ---------- Show / hide password ---------- */
.password-field {
  position: relative;
  margin-bottom: 18px;
}

.login-form .password-field input {
  width: 100%;
  margin-bottom: 0;
  padding-right: 48px;
}

/* Edge adds its own reveal button; this page has one already. */
.password-field input::-ms-reveal {
  display: none;
}

.login-form .password-field__toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--teal);
  transform: translateY(-50%);
  cursor: pointer;
}

.login-form .password-field__toggle:hover,
.login-form .password-field__toggle:focus-visible {
  background: var(--teal-tint);
}

/* The slash through the eye shows while the password is hidden. */
.password-field__toggle[aria-pressed='true'] .password-field__slash {
  display: none;
}

/* ---------- Organizer: care team, refills, note groups, edit buttons ---------- */
.items--columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  column-gap: 24px;
}

.items--columns .item + .item {
  border-top: 0;
}

.items--columns .item {
  border-bottom: 1px solid #e3eeef;
}

.items__group {
  margin-top: 14px;
  padding: 6px 0 4px;
  border-bottom: 2px solid var(--teal-tint);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.items__group:first-child {
  margin-top: 0;
}

.items__group + .item {
  border-top: 0;
}

.item__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
}

.item__edit {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #cfe1e3;
  border-radius: 6px;
  background: var(--white);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
}

.item__edit:hover,
.item__edit:focus-visible {
  border-color: var(--teal);
  background: var(--teal-tint);
}

.item__flag {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 0.88rem;
  font-weight: 700;
}

.item__flag--soon {
  padding: 2px 8px;
  border-radius: 6px;
  background: #fdf3e1;
  color: #8a4b00;
}

.item--refill .item__title {
  color: #8a4b00;
}

.modal__group {
  display: flex;
  flex-direction: column;
}

.modal__section {
  margin: 6px 0 4px;
  padding-top: 14px;
  border-top: 1px solid #e3eeef;
  font-weight: 700;
}

.login-form .modal__hint {
  margin: 0 0 14px;
}

.modal__pair {
  display: grid;
  /* Two exactly equal halves that may shrink below their contents' natural width;
     plain 1fr lets a wide box (like a phone's date picker) push into its neighbour. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.modal__pair > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.modal__pair input,
.modal__pair select {
  min-width: 0;
  max-width: 100%;
}

.btn:disabled,
.btn:disabled:hover {
  border-color: #d7e6e8;
  background: var(--white);
  opacity: 0.55;
  cursor: not-allowed;
}

/* Archived (discontinued) medications */
.archive {
  margin-top: 14px;
  border-top: 1px solid #e3eeef;
  padding-top: 10px;
}

.archive summary {
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.item--archived .item__title {
  opacity: 0.75;
}

/* Linking doctors to cases */
.checks {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.checks legend {
  padding: 0;
}

.login-form .checks__item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-weight: 400;
}

.login-form .checks__item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}

.team-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e3eeef;
}

.team-link label {
  font-size: 0.9rem;
  font-weight: 700;
}

.team-link__row {
  display: flex;
  gap: 8px;
}

.team-link select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #9fc3c7;
  border-radius: 6px;
  font: inherit;
  color: var(--teal);
  background: var(--white);
}

/* Calendar icons: appointments (teal calendar), medication refills (amber pill),
   reminders (plum bell). */
.ico {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico--appointment {
  color: var(--teal);
}

.ico--refill {
  color: #9a5b00;
}

.ico--reminder {
  color: #7a3e8e;
}

.item > .ico {
  margin-top: 2px;
}

.item--reminder .item__title {
  color: #7a3e8e;
}

.cal__icons {
  display: flex;
  gap: 1px;
  margin-top: 2px;
}

.cal__icons .ico {
  width: 11px;
  height: 11px;
  stroke-width: 2.6;
}

.cal__day--selected .ico {
  color: var(--white);
}

.cal__key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.cal__key li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal__key .ico {
  width: 15px;
  height: 15px;
}

/* "Show All" / "Show Less" under long lists */
.items__more {
  margin-top: 8px;
}

.card__sub + .items:has(+ .items__more) {
  margin-bottom: 0;
}

.items__more + .card__sub {
  margin-top: 18px;
}

/* ---------- Fold-up sections ---------- */
.org-grid {
  align-items: start;
}

.card.fold {
  padding: 0;
}

.fold__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 16px;
}

.fold__heading {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.1rem;
}

.fold__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px; /* a comfortable tap target on phones */
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--teal);
  text-align: left;
  cursor: pointer;
}

.fold__toggle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

.fold__icon,
.fold__chevron {
  display: flex;
  flex-shrink: 0;
}

.fold__icon .ico {
  width: 22px;
  height: 22px;
}

.fold__title {
  min-width: 0;
}

.fold__count {
  flex-shrink: 0;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--teal-tint);
  font-size: 0.8rem;
}

.fold__count:empty {
  display: none;
}

.fold__chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.fold__chevron .ico {
  width: 20px;
  height: 20px;
}

.fold--open .fold__chevron {
  transform: rotate(180deg);
}

.fold__add {
  flex-shrink: 0;
}

.fold__body {
  padding: 2px 20px 18px;
  border-top: 1px solid #e3eeef;
}

.fold__body > .items:first-child,
.fold__body > p:first-child {
  margin-top: 6px;
}

.cal__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal__title span {
  display: flex;
}

.cal__title .ico {
  width: 22px;
  height: 22px;
}

/* Questions to bring to an appointment */
.item__chip {
  align-self: flex-start;
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid #9fc3c7;
  border-radius: 999px;
  background: var(--white);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
}

.item__chip:hover,
.item__chip:focus-visible,
.item__chip[aria-expanded='true'] {
  border-color: var(--teal);
  background: var(--teal-tint);
}

.item__questions {
  margin: 6px 0 2px;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.item__questions li + li {
  margin-top: 4px;
}

.item__flag--appt {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--teal-tint);
}

@media (max-width: 640px) {
  /* On phones the section add buttons just say "+ Add"; the heading names the section. */
  .fold__add-word {
    display: none;
  }

  .fold__head {
    padding: 8px 10px 8px 12px;
  }

  .fold__body {
    padding: 2px 14px 14px;
  }

  .fold__heading {
    font-size: 1.02rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fold__chevron {
    transition: none;
  }
}

/* Fold-up sections stack full width, so opening one never leaves a gap beside another. */
.org-grid > .fold {
  grid-column: 1 / -1;
}

/* The name line: the person's (or case's) name with a pencil to edit it on the right. */
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-row .dash-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.title-row__edit {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #cfe1e3;
  border-radius: 8px;
  background: var(--white);
  color: var(--teal);
  cursor: pointer;
}

.title-row__edit:hover,
.title-row__edit:focus-visible {
  border-color: var(--teal);
  background: var(--teal-tint);
}

.title-row__edit span {
  display: flex;
}

.title-row__edit .ico {
  width: 20px;
  height: 20px;
}

/* A delete button in a form sits on the left, away from Save (on phones, on its own
   row below). */
.modal__buttons {
  flex-wrap: wrap;
}

.login-form .modal__buttons .modal__delete {
  margin-right: auto;
  border: 1px solid #e3b5b7;
  background: var(--white);
  color: #9b2226;
}

.login-form .modal__buttons .modal__delete:hover,
.login-form .modal__buttons .modal__delete:focus-visible {
  border-color: #9b2226;
  background: #fbeaea;
}

@media (max-width: 640px) {
  .login-form .modal__buttons .modal__delete {
    order: 3;
    width: 100%;
    margin: 6px 0 0;
  }
}

/* Checklist tick boxes for questions (asked) and reminders (done) */
.item__check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.item--done .item__title {
  text-decoration: line-through;
  opacity: 0.65;
}

.item--done .item__line {
  opacity: 0.75;
}

@media (max-width: 640px) {
  /* A bigger target for thumbs */
  .item__check {
    width: 26px;
    height: 26px;
  }
}

/* Custom repeat: "Repeat every [N] [weeks]" and weekday toggles */
.repeat-custom {
  display: flex;
  flex-direction: column;
  margin: 0 0 14px;
  padding: 12px 14px 4px;
  border: 1px solid #d7e6e8;
  border-radius: 8px;
}

.repeat-custom legend {
  padding: 0 4px;
  font-weight: 700;
  font-size: 0.95rem;
}

.repeat-custom__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
}

.repeat-custom__row input,
.repeat-custom__row select {
  min-width: 0;
}

.repeat-custom__label {
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.weekdays {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 12px;
}

.login-form .weekday {
  position: relative;
  margin: 0;
}

.weekday input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.weekday span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid #9fc3c7;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}

.weekday input:checked + span {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--white);
}

.weekday input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.login-form .repeat-custom .login-form__hint {
  margin: 0 0 12px;
}

/* ---------- Compact add/edit forms ---------- */
/* Fields in pop-up forms sit a little closer together. */
.modal .login-form label {
  margin-bottom: 4px;
}

.modal .login-form input,
.modal .login-form select,
.modal .login-form textarea {
  margin-bottom: 12px;
  padding: 9px 10px;
}

.modal .login-form .modal__pair input,
.modal .login-form .modal__pair select {
  width: 100%;
}

/* A pair whose second field is hidden (e.g. "How Many Times" before a repeat is chosen)
   lets the first field use the whole line. */
.modal__pair:has(> [hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

/* Safari on iPhone gives date and time boxes a built-in minimum width that ignores the
   box they sit in. Dropping the native look lets them fit; tapping still opens the
   phone's date or time picker. */
.modal .login-form input[type="date"],
.modal .login-form input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 42px;
  background: var(--white);
}

.modal .login-form input[type="date"]::-webkit-date-and-time-value,
.modal .login-form input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}

.modal .login-form .weekday input {
  margin: 0;
  padding: 0;
}

.modal .login-form .repeat-custom__row input,
.modal .login-form .repeat-custom__row select {
  margin-bottom: 10px;
}

.modal .modal__section {
  margin-top: 2px;
  padding-top: 10px;
}

@media (max-width: 640px) {
  .modal__pair {
    gap: 10px;
  }

  /* Native date/time boxes are wide; slightly smaller text and padding keep them inside
     their half of the line. */
  .modal .login-form input[type="date"],
  .modal .login-form input[type="time"] {
    padding: 9px 6px;
    font-size: 0.9rem;
  }
}

/* Side-by-side boxes line up even when one label wraps onto two lines, and every box in a
   form is the same height (date and time boxes included). */
.modal__pair > div {
  justify-content: flex-end;
}

.modal .login-form input:not([type="checkbox"]),
.modal .login-form select {
  min-height: 42px;
}
