/* Final polish layer: page frame, section headers, item cards, footer, forms and admin
   tables. Loaded after glass.css on every page. Selectors use `:root` (and the #items
   scope) where they must win over earlier page and responsive rules. */

:root {
  /* Room the footer and its top margin take up; short pages subtract it so the
  footer still sits at the bottom of the screen. */
  --footer-space: 8rem;
}

/* ── Page frame: the footer ends the page instead of covering it ── */
:root body {
  padding-bottom: 0;
}

:root .site-footer {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 1;
  display: block;
  min-height: 0;
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: none;
  /* It no longer floats over moving content, so it needs no blur. */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

:root .site-footer .footer-container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem 2rem;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.footer-brand img {
  width: 36px;
  height: 36px;
  flex: none;
  padding: 2px;
  border-radius: 50%;
  background: #ffffff;
  object-fit: contain;
}
.footer-name {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}
.footer-tagline,
.footer-location {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
/* Always the last column: logo on the left, address on the right. */
.footer-location {
  grid-column: -2 / -1;
  text-align: right;
}

/* Short pages keep the footer at the bottom of the screen. */
:root .auth-container,
:root #adminPanel {
  min-height: calc(100vh - var(--navbar-height) - var(--footer-space));
}
@supports (height: 100dvh) {
  :root .auth-container,
  :root #adminPanel {
    min-height: calc(100dvh - var(--navbar-height) - var(--footer-space));
  }
}

/* 768px, not 767px: every other breakpoint in the site (navbar, hero, nav drawer)
   switches to its mobile layout at max-width: 768px. The 1px mismatch left this
   footer alone in its 3-column desktop grid - brand flush left, address flush
   right with no room to breathe - on exactly that common device width. */
@media (max-width: 768px) {
  :root {
    --footer-space: 10rem;
  }
  :root .site-footer .footer-container {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 1rem;
    text-align: center;
  }
  .footer-location {
    grid-column: auto;
    text-align: center;
  }

  /* Stacked and centered reads as cramped at the base desktop sizes, so scale the
     logo and text up rather than just reusing the desktop numbers. */
  .footer-brand img {
    width: 44px;
    height: 44px;
  }

  .footer-name {
    font-size: 1.0625rem;
  }

  .footer-tagline,
  .footer-location {
    font-size: 0.9375rem;
    line-height: 1.55;
  }
}

/* ── Home: hero ── */
:root .hero-name {
  margin-bottom: 0.35rem;
}
:root .hero-tagline {
  max-width: 34rem;
  margin-bottom: 1.4rem;
  color: var(--text-muted);
  font-size: clamp(0.98rem, 1.5vw, 1.1rem);
  line-height: 1.6;
}
:root .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
:root .hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 1.35rem;
}
/* The hero centres its text from 768px down (styles.css); the new parts follow. */
@media (max-width: 768px) {
  :root .hero-tagline {
    margin-inline: auto;
  }
  :root .hero-actions {
    justify-content: center;
  }
}
@media (max-width: 480px) {
  :root .hero-actions .btn {
    flex: 1 1 100%;
    max-width: 20rem;
  }
}

/* A <button class="btn btn-primary"> otherwise shows the browser's default grey border. */
:root button.btn-primary {
  border: 0;
}

/* ── Home: section headers (same type scale as the About page) ── */
:root .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}
:root .section-head-text {
  flex: 1 1 28rem;
  min-width: 0;
}
:root .section-eyebrow {
  margin-bottom: 0.55rem;
  color: var(--blue-main);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
:root h2.section-title {
  margin: 0 !important;
  color: var(--text-main);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  text-transform: none;
  text-wrap: balance;
}
:root .section-subtitle {
  max-width: 62ch;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}
:root .section-meta {
  flex: none;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 600;
}
:root .section-meta:empty {
  display: none;
}

/* ── Home: item cards ── */
:root #items .projects-grid.items-grid:not(.registered-belongings-grid) {
  /* At most three cards per row: each track is at least a third of the row
    (minus the two 1.25rem gaps), and at least 15.5rem where the row is wider. */
  grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 15.5rem), calc((100% - 2.5rem) / 3)), 1fr)) !important;
  grid-auto-rows: auto !important;
  align-items: stretch !important;
  gap: 1.25rem !important;
  height: auto !important;
}
:root #items .projects-grid > .project-card.listing-card {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  min-height: 0 !important;
  height: 100% !important;
  align-self: stretch !important;
  padding: 0;
  overflow: hidden;
}

