/* Shared visual tokens: all application views use this palette. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
  --ink: #1e3d59;
  --canvas: #f5f0e1;
  --accent: #ff6e40;
  --attention: #ffc13b;
  --surface: #fff;
  --soft: #ece7db;
  --muted: #526576;
  --line: #cecfc7;
  --focus: #1e3d59;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: inherit;
  padding: 10px 15px;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: var(--ink);
  text-underline-offset: 3px;
}
.mark {
  background: var(--ink);
  color: white;
  padding: 12px 9px;
  border-radius: 9px;
  font-size: 19px;
  letter-spacing: -1px;
}
.quiet {
  background: transparent;
}
main {
  max-width: 1600px;
  margin: 0 auto 0 108px;
  padding: 24px 40px 56px;
  min-height: calc(100vh - 170px);
}
h1 {
  font-size: 28px;
  letter-spacing: -0.5px;
  margin: 10px 0 12px;
  font-weight: 500;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.3px;
  margin: 0 0 22px;
}
h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: var(--ink);
}
p {
  line-height: 1.6;
}
.intro {
  color: var(--muted);
  margin: 0 0 30px;
  max-width: 760px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 30px 0;
}
.stat {
  border: 0;
  border-left: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 22px 24px;
}
.stat strong {
  display: block;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -1px;
  margin: 11px 0 8px;
}
.stat small {
  font-size: 12px;
  color: var(--muted);
}
.stat.highlight {
  background: var(--soft);
  border-color: var(--accent);
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.filters {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: 14px;
  padding: 23px;
  border-bottom: 1px solid var(--line);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
input,
select {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
  min-height: 43px;
}
input:focus,
select:focus {
  outline: 2px solid var(--focus);
}
.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  font-size: 13px;
  gap: 15px;
}
.results-heading span:last-child {
  color: var(--muted);
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  max-height: 68vh;
  border-bottom: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 var(--line);
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  font-weight: 600;
  padding: 13px 24px;
  border-block: 1px solid var(--line);
}
td {
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--canvas);
}
.gkz {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}
.municipality-link {
  font-weight: 500;
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
}
.municipality-link:hover {
  text-decoration: underline;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
.number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tag {
  display: inline-block;
  font-size: 12px;
  background: var(--soft);
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 5px;
}
.tag.green {
  background: var(--canvas);
  color: var(--ink);
}
.email {
  overflow-wrap: anywhere;
}
.pagination {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.pagination div {
  display: flex;
  gap: 8px;
}
.pagination button {
  font-size: 12px;
  padding: 8px 12px;
}
.empty {
  padding: 55px 24px;
  text-align: center;
  color: var(--muted);
}
.error {
  border: 1px solid var(--accent);
  background: var(--canvas);
  border-radius: 8px;
  padding: 22px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 22px;
  margin-top: 28px;
}
.card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 24px 0;
}
.detail-grid .wide {
  grid-column: 1/-1;
}
.contact {
  border-top: 1px solid var(--line);
  padding: 20px 0 4px;
}
.contact:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.contact-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.contact-title a {
  font-weight: 600;
}
.meta {
  font-size: 12px;
  color: var(--muted);
}
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
  font-size: 12px;
}
.source-links a {
  overflow-wrap: anywhere;
}
dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 13px;
  margin: 0;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.research {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 20px;
}
.research:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.research-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.research p {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0;
}
.back {
  font-size: 13px;
  text-decoration: none;
}
.back:hover {
  text-decoration: underline;
}
.login {
  max-width: 510px;
  margin: 45px auto;
}
.login .card {
  padding: 36px;
}
.login h1 {
  font-size: 30px;
}
.login button[type='submit'] {
  margin-top: 20px;
  width: 100%;
  background: var(--ink);
  color: white;
}
.login code {
  display: block;
  background: var(--soft);
  padding: 15px;
  border-radius: 6px;
  font-size: 12px;
  overflow-wrap: anywhere;
  margin-top: 15px;
}
.notice {
  font-size: 12px;
  color: var(--muted);
  border-left: 3px solid var(--attention);
  padding-left: 13px;
  margin-top: 26px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 22px max(5vw, 24px);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.skip {
  position: absolute;
  top: -100px;
  background: white;
  padding: 15px;
}
.skip:focus {
  top: 0;
  z-index: 10;
}
[hidden] {
  display: none !important;
}
.loading {
  opacity: 0.55;
  pointer-events: none;
}
@media (max-width: 900px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 18px;
  }
  th,
  td {
    padding: 14px 17px;
  }
}
@media (max-width: 580px) {
  .mark {
    font-size: 17px;
  }
  main {
    padding: 30px 18px 45px;
  }
  h1 {
    font-size: 30px;
  }
  .intro {
    font-size: 14px;
  }
  .stats {
    grid-template-columns: 1fr;
    margin: 24px 0;
    gap: 8px;
  }
  .stat {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 15px 18px;
  }
  .stat strong {
    grid-column: 2;
    grid-row: 1/3;
    font-size: 28px;
    margin: 0;
  }
  .stat small {
    margin-top: 5px;
  }
  .filters {
    padding: 18px;
    gap: 13px;
    grid-template-columns: 1fr;
  }
  .filters label:first-child {
    grid-column: 1/-1;
  }
  .results-heading {
    padding: 16px 18px;
  }
  .results-heading span:last-child {
    display: none;
  }
  .pagination {
    padding: 15px;
  }
  .card {
    padding: 22px;
  }
  .login {
    margin: 10px auto;
  }
  .login .card {
    padding: 24px;
  }
  footer {
    padding: 20px;
    flex-direction: column;
  }
  .detail-grid {
    gap: 15px;
  }
  td,
  th {
    padding: 14px 17px;
  }
  .number {
    min-width: 90px;
  }
}
/* Login appearance adapted from Lebenslauf/dist/chat.css. */
.signed-out {
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
}
.signed-out header,
.signed-out footer {
  display: none;
}
.signed-out main {
  padding: 1px 18px;
  min-height: 100vh;
}
.admin-login {
  max-width: 420px;
  margin: 10vh auto;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.admin-login h1 {
  font-size: 30px;
  margin: 0 0 10px;
  letter-spacing: 0;
}
.admin-login input[type='password'] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 8px 0 18px;
}
.admin-login label {
  font-size: 15px;
  color: var(--ink);
  font-weight: 400;
}
.admin-login .admin-primary {
  margin-top: 20px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-weight: bold;
}
.admin-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
  margin-top: 14px;
}
.admin-remember input[type='checkbox'] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--ink);
}
.login-feedback {
  color: #a32d21;
  font-size: 14px;
  margin-bottom: 0;
}
.login-feedback:empty {
  display: none;
}
.landing {
  max-width: 760px;
  padding-top: 15vh;
}
.landing .mark {
  display: inline-block;
}
@media (max-width: 580px) {
  .header-actions button {
    font-size: 12px;
    padding: 8px;
  }
  .admin-login {
    padding: 26px;
    margin: 8vh auto;
  }
}

