/* Small custom layer on top of Pico.css. Keep this lean. */

:root {
  --pico-form-element-spacing-vertical: 0.5rem;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

/* Restrained warm-neutral accent, replacing Pico's stock azure. Drives links
   and primary buttons only — badges use their own status palette. Pico
   declares its own light-scheme colors on `:root:not([data-theme=dark])`
   (specificity 0,2,0), which beats a plain `:root` override regardless of
   source order — match it via the `[data-theme="light"]` we hardcode in
   base.html (also 0,2,0), so later source order wins the tie. */
:root[data-theme="light"] {
  --pico-primary: #9a5b3f;
  --pico-primary-background: #9a5b3f;
  --pico-primary-underline: rgba(154, 91, 63, 0.5);
  --pico-primary-hover: #7c4632;
  --pico-primary-hover-background: #7c4632;
  --pico-primary-focus: rgba(154, 91, 63, 0.5);
}

.narrow {
  max-width: 32rem;
  margin: 2rem auto;
}

/* Let the sign-out form sit inline in the nav without block spacing. */
.inline-form {
  display: inline;
  margin: 0;
}
.inline-form button {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-logo {
  height: 1.75rem;
  width: auto;
}

/* Pico hides the underline on nav links until hover, which leaves them
   color-only at rest — invisible affordance on touch devices with no hover. */
nav li :where(a, [role="link"]):not(.brand) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* Status badges (used by the needs/duties lists and detail views). */
.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--pico-muted-border-color);
  color: var(--pico-color);
}
.badge-new { background: #fde68a; color: #713f12; }
.badge-acknowledged { background: #bfdbfe; color: #1e3a8a; }
.badge-in_progress { background: #ddd6fe; color: #4c1d95; }
.badge-resolved { background: #bbf7d0; color: #14532d; }
.badge-closed { background: #e5e7eb; color: #374151; }
.badge-upcoming { background: #bfdbfe; color: #1e3a8a; }
.badge-past { background: #e5e7eb; color: #374151; }
.badge-cancelled { background: #fecaca; color: #7f1d1d; }

/* Whole-row navigation for scannable tables: the row click is a mouse/touch
   convenience layer; the inner <a> stays the real, accessible target for
   keyboard, screen readers, and middle-click. */
.row-link {
  cursor: pointer;
}
.row-link:hover td {
  background-color: var(--pico-table-row-stripped-background-color);
}

/* Confirms an HTMX auto-save landed. htmx applies .htmx-settling the instant
   swapped-in content is inserted (no transition fires on that first paint),
   then removes it after hx-swap's settle delay — so the accent tint appears
   immediately and eases back out on removal. Pair with `settle:500ms` on the
   triggering hx-swap so the flash is visible long enough to register. */
.flash-on-save {
  transition: background-color 450ms var(--ease-out-quart);
}
.flash-on-save.htmx-settling {
  background-color: rgba(154, 91, 63, 0.16);
}
tr.flash-on-save td {
  transition: background-color 450ms var(--ease-out-quart);
}
tr.flash-on-save.htmx-settling td {
  background-color: rgba(154, 91, 63, 0.16);
}
@media (prefers-reduced-motion: reduce) {
  .flash-on-save,
  tr.flash-on-save td {
    transition: none;
  }
}

/* Screen-reader-only content — visually hidden, still announced by AT. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Destructive/irreversible actions get a quiet red tint instead of the
   default secondary gray — reuses Pico's own --pico-del-color token (the
   same one .error already borrows) rather than inventing a new red.
   !important beats Pico's own :hover/:focus rules on the same custom
   properties; the second rule's higher specificity then wins on hover. */
.danger {
  --pico-color: var(--pico-del-color) !important;
  --pico-border-color: var(--pico-del-color) !important;
}
.danger:is(:hover, :focus, :active) {
  --pico-color: #6b2c2a !important;
  --pico-border-color: #6b2c2a !important;
}

.muted { color: var(--pico-muted-color); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Honeypot field: kept in the DOM (bots fill it) but hidden from people. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.intro { white-space: pre-line; }
.error { color: var(--pico-del-color, #b3261e); }

/* Dashboard filter bar: lay the three selects out in a row on wider screens. */
.filters.grid {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  align-items: end;
  margin-bottom: 1rem;
}

/* Activity timeline */
.timeline { list-style: none; padding: 0; }
.timeline li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Admin dashboard: plain grouped link list instead of a repeated card grid. */
.admin-links { list-style: none; padding: 0; margin: 0 0 2rem; }
.admin-links li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

/* Scheduled-visit list */
.appt-list { list-style: none; padding: 0; }
.appt-list li {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