/* Photo (or category placeholder) runs edge to edge across the top of the card. */
:root #items .listing-card .listing-media {
  flex: none;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
}
:root #items .listing-card .item-photo-frame {
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  background: var(--well-bg);
}
:root #items .listing-card .item-photo-frame[data-photo-state='empty'],
:root #items .listing-card .item-photo-frame[data-photo-state='error'] {
  background: radial-gradient(120% 90% at 50% 0%, rgba(59, 130, 246, 0.16), transparent 70%), var(--well-bg);
}
:root .listing-card .item-photo-status {
  gap: 0.4rem;
  font-size: 0.8125rem;
}
.listing-placeholder-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--blue-light);
  opacity: 0.85;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.item-photo-frame[data-photo-state='loading'] .listing-placeholder-icon,
.item-photo-frame[data-photo-state='loaded'] .listing-placeholder-icon {
  display: none;
}

.listing-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  padding: 1rem 1.1rem 1.1rem;
}
.listing-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}
:root #items .projects-grid .listing-card .item-badge {
  flex: none;
  max-width: none;
}
:root .listing-card .listing-ref {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
:root .listing-card .listing-ref-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--blue-main) 42%, transparent);
  border-radius: 0.4rem;
  padding: 0.2rem 0.45rem;
  background: color-mix(in srgb, var(--blue-main) 9%, transparent);
  color: var(--blue-main);
  -webkit-text-fill-color: currentColor;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}
/* No underline anywhere in the pill: the border, tint, hover fill and "QR" chip already
   show it is clickable. Set on the parts too, so no rule on the pill can bring it back. */
:root .listing-card .listing-ref-code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
:root .listing-card .listing-ref-action {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 1.05rem;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--blue-main) 16%, transparent);
  font-family: var(--font-brand);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
/* Hover: the chip fills, so it is clear the whole pill opens the QR sticker. */
:root .listing-card .listing-ref-button:hover .listing-ref-action {
  background: var(--blue-main);
  color: #fff;
  -webkit-text-fill-color: #fff;
}
:root .listing-card .listing-ref-button:hover {
  border-color: var(--blue-main);
  background: color-mix(in srgb, var(--blue-main) 18%, transparent);
  color: var(--blue-main);
}
:root .listing-card .listing-ref-button:focus-visible {
  border-radius: 0.2rem;
  outline: 2px solid var(--blue-main);
  outline-offset: 3px;
}
:root #items .projects-grid > .project-card.listing-card:hover {
  transform: none;
}
:root .projects-grid .listing-card h3.listing-title {
  margin: 0.15rem 0 0;
  color: var(--text-main);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
:root .projects-grid .listing-card p.listing-category {
  flex: none;
  color: var(--blue-dark);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}
:root .projects-grid .listing-card p.listing-desc {
  flex: none;
  margin: 0.15rem 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
:root .projects-grid .listing-card p.listing-desc.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
  overflow: visible;
}
.listing-more {
  align-self: flex-start;
  margin-top: -0.2rem;
  padding: 0.15rem 0;
  border: 0;
  background: none;
  color: var(--blue-light);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.listing-more:hover {
  text-decoration: underline;
}
.listing-more:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 2px;
  border-radius: 4px;
}
.listing-more[hidden] {
  display: none !important;
}

/* Location and time sit at the bottom so they line up across a row. */
.listing-facts {
  display: grid;
  gap: 0.35rem;
  margin: auto 0 0;
  padding: 0.7rem 0 0;
  border-top: 1px solid var(--card-border);
  list-style: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}
.listing-facts li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
}
.listing-facts li > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
/* icons.js swaps the emoji for an outline SVG in the current colour. */
.listing-fact-icon {
  flex: none;
  color: var(--blue-light);
  font-size: 1rem;
  line-height: 1.2;
}

