/*
 * Packrat — Material 3 design tokens + base + components.
 *
 * Single hand-authored stylesheet (ADR-0001 / DD-M3-1): no Tailwind, no
 * PostCSS, no build step. Tokens regenerated 2026-08-03 (DD-M3-2 amendment)
 * from seed #1976D2 (Material baseline blue, swapped in for the original
 * #6D4C41 brown) via material-color-utilities' themeFromSourceColor, same
 * canonical tone recipe as before (light 40/100/90/10, dark 80/20/30/90;
 * standard surface-container tone set). Error stays #BA1A1A, M3's standard
 * error hue, unrelated to the seed. Every pair re-verified against WCAG AA
 * — see the M3-01 ticket contrast report and ADR-0001 DD-M3-2. Component
 * classes below consume roles only; regenerating the palette never touches
 * them.
 *
 * Sections: tokens / base / components / utilities.
 */

/* == tokens == */

:root {
  color-scheme: light dark;

  /* -- color: primary -- */
  --md-sys-color-primary: light-dark(#005FAF, #A5C8FF);
  --md-sys-color-on-primary: light-dark(#FFFFFF, #00315F);
  --md-sys-color-primary-container: light-dark(#D4E3FF, #004786);
  --md-sys-color-on-primary-container: light-dark(#001C3A, #D4E3FF);
  --md-sys-color-inverse-primary: light-dark(#A5C8FF, #005FAF);

  /* -- color: secondary -- */
  --md-sys-color-secondary: light-dark(#545F71, #BCC7DC);
  --md-sys-color-on-secondary: light-dark(#FFFFFF, #273141);
  --md-sys-color-secondary-container: light-dark(#D8E3F8, #3D4758);
  --md-sys-color-on-secondary-container: light-dark(#111C2B, #D8E3F8);

  /* -- color: tertiary -- */
  --md-sys-color-tertiary: light-dark(#6E5676, #DABDE2);
  --md-sys-color-on-tertiary: light-dark(#FFFFFF, #3D2846);
  --md-sys-color-tertiary-container: light-dark(#F7D8FF, #553F5D);
  --md-sys-color-on-tertiary-container: light-dark(#271430, #F7D8FF);

  /* -- color: error (M3 standard error hue/chroma) -- */
  --md-sys-color-error: light-dark(#BA1A1A, #FFB4AB);
  --md-sys-color-on-error: light-dark(#FFFFFF, #690005);
  --md-sys-color-error-container: light-dark(#FFDAD6, #93000A);
  --md-sys-color-on-error-container: light-dark(#410002, #FFDAD6);

  /* -- color: surfaces -- */
  --md-sys-color-surface: light-dark(#FAF9FD, #121316);
  --md-sys-color-surface-dim: light-dark(#DAD9DD, #121316);
  --md-sys-color-surface-bright: light-dark(#FAF9FD, #38393C);
  --md-sys-color-surface-container-lowest: light-dark(#FFFFFF, #0D0E11);
  --md-sys-color-surface-container-low: light-dark(#F4F3F7, #1A1C1E);
  --md-sys-color-surface-container: light-dark(#EEEDF1, #1E2023);
  --md-sys-color-surface-container-high: light-dark(#E9E8EB, #292A2D);
  --md-sys-color-surface-container-highest: light-dark(#E3E2E6, #343538);
  --md-sys-color-on-surface: light-dark(#1A1C1E, #E3E2E6);
  --md-sys-color-on-surface-variant: light-dark(#43474E, #C3C6CF);
  --md-sys-color-inverse-surface: light-dark(#2F3033, #E3E2E6);
  --md-sys-color-inverse-on-surface: light-dark(#F1F0F4, #2F3033);

  /* -- color: outline & misc -- */
  --md-sys-color-outline: light-dark(#74777F, #8D9199);
  --md-sys-color-outline-variant: light-dark(#C3C6CF, #43474E);
  --md-sys-color-shadow: light-dark(#000000, #000000);
  --md-sys-color-scrim: light-dark(#000000, #000000);

  /* -- color: extension roles (not in the official M3 role set; generated
     the same way — TonalPalette from a conventional hue, same canonical
     tone recipe — for the banner--success/--info variants §4 needs) -- */
  --md-sys-color-success: light-dark(#3B6930, #A0D48F);
  --md-sys-color-on-success: light-dark(#FFFFFF, #0A3905);
  --md-sys-color-success-container: light-dark(#BCF1A9, #23501B);
  --md-sys-color-on-success-container: light-dark(#012200, #BCF1A9);
  --md-sys-color-info: light-dark(#00677D, #7AD2EF);
  --md-sys-color-on-info: light-dark(#FFFFFF, #003642);
  --md-sys-color-info-container: light-dark(#B3EBFF, #004E5F);
  --md-sys-color-on-info-container: light-dark(#001F27, #B3EBFF);

  /* -- typescale: 15 composite roles (size / line-height / weight / tracking) -- */
  --md-sys-typescale-display-l-size: 3.5625rem;   /* 57px */
  --md-sys-typescale-display-l-line: 4rem;        /* 64px */
  --md-sys-typescale-display-l-weight: 400;
  --md-sys-typescale-display-l-tracking: -0.015625rem;

  --md-sys-typescale-display-m-size: 2.8125rem;   /* 45px */
  --md-sys-typescale-display-m-line: 3.25rem;     /* 52px */
  --md-sys-typescale-display-m-weight: 400;
  --md-sys-typescale-display-m-tracking: 0;

  --md-sys-typescale-display-s-size: 2.25rem;     /* 36px */
  --md-sys-typescale-display-s-line: 2.75rem;     /* 44px */
  --md-sys-typescale-display-s-weight: 400;
  --md-sys-typescale-display-s-tracking: 0;

  --md-sys-typescale-headline-l-size: 2rem;       /* 32px */
  --md-sys-typescale-headline-l-line: 2.5rem;     /* 40px */
  --md-sys-typescale-headline-l-weight: 400;
  --md-sys-typescale-headline-l-tracking: 0;

  --md-sys-typescale-headline-m-size: 1.75rem;    /* 28px */
  --md-sys-typescale-headline-m-line: 2.25rem;    /* 36px */
  --md-sys-typescale-headline-m-weight: 400;
  --md-sys-typescale-headline-m-tracking: 0;

  --md-sys-typescale-headline-s-size: 1.5rem;     /* 24px */
  --md-sys-typescale-headline-s-line: 2rem;       /* 32px */
  --md-sys-typescale-headline-s-weight: 400;
  --md-sys-typescale-headline-s-tracking: 0;

  --md-sys-typescale-title-l-size: 1.375rem;      /* 22px */
  --md-sys-typescale-title-l-line: 1.75rem;       /* 28px */
  --md-sys-typescale-title-l-weight: 400;
  --md-sys-typescale-title-l-tracking: 0;

  --md-sys-typescale-title-m-size: 1rem;          /* 16px */
  --md-sys-typescale-title-m-line: 1.5rem;        /* 24px */
  --md-sys-typescale-title-m-weight: 500;
  --md-sys-typescale-title-m-tracking: 0.009375rem;

  --md-sys-typescale-title-s-size: 0.875rem;      /* 14px */
  --md-sys-typescale-title-s-line: 1.25rem;       /* 20px */
  --md-sys-typescale-title-s-weight: 500;
  --md-sys-typescale-title-s-tracking: 0.00625rem;

  --md-sys-typescale-body-l-size: 1rem;           /* 16px — also kills iOS zoom-on-focus */
  --md-sys-typescale-body-l-line: 1.5rem;         /* 24px */
  --md-sys-typescale-body-l-weight: 400;
  --md-sys-typescale-body-l-tracking: 0.03125rem;

  --md-sys-typescale-body-m-size: 0.875rem;       /* 14px */
  --md-sys-typescale-body-m-line: 1.25rem;        /* 20px */
  --md-sys-typescale-body-m-weight: 400;
  --md-sys-typescale-body-m-tracking: 0.015625rem;

  --md-sys-typescale-body-s-size: 0.75rem;        /* 12px */
  --md-sys-typescale-body-s-line: 1rem;           /* 16px */
  --md-sys-typescale-body-s-weight: 400;
  --md-sys-typescale-body-s-tracking: 0.025rem;

  --md-sys-typescale-label-l-size: 0.875rem;      /* 14px */
  --md-sys-typescale-label-l-line: 1.25rem;       /* 20px */
  --md-sys-typescale-label-l-weight: 500;
  --md-sys-typescale-label-l-tracking: 0.00625rem;

  --md-sys-typescale-label-m-size: 0.75rem;       /* 12px */
  --md-sys-typescale-label-m-line: 1rem;          /* 16px */
  --md-sys-typescale-label-m-weight: 500;
  --md-sys-typescale-label-m-tracking: 0.03125rem;

  --md-sys-typescale-label-s-size: 0.6875rem;     /* 11px */
  --md-sys-typescale-label-s-line: 1rem;          /* 16px */
  --md-sys-typescale-label-s-weight: 500;
  --md-sys-typescale-label-s-tracking: 0.03125rem;

  /* -- shape -- */
  --md-sys-shape-corner-none: 0;
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-sm: 8px;
  --md-sys-shape-corner-md: 12px;
  --md-sys-shape-corner-lg: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* -- state layer opacities (percentages, for direct use in color-mix()) -- */
  --md-sys-state-hover-opacity: 8%;
  --md-sys-state-focus-opacity: 10%;
  --md-sys-state-pressed-opacity: 10%;
  --md-sys-state-disabled-content-opacity: 38%;
  --md-sys-state-disabled-container-opacity: 12%;

  /* -- elevation: dual-shadow pairs keyed off --md-sys-color-shadow -- */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1:
    0 1px 2px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 1px 3px 1px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-2:
    0 1px 2px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 2px 6px 2px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-3:
    0 1px 3px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 4px 8px 3px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-4:
    0 2px 3px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 6px 10px 4px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-5:
    0 4px 4px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 8px 12px 6px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);

  /* -- Packrat-specific -- */
  --pk-touch-target: 44px;
  --pk-content-max: 64rem;
  --pk-focus-ring: 3px;
}

html.light { color-scheme: light; }
html.dark { color-scheme: dark; }

/* == base == */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--md-sys-typescale-body-l-size);
  line-height: var(--md-sys-typescale-body-l-line);
  font-weight: var(--md-sys-typescale-body-l-weight);
  letter-spacing: var(--md-sys-typescale-body-l-tracking);
  /* Plain light-value fallback BEFORE the light-dark() line — browsers that
     don't understand light-dark() treat it as an invalid value and keep
     these, so degradation is a readable light scheme, not a blank page
     (spec §5 browser-floor note). */
  background-color: #FFF8F6;
  background-color: var(--md-sys-color-surface);
  color: #201A18;
  color: var(--md-sys-color-on-surface);
}

h1 {
  font-size: var(--md-sys-typescale-headline-m-size);
  line-height: var(--md-sys-typescale-headline-m-line);
  font-weight: var(--md-sys-typescale-headline-m-weight);
  letter-spacing: var(--md-sys-typescale-headline-m-tracking);
  margin: 0 0 1rem;
}

h2 {
  font-size: var(--md-sys-typescale-title-l-size);
  line-height: var(--md-sys-typescale-title-l-line);
  font-weight: var(--md-sys-typescale-title-l-weight);
  letter-spacing: var(--md-sys-typescale-title-l-tracking);
  margin: 0 0 0.75rem;
}

h3 {
  font-size: var(--md-sys-typescale-title-m-size);
  line-height: var(--md-sys-typescale-title-m-line);
  font-weight: var(--md-sys-typescale-title-m-weight);
  letter-spacing: var(--md-sys-typescale-title-m-tracking);
  margin: 0 0 0.5rem;
}

label {
  font-size: var(--md-sys-typescale-label-l-size);
  line-height: var(--md-sys-typescale-label-l-line);
  font-weight: var(--md-sys-typescale-label-l-weight);
  letter-spacing: var(--md-sys-typescale-label-l-tracking);
}

small,
.footer-text {
  font-size: var(--md-sys-typescale-body-s-size);
  line-height: var(--md-sys-typescale-body-s-line);
  letter-spacing: var(--md-sys-typescale-body-s-tracking);
}

:focus-visible {
  outline: var(--pk-focus-ring) solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* == components == */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--pk-touch-target);
  padding: 0.625rem 1.5rem;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: var(--md-sys-typescale-label-l-size);
  line-height: var(--md-sys-typescale-label-l-line);
  font-weight: var(--md-sys-typescale-label-l-weight);
  letter-spacing: var(--md-sys-typescale-label-l-tracking);
  cursor: pointer;
  position: relative;
}

.btn:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-primary) var(--md-sys-state-hover-opacity), var(--md-sys-color-primary));
}

.btn:active {
  background: color-mix(in srgb, var(--md-sys-color-on-primary) var(--md-sys-state-pressed-opacity), var(--md-sys-color-primary));
}

.btn:disabled {
  cursor: not-allowed;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-content-opacity), transparent);
  background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-container-opacity), transparent);
}

.btn--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.btn--tonal:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-secondary-container) var(--md-sys-state-hover-opacity), var(--md-sys-color-secondary-container));
}

.btn--tonal:active {
  background: color-mix(in srgb, var(--md-sys-color-on-secondary-container) var(--md-sys-state-pressed-opacity), var(--md-sys-color-secondary-container));
}

.btn--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.btn--outlined:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-opacity), transparent);
}

.btn--outlined:active {
  background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-pressed-opacity), transparent);
}

.btn--text {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding-inline: 0.75rem;
}

.btn--text:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-hover-opacity), transparent);
}

.btn--text:active {
  background: color-mix(in srgb, var(--md-sys-color-primary) var(--md-sys-state-pressed-opacity), transparent);
}

.btn--danger {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

.btn--danger:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-error) var(--md-sys-state-hover-opacity), var(--md-sys-color-error));
}

.btn--danger:active {
  background: color-mix(in srgb, var(--md-sys-color-on-error) var(--md-sys-state-pressed-opacity), var(--md-sys-color-error));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.field__label {
  font-size: var(--md-sys-typescale-label-l-size);
  line-height: var(--md-sys-typescale-label-l-line);
  font-weight: var(--md-sys-typescale-label-l-weight);
  color: var(--md-sys-color-on-surface-variant);
}

.field input,
.field select,
.field textarea,
.field-input {
  min-height: var(--pk-touch-target);
  padding: 0.625rem 1rem;
  font: inherit;
  font-size: var(--md-sys-typescale-body-l-size);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-sm);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--md-sys-color-primary);
}

.card {
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-md);
  box-shadow: var(--md-sys-elevation-1);
  padding: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--pk-touch-target);
  padding: 0.375rem 0.75rem;
  gap: 0.375rem;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-sm);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-l-size);
  line-height: var(--md-sys-typescale-label-l-line);
  cursor: pointer;
}

.chip:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-opacity), var(--md-sys-color-surface-container-low));
}

/* .pct-chip-active is pct-panel.html's (M3-06) additive modifier on top
   of .chip.chip--filter for the status chips — kept merged into this
   selector rather than duplicated. The bare `.pct-chip` base class and
   its pill-radius override (M3-04's original legacy-compat scaffolding
   for pct-panel.html's pre-M3-06 markup) are gone: M3-06's real markup
   never emits a bare `.pct-chip` class, only `.chip.chip--filter` (+
   this modifier for the active state), so that selector/rule pair was
   dead on integration and has been dropped rather than merged.
   `.chip[aria-current="page"]` extends the same selected-chip look to
   consumables-list.html's plain-link All/Low-stock filter chips
   (p1-required-capabilities-spec.md §3): those are navigation links, not
   toggle buttons, so they mark selection with aria-current rather than
   aria-pressed, but share the exact same visual treatment. */
.chip--filter[aria-pressed="true"],
.chip[aria-current="page"],
.pct-chip-active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--md-sys-shape-corner-md);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}

.banner--error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.banner--success {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-success-container);
}

.banner--info {
  background: var(--md-sys-color-info-container);
  color: var(--md-sys-color-on-info-container);
}

.appbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0 1rem;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--md-sys-color-surface-container);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.navbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: var(--pk-touch-target);
  padding: 0.5rem;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: var(--md-sys-typescale-label-m-size);
}

.navbar a[aria-current="page"] {
  color: var(--md-sys-color-primary);
}

.navbar a svg,
.navbar summary svg {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--pk-touch-target);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.list__row:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-opacity), transparent);
}

/* by-project grouped view (M3-05: internal/item/by-project.html) */
.group-row {
  justify-content: space-between;
}

.group-count {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 400;
  font-size: var(--md-sys-typescale-body-s-size);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: var(--md-sys-typescale-label-s-size);
  line-height: 1.25rem;
}

.dialog {
  border: none;
  border-radius: var(--md-sys-shape-corner-xl);
  padding: 1.5rem;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-3);
  max-width: min(90vw, 32rem);
}

