/* MeinBezirk — ported from prototype index.html */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/PublicSans-Regular-2e8803b7.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/PublicSans-SemiBold-3b71cd77.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/PublicSans-Bold-8ef9e271.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/PublicSans-ExtraBold-eb160979.woff2") format("woff2");
}

:root {
  /* Surface */
  --color-bg:          #f5f3ef;
  --color-bg-card:     #ffffff;
  --color-bg-soft:     #faf8f3;

  /* Text */
  --color-text:        #1c1d2e;
  --color-text-muted:  #6a6a82;
  --color-text-soft:   #8a8a9a;

  /* Border */
  --color-border:      #e1ddd4;
  --color-border-soft: #ebe7df;

  /* Brand / primary (indigo) */
  --color-primary:     #213a8c;
  --color-primary-bg:  #e8eaf4;
  --color-primary-fg:  #1a2e6e;

  /* Axis accents */
  --color-axis-leb:        #d8694e;
  --color-axis-leb-bg:     #fdeee5;
  --color-axis-leb-border: #f0d4bc;
  --color-axis-leb-text:   #a04a18;

  --color-axis-ort:        #2b5a8c;
  --color-axis-ort-bg:     #e6eef7;
  --color-axis-ort-border: #c8d6e8;
  --color-axis-ort-text:   #1f4577;

  --color-axis-anl:        #c98a2c;
  --color-axis-anl-bg:     #f5ecdc;
  --color-axis-anl-border: #e0d2b0;
  --color-axis-anl-text:   #7a5a18;

  /* Stage */
  --color-stage-pending-bg:  #fff5e0;
  --color-stage-pending-fg:  #7a5210;
  --color-stage-accepted-bg: #e1eedd;
  --color-stage-accepted-fg: #2d5a1f;
  --color-stage-rejected-bg: #f5dcd7;
  --color-stage-rejected-fg: #8a2a1c;

  /* Priority */
  --color-priority-high: #b84233;

  /* Type */
  --font-body:    "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-body);

  /* Layout */
  --max-width: 1100px;
  --rail-width: 260px;
  --rail-gap: 28px;
  --content-max: 720px;

  /* Shape */
  --radius: 8px;
  --radius-sm: 4px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(28, 29, 46, 0.04), 0 0 0 1px rgba(28, 29, 46, 0.04);
  --shadow-card-hover: 0 4px 16px rgba(28, 29, 46, 0.06), 0 0 0 1px rgba(28, 29, 46, 0.05);

  /* Kept: --color-bg-warm aliases bg-soft for a handful of utility rules
     (landing-about, table headers, pagination hover, admin overlays).
     The chip/journey/location/occasion/source/primary-soft aliases are
     gone — those rules were all rewritten in the overhaul. */
  --color-bg-warm: var(--color-bg-soft);
}

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

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
@media (max-width: 720px) { h1 { font-size: 28px; } }

a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--color-primary-fg); }

.numerals { font-variant-numeric: tabular-nums; }

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Site header */
.site-header {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}
.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.site-header__brand {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--color-primary);
  text-decoration: none;
}
.site-header__brand:hover { color: var(--color-primary-fg); }
.site-header__district {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--color-text);
}

/* City picker */
.city-picker {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}
.city-picker h1 {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.city-picker p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.district-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 1.25rem;
}
.district-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.district-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card-hover);
}
.district-card__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.district-card__hint {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.city-all-cards {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.city-all-cards__link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-bg-card);
  transition: border-color 0.15s, background 0.15s;
}

.city-all-cards__link:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.city-all-cards__link--secondary {
  color: var(--color-text-muted);
}

/* Alpha badge */
.logo-badge {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border-radius: 3px;
  padding: 2px 5px;
  vertical-align: super;
  line-height: 1;
}

/* Landing page */
.landing-hero {
  padding: 3rem 0 2rem;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}