:root .listing-card .listing-actions {
  display: flex;
  flex-wrap: wrap !important;
  justify-content: flex-start;
  gap: 0.5rem !important;
  margin-top: 0.35rem;
  padding-top: 0;
}
/* Always sits at the right edge of the row, whatever else is there (or alone). */
:root .listing-card .listing-actions .btn-del {
  margin-left: auto;
}
/* "Potential match" now sits with the card's actions instead of covering the photo. */
:root .listing-card .listing-actions .potential-match-badge {
  position: relative;
  inset: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  max-width: 100%;
  min-height: 2rem;
  border-radius: 999px;
}

/* Phones: one column of compact cards with the photo as a thumbnail. */
@media (max-width: 599px) {
  :root #items .projects-grid.items-grid:not(.registered-belongings-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.75rem !important;
  }
  :root #items .projects-grid > .project-card.listing-card {
    display: grid !important;
    grid-template-columns: 5.75rem minmax(0, 1fr);
    align-items: start;
    column-gap: 0.85rem;
    padding: 0.85rem;
  }
  :root #items .listing-card .listing-media {
    border-radius: 14px;
  }
  :root #items .listing-card .item-photo-frame {
    aspect-ratio: 1 / 1;
    border: 1px solid var(--well-border);
    border-radius: 14px;
  }
  .listing-placeholder-icon {
    width: 1.75rem;
    height: 1.75rem;
  }
  .listing-body {
    gap: 0.3rem;
    padding: 0;
  }
  :root .projects-grid .listing-card h3.listing-title {
    font-size: 1rem;
  }
  .listing-facts {
    margin-top: 0.25rem;
    padding-top: 0.55rem;
  }
}

/* ── Home: report form ──────────────────────────────────────────────────── */
/* The form sits directly on its panel instead of a second card inside it. */
:root #portalHero,
:root #report,
:root #items {
  border: 1px solid var(--clay-edge);
  border-radius: 18px;
}
:root .tools-section > .simple-card {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
:root .photo-upload-icon {
  color: var(--blue-main);
}

#itemForm[aria-busy='true'] button[type='submit'] {
  cursor: wait;
  opacity: 0.86;
}

/* ── Portal hero globe ── */
.portal-hero-avatar {
  flex: 0 0 min(40%, 380px);
  text-align: center;
}
.portal-hero-globe {
  --portal-globe-size: clamp(300px, 35vw, 380px);
  position: relative;
  width: var(--portal-globe-size);
  height: var(--portal-globe-size);
  margin-inline: auto;
  perspective: 950px;
}
.portal-hero-globe::after {
  content: '';
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 1%;
  z-index: 1;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--blue-main) 20%, transparent);
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--blue-main) 14%, transparent), transparent 68%);
  transform: rotateX(68deg);
  pointer-events: none;
}
.portal-hero-glow {
  position: absolute;
  inset: 12%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(15, 23, 42, 0.22) 0%,
    rgba(30, 58, 138, 0.18) 34%,
    rgba(37, 99, 235, 0.07) 54%,
    transparent 72%
  );
  filter: blur(3px);
  pointer-events: none;
}
.portal-hero-stage {
  position: absolute;
  inset: 0 0 42px;
  z-index: 2;
  animation: portal-hero-bob 6s ease-in-out infinite;
}
.portal-hero-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.portal-hero-stage canvas:active {
  cursor: grabbing;
}
.portal-hero-shadow {
  position: absolute;
  left: 50%;
  bottom: -24px;
  width: 64%;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.24), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}
