/* Overrides on top of Pico. Keep this small. */

.icon {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
}

label > .icon {
  margin-inline-end: 0.3rem;
}

.brand {
  text-decoration: none;
}

.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  vertical-align: -0.3em;
  border-radius: 0.28rem;
}

form.inline {
  margin: 0;
}

nav form.inline button {
  margin: 0;
  padding: 0.4rem 0.6rem;
}

/* Focused form pages: a narrow column, centered under the header. */
main:has(.form-stack) {
  padding-top: 3rem;
}

.form-stack {
  width: min(100%, 30rem);
  margin-inline: auto;
}

.form-stack > h1 {
  margin-bottom: 1.15rem;
  font-size: 1.75rem;
  line-height: 1.2;
}

.form-card h2 {
  margin-bottom: 0.85rem;
  font-size: 1.25rem;
  line-height: 1.2;
}

.form-card > p {
  margin-bottom: 0.85rem;
}

.form-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0;
}

.form-card label,
.form-card button,
.form-card input,
.form-card select,
.form-card small {
  margin-bottom: 0;
}

.form-card details.timezone {
  margin-bottom: 0;
}

.form-card details.timezone[open] > summary {
  margin-bottom: 0.85rem;
}

.form-card small {
  display: block;
  margin-top: 0.35rem;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
}

.form-card button.quiet {
  align-self: center;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.form-card input:focus,
.form-card select:focus,
.form-card button:focus-visible,
.form-card a:focus-visible,
.form-card button.quiet:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.form-card input:focus {
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pico-primary) 40%, transparent);
}

/* Auth cards sit centered under the header. Other pages stay in the normal grid. */
main:has(.auth-card) {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3rem;
}

.auth-card {
  width: min(100%, 30rem);
  margin-bottom: 2rem;
}

.keep-prompt {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

.keep-prompt h2 {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.auth-card h1 {
  margin-bottom: 1.15rem;
  font-size: 1.75rem;
  line-height: 1.2;
}

.auth-card > p {
  margin-bottom: 1rem;
}

.auth-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0;
}

.cf-turnstile {
  margin: 0;
  align-self: flex-start;
}

.auth-form label,
.auth-form button {
  margin-bottom: 0;
}

.auth-form button,
.auth-card [role="button"] {
  width: 100%;
}

.auth-card [role="button"] {
  display: block;
  text-align: center;
}

.auth-password,
.auth-password-submit,
.auth-form:has(.auth-password-toggle:checked) .auth-link-submit,
.when-open,
.auth-form:has(.auth-password-toggle:checked) .when-closed {
  display: none;
}

.auth-form:has(.auth-password-toggle:checked) .auth-password,
.auth-form:has(.auth-password-toggle:checked) .auth-password-submit,
.auth-form:has(.auth-password-toggle:checked) .when-open {
  display: block;
}

.auth-form:has(.auth-password-toggle:checked) .when-open {
  display: inline;
}

.auth-card input.auth-password-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  appearance: none;
}

.auth-switch {
  text-align: center;
}

.auth-switch label {
  display: inline-block;
  margin: 0;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.auth-foot {
  margin: 1.15rem 0 0;
  text-align: center;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
}

.auth-note {
  margin-bottom: 0;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
}

.auth-card input:not(.auth-password-toggle):focus,
.auth-card button:focus-visible,
.auth-card a:focus-visible,
.auth-card input.auth-password-toggle:focus-visible + label {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.auth-card input:not(.auth-password-toggle):focus {
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pico-primary) 40%, transparent);
}

@media (max-width: 576px) {
  main:has(.auth-card),
  main:has(.form-stack) {
    padding-top: 1.25rem;
  }
}

input[data-select-on-focus] {
  cursor: pointer;
}

input[data-select-on-focus] + small.copied {
  color: var(--pico-ins-color);
}

.error {
  color: var(--pico-del-color);
}