.landing-hero h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}
.landing-hero__subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
.landing-hero__desc {
  max-width: 600px;
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}
.landing-districts {
  padding: 2rem 0;
}
.landing-city-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 1.5rem 0 0.5rem;
}
.landing-city-heading a {
  color: inherit;
  text-decoration: none;
}
.landing-city-heading a:hover {
  color: var(--color-primary);
}
.landing-districts h2 {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
.landing-districts__hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.landing-about {
  padding: 2rem 0 3rem;
  background: var(--color-bg-warm);
  border-top: 1px solid var(--color-border);
}
.landing-about__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: center;
}
.landing-about__item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.landing-about__item p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}
@media (max-width: 640px) {
  .landing-hero h1 { font-size: 2rem; }
  .landing-about__grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* Feed header */
.feed-header {
  padding: 2rem 0 1.5rem;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
}
.feed-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}
.feed-header__subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Filters */
/* === Filter rail === */
.filter-rail {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 14px 14px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
}
.filter-rail__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.filter-rail__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0;
}
.filter-rail__count {
  color: var(--color-primary);
  font-weight: 600;
}
.filter-rail__clear {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: underline;
}

.filter-rail__search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-bg);
}
.filter-rail__search-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: var(--color-primary);
}

.filter-rail__axis { margin-top: 14px; }
.filter-rail__axis-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.filter-rail__axis-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  display: inline-block;
}
.filter-rail__axis-dot--ort { background: var(--color-axis-ort); }
.filter-rail__axis-dot--lebenslage { background: var(--color-axis-leb); }
.filter-rail__axis-dot--anlass { background: var(--color-axis-anl); }

.filter-rail__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-pill {
  appearance: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  padding: 3px 9px;
  font: inherit;
  font-size: 11.5px;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.filter-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.filter-pill--on,
.filter-pill[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.filter-pill--on:hover { background: var(--color-primary-fg); }

/* === Feed layout (rail + main, ≥1024px goes 2-col) === */
.feed-layout {
  display: block;
  padding-top: 18px;
  padding-bottom: 36px;
}
.feed-layout__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feed-layout__rail { margin-top: 14px; }
.feed-layout__rail-toggle {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  list-style: none;
  padding: 10px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feed-layout__rail-toggle::-webkit-details-marker { display: none; }
.feed-layout__rail-toggle::before {
  content: "▾";
  margin-right: 8px;
  font-size: 14px;
  color: var(--color-primary);
}
.feed-layout__rail[open] .feed-layout__rail-toggle::before { content: "▴"; }
.feed-layout__rail-toggle-hint {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-soft);
}
.feed-layout__rail[open] > .filter-rail { margin-top: 10px; }

@media (min-width: 1024px) {
  .feed-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-width);
    column-gap: var(--rail-gap);
    align-items: start;
  }
  .feed-layout__main { max-width: var(--content-max); }
  .feed-layout__rail { margin-top: 0; }
  .feed-layout__rail-toggle { display: none; }
  .feed-layout__rail .filter-rail { display: block; }
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Cards */
/* === Feed card (v2) === */
.feed-card {
  position: relative;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.feed-card:hover { box-shadow: var(--shadow-card-hover); }

.feed-card--high-priority::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-priority-high);
  border-radius: var(--radius) 0 0 var(--radius);
}

.feed-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.feed-card__date {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.feed-card__title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-text);
  text-decoration: none;
  margin: 2px 0 8px;
}
.feed-card__title:hover { color: var(--color-primary); }

.feed-card__summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text);
  margin-bottom: 14px;
}

