.emt-calculator {
  --emt-calc-bg: #f4f7f9;
  --emt-calc-surface: #ffffff;
  --emt-calc-text: #17212b;
  --emt-calc-muted: #526170;
  --emt-calc-line: #d7e0e7;
  --emt-calc-accent: #f2b705;
  --emt-calc-accent-dark: #785900;
  --emt-calc-dark: #17212b;
  --emt-calc-danger: #a32727;
  --emt-calc-success: #1f6b4f;
  --emt-calc-radius: 22px;
  --emt-calc-radius-small: 14px;
  --emt-calc-shadow: 0 16px 42px rgba(23, 33, 43, 0.08);
  margin: 28px 0 34px;
  color: var(--emt-calc-text);
  font-size: 17px;
  line-height: 1.62;
}

.emt-calculator *,
.emt-calculator *::before,
.emt-calculator *::after {
  box-sizing: border-box;
}

.emt-calculator [hidden] {
  display: none !important;
}

.emt-calculator h1,
.emt-calculator h2,
.emt-calculator h3,
.emt-calculator h4 {
  margin-top: 0;
  color: var(--emt-calc-text);
  line-height: 1.2;
}

.emt-calculator h1,
.emt-calculator h2 {
  margin-bottom: 14px;
  font-size: clamp(28px, 3.5vw, 42px);
  letter-spacing: -0.025em;
}

.emt-calculator h3 {
  margin-bottom: 8px;
  font-size: clamp(23px, 2.5vw, 31px);
}

.emt-calculator h4 {
  margin-bottom: 8px;
  font-size: 21px;
}

.emt-calculator p {
  margin-top: 0;
  margin-bottom: 16px;
}

.emt-calculator__intro,
.emt-calculator__form,
.emt-result {
  border: 1px solid var(--emt-calc-line);
  border-radius: var(--emt-calc-radius);
  background: var(--emt-calc-surface);
  box-shadow: var(--emt-calc-shadow);
}

.emt-calculator__intro {
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 44px);
  background:
    radial-gradient(circle at 92% 8%, rgba(242, 183, 5, 0.2), transparent 28%),
    linear-gradient(145deg, #ffffff 0%, #f3f7f9 100%);
}

.emt-calculator__intro p:last-child {
  max-width: 900px;
  margin-bottom: 0;
  color: var(--emt-calc-muted);
}