/* Application shell: fixed desktop rail and compact section navigation. */
.app-header {
  height: auto;
  display: block;
  background: transparent;
  border: 0;
  padding: 32px 40px 0;
  margin-left: 108px;
  max-width: 1600px;
}
.app-rail {
  position: fixed;
  left: 20px;
  top: 70px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--ink);
}
.app-rail a,
.app-rail button {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--canvas);
}
.app-rail a:hover,
.app-rail button:hover {
  background: transparent;
  color: var(--attention);
}
.app-rail a[aria-current] {
  background: var(--accent);
  color: var(--ink);
}
.app-rail a:focus-visible,
.app-rail button:focus-visible {
  outline: 2px solid var(--attention);
}
.app-header svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
  font-weight: 350;
  margin: 0 0 20px;
}
.section-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.section-tabs a {
  padding: 12px 10px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
}
.section-tabs a[aria-current] {
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.section-tabs a:hover {
  border-bottom-color: var(--accent);
  color: var(--ink);
}
h1,
h2,
h3 {
  font-weight: 400;
}
button,
input,
select,
textarea {
  border-radius: var(--radius);
}
button {
  min-height: 40px;
  background: var(--surface);
}
input,
select,
textarea {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 12px;
}
input[type='checkbox'] {
  accent-color: var(--ink);
}
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.admin-primary,
.admin-login .admin-primary {
  background: #ff6e4026;
  color: var(--ink);
  border-color: transparent;
  font-weight: 500;
}
.admin-primary:hover {
  background: var(--accent);
}
.admin-login {
  border-radius: 8px;
}
.card.mail-composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
#session-controls,
#mail-context,
#mail-health {
  margin: 24px 40px 0 148px;
  max-width: 1400px;
}
#session-controls button + button {
  margin-left: 12px;
}
main:empty {
  min-height: 45vh;
  padding-top: 0;
}
body > p[role='status'] {
  margin: 0;
  padding: 7px 24px 7px 148px;
  font-size: 12px;
  background: var(--ink);
  color: var(--canvas);
}
footer {
  margin-left: 108px;
  padding: 20px 40px;
}
.signed-out main {
  margin: auto;
}
.signed-out > p[role='status'] {
  padding-left: 24px;
}
@media (max-width: 700px) {
  .app-rail {
    left: 8px;
    padding: 6px;
    gap: 8px;
  }
  .app-header {
    margin-left: 72px;
    padding: 24px 16px 0;
  }
  main {
    margin-left: 72px;
    padding: 20px 16px;
  }
  footer {
    margin-left: 72px;
    padding: 16px;
  }
  #session-controls,
  #mail-context,
  #mail-health {
    margin-left: 88px;
    margin-right: 16px;
  }
  body > p[role='status'] {
    padding-left: 88px;
  }
  .section-tabs {
    gap: 18px;
    overflow-x: auto;
  }
  .section-tabs a {
    white-space: nowrap;
  }
}