.feed-card__footer {
  padding-top: 12px;
  border-top: 1px solid var(--color-border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.feed-card__chips, .feed-card__source {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}
.feed-card__source-link {
  font-size: 11.5px;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.feed-card__source-link:hover { text-decoration: underline; }

/* === Badges (top row) === */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.badge--level         { background: var(--color-primary-bg); color: var(--color-primary); }
.badge--scope-all     { background: var(--color-text); color: var(--color-bg); }
.badge--stage-pending { background: var(--color-stage-pending-bg); color: var(--color-stage-pending-fg); }
.badge--stage-accepted{ background: var(--color-stage-accepted-bg); color: var(--color-stage-accepted-fg); }
.badge--stage-rejected{ background: var(--color-stage-rejected-bg); color: var(--color-stage-rejected-fg); }

/* === Chips (axis tags, party, admin) === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}
.chip__ico {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}
.chip--leb { background: var(--color-axis-leb-bg); color: var(--color-axis-leb-text); border-color: var(--color-axis-leb-border); }
.chip--leb .chip__ico { background: var(--color-axis-leb); }
.chip--ort { background: var(--color-axis-ort-bg); color: var(--color-axis-ort-text); border-color: var(--color-axis-ort-border); }
.chip--ort .chip__ico { background: var(--color-axis-ort); }
.chip--anl { background: var(--color-axis-anl-bg); color: var(--color-axis-anl-text); border-color: var(--color-axis-anl-border); }
.chip--anl .chip__ico { background: var(--color-axis-anl); }
.chip--party { background: transparent; color: var(--color-text-muted); border-color: var(--color-border); font-size: 10.5px; padding: 1px 7px; font-weight: 600; letter-spacing: 0.02em; }
.chip--admin { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); font-size: 10.5px; text-decoration: none; }
.chip--admin:hover { background: var(--color-primary); border-color: var(--color-primary); }
.chip-flag {
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
}
.chip-flag:hover { color: var(--color-primary); }
.chip-flag:disabled { opacity: 0.6; cursor: default; }

.flag-wrapper {
  position: relative;
  margin-left: auto;
}

.flag-popover {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  right: 0;
  z-index: 100;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  padding: 1rem;
  min-width: 280px;
  text-align: left;
}

.flag-popover__title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.6rem;
}

.flag-popover__reasons {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.flag-popover__option {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.flag-popover__option input[type="radio"] {
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.flag-popover__notes {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  resize: none;
  margin-bottom: 0.75rem;
  background: var(--color-bg-card);
}

.flag-popover__actions {
  display: flex;
  gap: 0.5rem;
}

.btn--sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.card-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}
.card-empty__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Card detail (permalink page) */
/* === Card detail (v2) === */
.card-detail {
  max-width: var(--content-max);
  padding-top: 24px;
  padding-bottom: 48px;
}
.card-detail__back {
  display: inline-flex;
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 18px;
}
.card-detail__back:hover { text-decoration: underline; }

.card-detail__top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-detail__date {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.card-detail__title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 14px;
}
@media (max-width: 720px) { .card-detail__title { font-size: 26px; } }

.card-detail__lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 18px;
}
.card-detail__lede p + p { margin-top: 10px; }

.card-detail__chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

/* === Process timeline === */
.timeline {
  display: flex;
  gap: 0;
  margin: 0 0 26px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.timeline__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: 11.5px;
  text-align: center;
  line-height: 1.3;
}
.timeline__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 60%;
  right: -40%;
  height: 2px;
  background: var(--color-border);
}
.timeline__step--done:not(:last-child)::after {
  background: var(--color-stage-accepted-fg);
}
.timeline__dot {
  width: 14px;
  height: 14px;
  border-radius: 99px;
  background: var(--color-border);
  box-shadow: 0 0 0 2px var(--color-bg);
  position: relative;
  z-index: 1;
}
.timeline__step--done .timeline__dot { background: var(--color-stage-accepted-fg); }
.timeline__step--now  .timeline__dot { background: var(--color-stage-pending-fg); }
.timeline__step--rejected .timeline__dot { background: var(--color-stage-rejected-fg); }
.timeline__label {
  color: var(--color-text-muted);
  font-weight: 500;
}
.timeline__step--now .timeline__label,
.timeline__step--rejected .timeline__label {
  color: var(--color-text);
  font-weight: 700;
}

/* === Source box === */
.source-box {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.source-box__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 14px;
}
.source-box__meta {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 16px;
  font-size: 13.5px;
}
.source-box__meta dt { color: var(--color-text-muted); }
.source-box__meta dd { color: var(--color-text); margin: 0; }
.source-box__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 16px;
}
.source-box__cta:hover { background: var(--color-primary-fg); color: #fff; }

/* === Related vorgänge === */
.related { margin-top: 26px; }
.related__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}
.related__list { list-style: none; margin: 0; padding: 0; }
.related__item { border-bottom: 1px solid var(--color-border-soft); }
.related__item:last-child { border-bottom: none; }
.related__link {
  display: block;
  padding: 12px 0;
  text-decoration: none;
  color: var(--color-text);
}
.related__link:hover .related__item-title { color: var(--color-primary); }
.related__item-title { font-size: 14.5px; font-weight: 600; display: block; }
.related__item-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; display: block; }

