/* Signed-in dashboard, part 3: the shared page blocks (cards.js) restyled flat and
   dense, and the dense-data helpers (table.js): dataTable, statCard, badge, avatar. */

/* Page header (pageHero): no card, title left, page controls right. */
.is-dash .page-hero {
  display: grid; gap: 12px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.is-dash .hero-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.is-dash .hero-text { display: grid; justify-items: start; gap: 2px; min-width: 0; }
.is-dash .hero-text .back-link { margin: 0 0 6px -4px; }
.is-dash .hero-label { margin: 0; color: var(--d-muted); font-size: 12px; font-weight: 500; }
.is-dash .page-title { margin: 0; font: 600 20px/1.3 var(--d-sans); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.is-dash .hero-sub { margin: 2px 0 0; max-width: 80ch; color: var(--d-muted); font-size: 13px; }
.is-dash .hero-note { margin: 0; color: var(--d-muted); font-size: 12px; }
.is-dash .hero-aside, .is-dash .hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.is-dash .hero-cover { width: 100%; max-width: 1040px; aspect-ratio: 16 / 6; margin: 0; border: 1px solid var(--d-border); border-radius: var(--d-radius-lg); }
.is-dash .hero-link { color: var(--d-text); text-decoration-color: var(--d-border-strong); }
.is-dash .hero-link:hover { color: var(--d-text); text-decoration-color: currentColor; }
.is-dash .page-hero .tiles, .is-dash .page-hero .actions-row, .is-dash .hero-tiles { margin-top: 0; }
.is-dash .hero-caption { margin: 0; }
.is-dash .meta-row { gap: 4px 16px; margin: 4px 0 0; color: var(--d-text-2); font-size: 13px; }
.is-dash .meta-row li { gap: 6px; }
.is-dash .meta-row .icon { width: 14px; height: 14px; color: var(--d-muted); }

/* Panels. `panel--flush` puts tables and lists edge to edge under a ruled head. */
.is-dash .panel {
  display: grid; align-content: start; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--d-border);
  border-radius: var(--d-radius-lg); background: var(--d-panel); box-shadow: none;
}
.is-dash .panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.is-dash .panel-title { margin: 0; font: 600 14px/1.4 var(--d-sans); letter-spacing: normal; }
.is-dash .panel-note { color: var(--d-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-dash .panel--flush { gap: 0; padding: 0; overflow: hidden; }
.is-dash .panel--flush > .panel-head { padding: 12px 16px; border-bottom: 1px solid var(--d-border); }
.is-dash .panel .empty { padding: 12px 0; border: 0; background: none; }
.is-dash .panel-link {
  justify-content: flex-start; width: fit-content; min-height: 32px; margin: 0; padding: 0 10px; border: 1px solid var(--d-border);
  border-radius: var(--d-radius); color: var(--d-text-2); box-shadow: none; font-size: 13px; font-weight: 500;
}
.is-dash .panel-link:hover { background: var(--d-hover); color: var(--d-text); }
.is-dash .panel-link .icon { width: 14px; height: 14px; }

/* Stat tiles (statPanel / tiles): label over a bold number, each its own small card. */
.is-dash .stats { display: grid; gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; }
.is-dash .stats-caption { margin: 0; color: var(--d-muted); font-size: 12px; font-weight: 500; }
.is-dash .tiles { gap: 12px; }
.is-dash .tile {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 0; padding: 14px 16px; border: 1px solid var(--d-border);
  border-radius: var(--d-radius-lg); background: var(--d-panel); box-shadow: none; text-align: left;
}
.is-dash .tile .icon { order: 0; width: 16px; height: 16px; color: var(--d-muted); }
.is-dash .tile-mark { order: 0; width: 17px; height: 16px; background: var(--d-muted); }
.is-dash .tile-label { order: 1; flex: 1; min-width: 0; color: var(--d-muted); font-size: 12px; font-weight: 500; }
.is-dash .tile-value { order: 2; flex-basis: 100%; font: 600 28px/1.15 var(--d-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* Ranked rows (rankList) and bars: thin solid bars, no glow. */
.is-dash .rank-list { gap: 0; }
.is-dash .rank-list > li + li { border-top: 1px solid var(--d-border); }
.is-dash .rank-row {
  grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 7px 8px; border-radius: var(--d-radius);
  background: none; color: var(--d-text);
}
.is-dash .rank-list--plain .rank-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 8px; }
.is-dash a.rank-row:hover { background: var(--d-hover); box-shadow: none; color: var(--d-text); }
.is-dash a.rank-row:active { background: var(--d-selected); }
.is-dash a.rank-row:focus-visible { outline-offset: -2px; }
.is-dash .rank-n { color: var(--d-muted); font: 500 12px/1 var(--d-sans); font-variant-numeric: tabular-nums; text-align: right; }
.is-dash .rank-main { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 8px; }
.is-dash .rank-name { font-size: 13px; font-weight: 500; }
.is-dash .rank-detail { color: var(--d-muted); font-size: 12px; white-space: nowrap; }
.is-dash .rank-bar { grid-column: 1 / -1; height: 3px; margin-top: 2px; }
.is-dash .rank-value { font: 600 13px/1 var(--d-sans); font-variant-numeric: tabular-nums; }
.is-dash .bars { gap: 0; }
.is-dash .bar-row { grid-template-columns: minmax(80px, 160px) minmax(0, 1fr) 48px; gap: 12px; padding: 6px 0; }
.is-dash .bar-name { font-size: 13px; font-weight: 500; }
.is-dash .bar-value { font-size: 13px; }
.is-dash .bar-track, .is-dash .species-bar { height: 4px; border-radius: 2px; background: var(--d-border-strong); }
.is-dash .bar-fill { border-radius: inherit; background: var(--d-text-2); box-shadow: none; }

/* Species grid: compact cells with a hairline bar. */
.is-dash .species-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.is-dash .species-row {
  gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--d-border); border-radius: var(--d-radius);
  background: var(--d-raised); box-shadow: none;
}
.is-dash .species-name { font-size: 13px; font-weight: 500; }
.is-dash .species-count { min-width: 0; padding: 0; background: none; color: var(--d-text); font-size: 13px; }
.is-dash .species-bar { height: 3px; }

/* The day-grouped log (reportItem, defectItem, recordRow): compact ruled rows. */
.is-dash .log { gap: 12px; }
.is-dash .log-day { gap: 6px; }
.is-dash .log-day-title { padding: 0 2px; color: var(--d-muted); font: 500 12px/1.4 var(--d-sans); }
.is-dash .log-day-count { color: var(--d-muted); font-size: 12px; font-weight: 400; }
.is-dash .log-items { gap: 0; border: 1px solid var(--d-border); border-radius: var(--d-radius-lg); overflow: hidden; }
.is-dash .log-items > li + li { border-top: 1px solid var(--d-border); }
.is-dash .log-item { gap: 12px; padding: 8px 12px 8px 8px; border-radius: 0; background: var(--d-panel); box-shadow: none; color: var(--d-text); }
.is-dash a.log-item:hover { background: var(--d-hover); box-shadow: none; color: var(--d-text); }
.is-dash a.log-item:active { background: var(--d-selected); }
.is-dash a.log-item:focus-visible { outline-offset: -2px; }
.is-dash .log-item--alert { box-shadow: inset 2px 0 0 var(--d-rose); }
.is-dash .log-thumb { width: 40px; height: 40px; border-radius: var(--d-radius); }
.is-dash .log-thumb--mark { background: var(--d-raised); }
.is-dash .log-thumb--mark::after { width: 20px; height: 19px; background: var(--d-faint); }
.is-dash .log-thumb--alert { background: var(--d-rose-bg); color: var(--d-rose); font: 600 16px/1 var(--d-sans); }
.is-dash .log-thumb--service { background: var(--d-raised); color: var(--d-muted); font-size: 16px; }
.is-dash .log-main { gap: 2px; }
.is-dash .log-title { font-size: 13px; font-weight: 600; line-height: 1.35; -webkit-line-clamp: 1; }
.is-dash .log-main .meta-row { gap: 2px 12px; margin: 0; color: var(--d-muted); font-size: 12px; }
.is-dash .log-main .meta-row .icon { width: 13px; height: 13px; }
.is-dash .log-seen { color: var(--d-muted); font-size: 12px; }
.is-dash .log-alert { color: var(--d-rose); font-size: 12px; font-weight: 500; }
.is-dash .log-item .chips { margin-top: 2px; }
.is-dash .log-count { gap: 0; }
.is-dash .log-count-value { font: 600 18px/1.1 var(--d-sans); letter-spacing: normal; font-variant-numeric: tabular-nums; }
.is-dash .log-count-label { color: var(--d-muted); font-size: 11px; font-weight: 500; }
.is-dash .log-action { min-height: 28px; padding: 0 10px; font-size: 12px; }
.is-dash .season-log { gap: 20px; }
.is-dash .season-block { gap: 10px; }
.is-dash .season-heading { padding: 0 2px 6px; border-bottom: 1px solid var(--d-border); font: 600 14px/1.3 var(--d-sans); }

/* Tags, photos, prose. */
.is-dash .chips { gap: 4px; }
.is-dash .chip {
  padding: 2px 6px; border: 1px solid var(--d-border); border-radius: 4px; background: var(--d-raised);
  color: var(--d-text-2); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.is-dash .log-item .chip { padding: 1px 6px; font-size: 11.5px; }
.is-dash .count-pill { padding: 2px 8px; border: 1px solid var(--d-border); border-radius: 4px; background: var(--d-raised); color: var(--d-text-2); font-size: 12px; }
.is-dash .dog-list li { padding: 8px 10px; border: 1px solid var(--d-border); border-radius: var(--d-radius); background: var(--d-raised); font-size: 13px; font-weight: 500; }
.is-dash .photo { background: var(--d-raised); }
.is-dash .photo img { transition: none; } /* no fade-in */
.is-dash .photo.is-missing { background: var(--d-raised); }
.is-dash .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.is-dash .photo-card .photo { border-radius: var(--d-radius); }
.is-dash .photo-card figcaption { color: var(--d-muted); font-size: 12px; font-weight: 500; }
.is-dash .prose { max-width: 80ch; font-size: 14px; line-height: 1.6; }

/* Empty and error states: say what is missing and what to do. */
.is-dash .empty {
  display: grid; justify-items: start; gap: 4px; padding: 20px; border: 1px solid var(--d-border);
  border-radius: var(--d-radius-lg); background: var(--d-panel); text-align: left;
}
.is-dash .empty-title { margin: 0; font: 600 14px/1.4 var(--d-sans); }
.is-dash .empty p { margin: 0; color: var(--d-muted); font-size: 13px; }
.is-dash .empty a:not(.pill):not(.d-btn) { color: var(--d-text-2); } /* buttons keep their own colours */
.is-dash .empty a:not(.pill):not(.d-btn):hover { color: var(--d-text); }
.is-dash .empty .pill { margin-top: 8px; }
.is-dash .empty[role="alert"] { border-color: var(--d-rose-border); }
.is-dash .empty[role="alert"] .empty-title { color: var(--d-rose); }

/* dataTable: sticky header, ruled rows, numbers right-aligned in tabular figures. */
.is-dash .d-table-block { display: grid; min-width: 0; }
/* The wrapper scrolls both ways (so the sticky header works at every width), never
   taller than the space under the top bar; 25 rows fit at 1080p without it. */
.is-dash .d-table-wrap { min-width: 0; max-height: calc(100vh - var(--d-bar-h) - 2 * var(--d-pad)); overflow: auto; }
.is-dash .d-table-wrap:focus-visible { outline-offset: -2px; }
.is-dash .d-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.is-dash .d-table th {
  position: sticky; top: 0; z-index: 1; padding: 8px 12px; border-bottom: 1px solid var(--d-border); background: var(--d-raised);
  color: var(--d-muted); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap;
}
.is-dash .d-table td { padding: 6px 12px; border-top: 1px solid var(--d-border); color: var(--d-text-2); vertical-align: middle; white-space: nowrap; }
.is-dash .d-table tbody tr:first-child td { border-top: 0; }
.is-dash .d-table .is-num { text-align: right; }
.is-dash .d-table tr.is-link { cursor: pointer; }
.is-dash .d-table tbody tr:hover td, .is-dash .d-table tbody tr:focus-within td { background: var(--d-hover); }
.is-dash .d-table tbody tr.is-link:active td { background: var(--d-selected); }
.is-dash .d-table a { color: var(--d-text); text-decoration: none; }
.is-dash .d-table a:hover { text-decoration: underline; text-underline-offset: 3px; }
.is-dash .d-row-link { font-weight: 600; }
.is-dash .d-cell-muted, .is-dash .d-cell-none { color: var(--d-muted); }
.is-dash .d-cell-trunc { display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.is-dash .d-cell-people { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.is-dash .d-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border: 1px solid var(--d-border);
  border-radius: 4px; background: var(--d-raised); color: var(--d-text); font-size: 11px; font-weight: 600;
}
.is-dash .d-col-strong { color: var(--d-text); font-weight: 600; }
.is-dash .d-table-empty { display: grid; gap: 2px; padding: 20px 16px; }
.is-dash .d-empty-title { margin: 0; color: var(--d-text); font-size: 13px; font-weight: 600; }
.is-dash .d-empty-text { margin: 0; color: var(--d-muted); font-size: 13px; }
.is-dash .d-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--d-border); }
.is-dash .d-table-foot > :only-child { margin-left: auto; }
.is-dash .d-table-more, .is-dash .d-foot-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 8px; border: 0; border-radius: var(--d-radius);
  background: transparent; color: var(--d-text-2); font: 500 13px/1 var(--d-sans); text-decoration: none; cursor: pointer;
}
.is-dash .d-table-more:hover, .is-dash .d-foot-link:hover { background: var(--d-hover); color: var(--d-text); }
.is-dash .d-table-more:active, .is-dash .d-foot-link:active { background: var(--d-selected); }
.is-dash .d-foot-link .icon { width: 14px; height: 14px; }
/* pager(): previous / status / next, so long lists page instead of growing. */
.is-dash .list-pager { display: flex; justify-content: flex-end; padding-top: 8px; }
.is-dash .d-pager { display: inline-flex; align-items: center; gap: 4px; }
.is-dash .d-pager-status { min-width: 9ch; padding: 0 6px; color: var(--d-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.is-dash .d-pager-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--d-border); border-radius: var(--d-radius);
  background: var(--d-raised); color: var(--d-text-2); cursor: pointer;
}
.is-dash .d-pager-btn .icon { width: 14px; height: 14px; }
.is-dash .d-pager-btn:hover:not(:disabled) { background: var(--d-hover); border-color: var(--d-border-strong); color: var(--d-text); }
.is-dash .d-pager-btn:active:not(:disabled) { background: var(--d-selected); }
.is-dash .d-pager-btn:disabled { opacity: 0.4; cursor: default; }

/* statCard / statRow: four across, two by two under 1024px. */
.is-dash .d-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.is-dash .d-stat {
  display: grid; align-content: start; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid var(--d-border);
  border-radius: var(--d-radius-lg); background: var(--d-panel);
}
.is-dash .d-stat-head { display: flex; align-items: center; gap: 8px; color: var(--d-muted); font-size: 12px; font-weight: 500; }
.is-dash .d-stat-head .icon { width: 16px; height: 16px; }
.is-dash .d-stat-head .tile-mark { width: 17px; height: 16px; background: var(--d-muted); }
.is-dash .d-stat-value { color: var(--d-text); font: 600 28px/1.15 var(--d-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.is-dash .d-stat-pills { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 1023.98px) {
  .is-dash .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* badge and avatar. */
.is-dash .d-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border: 1px solid var(--d-border);
  border-radius: 4px; background: var(--d-raised); color: var(--d-text-2); font-size: 11.5px; font-weight: 500; line-height: 1;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.is-dash .d-badge--emerald { border-color: var(--d-emerald-border); background: var(--d-emerald-bg); color: var(--d-emerald); }
.is-dash .d-badge--amber { border-color: var(--d-amber-border); background: var(--d-amber-bg); color: var(--d-amber); }
.is-dash .d-badge--rose { border-color: var(--d-rose-border); background: var(--d-rose-bg); color: var(--d-rose); }
.is-dash .d-avatar {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border: 1px solid var(--d-border-strong);
  border-radius: 50%; background: var(--d-raised); color: var(--d-text); font: 600 10px/1 var(--d-sans); letter-spacing: 0.02em;
}
.is-dash .d-avatar--md { width: 32px; height: 32px; font-size: 12px; }
.is-dash .d-avatar--lg { width: 40px; height: 40px; font-size: 14px; }