.saved {
  color: var(--pico-ins-color);
}

.muted {
  color: var(--pico-muted-color);
}

.form-stack > hgroup {
  margin-bottom: 1.15rem;
}

.form-stack > hgroup h1 {
  font-size: 1.75rem;
  line-height: 1.2;
}

/* A text-like secondary action: Record none, Undo on an entry, Restore. */
button.quiet {
  width: auto;
  margin: 0;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

button.quiet:hover {
  color: var(--pico-color);
}

/* Footer install control. Hidden when this window is already the installed app. */
.site-footer {
  margin-top: 0.5rem;
  padding-bottom: 1.75rem;
  text-align: center;
}

.site-footer[hidden],
html.install-session .site-footer {
  display: none;
}

@media (display-mode: standalone),
       (display-mode: fullscreen),
       (display-mode: minimal-ui),
       (display-mode: window-controls-overlay) {
  .site-footer {
    display: none;
  }
}

button.footer-link {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0.65rem 0.35rem;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: var(--pico-text-underline-offset, 0.1rem);
  vertical-align: baseline;
  cursor: pointer;
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--pico-primary);
  --pico-box-shadow: none;
}

button.footer-link:is(:hover, :active, :focus) {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--pico-primary-hover);
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--pico-primary-hover);
  --pico-box-shadow: none;
}

button.footer-link:focus-visible {
  outline: var(--pico-outline-width) solid var(--pico-primary-focus);
  outline-offset: 3px;
}

.install-dialog::backdrop {
  background: var(--pico-modal-overlay-background-color);
}

.install-dialog > article {
  max-width: 32rem;
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: max(0.5rem, env(safe-area-inset-top, 0px)) max(0.5rem, env(safe-area-inset-right, 0px)) max(0.5rem, env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-left, 0px));
  overflow: auto;
  overscroll-behavior: contain;
}

.install-dialog > article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.install-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.install-title {
  margin: 0;
  color: var(--pico-h2-color);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.install-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: 0.55rem;
}

.install-close {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--pico-border-radius);
  background: transparent;
  box-shadow: none;
  color: var(--pico-color);
  line-height: 1;
}

.install-close,
.install-close:is(:hover, :active, :focus) {
  border-color: transparent;
  box-shadow: none;
  /* Filled Pico buttons set --pico-color to white. Use the heading color. */
  color: var(--pico-h1-color);
}

.install-close:is(:hover, :active, :focus) {
  background: var(--pico-card-sectioning-background-color);
}

.install-close:focus-visible,
.install-dialog [data-install-toggle]:focus-visible,
.install-dialog [data-install-prompt]:focus-visible,
.install-dialog [data-install-copy-button]:focus-visible,
.install-platforms button:focus-visible {
  outline: 2px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

.install-status {
  margin: 0;
}

.install-status:empty {
  display: none;
}

.install-status:not(:empty) {
  margin-bottom: 0.75rem;
}

.install-dialog [data-install-native] {
  margin-bottom: 0.75rem;
}

.install-dialog [data-install-prompt],
.install-dialog [data-install-copy-button] {
  width: auto;
  margin-bottom: 0;
}

.install-dialog [data-install-copy-button],
.install-dialog [data-install-copy-button]:is(:hover, :active, :focus) {
  padding: 0.4rem 0.85rem;
  background: transparent;
  border-color: var(--pico-form-element-border-color);
  box-shadow: none;
  color: var(--pico-form-element-color);
  font-weight: 400;
  --pico-background-color: transparent;
  --pico-border-color: var(--pico-form-element-border-color);
  --pico-color: var(--pico-form-element-color);
  --pico-box-shadow: none;
}

.install-dialog [data-install-copy-button]:is(:hover, :active, :focus) {
  border-color: var(--pico-primary-border);
  --pico-border-color: var(--pico-primary-border);
}

.install-dialog [data-install-toggle] {
  width: auto;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-primary);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--pico-primary);
  --pico-box-shadow: none;
}