.dialog::backdrop {
  background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md);
}

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

.table-wrap th,
.table-wrap td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

/* Sortable table-header links (internal/insurance/valuables.html —
   P1-11 adversarial-review FOLD 3, AC-A11Y-1): a bare <a> inside a
   padded <th> only gets a hit-box the size of its own text glyphs
   (roughly 20px tall), well under the 44px touch-target floor. Zeroing
   the th's own padding and moving it onto the anchor instead — as a
   block-level flex item that fills the cell — makes the ENTIRE padded
   header tappable, not just the label text. */
.th-sort {
  padding: 0;
}

.th-sort > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}

/* consumables list warning tint (M3-05: internal/item/consumables-list.html) */
.table-wrap tr.pct-low {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.table-wrap tr.pct-low a {
  color: var(--md-sys-color-on-error-container);
}

.progress {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container);
}

.progress::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  animation: pk-progress-indeterminate 1.4s ease-in-out infinite;
}

@keyframes pk-progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* locations tree (M3-05: internal/location/locations.html). Scoped under
   .location-tree, not bare `details`/`summary` — handler_test.go asserts
   the literal "<details open>"/"<summary>" (no class), and a bare type
   selector would leak into other packages' own disclosure widgets. */
.location-tree,
.location-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 1.25rem;
}