@keyframes portal-hero-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}
@media (max-width: 768px) {
  .portal-hero-avatar {
    flex: 0 0 auto;
  }
  .portal-hero-globe {
    --portal-globe-size: min(82vw, 340px);
  }
  :root .landing-hero,
  :root #portalHero {
    overflow: visible;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-hero-stage {
    animation: none;
  }
}

/* ── Sign-in and register forms: same label style as the rest of the site ─ */
:root .form-group label {
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  text-transform: none;
}

/* ── Admin: tab headers ── */
:root .claims-tab-intro {
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 641px) {
  :root .claims-tab-intro {
    align-items: flex-end;
  }
}
:root .claims-tab-intro h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-transform: none;
}
:root .claims-tab-intro p {
  margin-top: 0.3rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ── Admin: items table ── */
/* Text columns read left to right; only the row number and actions are centred. */
:root #adminItemsTable th,
:root #adminItemsTable td {
  text-align: left;
}
:root #adminItemsTable th:first-child,
:root #adminItemsTable td:first-child,
:root #adminItemsTable th:last-child,
:root #adminItemsTable td:last-child {
  text-align: center;
}

/* Reporter name on one line, contact underneath in a muted style. */
:root #adminItemsTable .reporter-cell .admin-cell-wrap {
  display: block;
}
:root #adminItemsTable .reporter-cell .reporter-contact {
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

:root #adminItemsTable .actions-cell .action-btn {
  display: inline-flex;
  justify-content: center;
  width: auto;
  min-width: 4.5rem;
}

/* Status and role pills (glass.css makes every .badge a pill). */
:root .badge-active,
:root .badge-role-student {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.32);
}
:root .badge-role-admin {
  background: rgba(59, 130, 246, 0.14);
  color: var(--blue-light);
  border: 1px solid rgba(59, 130, 246, 0.35);
}
:root .badge-role-employee {
  background: rgba(45, 212, 191, 0.14);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.35);
}

/* ── Admin: broadcast form ── */
:root .broadcast-card {
  display: grid;
  gap: 0.45rem;
  max-width: none;
  margin-top: 0;
  padding: clamp(1rem, 2.5vw, 1.5rem);
}
:root .broadcast-card label:not(:first-child) {
  margin-top: 0.5rem;
}
:root .broadcast-card .form-control,
:root .broadcast-card textarea {
  width: 100%;
  margin-top: 0;
}
:root .broadcast-card .btn {
  margin-top: 0;
}
.broadcast-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── Home: items and report form side by side ───────────────────────────── */
/* Below 1100px the wrapper is a plain block, so the two panels stack as before.
   From 1100px the items take the remaining width and the form gets a fixed
   column on the right. Everything lines up with the navbar's content edges:
   1100px wide, or 1320px on large screens (navbar and footer widen to match). */
:root {
  --home-content-width: 1100px;
}

/* responsive.css gives body overflow-x: hidden, which makes body a scroll container
   and stops the sticky report form from sticking. clip trims sideways overflow the
   same way without that; browsers without clip keep hidden. */
:root body {
  overflow-x: clip;
}

@media (min-width: 1100px) {
  :root .hero-section {
    max-width: var(--home-content-width);
  }

  .browse-report-layout {
    display: grid;
    /* 420px still leaves the items room for two cards (three from 1440px). */
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    gap: clamp(0.75rem, 1.5vw, 1.25rem);
    align-items: start;
    width: calc(100% - 1rem);
    max-width: var(--home-content-width);
    margin: clamp(0.75rem, 2vw, 1.25rem) auto;
  }

  :root .browse-report-layout > .projects-section,
  :root .browse-report-layout > .tools-section {
    width: auto;
    max-width: none;
    margin: 0;
  }

  /* The form stays in view while the item list scrolls. When it is taller than
     the window, js/home-page.js sets a negative top so its bottom (the submit
     button) is what stays on screen. */
  :root .browse-report-layout > .tools-section {
    position: sticky;
    top: var(--report-sticky-top, calc(var(--navbar-height) + 1rem));
  }

  /* The narrow column fits one field per row. */
  :root .browse-report-layout > .tools-section .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Tighter spacing so the whole sticky form fits below the navbar on a 1080p
    screen. Text and field sizes stay the same; only the gaps shrink.
    !important where the spacing comes from inline styles or glass.css's
    !important panel padding. */
  :root .browse-report-layout > .tools-section {
    padding: 1.5rem !important;
  }
  :root #report .section-head {
    margin-bottom: 1rem;
  }
  :root #report .report-type-selection {
    margin-bottom: 0.9rem !important;
  }
  :root #report .type-switcher .type-option {
    min-height: 2.6rem;
  }
  :root #report .form-row {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  :root #report #itemForm > .input-field {
    margin-bottom: 0.9rem !important;
  }
  :root #report #itemDesc {
    min-height: 4rem;
  }
  :root #report .report-more {
    margin-bottom: 0.9rem;
  }
  :root #report .report-more > summary {
    padding-block: 0.6rem;
  }
}