.install-dialog [data-install-toggle]:is(:hover, :active, :focus) {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--pico-primary-hover);
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--pico-primary-hover);
  --pico-box-shadow: none;
}

.install-dialog ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.install-dialog li + li {
  margin-top: 0.35rem;
}

.install-dialog li .icon {
  width: 1.15em;
  height: 1.15em;
  margin-inline-end: -0.2em;
  vertical-align: -0.2em;
}

.install-url {
  margin: 0.5rem 0 0;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.install-dialog [data-install-url]:focus {
  outline: 2px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

/* Pico joins [role=group] into one bar and squares the inner corners.
   These stay separate buttons, with the fill covering each one. */
.install-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  margin: 0.75rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.install-dialog .install-platforms > button,
.install-dialog .install-platforms > button:not(:first-child),
.install-dialog .install-platforms > button:not(:last-child) {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border-radius: var(--pico-border-radius);
  background: transparent;
  border: var(--pico-border-width) solid var(--pico-muted-border-color);
  box-shadow: none;
  color: var(--pico-form-element-color);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  --pico-background-color: transparent;
  --pico-border-color: var(--pico-muted-border-color);
  --pico-color: var(--pico-form-element-color);
  --pico-box-shadow: none;
}

.install-dialog .install-platforms > button:is(:hover, :active, :focus) {
  background: transparent;
  border-color: var(--pico-primary-border);
  box-shadow: none;
  color: var(--pico-form-element-color);
  --pico-background-color: transparent;
  --pico-border-color: var(--pico-primary-border);
  --pico-color: var(--pico-form-element-color);
  --pico-box-shadow: none;
}

.install-dialog .install-platforms > button[aria-pressed="true"],
.install-dialog .install-platforms > button[aria-pressed="true"]:is(:hover, :active, :focus) {
  --pico-background-color: var(--pico-primary-background);
  --pico-border-color: var(--pico-primary-background);
  --pico-color: var(--pico-primary-inverse);
  background-color: var(--pico-primary-background);
  border-color: var(--pico-primary-background);
  border-radius: var(--pico-border-radius);
  box-shadow: none;
  color: var(--pico-primary-inverse);
}

@media (max-height: 32rem) {
  .install-dialog > article > header {
    padding-block: 0.4rem;
  }

  .install-icon {
    width: 2rem;
    height: 2rem;
  }

  .install-title {
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .install-dialog,
  .install-dialog > article {
    animation: none;
    transition: none;
  }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
}

.page-head [role="button"] {
  padding: 0.4rem 0.8rem;
}

/* Tracker accents: soft tints on the card and icon, never the only label. */
.accent-blue { --accent: #3b82f6; }
.accent-green { --accent: #22a06b; }
.accent-amber { --accent: #d99a00; }
.accent-rose { --accent: #e0607e; }
.accent-violet { --accent: #8b5cf6; }

.tracker-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--accent, var(--pico-muted-border-color)) 22%, transparent);
  vertical-align: middle;
}

.tracker-icon .icon {
  vertical-align: 0;
}

.tracker-icon .emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.tracker-page h2,
.share-page h2,
.household-page h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.2rem;
}

.household-page a[role="button"] {
  display: block;
  width: 100%;
  margin-top: 1rem;
}

/* Hidden until reorder.js runs, so a page without the script has no dead control. */
button.drag-handle {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pico-muted-color);
  line-height: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html[data-reorder] button.drag-handle {
  display: inline-flex;
}

button.drag-handle:is(:hover, :focus, :active) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--pico-color);
}

button.drag-handle:focus-visible {
  outline: var(--pico-outline-width) solid var(--pico-primary-focus);
  outline-offset: 2px;
}

button.drag-handle .icon {
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: 0;
}

html[data-reordering],
html[data-reordering] * {
  user-select: none;
  -webkit-user-select: none;
}

[data-reorder-item].is-dragging {
  position: relative;
  z-index: 1;
  opacity: 0.72;
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.new-household,
.rename-household {
  margin-top: 1.5rem;
}

.rename-household {
  margin-top: 0.35rem;
}

.new-household summary,
.rename-household summary,
.leave-household {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.new-household form,
.rename-household form,
.move-form {
  margin-top: 0.75rem;
}

.move-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 1rem 0;
}

.move-form select {
  margin-bottom: 0;
}

.leave-household {
  margin-top: 2rem;
}

.tracker-card {
  margin-bottom: 1rem;
}

/* A changed tracker gets a tint that fades. The overlay does not affect layout. */
[data-highlight] {
  position: relative;
}

[data-highlight].is-changed::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: color-mix(in srgb, var(--pico-primary) 16%, transparent);
  animation: tracker-changed 1s ease-out forwards;
}

@keyframes tracker-changed {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  [data-highlight].is-changed::after {
    animation: none;
  }
}

.tracker-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
}

.tracker-card-title {
  flex: 1;
  min-width: 0;
}

.tracker-card-head .tracker-name {
  min-width: 0;
}

.tracker-household {
  display: block;
  margin-top: 0.15rem;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tracker-household:is(:hover, :focus) {
  text-decoration: underline;
}

.tracker-card-head:has(.drag-handle) .tracker-name {
  padding-top: 0.35rem;
}

.tracker-card-head .drag-handle {
  margin-top: -0.15rem;
  margin-left: -0.45rem;
}

.tracker-card[class*="accent-"] {
  border-inline-start: 4px solid color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--pico-card-background-color));
}

