:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #eef4f7;
  --text: #17232b;
  --muted: #65737c;
  --line: #dce5e9;
  --blue: #1d6f95;
  --blue-dark: #15506c;
  --red: #c83b32;
  --yellow: #f0bd37;
  --green: #2f7d4f;
  --warning-bg: #fff7df;
  --warning-line: #e8c873;
  --error: #a12b25;
  --shadow: 0 18px 48px rgba(23, 35, 43, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
  background: var(--bg);
}

body.app-page {
  height: 100dvh;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.app-page .app-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 14px 0;
}

.app-page main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.app-page .app-header {
  margin-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 78px;
  max-width: 34vw;
  height: 54px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.brand > span:last-child {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 1.08rem;
}

.brand span span {
  color: var(--muted);
  font-size: 0.95rem;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
}

.brand-mark__red,
.brand-mark__yellow,
.brand-mark__blue {
  position: absolute;
  inset: auto;
  width: 52px;
  height: 22px;
}

.brand-mark__red {
  left: -12px;
  top: 8px;
  background: var(--red);
  transform: rotate(-35deg);
}

.brand-mark__yellow {
  left: 0;
  bottom: 6px;
  background: var(--yellow);
  transform: rotate(-35deg);
}

.brand-mark__blue {
  right: -18px;
  bottom: 4px;
  background: var(--blue);
  transform: rotate(-35deg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-warning {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--warning-line);
  border-radius: 999px;
  color: #704700;
  background: var(--warning-bg);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.fullscreen-button {
  position: relative;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.fullscreen-button:hover,
.fullscreen-button.is-active {
  color: var(--blue-dark);
  background: transparent;
}

.fullscreen-button span {
  position: relative;
  width: 14px;
  height: 14px;
  display: block;
  margin: auto;
}

.fullscreen-button span::before,
.fullscreen-button span::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.8px solid currentColor;
  border-radius: 2px;
}

.fullscreen-button span::before {
  clip-path: polygon(0 0, 42% 0, 42% 15%, 15% 15%, 15% 42%, 0 42%, 0 0, 58% 0, 100% 0, 100% 42%, 85% 42%, 85% 15%, 58% 15%);
}

.fullscreen-button span::after {
  clip-path: polygon(0 58%, 15% 58%, 15% 85%, 42% 85%, 42% 100%, 0 100%, 0 58%, 58% 85%, 85% 85%, 85% 58%, 100% 58%, 100% 100%, 58% 100%);
}

.header-link--subtle {
  min-height: 42px;
  padding: 0 12px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.header-link--subtle:hover {
  color: var(--blue-dark);
  background: var(--surface-strong);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}

.app-page .stepper {
  margin-bottom: 10px;
}

.stepper__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 700;
}

.stepper__item.is-active {
  color: #ffffff;
  border-color: var(--blue);
  background: var(--blue);
}

.stepper__line {
  width: 72px;
  height: 2px;
  background: #b7c8d0;
  border-radius: 999px;
}

.tool-step {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-page .tool-step {
  min-height: 0;
  overflow: hidden;
  padding: 22px;
}

.app-page #result-step:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.app-page #input-step:not([hidden]) {
  display: block;
}

.section-head {
  max-width: 760px;
  margin-bottom: 28px;
}

.app-page .section-head {
  margin-bottom: 18px;
}

.result-headline-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.result-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-dark);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.section-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.app-page .form-grid {
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.app-page .field {
  gap: 5px;
}

.field span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #ffffff;
}

.app-page .field input,
.app-page .field select {
  min-height: 50px;
}

.field textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(29, 111, 149, 0.18);
  border-color: var(--blue);
}

.field-message {
  min-height: 20px;
  color: var(--error);
  font-size: 0.9rem;
}

.app-page .field-message {
  min-height: 16px;
  font-size: 0.82rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 26px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.app-page .toggle-row {
  margin: 12px 0;
  padding: 12px 14px;
}

.toggle-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 64px;
  height: 36px;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  width: 64px;
  height: 36px;
  border-radius: 999px;
  background: #c9d6dc;
  transition: background 160ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 35, 43, 0.2);
  transition: transform 160ms ease;
}

.switch input:checked + .switch__track {
  background: var(--blue);
}

.switch input:checked + .switch__track::after {
  transform: translateX(28px);
}

.switch--small {
  width: 48px;
  height: 28px;
}

.switch--small .switch__track {
  width: 48px;
  height: 28px;
}

.switch--small .switch__track::after {
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
}

.switch--small input:checked + .switch__track::after {
  transform: translateX(20px);
}