.emt-calculator__eyebrow {
  margin-bottom: 8px !important;
  color: var(--emt-calc-accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.emt-calculator__form {
  padding: clamp(20px, 4vw, 38px);
}

.emt-calculator__panel {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.emt-calculator__panel + .emt-calculator__panel {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--emt-calc-line);
}

.emt-calculator__panel > legend {
  margin-bottom: 18px;
  padding: 0;
  font-size: clamp(21px, 2.3vw, 27px);
  font-weight: 800;
  line-height: 1.25;
}

.emt-field-help {
  max-width: 920px;
  color: var(--emt-calc-muted);
}

.emt-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.emt-choice-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.emt-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.emt-choice-card > span {
  display: block;
  min-height: 100%;
  padding: 18px 20px;
  border: 2px solid var(--emt-calc-line);
  border-radius: var(--emt-calc-radius-small);
  background: var(--emt-calc-bg);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.emt-choice-card strong,
.emt-choice-card small {
  display: block;
}

.emt-choice-card strong {
  margin-bottom: 5px;
  font-size: 18px;
}

.emt-choice-card small {
  color: var(--emt-calc-muted);
}

.emt-choice-card input:checked + span {
  border-color: var(--emt-calc-accent);
  background: #fff9dd;
  box-shadow: 0 0 0 3px rgba(242, 183, 5, 0.16);
}

.emt-choice-card input:focus-visible + span {
  outline: 3px solid rgba(21, 90, 138, 0.24);
  outline-offset: 2px;
}

.emt-camera-groups {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.emt-camera-group {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--emt-calc-line);
  border-radius: var(--emt-calc-radius-small);
  background: var(--emt-calc-bg);
}

.emt-camera-group > legend {
  padding: 0 8px;
  font-weight: 800;
}

.emt-camera-group__remove {
  position: absolute;
  top: 15px;
  right: 16px;
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--emt-calc-danger);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.emt-camera-group__remove:hover,
.emt-camera-group__remove:focus-visible {
  background: #fff0f0;
  outline: none;
}

.emt-field-grid {
  display: grid;
  gap: 16px;
}

.emt-field-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.emt-field-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.emt-field {
  display: block;
  min-width: 0;
}

.emt-field > span:first-child,
.emt-field > label:first-child {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
  line-height: 1.35;
}

.emt-field input,
.emt-field select {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid #b7c4ce;
  border-radius: 11px;
  background: #ffffff;
  color: var(--emt-calc-text);
  font: inherit;
}

.emt-field input:focus,
.emt-field select:focus {
  border-color: #155a8a;
  outline: 3px solid rgba(21, 90, 138, 0.17);
}

.emt-field input[readonly] {
  background: #edf1f4;
  color: #4d5964;
}

.emt-field small {
  display: block;
  margin-top: 6px;
  color: var(--emt-calc-muted);
  font-size: 13px;
  line-height: 1.4;
}

.emt-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.emt-input-unit input {
  border-radius: 11px 0 0 11px;
}

.emt-input-unit b {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #b7c4ce;
  border-left: 0;
  border-radius: 0 11px 11px 0;
  background: #edf2f5;
  color: #465564;
  font-size: 14px;
  white-space: nowrap;
}

.emt-calculator__actions,
.emt-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.emt-calculator__actions {
  margin-top: 30px;
}

.emt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.emt-button:focus-visible {
  outline: 3px solid rgba(21, 90, 138, 0.26);
  outline-offset: 2px;
}

.emt-button--primary {
  background: var(--emt-calc-accent);
  color: var(--emt-calc-dark);
}

.emt-button--primary:hover {
  background: #ffd247;
}

.emt-button--secondary {
  border-color: var(--emt-calc-dark);
  background: var(--emt-calc-dark);
  color: #ffffff;
}

.emt-button--ghost,
.emt-button--small {
  border-color: #aebbc5;
  background: #ffffff;
  color: var(--emt-calc-text);
}

.emt-button--small {
  min-height: 40px;
  padding: 8px 13px;
  font-size: 14px;
}

.emt-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.emt-form-errors {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid #e5adad;
  border-radius: var(--emt-calc-radius-small);
  background: #fff3f3;
  color: #7e1e1e;
}

.emt-form-errors ul {
  margin: 8px 0 0;
}

.emt-result {
  margin-top: 20px;
  padding: clamp(22px, 4vw, 40px);
  scroll-margin-top: 90px;
}

.emt-result__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.emt-result__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.emt-result-metric {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--emt-calc-line);
  border-radius: var(--emt-calc-radius-small);
  background: var(--emt-calc-bg);
}

.emt-result-metric span,
.emt-result-metric strong,
.emt-result-metric small {
  display: block;
}

.emt-result-metric span {
  color: var(--emt-calc-muted);
  font-size: 13px;
  font-weight: 700;
}

.emt-result-metric strong {
  margin: 5px 0;
  font-size: clamp(21px, 2.5vw, 29px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.emt-result-metric small {
  color: var(--emt-calc-muted);
  font-size: 12px;
}

.emt-result__recommendation {
  margin-top: 18px;
  padding: 20px;
  border-left: 5px solid var(--emt-calc-accent);
  border-radius: 0 var(--emt-calc-radius-small) var(--emt-calc-radius-small) 0;
  background: #fff8df;
}

.emt-result__recommendation p:last-child {
  margin-bottom: 0;
}

.emt-result__details {
  margin-top: 18px;
}

.emt-result__details details {
  padding: 17px 19px;
  border: 1px solid var(--emt-calc-line);
  border-radius: var(--emt-calc-radius-small);
  background: #ffffff;
}

.emt-result__details summary {
  font-weight: 800;
  cursor: pointer;
}

.emt-result-table-wrap {
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--emt-calc-line);
  border-radius: 10px;
}

.emt-result-table-wrap table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.emt-result-table-wrap th,
.emt-result-table-wrap td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--emt-calc-line);
  text-align: left;
  vertical-align: top;
}

.emt-result-table-wrap th {
  background: var(--emt-calc-dark);
  color: #ffffff;
}

.emt-result-table-wrap tr:last-child td {
  border-bottom: 0;
}

.emt-result__notice {
  margin: 18px 0 0 !important;
  color: var(--emt-calc-muted);
  font-size: 14px;
}

.emt-copy-status {
  min-height: 1.4em;
  margin: 8px 0 0 !important;
  color: var(--emt-calc-success);
  font-size: 14px;
}

@media (max-width: 980px) {
  .emt-field-grid--four,
  .emt-field-grid--three,
  .emt-result__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .emt-calculator {
    font-size: 16px;
  }

  .emt-choice-grid,
  .emt-field-grid--four,
  .emt-field-grid--three,
  .emt-result__metrics {
    grid-template-columns: 1fr;
  }

  .emt-calculator__intro,
  .emt-calculator__form,
  .emt-result {
    border-radius: 17px;
  }

  .emt-camera-group {
    padding: 18px;
  }

  .emt-camera-group__remove {
    position: static;
    margin: 0 0 14px auto;
  }

  .emt-result__header {
    display: block;
  }

  .emt-result__actions {
    margin-top: 14px;
  }

  .emt-calculator__actions .emt-button {
    width: 100%;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .emt-result,
  .emt-result * {
    visibility: visible !important;
  }

  .emt-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .emt-result__actions,
  .emt-copy-status {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emt-choice-card > span {
    transition: none;
  }
}

.emt-field em {
  color: var(--emt-calc-muted);
  font-size: 0.88em;
  font-style: normal;
  font-weight: 500;
}

.emt-calculator-help {
  max-width: 980px;
  margin-top: 20px;
  border: 1px solid #d8c16b;
  border-radius: var(--emt-calc-radius-small);
  background: #fff9df;
}

.emt-calculator-help > summary {
  padding: 15px 18px;
  color: var(--emt-calc-text);
  font-weight: 800;
  cursor: pointer;
}

.emt-calculator-help > summary:hover,
.emt-calculator-help > summary:focus-visible {
  background: rgba(242, 183, 5, 0.09);
  outline: none;
}

.emt-calculator-help__content {
  padding: 0 18px 18px;
}

.emt-help-steps {
  margin: 0 0 14px;
  padding-left: 22px;
}

.emt-help-steps li + li {
  margin-top: 8px;
}

.emt-inline-note,
.emt-result__caution {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 11px;
  background: #ffffff;
  color: var(--emt-calc-muted);
}

.emt-result__caution {
  border-left: 4px solid var(--emt-calc-accent);
  background: #fff9df;
  color: var(--emt-calc-text);
}

@media (max-width: 520px) {
  .emt-calculator-help > summary,
  .emt-calculator-help__content {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* Shared field guidance, Electrikman Tools 1.53+ */
.emt-ux-banner{display:flex;align-items:flex-start;gap:10px;margin:0 0 22px;padding:13px 15px;border:1px solid #d7e0e7;border-radius:12px;background:#f7fafc;color:#334155;font-size:.94rem;line-height:1.45}
.emt-ux-banner strong{color:#17212b;white-space:nowrap}
.emt-ux-banner span{min-width:0}
.emt-ux-banner b{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:1px solid #9aa9b5;border-radius:50%;background:#fff;font-size:12px;line-height:1}
.emt-help-toggle{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin-left:7px;padding:0;border:1px solid #9cadb9;border-radius:50%;background:#fff;color:#24465e;font:800 13px/1 system-ui,sans-serif;vertical-align:1px;cursor:pointer}
.emt-help-toggle:hover,.emt-help-toggle:focus-visible{border-color:#155a8a;background:#eef6fb;color:#0f4f79;outline:2px solid rgba(21,90,138,.18);outline-offset:1px}
.emt-help-toggle[aria-expanded="true"]{background:#155a8a;color:#fff;border-color:#155a8a}
.emt-smart-help{display:block;margin-top:7px;padding:9px 11px;border-left:3px solid #f2b705;border-radius:7px;background:#fff9df;color:#475569;font-size:13px;line-height:1.45}
.emt-smart-help[hidden]{display:none!important}
@media(max-width:680px){.emt-ux-banner{display:block}.emt-ux-banner strong{display:block;margin-bottom:4px;white-space:normal}.emt-help-toggle{width:24px;height:24px}}

.emt-table-help-host{position:relative}
.emt-help-toggle--table{margin-left:6px;vertical-align:middle}
.emt-table-smart-help{position:absolute;z-index:30;top:calc(100% + 6px);left:6px;width:min(280px,70vw);padding:10px 11px;border:1px solid #d4dee6;border-radius:10px;background:#fff;color:#334155;box-shadow:0 10px 28px rgba(23,33,43,.16);font-size:12px;font-weight:500;line-height:1.45;text-align:left;white-space:normal}
.emt-table-smart-help[hidden]{display:none!important}