.location-tree {
  padding-left: 0;
}

.location-tree li {
  margin: 0.5rem 0;
}

.location-tree details {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 0.75rem 1rem;
}

.location-tree summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.location-tree summary span:nth-child(2),
.location-tree summary span:nth-child(3) {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-s-size);
}

.location-tree summary span:last-child {
  margin-left: auto;
}

.node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* -- bulk scan (M3-05: internal/bulkscan/bulk-page.html) -- */
.bulk-scan {
  max-width: 40rem;
  margin: 0 auto;
}

/* PRD §8.4 Responsive: desktop 3-col grid, iPad 2-col, phone 1-col. */
.draft-cards {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .draft-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .draft-cards { grid-template-columns: repeat(3, 1fr); }
}

.draft-meta {
  display: block;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-s-size);
  margin-top: 0.125rem;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* == utilities == */

.pk-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pk-stack--sm {
  gap: 0.5rem;
}

/* == shell (PKRT-40 / M3-02 / M3-03) ==
   Sidebar breakpoint at 834px folds the phone tab-bar and the sub-834px
   sliver of the iPad-portrait band into one "mobile" behavior; >=834px is
   the persistent (non-collapsible) sidebar for both iPad and desktop —
   see internal/templates/layout.html's doc comment for the documented
   simplification vs. the spec's separate 640/1024/834-1194 bands. */