.third-party {
  margin: 0 0 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.app-page .third-party {
  margin-bottom: 12px;
  padding: 14px;
}

.third-party legend {
  padding: 0 8px;
  font-weight: 700;
}

.segmented-control {
  display: inline-flex;
  margin-top: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.segmented-control label {
  position: relative;
  display: inline-flex;
}

.segmented-control input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.segmented-control span {
  min-width: 106px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}

.segmented-control input:checked + span {
  color: #ffffff;
  background: var(--blue);
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
}

.form-status {
  min-height: 24px;
  color: var(--error);
  font-weight: 700;
}

.form-actions,
.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.app-page .form-actions,
.app-page .result-actions {
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.subtle-button,
.icon-button {
  min-height: 48px;
  border-radius: var(--radius);
  font-weight: 700;
}

.primary-button {
  min-width: 210px;
  padding: 0 22px;
  border: 1px solid var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  min-width: 190px;
  padding: 0 18px;
  border: 1px solid var(--blue);
  color: var(--blue-dark);
  background: #ffffff;
}

.ghost-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--blue-dark);
  background: #ffffff;
}

.ghost-button.header-link--subtle {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.ghost-button.header-link--subtle:hover {
  color: var(--blue-dark);
  background: var(--surface-strong);
}

.ghost-button.fullscreen-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.ghost-button.fullscreen-button:hover,
.ghost-button.fullscreen-button:focus-visible,
.ghost-button.fullscreen-button.is-active {
  color: var(--blue-dark);
  background: transparent;
}

.ghost-button.fullscreen-button span {
  width: 12px;
  height: 12px;
}

.subtle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-strong);
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #ffffff;
}