/* Large screens: the content follows the window (2rem margin each side) up to
   1760px; items keep three cards per row and the form takes the rest. Widths elsewhere are
   percentage-based, so this only caps them and never causes sideways scroll. */
@media (min-width: 1440px) {
  body:has(.browse-report-layout) {
    --home-content-width: min(calc(100vw - 4rem), 1760px);
  }
  /* Items stop at three cards per row, so the extra width goes to the form. */
  .browse-report-layout {
    grid-template-columns: minmax(0, 1fr) clamp(420px, 32%, 560px);
  }
  /* A wide form puts two short fields side by side again (auto-fit keeps one
     per row until each can be 220px). */
  :root .browse-report-layout > .tools-section .form-row {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  /* The content width plus the bars' 1.25rem side padding. */
  body:has(.browse-report-layout) .navbar-container,
  :root body:has(.browse-report-layout) .site-footer .footer-container {
    max-width: calc(var(--home-content-width) + 2.5rem);
  }
}

/* Office and sort share one row beside each other. */
@media (min-width: 769px) {
  :root .browse-report-layout .hotspots-row {
    flex-wrap: nowrap;
  }
  :root .browse-report-layout .location-filter-wrap {
    flex: 1 1 200px;
    min-width: 0;
  }
}

/* ── Report form: lost / found switch ── */
/* Form labels are inline-block with a bottom margin (styles.css); these are flex
  buttons, so the icon and text centre together. */
:root .type-switcher .type-option {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  gap: 0.5rem;
  min-height: 3rem;
  justify-content: center;
  text-align: center;
  font-size: 1rem;
  border-radius: 12px;
}
.type-option-icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The badge colours are readable on glass in both themes. !important beats the
   theme-wide label colours, which are themselves !important (home.css, styles.css). */
:root .type-switcher .type-option.active-lost {
  color: var(--badge-lost-fg) !important;
}
:root .type-switcher .type-option.active-found {
  color: var(--badge-found-fg) !important;
}

/* ── Report form: optional fields folded under "Add more details" ── */
.report-more {
  margin: 0 0 1.25rem;
  border: 1px solid var(--control-border);
  border-radius: 14px;
  background: var(--control-bg);
}
.report-more > summary {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  padding: 0.8rem 2.75rem 0.8rem 1rem;
  border-radius: 14px;
  list-style: none;
  cursor: pointer;
}
.report-more > summary::-webkit-details-marker {
  display: none;
}
/* Chevron: points down when closed, up when open. */
.report-more > summary::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 1.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--blue-light);
  border-bottom: 2px solid var(--blue-light);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
.report-more[open] > summary::after {
  transform: translateY(-30%) rotate(-135deg);
}
.report-more > summary:hover .report-more-title {
  text-decoration: underline;
}
.report-more > summary:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 2px;
}
.report-more-title {
  color: var(--blue-light);
  font-size: 0.9375rem;
  font-weight: 700;
}
.report-more-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.report-more > .input-field {
  padding: 0 1rem;
}
.report-more[open] > summary {
  margin-bottom: 0.25rem;
}

