:root {
  --bg: #061315;
  --bg-top: #061113;
  --panel: #0c2326;
  --panel-strong: #071012;
  --text: #f4fbfa;
  --muted: #a9c7c4;
  --accent: #26bcea;
  --accent-gradient: linear-gradient(
    135deg,
    rgba(38, 188, 234, 0.8),
    rgb(38, 188, 234) 50%,
    rgba(38, 188, 234, 0.8)
  );
  --line: rgba(38, 188, 234, 0.26);
  --danger: #ffb4a9;
  --success: #96f2c8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  overflow-x: hidden;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  overflow-x: hidden;
}

main {
  display: flex;
  justify-content: center;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  display: flex;
  justify-content: center;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(0.65rem, 1.8dvh, 1.25rem) 0 clamp(0.55rem, 1.6dvh, 1.35rem);
}

.brand img {
  display: block;
  width: clamp(180px, 20dvh, 250px);
  height: auto;
}

.form-section {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(0.65rem, 1.9dvh, 1.7rem) 0 1.4rem;
}

.section-heading {
  margin: 0 auto 1rem;
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.85rem, 4.5dvh, 2.8rem);
  font-weight: 900;
  line-height: 1.08;
  text-wrap: balance;
}

h1 span {
  white-space: nowrap;
}

.section-heading p {
  margin: clamp(0.15rem, 0.35dvh, 0.35rem) auto 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 1.7dvh, 0.95rem);
  line-height: 1.35;
  max-width: 680px;
}

.request-form,
.property-list {
  display: grid;
  gap: 0.9rem;
}