.appbar__wordmark {
  font-weight: var(--md-sys-typescale-title-l-weight, 700);
  font-size: var(--md-sys-typescale-title-m-size);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  margin-right: 0.5rem;
}

.appbar__search {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.appbar__search input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: var(--pk-touch-target);
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-sm);
}

.badge--pill {
  min-width: 0;
  height: auto;
  padding: 0.25rem 0.75rem;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-m-size);
  white-space: nowrap;
}

.badge--pill[data-state="scanning"] {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.appbar__account {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.appbar__theme-form,
.appbar__logout-form {
  margin: 0;
}

.navbar summary,
.navbar__desktop-only {
  cursor: pointer;
}

.navbar summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: var(--pk-touch-target);
  padding: 0.5rem;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-m-size);
  list-style: none;
}

.navbar summary::-webkit-details-marker {
  display: none;
}

.navbar__more {
  flex: 1;
  position: relative;
}

.navbar__more-panel {
  display: flex;
  flex-direction: column;
}

.navbar__more[open] .navbar__more-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  min-width: 12rem;
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-md);
  box-shadow: var(--md-sys-elevation-3);
  padding: 0.5rem 0;
  z-index: 200;
}

.navbar__more-panel a,
.navbar__more-panel button {
  min-height: var(--pk-touch-target);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.navbar__logout-form {
  margin: 0;
}

.navbar__desktop-only {
  display: none;
}

.chrome-hidden .appbar,
.chrome-hidden .navbar {
  display: none;
}

@media (min-width: 834px) {
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 15rem;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-top: none;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    padding: 1rem 0;
    gap: 0.25rem;
  }

  .navbar a,
  .navbar summary {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    text-align: left;
    border-radius: var(--md-sys-shape-corner-full);
    margin: 0 0.5rem;
  }

  .navbar__desktop-only {
    display: flex;
  }

  /* Superseded by .navbar__desktop-only — see layout.html. */
  .navbar a.navbar__mobile-only,
  .navbar__more {
    display: none;
  }

  .navbar a[data-nav="dashboard"] { order: 1; }
  .navbar a[data-nav="items"] { order: 2; }
  .navbar a[data-nav="search"] { order: 3; }
  .navbar a[data-nav="scan"] { order: 4; }
  .navbar a[data-nav="bulk"] { order: 5; }
  .navbar a[data-nav="consumables"] { order: 6; }
  .navbar a[data-nav="meals"] { order: 7; }
  .navbar a[data-nav="shopping"] { order: 8; }
  .navbar a[data-nav="by-project"] { order: 9; }
  .navbar a[data-nav="valuables"] { order: 10; }
  .navbar a[data-nav="locations"] { order: 11; }

  .app-main,
  .appbar {
    margin-left: 15rem;
  }
}

