/* Shared field settings for the website calculator and PWA. */
html.calc-settings-open { overflow: hidden; }
.calc-settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  margin-left: auto;
  padding: 9px 14px;
  border: 1px solid var(--app-line, #dce1e6);
  border-radius: 6px;
  background: transparent;
  color: var(--app-ink, #142637);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.calc-settings-toggle svg {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.calc-settings-toggle:hover {
  border-color: #ffd028;
  background: #ffd028;
  color: #142637;
}

.calc-settings-dialog {
  --app-orange: #ffd028;
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  width: min(660px, calc(100% - 32px));
  max-width: 660px;
  max-height: calc(100vh - 32px);
  max-height: min(780px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--app-line, #dce1e6);
  border-radius: 12px;
  background: var(--app-surface, #fff);
  color: var(--app-ink, #142637);
  box-shadow: 0 24px 80px rgba(9, 20, 32, .28);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

.calc-settings-dialog[open] {
  display: flex;
}

.calc-settings-dialog::backdrop {
  background: rgba(10, 20, 30, .6);
}

.calc-settings-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
}

.calc-settings-head h2 {
  min-width: 0;
  margin: 0;
  color: var(--app-ink, #142637);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.calc-settings-close {
  display: flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--app-ink, #142637);
  cursor: pointer;
}

.calc-settings-close svg {
  display: block;
  width: 22px;
  height: 22px;
}

.calc-settings-close:hover {
  background: var(--app-surface-raised, #f1f4f6);
}

.calc-settings-dialog .calc-settings-description {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 24px 16px;
  color: var(--app-muted, #606b78);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
}

.calc-settings-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 24px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.calc-settings-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calc-settings-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 62px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--app-line, #dce1e6);
  border-radius: 8px;
  color: var(--app-ink, #142637);
  cursor: pointer;
}

.calc-settings-option:not(.is-required):hover {
  background: var(--app-surface-raised, #f1f4f6);
}

.calc-settings-option.is-required {
  background: var(--app-surface-raised, #f1f4f6);
  cursor: default;
}

.calc-settings-option input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  accent-color: #ffd028;
  cursor: pointer;
}

.calc-settings-option input[type="checkbox"]:disabled {
  opacity: .7;
  cursor: default;
}

.calc-settings-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.calc-settings-option-copy small {
  color: var(--app-muted, #606b78);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.calc-settings-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--app-line, #dce1e6);
}

.calc-settings-done {
  min-width: 112px;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid #ffd028;
  border-radius: 6px;
  background: #ffd028;
  color: #142637;
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.calc-settings-done:hover {
  border-color: #f1bf16;
  background: #f1bf16;
}

.calc-settings-toggle:focus-visible,
.calc-settings-dialog button:focus-visible,
.calc-settings-option input[type="checkbox"]:focus-visible {
  outline: 3px solid #b18800;
  outline-offset: 3px;
}

.calculator-fields .calc-field[hidden] {
  display: none;
}

@media (max-width: 575px) {
  .calc-settings-dialog {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .calc-settings-head {
    padding: 16px 16px 10px;
  }

  .calc-settings-head h2 {
    font-size: 20px;
  }

  .calc-settings-dialog .calc-settings-description {
    padding: 0 16px 14px;
  }

  .calc-settings-body {
    padding: 4px 16px 16px;
  }

  .calc-settings-options {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .calc-settings-option {
    min-height: 56px;
  }

  .calc-settings-footer {
    padding: 12px 16px;
  }

  .calc-settings-done {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calc-settings-toggle {
    transition: none;
  }
}
