.sdc-calculator {
  --sdc-border: #d5d8de;
  --sdc-text: #3a3f47;
  --sdc-muted: #6b7280;
  --sdc-heading: #2f3540;
  --sdc-accent: #fb8500;
  --sdc-active: #fb8500;
  --sdc-panel: #ffffff;
  --sdc-bg: #f7f8fa;
  --sdc-focus: #fb8500;
  box-sizing: border-box;
  color: var(--sdc-text);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
  max-width: none;
  width: 100%;
}

.sdc-calculator *,
.sdc-calculator *::before,
.sdc-calculator *::after {
  box-sizing: border-box;
}

.sdc-panel {
  background: var(--sdc-panel);
  border: 1px solid var(--sdc-border);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}

.sdc-panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--sdc-border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: space-between;
  padding: 14px 16px 12px;
}

.sdc-panel-title {
  color: var(--sdc-heading);
  font-size: 18px;
  font-weight: 600;
}

.sdc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sdc-panel-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  width: 100%;
}

.sdc-state-tabs {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: 100%;
}

.sdc-state-tab {
  background: #fff;
  border: 1px solid var(--sdc-border);
  border-radius: 6px;
  color: var(--sdc-text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  min-height: 40px;
  padding: 8px 4px;
}

.sdc-state-tab.is-active,
.sdc-state-tab:hover {
  background: var(--sdc-active);
  border-color: var(--sdc-active);
  color: #fff;
  position: relative;
  z-index: 1;
}

.sdc-section {
  width: 100%;
}

.sdc-section-title {
  color: var(--sdc-heading);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}

.sdc-fields {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.sdc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

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

.sdc-label {
  color: var(--sdc-text);
  font-size: 13px;
  font-weight: 400;
  margin: 0;
}

.sdc-input,
.sdc-select {
  appearance: none;
  background: #fff;
  border: 1px solid var(--sdc-border);
  border-radius: 2px;
  color: var(--sdc-text);
  font: inherit;
  height: 36px;
  padding: 4px 10px;
  width: 100%;
}

.sdc-select {
  background-image: linear-gradient(45deg, transparent 50%, #666 50%),
    linear-gradient(135deg, #666 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 26px;
}

.sdc-input:focus,
.sdc-select:focus {
  border-color: var(--sdc-focus);
  outline: none;
  box-shadow: 0 0 0 2px rgba(251, 133, 0, 0.2);
}

.sdc-toggle {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  width: 100%;
}

.sdc-toggle-triple {
  grid-template-columns: 1fr 1fr 1fr;
}

.sdc-toggle-btn {
  background: #fff;
  border: 1px solid var(--sdc-border);
  border-radius: 6px;
  color: var(--sdc-text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  min-height: 36px;
  padding: 6px 8px;
}

.sdc-toggle-btn.is-active,
.sdc-toggle-btn:hover {
  background: var(--sdc-active);
  border-color: var(--sdc-active);
  color: #fff;
  position: relative;
  z-index: 1;
}

.sdc-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--sdc-border);
  border-radius: 2px;
  color: var(--sdc-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 8px;
  height: 34px;
  justify-content: center;
  min-width: 110px;
  padding: 0 12px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sdc-btn:hover {
  background: var(--sdc-bg);
  border-color: #b8bec8;
}

.sdc-btn-icon {
  font-size: 14px;
  line-height: 1;
}

.sdc-results {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.sdc-result {
  align-items: flex-start;
  border: 1px solid var(--sdc-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
  padding: 14px 16px;
}

.sdc-result-label {
  color: var(--sdc-muted);
  font-size: 13px;
}

.sdc-result-value {
  color: var(--sdc-heading);
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  word-break: break-word;
}

.sdc-result-primary {
  background: rgba(251, 133, 0, 0.08);
  border-color: rgba(251, 133, 0, 0.35);
}

.sdc-result-primary .sdc-result-label,
.sdc-result-primary .sdc-result-value {
  color: var(--sdc-accent);
}

.sdc-result-primary .sdc-result-value {
  font-size: 22px;
  font-weight: 700;
}

.sdc-status {
  color: var(--sdc-accent);
  font-size: 12px;
  margin: 0;
  min-height: 1.2em;
}

.sdc-calculator.is-calculating .sdc-result-value {
  opacity: 0.55;
}

.sdc-disclaimer {
  color: #544e4f;
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
}

.sdc-modal[hidden] {
  display: none !important;
}

.sdc-modal {
  align-items: center;
  background: rgba(20, 24, 32, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 100000;
}

.sdc-modal-dialog {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  max-height: min(90vh, 640px);
  max-width: 560px;
  overflow: auto;
  padding: 24px 28px;
  position: relative;
  width: 100%;
}

.sdc-modal-dialog p,
.sdc-modal-dialog li {
  color: var(--sdc-text);
  font-size: 13px;
  line-height: 1.55;
}

.sdc-modal-dialog ul {
  margin: 0;
  padding-left: 18px;
}

.sdc-modal-dialog li + li {
  margin-top: 8px;
}

.sdc-modal-close {
  background: transparent;
  border: 0;
  color: #666;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 12px;
  top: 8px;
}

body.sdc-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .sdc-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .sdc-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sdc-toolbar {
    width: 100%;
  }

  .sdc-toolbar .sdc-btn {
    flex: 1 1 auto;
  }

  .sdc-state-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sdc-fields,
  .sdc-results {
    grid-template-columns: 1fr;
  }

  .sdc-toggle-triple {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sdc-toolbar,
  .sdc-modal,
  .sdc-status {
    display: none !important;
  }

  .sdc-calculator {
    max-width: none;
    width: 100%;
  }

  .sdc-panel {
    border: 0;
  }
}