/* Checkboxes keep native, compact dimensions instead of text-field sizing. */
label:has(> input[type='checkbox']) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 14px;
  font-weight: 400;
}
input[type='checkbox'] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}
label > input[type='checkbox'] {
  order: -1;
}
button + button {
  margin-left: 8px;
}

input,
select,
textarea {
  font-weight: 400;
}

/* Interaction language: click cursor for actions, directional arrows for navigation. */
:root {
  --icon-click: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3l14 10-7 1-3 6zM12 14l4 7M3 10H1M10 3V1M3 3L1 1' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h16m-6-6 6 6-6 6' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
button {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 400;
}
button:hover {
  background: #ffc13b45;
}
button:active {
  background: #ff6e4040;
}
button::before,
a[data-route]:not(.app-rail a)::before,
summary::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  background: currentColor;
  mask: var(--icon-click) center / contain no-repeat;
  flex-shrink: 0;
}
a[data-route]:not(.app-rail a)::before,
button[data-direction]::before,
button[aria-expanded]::before,
summary::before {
  mask-image: var(--icon-arrow);
}
[data-direction='left']::before,
a.back::before {
  transform: rotate(180deg);
}
button[aria-expanded='false']::before,
summary::before {
  transform: rotate(90deg);
}
button[aria-expanded='true']::before,
details[open] > summary::before {
  transform: rotate(-90deg);
}
.app-rail button {
  padding: 0;
  border: 0;
  background: transparent;
  margin: 0;
}
.app-rail button::before {
  display: none;
}
.app-rail .rail-back {
  border-top: 1px solid #ffffff35;
  border-radius: 0 0 6px 6px;
  margin-top: 4px;
  padding-top: 8px;
  height: 52px;
}
.card,
.card.mail-composer,
.mail-toolbar,
.mail-template-picker,
.mail-placeholder-row,
#session-controls {
  background: var(--surface);
  padding: 24px;
  border: 0;
  border-radius: var(--radius);
}
.card + .card {
  border-top: 1px solid var(--line);
}
.card.mail-composer {
  border-left: 3px solid var(--accent);
}
.mail-placeholder-row {
  border-left: 3px solid var(--attention);
}
.mail-group {
  border-left: 3px solid var(--attention);
}
.mail-group[open] {
  border-left-color: var(--accent);
}
.mail-group summary:hover {
  color: var(--ink);
}

/* Compact text actions: the underline belongs to the label, not the leading icon.
   Explicit scope also covers primary/login/token buttons without restyling the rail. */
button:not(.app-rail button):not(.mail-snackbar button) {
  min-height: 32px;
  padding: 4px 6px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
  text-decoration-skip-ink: none;
  transition: none;
}
button:not(.app-rail button):not(.mail-snackbar button):hover,
button:not(.app-rail button):not(.mail-snackbar button):active {
  background: transparent;
  color: var(--ink);
}
button:not(.app-rail button):not(.mail-snackbar button):disabled {
  text-decoration-color: var(--line);
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