.tracker-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--pico-color);
}

.tracker-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tracker-summary {
  margin: 0.75rem 0;
  font-size: 1.1rem;
}

.log-buttons {
  display: flex;
  gap: 0.75rem;
}

.log-buttons form {
  margin: 0;
}

.log-buttons button {
  margin: 0;
}

/* The loader replaces the label. It stays the button's text color, including on a disabled button. */
button[data-occurrence][aria-busy="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

button[data-occurrence][aria-busy="true"]::before {
  content: none;
  display: none;
}

button[data-occurrence][aria-busy="true"] .icon {
  flex: none;
  animation: loader-spin 0.7s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

.log-buttons > :first-child {
  flex: 1;
}

.log-buttons > :first-child button,
.log-buttons > :first-child a {
  width: 100%;
  margin: 0;
}

/* A number's Log again field stacks until the tracker itself is wide enough to sit beside the button. */
.log-control {
  container-type: inline-size;
  container-name: log-control;
}

.log-buttons:has(> form.log-again) {
  flex-wrap: wrap;
}

.log-buttons > form.log-again {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 100%;
  min-width: 0;
}

.log-again-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.log-again-field .error {
  margin: 0;
}

.log-again .with-unit {
  flex: 1 1 auto;
  min-width: 0;
}

.log-control > .error {
  margin: 0.75rem 0 0;
}

@container log-control (min-width: 400px) {
  .log-buttons:has(.log-again) {
    align-items: flex-start;
  }

  .log-buttons > form.log-again {
    flex-direction: row;
    flex: 1 1 auto;
    align-items: flex-start;
  }

  .log-buttons > form.log-again button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.carry {
  margin: -0.25rem 0 0.75rem;
  color: var(--pico-muted-color);
}

.goal-progress {
  display: block;
  width: 100%;
  height: 0.5rem;
  margin: -0.35rem 0 0.75rem;
  accent-color: var(--pico-primary);
}

.goal-meta {
  margin: -0.35rem 0 0.75rem;
  color: var(--pico-muted-color);
}

.redeem-form {
  margin: 0 0 0.75rem;
}

.redeem-form details {
  margin-bottom: 0.5rem;
}

.redeem-form button {
  margin-bottom: 0;
}

.reward-history {
  margin-top: 1.25rem;
}

.entry-running {
  color: var(--pico-muted-color);
  font-variant-numeric: tabular-nums;
}

.with-unit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.with-unit input {
  flex: 1;
  margin-bottom: 0;
}

.duration-fields {
  display: flex;
  gap: 0.75rem;
}

.duration-fields label {
  flex: 1;
}

.entry-value {
  font-variant-numeric: tabular-nums;
}

.export {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.log-details {
  margin-top: 1rem;
}

.log-details summary,
.entry-edit summary {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.entries {
  padding: 0;
}

.entries li {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.entry-time {
  font-variant-numeric: tabular-nums;
}

.entry-edit {
  margin: 0;
  border: 0;
  padding: 0;
}

.entry-edit[open] {
  flex-basis: 100%;
}

.entry-edit > summary {
  display: inline;
  margin: 0;
  list-style: none;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.entry-edit > summary::after {
  display: none;
}

.entry-edit form {
  margin: 0.5rem 0;
}

.day-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.9rem 0 0.2rem;
}

.day-head h3 {
  flex: 1;
  margin: 0;
  font-size: 1rem;
}

.day-summary {
  min-width: 7.5rem;
  text-align: end;
}

.history-day.unlogged h3 {
  color: var(--pico-muted-color);
  font-weight: 400;
}

.history-day.unlogged .day-summary {
  color: var(--pico-muted-color);
  font-style: italic;
}

.rows {
  padding: 0;
}

.rows li {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.rows a {
  text-decoration: none;
}

.row-actions {
  display: flex;
  gap: 1rem;
}

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.picker legend {
  width: 100%;
  margin-bottom: 0.4rem;
}

.form-card .picker label {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.picker .tracker-icon,
.picker .swatch {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid transparent;
}

.picker .swatch {
  display: inline-block;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent, var(--pico-muted-border-color)) 45%, transparent);
}

.picker input:checked + span {
  border-color: var(--pico-primary);
}

.picker input:focus-visible + span {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.archive-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin: 1rem 0;
}

.archive-form small,
.form-foot {
  color: var(--pico-muted-color);
  font-size: 0.875rem;
}

.tracker-side {
  min-width: 0;
}

.chart-frame {
  position: relative;
  height: 14rem;
  margin-top: 0.75rem;
}

.chart-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay-picker {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
}

.overlay-picker summary {
  color: var(--pico-muted-color);
  cursor: pointer;
}

.overlay-picker summary .tracker-icon,
.overlay-picker a .tracker-icon {
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.15rem;
}

.overlay-picker ul {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
}

.overlay-picker li {
  margin: 0.15rem 0;
}

.overlay-picker a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}

.overlay-picker a[aria-current="page"] {
  font-weight: 600;
}

.chart-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  margin: 0;
  padding: 0.2rem 0.45rem;
  max-width: 16rem;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-line;
  color: var(--pico-color);
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

/* Charts page: the same trend, with room to look. Selectors stack until the page is wide. */
.chart-explore {
  min-width: 0;
  max-width: 100%;
}

.chart-explore .chart-frame {
  height: 20rem;
}

.chart-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
}

.chart-controls .overlay-picker {
  margin: 0;
}

.chart-controls .overlay-picker summary {
  padding: 0.35rem 0;
}

.chart-controls .overlay-picker a {
  min-height: 2.75rem;
  padding: 0.35rem 0;
}

@media (min-width: 720px) {
  .chart-controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 1.75rem;
  }

  .chart-controls .overlay-picker {
    flex: 1 1 12rem;
    min-width: 0;
  }

  .chart-explore .chart-frame {
    height: 28rem;
  }
}

/* Wide screens: the trend, then history, sit beside the logging column, never above it. */
@media (min-width: 1024px) {
  .tracker-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }

  .share-page {
    max-width: 36rem;
  }
}