.history-panel {
  position: fixed;
  z-index: 10;
  top: 22px;
  right: 22px;
  width: min(420px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.history-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  background: #ffffff;
}

.history-item:hover {
  border-color: var(--blue);
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.92rem;
}

.notice {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  background: var(--warning-bg);
}

.app-page .notice {
  margin-bottom: 10px;
  padding: 10px 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.app-page .table-wrap {
  min-height: 0;
  overflow: auto;
}

.comparison-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: #ffffff;
}

.comparison-table th,
.comparison-table td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.app-page .comparison-table th,
.app-page .comparison-table td {
  padding: 10px 12px;
}

.comparison-table th {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.comparison-table tbody tr:last-child td {
  border-bottom: 0;
}

.comparison-table td[data-label="Jahreskosten brutto"] {
  font-weight: 700;
  white-space: nowrap;
}

.comparison-table tr.is-best-option {
  background: #edf7f1;
}

.provider-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.provider-cell > div {
  min-width: 0;
}

.provider-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}

.provider-name-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.provider-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.tariff-name {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95rem;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.result-badge--best {
  color: var(--green);
  background: #dff0e6;
}

.result-badge--guarantee {
  color: var(--blue-dark);
  background: #dceef7;
}

.difference-cell {
  font-weight: 800;
  white-space: nowrap;
}

.difference-cell::before {
  content: "";
}

.comparison-table tbody td.difference-cell {
  color: var(--blue-dark);
  background: #f8fbfc;
}

.result-cards-wrap {
  margin-top: 4px;
  overflow-x: auto;
  padding: 14px 0 4px;
}

.app-page .result-cards-wrap {
  min-height: 0;
  margin-top: 0;
  padding: 14px 0 2px;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(var(--result-card-count, 3), minmax(240px, 1fr));
  gap: 14px;
  min-width: min(100%, calc((var(--result-card-count, 3) * 240px) + ((var(--result-card-count, 3) - 1) * 14px)));
}

.app-page .result-cards {
  grid-template-columns: repeat(var(--result-card-count, 3), minmax(210px, 1fr));
  gap: 10px;
  min-width: min(100%, calc((var(--result-card-count, 3) * 210px) + ((var(--result-card-count, 3) - 1) * 10px)));
}

.result-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 318px;
  min-width: 0;
  padding: 20px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.app-page .result-card {
  gap: 9px;
  min-height: 0;
  padding: 18px 12px 12px;
}

.result-card.is-best-option {
  border-color: #b8dcc8;
  background: #f3fbf6;
}

.result-card__badges {
  position: absolute;
  top: 0;
  left: 50%;
  max-width: calc(100% - 24px);
  padding: 0 8px;
  background: inherit;
  transform: translate(-50%, -50%);
}

.result-card__badges .provider-badges {
  justify-content: center;
  flex-wrap: wrap;
}

.result-card__provider {
  min-height: 46px;
}

.app-page .result-card__provider {
  min-height: 40px;
}

.result-card__provider .provider-logo {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.result-card__provider .provider-name-line strong {
  font-size: 1rem;
}

.result-card__values {
  display: grid;
  gap: 10px;
  margin: 4px 0 0;
}

.app-page .result-card__values {
  gap: 5px;
  margin-top: 0;
}

.result-card__values div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.app-page .result-card__values div {
  gap: 6px;
  padding: 5px 0;
}

.result-card__values div:last-child {
  border-bottom: 0;
}

.result-card__values dt {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-card__values dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.result-card__bottom {
  padding-top: 2px;
}

.result-card__bottom span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.result-card__bottom strong {
  display: block;
  margin-top: 3px;
  font-size: 1.62rem;
  line-height: 1.1;
  font-weight: 800;
}

.app-page .result-card__bottom strong {
  font-size: 1.38rem;
}

.result-card__bottom em {
  display: block;
  margin-top: 8px;
  color: var(--blue-dark);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.tariff-meta {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.app-page .tariff-meta {
  margin-top: 8px;
  font-size: 0.86rem;
}

.editor-shell {
  width: min(1280px, calc(100% - 32px));
}

.editor-layout {
  display: grid;
  gap: 18px;
}

.editor-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: -6px 0 18px;
}

.editor-guide div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.editor-guide strong,
.editor-guide span {
  display: block;
}

.editor-guide span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.editor-toolbar,
.editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.editor-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.autosave-note {
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 700;
}

.autosave-note span {
  color: var(--muted);
  font-size: 0.88rem;
}

.backup-tools {
  position: relative;
}

.backup-tools summary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-strong);
  font-weight: 700;
  cursor: pointer;
}

.backup-tools[open] summary {
  color: var(--blue-dark);
  border-color: #c7d8df;
  background: #ffffff;
}

.backup-tools__actions {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + 8px);
  width: min(560px, calc(100vw - 48px));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.backup-tools__actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.backup-tools__actions .subtle-button {
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.sync-modal__panel {
  width: min(720px, calc(100vw - 28px));
}

.sync-summary {
  margin: 0 0 14px;
  color: var(--text);
  font-weight: 700;
}

.sync-versions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.sync-versions div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.sync-versions dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.sync-versions dd {
  margin: 3px 0 0;
  color: var(--text);
  font-weight: 800;
}

.sync-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-toolbar__main,
.editor-toolbar__secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-status {
  min-height: 24px;
  margin: 10px 0 16px;
  color: var(--muted);
  font-weight: 700;
}

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

.hint--strong {
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

#tab-tariffs > .hint:not(.hint--strong),
#tab-locations > .hint:not(.hint--strong) {
  display: none;
}

.editor-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.editor-tab {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--blue-dark);
  background: #ffffff;
  font-weight: 700;
}

.editor-tab.is-active {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.editor-section {
  display: none;
}

.editor-section.is-active {
  display: block;
}

.editor-section h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.editor-grid {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) 1fr;
}

.editor-wide {
  grid-column: span 1;
}

.editor-list {
  display: grid;
  gap: 14px;
}

.tariff-list {
  display: grid;
  gap: 10px;
}

.tariff-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.35fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  background: #ffffff;
}

.tariff-list-item:hover,
.tariff-list-item:focus-visible {
  border-color: var(--blue);
  outline: none;
}

.tariff-list-item.is-incomplete {
  border-color: #e5d2a1;
}

.tariff-list-item__main,
.tariff-list-item__meta {
  min-width: 0;
}

.tariff-list-item__main strong,
.tariff-list-item__main small,
.tariff-list-item__meta span {
  display: block;
}

.tariff-list-item__main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tariff-list-item__main small,
.tariff-list-item__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.tariff-list-item__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tariff-list-item__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tariff-list-item__action {
  color: var(--blue-dark);
  font-weight: 800;
  white-space: nowrap;
}

.editor-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.editor-group-title h3 {
  margin: 0;
  font-size: 1.08rem;
}

.editor-group-title span {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.editor-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.editor-card--incomplete {
  border-color: #e5d2a1;
}

.editor-card--focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(29, 111, 149, 0.12);
}

.tariff-list-item.editor-card--focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(29, 111, 149, 0.12);
}

.editor-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.editor-card__head strong {
  word-break: break-word;
}

.editor-card__subline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.editor-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.editor-card__badges span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--surface-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.editor-card__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.editor-card__grid .field--wide {
  grid-column: 1 / -1;
}

.editor-details {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.editor-details summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--blue-dark);
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}

