/* ---- 18a. KPI row -------------------------------------------------------
 * The KPI row's styles live in components/shell.css (the in-app pane grammar),
 * which loads after this file and owned the effective rules anyway. Kept here
 * as a pointer so the next reader doesn't re-add a second definition. */

/* ---- 18b. Gauge (speedometer dial) --------------------------------------- */

/* `section.gauge`, not `.gauge`: the component composes `.glass-card` for its
   MATERIAL (translucent fill, rim, tinted shadow, blur) but owns its own box —
   a card pane is padding-free because the header rule has to reach the pane's
   edges, and it sits on the card radius step, not the utility's default. The
   element+class selector wins over the single-class utility regardless of which
   stylesheet loads first, so this doesn't depend on the @import order. */
section.gauge {
  margin-bottom: 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--ta-r-xl);
  /* The pane keeps its content height. `.app-main` is a flex column, so a
     shrinkable item gets squeezed when the page is taller than the viewport —
     and because the pane clips (overflow: hidden, to keep the header rule
     inside its rounded corners) that squeeze silently cut the bottom off the
     dial rather than just crowding it. */
  flex-shrink: 0;
}

.gauge-head {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--ta-border);
}

.gauge-title {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.014em;
}

.gauge-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
}

/* The dial is capped rather than fluid: a speedometer that grows with its
   column stops reading as an instrument. */
.gauge-dial {
  display: block;
  width: 100%;
  max-width: 15rem;
  height: auto;
}

.gauge-track {
  stroke: var(--ta-surface-2);
}

/* Arc AND needle both take the severity colour, so the reading and the
   position agree — a green needle on a red arc is a mixed message. */
.gauge-arc,
.gauge-needle {
  stroke: var(--ta-ok);
  transition: stroke var(--ta-t) var(--ta-ease);
}

.gauge.warn .gauge-arc,
.gauge.warn .gauge-needle {
  stroke: var(--ta-warn);
}

.gauge.danger .gauge-arc,
.gauge.danger .gauge-needle {
  stroke: var(--ta-err);
}

/* Ticks and the hub's ring are quiet scale furniture — they orient the needle
   without competing with it. */
.gauge-tick {
  stroke: color-mix(in oklab, var(--ta-muted) 40%, transparent);
}

.gauge-pivot {
  fill: var(--ta-surface);
  stroke: color-mix(in oklab, var(--ta-muted) 40%, transparent);
}

.gauge-value {
  fill: var(--ta-text);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.gauge-unit {
  fill: var(--ta-muted);
  font-size: 14px;
  font-weight: 500;
}

.gauge-end {
  fill: var(--ta-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.gauge-caption {
  margin: 0.375rem 0 0;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--ta-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ---- 18c. Today focus (funeral director's morning glance) ---------------- */

.today-focus {
  margin-bottom: 1.5rem;
}

.today-focus-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--ta-border);
}

.today-focus-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.today-date {
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  color: var(--ta-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0.9rem;
}

.today-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 1.15rem;
  background: var(--ta-surface);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r);
  text-decoration: none;
}

a.today-pane {
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.today-pane:hover {
  border-color: var(--ta-accent);
  box-shadow: var(--ta-shadow-sm);
}

.today-pane h3 {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.today-empty {
  margin: 0.2rem 0;
  color: var(--ta-muted);
  font-size: 0.9rem;
}

.today-services-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.today-services-list li {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.6rem;
  align-items: start;
}

.today-time {
  font-family: var(--ta-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ta-accent);
  padding-top: 0.1rem;
}

.today-service-body {
  min-width: 0;
}

.today-person {
  font-weight: 600;
  color: var(--ta-text);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-person:hover {
  color: var(--ta-accent);
}

.today-service-meta {
  margin: 0.15rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--ta-muted);
}

.today-place {
  color: var(--ta-faint);
}

.today-attention-list {
  list-style: none;
  margin: 0;
  padding: 0 0.25rem 0 0;
  display: grid;
  gap: 0.55rem;
  /* A long attention list scrolls inside its pane so the four-pane grid
     stays balanced — the services and care counts stay in view. */
  max-height: 19rem;
  overflow-y: auto;
}

.today-attention-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.today-kind {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: none;
}

.today-kind.kind-task {
  background: var(--ta-accent);
}

.today-kind.kind-message {
  background: var(--ta-teal);
}

.today-attention-text {
  color: var(--ta-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-attention-text:hover {
  color: var(--ta-accent);
}

.today-attention-text.overdue {
  color: var(--ta-err);
  font-weight: 600;
}

.today-attention-who {
  margin-left: auto;
  flex: none;
  color: var(--ta-faint);
  font-size: 0.8rem;
}

.today-care-count {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ta-teal);
}

.today-care-note {
  margin: 0.2rem 0 0;
  color: var(--ta-muted);
  font-size: 0.88rem;
}

.today-family-link {
  margin: auto 0 0;
  color: var(--ta-accent);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---- 18d. In-our-care board (inspector register) ------------------------- */

.in-care-board {
  margin-bottom: 1.5rem;
}

.in-care-heading {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 650;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--ta-border);
}

.in-care-columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.in-care-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r);
  background: var(--ta-surface-2);
}

.in-care-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--ta-border);
}

.in-care-col-head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.in-care-count {
  color: var(--ta-muted);
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.in-care-col-body {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 0.6rem;
  min-height: 2rem;
}

.in-care-card {
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface);
  box-shadow: var(--ta-shadow-sm);
  color: inherit;
  text-decoration: none;
}

.in-care-card:hover {
  border-color: var(--ta-accent);
}

.in-care-photo {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--ta-surface-2);
}