/* === Detail footer === */
.card-detail__footer {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.card-detail__admin {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Pagination */
.pagy.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2rem;
  padding: 0;
  font-family: var(--font-body);
}
.pagy.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  transition: background 0.15s, border-color 0.15s;
}
.pagy.nav a:hover:not([aria-disabled="true"]) {
  background: var(--color-bg-warm);
  border-color: var(--color-text-muted);
}
.pagy.nav a.current {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  pointer-events: none;
}
.pagy.nav a[aria-disabled="true"]:not(.current) {
  color: var(--color-text-muted);
  opacity: 0.5;
  pointer-events: none;
}

/* Flash messages */
.flash {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.flash--notice { background: #e8f5e9; color: #2e7d32; }
.flash--alert { background: #fce8e6; color: #b84233; }

/* Admin styles */
.admin-layout { font-family: var(--font-body); }
.admin-nav {
  background: var(--color-text);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.admin-nav__brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.admin-nav__links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.admin-nav__links a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.875rem; }
.admin-nav__links a:hover { color: #fff; }
.admin-nav__sep { width: 1px; height: 1rem; background: rgba(255,255,255,0.2); }
.admin-nav__logout {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
  font-family: inherit;
}
.admin-nav__logout:hover { color: #fff; }
.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  display: block;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.stat-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(184, 66, 51, 0.1);
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.25rem; }

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.status-filter {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  transition: background 0.15s, border-color 0.15s;
}
.status-filter:hover { background: var(--color-bg-warm); border-color: var(--color-text-muted); }
.status-filter.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.doc-info { max-width: 250px; }
.error-text { font-size: 0.75rem; color: #b84233; }
.muted-text { font-size: 0.75rem; color: var(--color-text-muted); }

table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); font-size: 0.875rem; }
th { font-weight: 600; background: var(--color-bg-warm); }

.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
}
.btn--primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

h1 { font-size: 1.5rem; margin-bottom: 1rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; font-weight: 600; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.3rem; }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="number"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  background: var(--color-bg-card);
}
.field textarea { min-height: 120px; resize: vertical; }
dl { display: grid; grid-template-columns: 180px 1fr; gap: 0.5rem 1rem; margin-bottom: 1.5rem; }
dt { font-weight: 600; font-size: 0.875rem; padding-top: 0.1rem; }
dd { font-size: 0.875rem; color: var(--color-text-muted); word-break: break-all; }

/* Auth / login page */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-warm);
}
.auth-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card-hover);
}
.auth-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}
.auth-subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.auth-form .field { margin-bottom: 1rem; }
.auth-form .field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: var(--color-bg-card);
}
.btn--full { width: 100%; text-align: center; margin-top: 0.5rem; }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-completed, .status-published { background: #e8f5e9; color: #2e7d32; }
.status-running, .status-extracting_text, .status-checking_relevance, .status-summarizing, .status-tagging { background: #fff8e1; color: #f57f17; }
.status-failed, .status-error { background: #fce8e6; color: #b84233; }
.status-stale, .status-cancelled { background: #f3e8fd; color: #7b1fa2; }
.status-never, .status-pending, .status-irrelevant, .status-skipped { background: var(--color-bg-warm); color: var(--color-text-muted); }

@media (max-width: 640px) {
  .district-grid { grid-template-columns: 1fr 1fr; }
}