@media (max-width: 833.98px) {
  .app-main {
    padding-bottom: calc(var(--pk-touch-target) + 1rem);
  }
}

/* == item list / browse (PKRT-42) ==
   Born-on-M3 (material3-migration-spec.md §7 row 5): no inline <style>, no
   raw hex — every value below is a role token or an existing --pk-* var. */

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-group__label {
  font-size: var(--md-sys-typescale-label-l-size);
  color: var(--md-sys-color-on-surface-variant);
  margin-right: 0.25rem;
  align-self: center;
}

.chip:disabled,
.chip[aria-disabled="true"] {
  cursor: not-allowed;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-content-opacity), transparent);
  background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-container-opacity), transparent);
}

.list-summary {
  font-size: var(--md-sys-typescale-body-s-size);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 0.5rem;
}

.row-actions summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--pk-touch-target);
  min-height: var(--pk-touch-target);
  list-style: none;
  cursor: pointer;
  border-radius: var(--md-sys-shape-corner-full);
}

.row-actions summary::-webkit-details-marker {
  display: none;
}

.row-actions[open] > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.375rem;
}

.row-actions a,
.row-actions button {
  min-height: var(--pk-touch-target);
  display: flex;
  align-items: center;
}

.skeleton-row {
  height: var(--pk-touch-target);
  border-radius: var(--md-sys-shape-corner-sm);
  margin-bottom: 0.5rem;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-surface-container-low) 25%,
    var(--md-sys-color-surface-container) 37%,
    var(--md-sys-color-surface-container-low) 63%
  );
  background-size: 400% 100%;
  animation: pk-skeleton-shimmer 1.4s ease infinite;
}

@keyframes pk-skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* Responsive table -> stacked-card conversion (spec §4: "same template,
   CSS-switched"). thead is hidden using the .visually-hidden clip-path
   technique (never left:-9999px, never the legacy `clip: rect(...)` form
   either — M3-07's TestNoLegacyVisuallyHidden caught this rule still
   using `clip: rect(0, 0, 0, 0)`, fixed here to match .visually-hidden's
   own `clip-path: inset(50%)` exactly, per material3-migration-spec.md
   §7 row 13's named anti-pattern) so column semantics stay in the
   accessibility tree while each td's own data-label ::before supplies
   the visible label in card layout. */
@media (max-width: 639.98px) {
  .table-wrap--responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .table-wrap--responsive table,
  .table-wrap--responsive tbody,
  .table-wrap--responsive tr,
  .table-wrap--responsive td {
    display: block;
    width: 100%;
  }

  .table-wrap--responsive tr {
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 0.5rem 0;
  }

  .table-wrap--responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-bottom: none;
    padding: 0.375rem 1rem;
  }

  .table-wrap--responsive td[data-label]::before {
    content: attr(data-label);
    font-weight: var(--md-sys-typescale-label-l-weight);
    color: var(--md-sys-color-on-surface-variant);
    margin-right: 0.75rem;
  }
}

@media (min-width: 640px) {
  .filter-bar__disclosure summary {
    display: none;
  }

  .filter-bar__disclosure > div {
    display: contents;
  }
}

/* == item detail (PKRT-43) ==
   Born-on-M3 (material3-migration-spec.md §7 row 6): no inline <style>,
   no raw hex — every value below is a role token or an existing --pk-*
   var. */

.detail-section {
  margin-bottom: 1rem;
}

.detail-fieldlist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.detail-fieldlist > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.detail-fieldlist dt {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-s-size);
}