.property-card {
  min-width: 0;
  margin: 0;
  padding: clamp(0.5rem, 1dvh, 0.9rem) 0.95rem clamp(0.85rem, 1.2dvh, 1.1rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 35, 38, 0.92);
  box-shadow: 0 20px 40px rgba(3, 11, 12, 0.18);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.property-title {
  margin: 0;
  padding: 0 0.5rem 0 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field-group {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.submission-card .field-group {
  margin-bottom: 0;
}

.top-grid {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.8fr);
  align-items: start;
}

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

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

label {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-weight: 700;
}

label span {
  font-size: clamp(0.68rem, 1.45dvh, 0.8rem);
  line-height: 1.25;
}

input,
select,
textarea {
  width: 100%;
  min-height: clamp(40px, 4.4dvh, 46px);
  border: 1px solid rgba(244, 251, 250, 0.16);
  border-radius: 6px;
  padding: clamp(0.5rem, 0.8dvh, 0.7rem) 0.7rem;
  color: var(--text);
  background: rgba(2, 9, 10, 0.44);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(0.8rem, 1.7dvh, 0.92rem);
  font-weight: 500;
  line-height: 1.25;
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  appearance: none;
  background-color: rgba(2, 9, 10, 0.44);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size:
    6px 6px,
    6px 6px;
  padding-right: 2.3rem;
  cursor: pointer;
}

select option {
  color: #10191b;
  background: #f4fbfa;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(38, 188, 234, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: rgba(169, 199, 196, 0.68);
}

.is-invalid {
  border-color: #ff8e7d;
  box-shadow: 0 0 0 4px rgba(255, 142, 125, 0.14);
}

.field-error {
  min-height: 1rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.field-format {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.field-subline {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.22;
}

.toggle-card {
  display: grid;
  gap: 0.18rem;
  padding: 0.42rem 0.72rem;
  border: 1px solid rgba(38, 188, 234, 0.22);
  border-radius: 10px;
  background: rgba(5, 18, 20, 0.42);
  align-content: start;
}

.toggle-card--compact {
  min-height: 46px;
  padding: 0 0.72rem;
  gap: 0;
  align-items: center;
  align-content: center;
  margin-top: 18px;
}

.toggle-card--compact .field-subline {
  display: none;
}

.toggle-card--compact .field-error {
  min-height: 0;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  font-weight: 700;
}

.switch-label--compact {
  gap: 0.45rem;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(244, 251, 250, 0.18);
  border-radius: 999px;
  background: rgba(2, 9, 10, 0.66);
  transition: background 160ms ease, border-color 160ms ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4fbfa;
  transition: transform 160ms ease;
}

.switch input:checked + .switch-slider {
  border-color: rgba(38, 188, 234, 0.45);
  background: rgba(38, 188, 234, 0.3);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
  background: #26bcea;
}

.switch input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 4px rgba(38, 188, 234, 0.16);
}

.section-card {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  padding: 0.68rem 0.82rem;
  border: 1px solid rgba(38, 188, 234, 0.18);
  border-radius: 10px;
  background: rgba(5, 18, 20, 0.34);
}

.section-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.section-card-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.section-card-header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.18;
}

.secondary-button,
.inline-remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, opacity 160ms ease;
}

.secondary-button {
  border: 1px dashed var(--accent);
  background: rgba(38, 188, 234, 0.08);
  color: var(--accent);
  padding: 0.32rem 0.6rem;
}

.secondary-button:hover,
.inline-remove-button:hover {
  background: rgba(38, 188, 234, 0.16);
}

.lease-table-head,
.lease-row {
  display: grid;
  grid-template-columns: 56px minmax(190px, 1.5fr) 90px 94px minmax(130px, 0.95fr) 86px;
  gap: 0.45rem;
  align-items: center;
}

.lease-table-head {
  padding: 0 0.2rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lease-list {
  display: grid;
  gap: 0.45rem;
}

.lease-actions {
  display: flex;
  width: 100%;
}

.lease-actions .secondary-button {
  width: 100%;
}

[data-error-for="mietvertraege"] {
  min-height: 0;
}

[data-error-for="mietvertraege"]:empty {
  display: none;
}

.lease-row {
  padding: 0.18rem 0.5rem;
  border: 1px solid rgba(244, 251, 250, 0.09);
  border-radius: 10px;
  background: rgba(2, 9, 10, 0.36);
  min-height: 48px;
}

.lease-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.lease-cell {
  display: grid;
  gap: 0;
  align-self: center;
  align-content: center;
}

.lease-cell input {
  min-height: 32px;
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.lease-check {
  align-self: center;
}

.lease-result {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.05;
}

.lease-result-block {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: center;
}

.lease-multiplier {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
  white-space: nowrap;
}

.lease-error {
  min-height: 0;
  margin: 0;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.lease-error:empty {
  display: none;
}

.inline-remove-button {
  min-height: 30px;
  border: 1px solid rgba(255, 180, 169, 0.3);
  background: rgba(255, 180, 169, 0.08);
  color: var(--danger);
  padding: 0.28rem 0.45rem;
  font-size: 0.72rem;
  align-self: center;
}

.metrics-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-panel {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid rgba(244, 251, 250, 0.09);
  border-radius: 10px;
  background: rgba(2, 9, 10, 0.28);
}

.metric-panel-header h3 {
  margin: 0 0 0.2rem;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.metric-row span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.metric-row strong {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.metric-row--accent {
  border: 1px solid rgba(38, 188, 234, 0.28);
  background: rgba(38, 188, 234, 0.08);
}

.form-actions {
  display: flex;
}

.add-button,
.remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: inherit;
  font-size: clamp(0.8rem, 1.7dvh, 0.92rem);
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.add-button {
  width: 100%;
  border: 1px dashed var(--accent);
  background: rgba(38, 188, 234, 0.08);
  color: var(--accent);
  padding: 0.8rem 1rem;
}

.add-button:hover,
.remove-button:hover {
  background: rgba(38, 188, 234, 0.16);
}

.remove-button {
  border: 1px solid rgba(255, 180, 169, 0.3);
  background: rgba(255, 180, 169, 0.08);
  color: var(--danger);
  padding: 0.55rem 0.85rem;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.25rem;
}

.status-message {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.status-message.is-error {
  color: var(--danger);
}

.status-message.is-success {
  color: var(--success);
}

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  min-height: clamp(42px, 4.3dvh, 48px);
  border: 0;
  border-radius: 6px;
  padding: clamp(0.42rem, 0.8dvh, 0.75rem) 1.1rem;
  color: #061416;
  background: var(--accent-gradient);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(0.8rem, 1.7dvh, 0.92rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.submit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(38, 188, 234, 0.2);
}

.submit-button:disabled,
.add-button:disabled,
.remove-button:disabled,
.secondary-button:disabled,
.inline-remove-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.secondary-button:disabled:hover,
.inline-remove-button:disabled:hover,
.remove-button:disabled:hover,
.add-button:disabled:hover,
.submit-button:disabled:hover {
  background: inherit;
  box-shadow: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.9rem 0 1.15rem;
  color: rgba(169, 199, 196, 0.76);
  font-size: 0.82rem;
}

.site-footer img {
  width: 96px;
  height: auto;
  opacity: 0.9;
}

@media (max-width: 720px) {
  .two-columns,
  .three-columns,
  .form-footer,
  .card-header,
  .section-card-header,
  .top-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .card-header,
  .form-footer,
  .section-card-header {
    justify-content: stretch;
  }

  .submit-button {
    width: 100%;
    min-width: 0;
  }

  .remove-button {
    width: 100%;
  }

  .secondary-button {
    width: 100%;
  }

  .lease-table-head {
    display: none;
  }

  .lease-row {
    grid-template-columns: 1fr;
  }

  .lease-title,
  .lease-result {
    padding-top: 0;
  }

  .metrics-panels {
    grid-template-columns: 1fr;
  }
}