.in-care-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.in-care-name {
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.in-care-ref {
  font-family: var(--ta-mono);
  font-size: 0.72rem;
  color: var(--ta-faint);
}

.in-care-ids {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--ta-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.in-care-idsep {
  color: var(--ta-faint);
}

.in-care-meta {
  margin: 0.1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ta-muted);
}

.in-care-time {
  color: var(--ta-faint);
}

.in-care-idwarn {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ta-err);
}

.in-care-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ta-warn);
  background: var(--ta-warn-soft);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}

.in-care-flag svg {
  width: 0.8rem;
  height: 0.8rem;
  flex: none;
}

/* ---- 18e. Custody register (chain-of-custody timeline) ------------------- */

.custody-register {
  margin-bottom: 1.5rem;
}

.custody-heading {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.custody-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.custody-timeline::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 1px;
  background: var(--ta-border-strong);
}

.custody-checkpoint {
  position: relative;
  padding-left: 1.6rem;
  padding-bottom: 1.1rem;
}

.custody-checkpoint:last-child {
  padding-bottom: 0;
}

.custody-dot {
  position: absolute;
  left: 0.12rem;
  top: 0.3rem;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--ta-surface);
  border: 2px solid var(--ta-accent);
}

.custody-body {
  background: var(--ta-surface);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r);
  padding: 0.7rem 0.9rem;
}

.custody-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.custody-state {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: capitalize;
}

.custody-time {
  flex: none;
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  color: var(--ta-faint);
}

.custody-loc {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  color: var(--ta-muted);
}

.custody-note {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  color: var(--ta-muted);
  font-style: italic;
}

.custody-meta {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.custody-id {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
}

.custody-id::before {
  content: "";
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: currentColor;
}

.custody-id.ok {
  color: var(--ta-ok);
}

.custody-id.missing {
  color: var(--ta-err);
}

.custody-by {
  margin-left: auto;
  color: var(--ta-faint);
}

/* ---- 18f. Day-sheet run (chronological run sheet) ------------------------ */

.day-sheet-run {
  margin-bottom: 1.5rem;
}

.day-sheet-run-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--ta-border);
}

.day-sheet-run-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.day-sheet-run-date {
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  color: var(--ta-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.day-sheet-runs {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--ta-surface);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r);
  overflow: hidden;
}

.day-sheet-run-item {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--ta-border);
  align-items: start;
}

.day-sheet-run-item:last-child {
  border-bottom: none;
}

.day-sheet-run-item.conflict {
  background: var(--ta-warn-soft);
}

.day-sheet-time {
  font-family: var(--ta-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ta-accent);
  padding-top: 0.1rem;
}

.day-sheet-body {
  min-width: 0;
}

.day-sheet-person {
  font-weight: 600;
  color: var(--ta-text);
  text-decoration: none;
}

.day-sheet-person:hover {
  color: var(--ta-accent);
}

.day-sheet-meta {
  margin: 0.15rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--ta-muted);
}

.day-sheet-kind {
  text-transform: capitalize;
}

.day-sheet-place {
  color: var(--ta-faint);
}

.day-sheet-conflict {
  color: var(--ta-err);
  font-weight: 650;
}