.detail-fieldlist dd {
  margin: 0;
  text-align: right;
}

.detail-breadcrumb {
  font-size: var(--md-sys-typescale-body-l-size);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.detail-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* == movement history (P1-08/09, p1-required-capabilities-spec.md §4) ==
   Born-on-M3: role tokens only, no raw hex. .list__row already provides
   the row's baseline (flex/gap/min-height/border); this block only
   overrides its axis to stack a history row's badge/chip/time meta line
   above its sentence(s) and expandable raw diff. */
.detail-history-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  padding: 0.75rem 1rem;
}

.detail-history-row__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-history-row__time {
  font-size: var(--md-sys-typescale-body-s-size);
  color: var(--md-sys-color-on-surface-variant);
}

.detail-history-footer {
  font-size: var(--md-sys-typescale-body-s-size);
  color: var(--md-sys-color-on-surface-variant);
  padding: 0.5rem 1rem;
}

@media (max-width: 833.98px) {
  .detail-actions {
    position: sticky;
    bottom: calc(var(--pk-touch-target) + 1rem);
    padding: 0.75rem;
    background: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-2);
    z-index: 10;
  }
}

/* == W4 fragments (M3-06) ==
   pct-panel / project-chip / photo-gallery / label pages / not-found —
   no inline <style>, no raw hex; every value below is a role token or an
   existing --pk-*/--md-sys-* var. */

.pct-panel {
  margin: 1rem 0;
}

.pct-readout {
  font-size: var(--md-sys-typescale-body-l-size);
  margin: 0 0 0.5rem;
}

.pct-quickpicks,
.pct-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.pct-slider {
  width: 100%;
  margin: 0.5rem 0;
}

.pct-stale {
  color: var(--md-sys-color-on-surface-variant);
}

/* pct-panel-unavailable is item-form.html's OWN "save/reload first"
   copy (not a pct-panel.html fragment class) — item-form.html is out of
   M3-06's file scope, so this rule survives from M3-04 rather than
   being retired with the rest of that ticket's legacy-compat section. */
.pct-panel-unavailable {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-s-size);
}

.project-chip-wrap {
  margin: 1rem 0;
}

/* .project-chip / .project-assign-form merge M3-06's flex-layout rules
   with M3-04's box treatment (background/border/padding/font-size) —
   both were real, targeting the same selectors from two directions
   (internal alignment vs. container look), so this is a genuine merge,
   not a pick-one dedupe. */
.project-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 0.625rem 0.875rem;
  font-size: var(--md-sys-typescale-body-l-size);
}

.project-assign-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-sm);
  padding: 0.625rem 0.875rem;
  font-size: var(--md-sys-typescale-body-l-size);
}

.project-suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-suggestion {
  min-height: var(--pk-touch-target);
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-radius: var(--md-sys-shape-corner-sm);
}

.project-suggestion:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-opacity), transparent);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.photo-thumb {
  position: relative;
  margin: 0;
}

.photo-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--md-sys-shape-corner-sm);
}

.photo-delete {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  min-width: var(--pk-touch-target);
  min-height: var(--pk-touch-target);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
}

.photo-empty {
  color: var(--md-sys-color-on-surface-variant);
}

.label-page-main {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

.size-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.label-preview-card {
  text-align: center;
}

.label-preview-card img {
  max-width: 100%;
  image-rendering: pixelated;
  border-radius: var(--md-sys-shape-corner-sm);
}

.label-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 1rem;
}

/* -- P1-02/03 label batch printing (p1-required-capabilities-spec.md §1) --
   .member-check: one checkbox row of the batch picker; min-height keeps
   the whole row at the 44px touch floor (--pk-touch-target).
   .batch-select-form: the item-list multi-select → POST /labels/batch
   form. The selection bar is hidden until at least one row checkbox is
   checked (:has()), and the live count is a pure-CSS counter over checked
   boxes — the zero-JS implementation of the spec's "'Print labels'
   action disabled with count 0 / shown with live N" states. */
.member-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--pk-touch-target);
}
.member-check__sub {
  display: block;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-s-size);
}
.row-select input[type="checkbox"],
.member-check input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--md-sys-color-primary);
}
.row-select {
  min-width: var(--pk-touch-target);
}
.batch-select-form {
  counter-reset: pk-selected;
}
.batch-select-form input[name="refs"]:checked {
  counter-increment: pk-selected;
}
.batch-select-form .selection-bar {
  display: none;
}
.batch-select-form:has(input[name="refs"]:checked) .selection-bar {
  display: flex;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  padding: 0.5rem 0;
  background: var(--md-sys-color-surface);
  border-top: 1px solid var(--md-sys-color-outline-variant);
}
.selection-bar__count::after {
  content: counter(pk-selected);
}

