:root {
  --es-blau: #014e66;
  --es-dunkelblau-tbd: #003647;
  --es-schrift-blau: #002733;
  --es-cyan: #80cef5;
  --cyan-light: #b3e6ff;
  --cyan-extra-light: #e3f5ff;
  --es-gruen: #01a48b;
  --es-rot: #e40146;
  --flaechenfarbe-1: #e1ebf1;
  --flaechenfarbe-2: #f0f5f8;
  --flaechenfarbe-3: #d8e4eb;
  --stadtentwicklung-bau: #018cce;
  --white: #ffffff;
  --muted: #5b6c73;
  --line: var(--flaechenfarbe-3);
  --shadow: 0 8px 18px rgba(0, 39, 51, 0.08);
}

@font-face {
  font-family: "Source Sans Pro";
  src: url("/assets/fonts/SourceSansPro-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans Pro";
  src: url("/assets/fonts/SourceSansPro-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Slab";
  src: url("/assets/fonts/RobotoSlab-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--es-schrift-blau);
  background: var(--white);
  font-family: "Source Sans Pro", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: 0;
}

a {
  color: var(--es-blau);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 22px max(20px, calc((100vw - 1160px) / 2));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--es-schrift-blau);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 170px;
  height: auto;
}

.app-title {
  display: inline-block;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  color: var(--es-blau);
  font-weight: 700;
  line-height: 1.25;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  padding: 8px 12px;
  color: var(--es-blau);
  font-weight: 700;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a:focus {
  border-color: var(--flaechenfarbe-3);
  background: var(--flaechenfarbe-2);
}

.page {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 72px;
}

.intro {
  max-width: 760px;
  margin-bottom: 34px;
}

.intro--compact {
  margin-bottom: 24px;
}

.section-label {
  margin: 0 0 6px;
  color: var(--stadtentwicklung-bau);
  font-size: 16px;
  font-weight: 700;
}

h1,
h2,
h3 {
  color: var(--es-blau);
  font-family: "Roboto Slab", Georgia, serif;
  line-height: 1.2;
}

h1 {
  margin: 0 0 14px;
  font-size: 46px;
}

h2 {
  margin: 0;
  font-size: 30px;
}

.lead {
  margin: 0;
  color: var(--es-schrift-blau);
  font-size: 21px;
}

.tool-grid,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-layout {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.8fr);
}

.panel,
.result,
.table-section {
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel,
.result {
  padding: 26px;
}

.panel--wide {
  padding: 0;
}

.panel--wide .button {
  margin: 22px 26px 26px;
}

.panel__header {
  margin-bottom: 20px;
}

.panel__header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 700;
}

.field span {
  color: var(--es-schrift-blau);
}

input[type="file"],
input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--flaechenfarbe-3);
  border-radius: 0;
  padding: 0.8rem 1.3rem;
  color: var(--es-schrift-blau);
  background: var(--white);
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(1, 78, 102, 0.25);
  outline-offset: 1px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid var(--es-blau);
  border-radius: 0;
  padding: 0.8rem 1.3rem;
  color: var(--white);
  background: var(--es-blau);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  cursor: pointer;
}

.button:hover,
.button:focus {
  background: var(--es-dunkelblau-tbd);
  text-decoration-color: currentColor;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field--compact {
  margin: 0;
}

.notice {
  border-left: 6px solid var(--es-blau);
  margin-bottom: 22px;
  padding: 14px 18px;
  background: var(--flaechenfarbe-2);
  font-weight: 700;
}

.notice--error {
  border-left-color: var(--es-rot);
}

.result {
  margin-top: 26px;
  padding: 0;
  overflow: hidden;
}

.result-summary {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.9fr;
  gap: 1px;
  background: var(--line);
}

.result-summary > div {
  min-width: 0;
  padding: 20px 24px;
  background: var(--flaechenfarbe-2);
}

.metric-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.result-summary strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1.2;
}

.table-section {
  margin-top: 26px;
  padding: 24px;
}

.result .table-section {
  margin-top: 0;
  border-width: 1px 0 0;
  box-shadow: none;
}

.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.text-link {
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--es-blau);
  background: var(--flaechenfarbe-2);
  font-weight: 700;
}

tfoot th {
  background: var(--white);
}

.number {
  text-align: right;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.format-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.format-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--flaechenfarbe-3);
  padding: 13px 14px;
  background: var(--flaechenfarbe-2);
}

.format-chip span {
  font-weight: 700;
}

.format-chip strong {
  font-size: 23px;
}

.money-input {
  max-width: 120px;
  text-align: right;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.new-row td {
  background: #fbfdfe;
}

.stats {
  display: grid;
  gap: 14px;
  margin: 0;
}

.stats div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.stats dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.stats dd {
  margin: 4px 0 0;
  color: var(--es-blau);
  font-family: "Roboto Slab", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .site-header,
  .tool-grid,
  .admin-layout,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .site-header {
    display: grid;
    align-items: start;
  }

  .main-nav {
    width: 100%;
  }

  .main-nav a {
    flex: 1;
    justify-content: center;
  }

  .brand {
    align-items: flex-start;
  }

  .manual-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 28px, 1160px);
    padding-top: 30px;
  }

  .panel,
  .table-section {
    padding: 18px;
  }

  .manual-grid {
    grid-template-columns: 1fr;
  }

  .brand {
    display: grid;
    gap: 10px;
  }

  .brand-logo {
    width: 150px;
  }

  .app-title {
    border-left: 0;
    padding-left: 0;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 25px;
  }

  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