.editor-details > .field,
.editor-details > .assignment-list {
  padding: 0 14px 14px;
}

.editor-details textarea {
  background: #ffffff;
}

.editor-modal {
  width: min(980px, calc(100% - 28px));
  max-height: min(860px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.editor-modal::backdrop {
  background: rgba(23, 35, 43, 0.38);
}

.editor-modal__panel {
  max-height: inherit;
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.editor-modal__head,
.editor-modal__actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.editor-modal__head h2 {
  margin: 0;
}

.editor-modal__actions {
  align-items: center;
  margin: 22px 0 0;
}

.editor-modal__actions > div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  font-weight: 700;
}

.checkbox-field input {
  width: 20px;
  height: 20px;
}

.checkbox-field--compact {
  min-height: 44px;
  padding: 0 10px;
  background: #ffffff;
}

.editor-modal__panel {
  scrollbar-width: thin;
  scrollbar-color: #9fb4bf transparent;
}

.editor-modal__panel::-webkit-scrollbar {
  width: 8px;
}

.editor-modal__panel::-webkit-scrollbar-track {
  background: transparent;
}

.editor-modal__panel::-webkit-scrollbar-thumb {
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #9fb4bf;
}

.assignment-list {
  display: grid;
  gap: 10px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, auto) minmax(230px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.assignment-row > strong {
  word-break: break-word;
}

.multi-select-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.multi-select-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #ffffff;
}

.multi-select-list input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.inline-help {
  display: block;
  align-self: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.info-button {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--blue-dark);
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.info-button::after {
  content: attr(data-info);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 8px);
  width: min(280px, 72vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.info-button:hover::after,
.info-button:focus-visible::after {
  opacity: 1;
}

.danger-button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #e0b7b3;
  border-radius: var(--radius);
  color: var(--error);
  background: #fff7f6;
  font-weight: 700;
}

#json-output {
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 14px;
  }

  .app-header {
    align-items: flex-start;
  }

  .brand-logo {
    width: 72px;
    height: 48px;
  }

  .tool-step {
    padding: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .editor-grid,
  .editor-card__grid {
    grid-template-columns: 1fr;
  }

  .editor-guide {
    grid-template-columns: 1fr;
  }

  .editor-toolbar,
  .editor-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-toolbar__main,
  .editor-toolbar__secondary,
  .backup-tools__actions {
    width: 100%;
  }

  .backup-tools__actions {
    position: static;
    margin-top: 8px;
    box-shadow: none;
  }

  .sync-versions {
    grid-template-columns: 1fr;
  }

  .sync-actions {
    flex-direction: column;
  }

  .sync-actions .secondary-button,
  .sync-actions .subtle-button {
    width: 100%;
  }

  .editor-group-title,
  .assignment-row,
  .tariff-list-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .tariff-list-item__meta {
    grid-template-columns: 1fr;
  }

  .editor-toolbar > *,
  .editor-section-head > * {
    width: 100%;
  }

  .toggle-row {
    align-items: flex-start;
  }

  .result-headline-row {
    gap: 14px;
  }

  .result-cards {
    grid-template-columns: repeat(var(--result-card-count, 3), minmax(240px, 1fr));
  }

  h1 {
    font-size: 1.6rem;
  }

  .form-actions,
  .result-actions {
    flex-direction: column-reverse;
  }

  .primary-button,
  .secondary-button,
  .subtle-button {
    width: 100%;
  }

  .editor-modal__head,
  .editor-modal__actions {
    flex-direction: column;
  }

  .editor-modal__actions > div {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .comparison-table,
  .comparison-table thead,
  .comparison-table tbody,
  .comparison-table tr,
  .comparison-table th,
  .comparison-table td {
    display: block;
    min-width: 0;
  }

  .comparison-table thead {
    display: none;
  }

  .comparison-table tr {
    border-bottom: 1px solid var(--line);
  }

  .comparison-table tr:last-child {
    border-bottom: 0;
  }

  .comparison-table td {
    display: grid;
    grid-template-columns: minmax(120px, 42%) 1fr;
    gap: 12px;
    border-bottom: 0;
  }

  .comparison-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  .result-headline-row {
    flex-direction: column;
  }

  .result-view-toggle {
    align-self: flex-start;
  }

  .result-cards {
    grid-template-columns: repeat(var(--result-card-count, 3), minmax(240px, 1fr));
  }

  .provider-name-line {
    flex-wrap: wrap;
  }
}