.not-found-content,
.action-confirm {
  max-width: 32rem;
  margin: 4rem auto 0;
  text-align: center;
}

.not-found-content p,
.action-confirm p {
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 1.5rem;
}

/* == M3-04 additions (login/scan/search/item-form migration) ==
   One-line-per-rule below (a deliberate density trade-off, not the house
   style) — this file has a hard size ceiling (§1) and this ticket alone
   added five templates' worth of classes; verbose per-rule comments the
   way the rest of this file uses them would blow the budget. See
   material3-migration-spec.md §7 rows 9-12 for what each block migrates. */

/* -- login (row 9): standalone doc, no shared shell, see login.html -- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 1rem; }
.login-page__card { width: 100%; max-width: 24rem; }
.login-page__purpose { margin: 0 0 1.5rem; color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-m-size); }
.login-page__submit { width: 100%; }
.login-page__footer { margin-top: 1.5rem; font-size: var(--md-sys-typescale-body-s-size); color: var(--md-sys-color-on-surface-variant); text-align: center; }

/* -- htmx loading indicator (global): htmx 2.x ships no default CSS for
   this convention; was silently missing repo-wide until this ticket
   (found via items-list.html's #items-skeleton while migrating
   item-form.html's own copy of the identical rule) -- */
.htmx-indicator { display: none; color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-s-size); margin-left: 0.5rem; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* -- scan viewfinder (row 10): camera.js untouched, ids unchanged, only
   classes moved here. Deliberately fixed-dark, NOT light-dark() roles —
   a full-bleed viewfinder ignores OS theme like every camera app (hex is
   fine here: it's app.css, not a template, so it doesn't trip
   TestNoRawHexInTemplates). Torch-on reuses the tertiary role instead of
   a hardcoded amber (no "warning" role exists in the token set). -- */
.scan-viewfinder { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
body.chrome-hidden { background: #000; color: #fff; }
.scan-viewfinder__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-viewfinder__reticle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70vw; max-width: 22rem; aspect-ratio: 1.6 / 1; border: 3px solid rgba(255, 255, 255, 0.85); border-radius: var(--md-sys-shape-corner-lg); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35); pointer-events: none; }
.scan-viewfinder__instructions { position: absolute; top: 1.25rem; left: 0; right: 0; text-align: center; font-size: var(--md-sys-typescale-body-m-size); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); padding: 0 1rem; pointer-events: none; }
.scan-viewfinder__bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.65)); }
.scan-viewfinder__btn { min-width: var(--pk-touch-target); min-height: var(--pk-touch-target); padding: 0.5rem 1rem; font-size: var(--md-sys-typescale-label-l-size); font-weight: var(--md-sys-typescale-label-l-weight); border-radius: var(--md-sys-shape-corner-full); cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.4); color: #fff; }
.scan-viewfinder__btn[aria-pressed="true"] { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); border-color: var(--md-sys-color-tertiary); }
.scan-viewfinder__type-link { color: #fff; text-decoration: underline; font-size: var(--md-sys-typescale-body-m-size); display: inline-flex; align-items: center; min-height: var(--pk-touch-target); }
.scan-viewfinder__error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; background: #1c1917; text-align: center; }
.scan-viewfinder__error[hidden] { display: none; }
.scan-viewfinder__error p { max-width: 28rem; line-height: 1.5; color: #e7e5e4; }

/* -- search (row 11): page + fragment <style> blocks collapse here; both
   fully in scope, so .banner--info/--error (defined above) are used
   directly rather than the old space-separated .banner.ai/.error -- */
.search-box { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-box input[type="search"] { flex: 1; box-sizing: border-box; padding: 0.625rem 0.75rem; min-height: var(--pk-touch-target); font-size: var(--md-sys-typescale-body-l-size); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-sm); }
#results { margin-top: 0.5rem; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-item { background: var(--md-sys-color-surface-container-low); border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-md); padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.result-item .name { font-weight: var(--md-sys-typescale-title-s-weight); }
.result-item .meta { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-s-size); margin-top: 0.125rem; }
.empty { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-m-size); }
.typo-note { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-s-size); margin-bottom: 0.5rem; }

/* -- item form (row 12, the AC-A11Y-1 hotspot: was 32/36/40/44px in one
   file). Scoped under .item-form-page (a wrapper div item-form-content
   now renders) rather than bare elements. pct-panel.html/project-chip.html/
   photo-gallery.html (M3-06) render inside this page's tree as separate
   fragment files with their own classes (see the W4 fragments section
   above) — item-form.html itself only needs its own fieldset/field/photo-
   section-wrapper styling here. `button` is scoped by selector instead of
   ancestor-class (.item-form-page button would out-specificity and
   silently override the fragments' own single-class button rules) — every
   button in item-form.html itself gets an explicit .btn. -- */