/* Keep no-photo frames the same size as photo frames so card content aligns. */
@media (min-width: 600px) {
  :root #items .projects-grid.items-grid:not(.registered-belongings-grid) {
    grid-auto-rows: 1fr !important;
  }
  :root #items .listing-card .item-photo-frame[data-photo-state='empty'] .item-photo-status {
    flex-direction: row;
    gap: 0.6rem;
  }
  :root #items .listing-card .item-photo-frame[data-photo-state='empty'] .listing-placeholder-icon {
    width: 1.6rem;
    height: 1.6rem;
  }
}

/* ── Report form: actions ── */
/* Submit is the main action, so it gets twice Cancel's width; labels never wrap. */
.report-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.report-actions .btn {
  min-width: 0;
  white-space: nowrap;
  cursor: pointer;
}
.report-actions .report-cancel {
  flex: 1 1 0;
}
.report-actions .report-submit {
  flex: 2 1 0;
  border: none;
}

/* ── Text sizes ─────────────────────────────────────────────────────────── */
/* Scale: 16px body text and fields, 15px buttons, links and card text, 14px
   labels and secondary text, 13px small uppercase tags. These rules fix the
   places where earlier (often !important) phone rules set smaller sizes. */

/* Form fields are 16px everywhere; phones zoom in on smaller fields when tapped. */
:root input:not([type='checkbox']):not([type='radio']):not([type='file']),
:root textarea,
:root select,
:root .category-picker {
  font-size: 1rem !important;
}

@media (min-width: 769px) {
  :root .navbar .nav-links a {
    font-size: 0.9375rem;
  }
}

@media (max-width: 768px) {
  :root .filter-chips .chip {
    font-size: 0.875rem !important;
  }
  :root .input-field label,
  :root .form-group label {
    font-size: 0.875rem !important;
  }
  :root .type-switcher .type-option {
    font-size: 0.9375rem !important;
  }
  :root .mobile-header-signin {
    font-size: 0.875rem !important;
  }
}

/* ── Fit and readability fixes ──────────────────────────────────────────── */
/* Search keeps a usable width; when the chips (with "My Belongings" for signed-in
   students) no longer fit beside it, they move to their own row instead of
   squeezing the box down to a few letters. */
@media (min-width: 640px) {
  :root .filter-row {
    flex-wrap: wrap;
  }
  :root .filter-row .search-box {
    flex: 1 1 15rem;
    min-width: min(100%, 15rem);
  }
}

/* The end of a reference code is the part that tells two items apart, so the
   code is never cut off: on a narrow card it moves below the status badge. */
:root .listing-topline {
  flex-wrap: wrap;
}
:root .listing-card .listing-ref {
  overflow: visible;
  text-overflow: clip;
}

/* Admin: the search box matches the height and inner spacing of the filters beside it. */
@media (min-width: 561px) {
  :root .admin-search-row #adminSearch {
    height: 2.5rem;
    padding-inline: 0.85rem;
  }
}

/* Admin: status badges stay on one line, and the amber / red ones are dark enough
   to read on the light theme's white rows. */
:root #adminItemsTable .status-cell .badge.admin-status-pending {
  white-space: nowrap;
}
[data-theme='light'] .admin-status-pending {
  color: #92400e !important;
  border-color: rgba(217, 119, 6, 0.5) !important;
  background: rgba(245, 158, 11, 0.16) !important;
}
[data-theme='light'] .admin-status-rejected {
  color: #b91c1c !important;
  border-color: rgba(220, 38, 38, 0.45) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Admin, light theme: the outlined action buttons use darker greens and reds; the
   dark theme's bright shades are too faint on white. */
[data-theme='light'] .action-btn-claim {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.5);
}
[data-theme='light'] .action-btn-delete {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.45);
}
[data-theme='light'] .action-btn-outline {
  color: #334155;
  border-color: rgba(51, 65, 85, 0.45);
}