.item-form-page fieldset { border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-md); padding: 0.875rem 1rem; margin: 0 0 1rem; background: var(--md-sys-color-surface-container-low); }
.item-form-page legend { font-weight: var(--md-sys-typescale-title-s-weight); font-size: var(--md-sys-typescale-title-s-size); padding: 0 0.375rem; }
.item-form-page label { display: block; font-size: var(--md-sys-typescale-label-l-size); color: var(--md-sys-color-on-surface-variant); margin: 0.625rem 0 0.25rem; }
.item-form-page input, .item-form-page select, .item-form-page textarea { width: 100%; box-sizing: border-box; padding: 0.5rem 0.625rem; border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-sm); font-size: var(--md-sys-typescale-body-l-size); min-height: var(--pk-touch-target); font-family: inherit; background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface); }
.item-form-page textarea { min-height: 5rem; }
#photo-section { margin-top: 1.5rem; }
#photo-section h2 { font-size: var(--md-sys-typescale-title-m-size); margin: 0 0 0.5rem; }

/* -- SE-03 session UI (session-engine-spec.md §3.3, meal spec §2.4
   inherited): the shell session banner + the /session and /sessions
   pages. The banner is the slim strip layout.html's session-banner block
   lazy-includes under the app bar on every authenticated page while a
   verb session is live; tertiary-container is the one M3 role pair not
   already claimed by the error/success/info banners, so "a session is
   running" reads as its own kind of ambient state. Both interactive
   pieces (label link, Close button) honor the 44px floor via
   --pk-touch-target. The immersive scan viewfinder hides it with the
   rest of the chrome — full-bleed stays full-bleed. -- */
.session-banner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.125rem 1rem; background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.session-banner__label { color: inherit; font-size: var(--md-sys-typescale-body-m-size); font-weight: var(--md-sys-typescale-title-s-weight); min-height: var(--pk-touch-target); display: inline-flex; align-items: center; text-decoration: none; }
.session-banner__label:hover { text-decoration: underline; }
.session-banner form { margin: 0; }
.chrome-hidden .session-banner { display: none; }

.session-page__times { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 1rem 0; }
.session-page__times dt { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-label-l-size); }
.session-page__times dd { margin: 0; }
.session-page__actions { padding-left: 1.25rem; }
.session-page__links, .sessions-page__links { display: flex; gap: 1.5rem; margin-top: 1.5rem; }
.session-page__links a, .sessions-page__links a { min-height: var(--pk-touch-target); display: inline-flex; align-items: center; color: var(--md-sys-color-primary); }

/* SE-05 move outcome card (§3.1) — injected into #scan-dup-target, replaced by the next scan; its link rides .btn. */
.session-move-outcome { margin: 0.75rem 0; padding: 0.75rem 1rem; border-radius: var(--md-sys-shape-corner-md); background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.session-move-outcome h2 { margin: 0; font-size: var(--md-sys-typescale-title-m-size); }
.session-move-outcome p { margin: 0.25rem 0 0; font-size: var(--md-sys-typescale-body-m-size); }

/* The sessions list's state pill rides .badge--pill's base look; active
   gets the tertiary "live" pair to match the banner, closed/expired stay
   the neutral base tones (they are history, not alerts). */
.badge--pill[data-state="active"] { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

/* -- MT-12 daily meal view (§4.3): native <progress> target bars (no
   inline widths, no JS); over-target renders numerically, the bar just
   clamps full. Entry rows reuse .list/.list__row. -- */
.meal-day__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.meal-day__head h1 { margin: 0; }
.meal-day__nav { display: flex; gap: 0.5rem; }
.meal-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.625rem; }
.meal-bars__row { display: grid; grid-template-columns: 6rem 1fr; gap: 0.125rem 0.75rem; align-items: baseline; }
.meal-bars__label { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-label-l-size); }
.meal-bars__over { color: var(--md-sys-color-on-surface-variant); }
.meal-bars__bar { grid-column: 2; width: 100%; height: 6px; appearance: none; border: none; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-secondary-container); overflow: hidden; }
.meal-bars__bar::-webkit-progress-bar { background: var(--md-sys-color-secondary-container); border-radius: var(--md-sys-shape-corner-full); }
.meal-bars__bar::-webkit-progress-value { background: var(--md-sys-color-primary); border-radius: var(--md-sys-shape-corner-full); }
.meal-bars__bar::-moz-progress-bar { background: var(--md-sys-color-primary); border-radius: var(--md-sys-shape-corner-full); }
.meal-day__unlogged { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-m-size); }
.meal-entry { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.meal-entry__time { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-label-l-size); min-width: 4.5rem; }
.meal-entry__name a { color: var(--md-sys-color-on-surface); }
.meal-entry__facts, .meal-entry__gap { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-m-size); }
.meal-entry__delete { margin-left: auto; }
.meal-entry__delete .btn { color: var(--md-sys-color-error); }
.meal-targets summary { cursor: pointer; min-height: var(--pk-touch-target); display: flex; align-items: center; font-weight: var(--md-sys-typescale-title-s-weight); }
.meal-targets__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
.meal-targets__grid label { display: block; font-size: var(--md-sys-typescale-label-l-size); color: var(--md-sys-color-on-surface-variant); }
.meal-targets__grid input { width: 100%; box-sizing: border-box; margin-top: 0.25rem; padding: 0.5rem 0.625rem; border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-sm); font-size: var(--md-sys-typescale-body-l-size); min-height: var(--pk-touch-target); font-family: inherit; background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface); }
