.bwlcc-calculator,
.bwlcc-calculator * {
  box-sizing: border-box;
}

.bwlcc-calculator {
  --bwlcc-bg: #f3f5f7;
  --bwlcc-panel: #ffffff;
  --bwlcc-panel-2: #eef1f5;
  --bwlcc-text: #151922;
  --bwlcc-muted: #5f6b7a;
  --bwlcc-border: #d9dee7;
  --bwlcc-accent: #3f6f8f;
  --bwlcc-accent-2: #111827;
  --bwlcc-good: #1f7a4d;
  --bwlcc-warning: #9a6415;
  --bwlcc-danger: #aa3030;
  --bwlcc-shadow: 0 18px 45px rgba(17, 24, 39, 0.12);
  --bwlcc-radius: 22px;
  color: var(--bwlcc-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  width: 100%;
  margin: 0 auto;
}

.bwlcc-calculator[data-theme="dark"] {
  --bwlcc-bg: #11141a;
  --bwlcc-panel: #191f29;
  --bwlcc-panel-2: #232b37;
  --bwlcc-text: #f7f8fb;
  --bwlcc-muted: #a9b2c1;
  --bwlcc-border: #333d4d;
  --bwlcc-accent: #8cb7d5;
  --bwlcc-accent-2: #f6f7f9;
  --bwlcc-good: #78d9aa;
  --bwlcc-warning: #f0be73;
  --bwlcc-danger: #ff8e8e;
  --bwlcc-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.bwlcc-shell {
  background: linear-gradient(135deg, var(--bwlcc-bg), var(--bwlcc-panel-2));
  border: 1px solid var(--bwlcc-border);
  border-radius: 28px;
  padding: clamp(18px, 3vw, 32px);
  overflow: hidden;
  position: relative;
}

.bwlcc-shell::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(63, 111, 143, 0.2), transparent 68%);
  top: -180px;
  right: -120px;
  pointer-events: none;
}

.bwlcc-header,
.bwlcc-grid,
.bwlcc-card,
.bwlcc-mini,
.bwlcc-actions,
.bwlcc-results {
  position: relative;
  z-index: 1;
}

.bwlcc-header {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.bwlcc-eyebrow {
  color: var(--bwlcc-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  margin: 0 0 7px;
  text-transform: uppercase;
}

.bwlcc-header h2 {
  color: var(--bwlcc-text);
  font-size: clamp(1.55rem, 2.8vw, 2.45rem);
  line-height: 1.06;
  margin: 0;
  text-transform: capitalize;
}

.bwlcc-subtitle {
  color: var(--bwlcc-muted);
  font-size: clamp(0.96rem, 1.8vw, 1.05rem);
  line-height: 1.55;
  margin: 10px 0 0;
  max-width: 760px;
}

.bwlcc-theme-toggle,
.bwlcc-button {
  align-items: center;
  appearance: none;
  border: 1px solid var(--bwlcc-border);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  line-height: 1;
  min-height: 44px;
  padding: 12px 16px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.bwlcc-theme-toggle {
  background: var(--bwlcc-panel);
  color: var(--bwlcc-text);
  white-space: nowrap;
}

.bwlcc-button {
  background: var(--bwlcc-accent-2);
  color: var(--bwlcc-panel);
}

.bwlcc-button:nth-child(odd) {
  background: var(--bwlcc-panel);
  color: var(--bwlcc-text);
}

.bwlcc-theme-toggle:hover,
.bwlcc-button:hover {
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.12);
  transform: translateY(-1px);
}

.bwlcc-theme-toggle:focus-visible,
.bwlcc-button:focus-visible,
.bwlcc-calculator input:focus-visible,
.bwlcc-calculator select:focus-visible {
  outline: 3px solid rgba(63, 111, 143, 0.45);
  outline-offset: 3px;
}

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

.bwlcc-form,
.bwlcc-results {
  display: grid;
  gap: 18px;
}

.bwlcc-card,
.bwlcc-mini {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--bwlcc-border);
  border-radius: var(--bwlcc-radius);
  box-shadow: var(--bwlcc-shadow);
}

.bwlcc-calculator[data-theme="dark"] .bwlcc-card,
.bwlcc-calculator[data-theme="dark"] .bwlcc-mini {
  background: rgba(25, 31, 41, 0.86);
}

.bwlcc-card {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  padding: clamp(16px, 2.4vw, 24px);
}

.bwlcc-section-title {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
}

.bwlcc-section-title > span {
  align-items: center;
  background: var(--bwlcc-accent-2);
  border-radius: 14px;
  color: var(--bwlcc-panel);
  display: inline-flex;
  flex: 0 0 34px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
}

.bwlcc-section-title.compact > span {
  background: var(--bwlcc-panel-2);
  color: var(--bwlcc-accent-2);
}

.bwlcc-section-title h3 {
  color: var(--bwlcc-text);
  font-size: 1.03rem;
  line-height: 1.2;
  margin: 0;
}

.bwlcc-section-title p,
.bwlcc-help,
.bwlcc-disclaimer {
  color: var(--bwlcc-muted);
  font-size: 0.89rem;
  line-height: 1.45;
  margin: 4px 0 0;
}

.bwlcc-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.bwlcc-field label,
.bwlcc-label {
  color: var(--bwlcc-text);
  font-size: 0.92rem;
  font-weight: 800;
}

.bwlcc-input-wrap {
  align-items: center;
  background: var(--bwlcc-panel);
  border: 1px solid var(--bwlcc-border);
  border-radius: 16px;
  display: flex;
  min-height: 48px;
  overflow: hidden;
}

.bwlcc-input-wrap input,
.bwlcc-field select {
  background: var(--bwlcc-panel);
  border: 1px solid var(--bwlcc-border);
  border-radius: 16px;
  color: var(--bwlcc-text);
  font: inherit;
  min-height: 48px;
  width: 100%;
}

.bwlcc-input-wrap input {
  border: 0;
  border-radius: 0;
  padding: 0 13px;
}

.bwlcc-input-wrap span {
  color: var(--bwlcc-muted);
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 13px 0 6px;
}

.bwlcc-field select {
  padding: 0 13px;
}

.bwlcc-inline-inputs {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.bwlcc-segmented {
  background: var(--bwlcc-panel-2);
  border: 1px solid var(--bwlcc-border);
  border-radius: 18px;
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
}

.bwlcc-segmented label {
  cursor: pointer;
  display: block;
  position: relative;
}

.bwlcc-segmented input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.bwlcc-segmented span {
  align-items: center;
  border-radius: 14px;
  color: var(--bwlcc-muted);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  padding: 10px;
  text-align: center;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.bwlcc-segmented input:checked + span {
  background: var(--bwlcc-panel);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
  color: var(--bwlcc-text);
}

.bwlcc-range-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.bwlcc-range-row input[type="range"] {
  accent-color: var(--bwlcc-accent);
  width: 100%;
}

.bwlcc-range-row output {
  background: var(--bwlcc-panel-2);
  border: 1px solid var(--bwlcc-border);
  border-radius: 999px;
  color: var(--bwlcc-text);
  font-size: 0.9rem;
  font-weight: 900;
  min-width: 86px;
  padding: 9px 11px;
  text-align: center;
}

.bwlcc-switch {
  align-items: center;
  color: var(--bwlcc-muted) !important;
  cursor: pointer;
  display: flex;
  gap: 10px;
  line-height: 1.4;
}

.bwlcc-switch input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.bwlcc-switch span {
  background: var(--bwlcc-panel-2);
  border: 1px solid var(--bwlcc-border);
  border-radius: 999px;
  flex: 0 0 48px;
  height: 28px;
  position: relative;
  transition: background 180ms ease;
}

.bwlcc-switch span::after {
  background: var(--bwlcc-panel);
  border-radius: 999px;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
  content: "";
  height: 22px;
  left: 3px;
  position: absolute;
  top: 2px;
  transition: transform 180ms ease;
  width: 22px;
}

.bwlcc-switch input:checked + span {
  background: var(--bwlcc-accent);
}

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

.bwlcc-error {
  color: var(--bwlcc-danger);
  font-size: 0.82rem;
  font-weight: 750;
  margin: 0;
  min-height: 1.1em;
}

.bwlcc-field.bwlcc-invalid input,
.bwlcc-field.bwlcc-invalid select,
.bwlcc-field.bwlcc-invalid .bwlcc-input-wrap {
  border-color: var(--bwlcc-danger);
}

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

.bwlcc-result-topline {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.bwlcc-final-weight {
  color: var(--bwlcc-text);
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1;
  margin: 0;
}

.bwlcc-result-summary {
  color: var(--bwlcc-muted);
  line-height: 1.55;
  margin: 0;
}

.bwlcc-ring {
  align-items: center;
  background: conic-gradient(var(--bwlcc-accent) 0deg, var(--bwlcc-panel-2) 0deg);
  border-radius: 999px;
  display: flex;
  flex: 0 0 96px;
  height: 96px;
  justify-content: center;
  position: relative;
  width: 96px;
}

.bwlcc-ring::after {
  background: var(--bwlcc-panel);
  border-radius: inherit;
  content: "";
  inset: 9px;
  position: absolute;
}

.bwlcc-ring span {
  color: var(--bwlcc-text);
  font-size: 0.95rem;
  font-weight: 950;
  position: relative;
  z-index: 1;
}

.bwlcc-meter {
  background: var(--bwlcc-panel-2);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bwlcc-meter span {
  background: linear-gradient(90deg, var(--bwlcc-accent), var(--bwlcc-good));
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width 240ms ease;
  width: 0;
}

.bwlcc-mini-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bwlcc-mini {
  padding: 16px;
}

.bwlcc-mini span {
  color: var(--bwlcc-muted);
  display: block;
  font-size: 0.82rem;
  font-weight: 850;
  margin-bottom: 5px;
}

.bwlcc-mini strong {
  color: var(--bwlcc-text);
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

.bwlcc-chart {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(18px, 1fr);
  min-height: 190px;
  overflow-x: auto;
  padding: 10px 0 2px;
}

.bwlcc-bar {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: end;
  min-width: 18px;
}

.bwlcc-bar span:first-child {
  background: linear-gradient(180deg, var(--bwlcc-accent), var(--bwlcc-accent-2));
  border-radius: 999px 999px 5px 5px;
  display: block;
  min-height: 4px;
  width: 100%;
}

.bwlcc-bar small {
  color: var(--bwlcc-muted);
  font-size: 0.68rem;
  font-weight: 800;
  writing-mode: vertical-rl;
}

.bwlcc-table-wrap {
  max-height: 360px;
  overflow: auto;
  width: 100%;
}

.bwlcc-table {
  border-collapse: collapse;
  min-width: 620px;
  width: 100%;
}

.bwlcc-table th,
.bwlcc-table td {
  border-bottom: 1px solid var(--bwlcc-border);
  color: var(--bwlcc-text);
  font-size: 0.88rem;
  padding: 11px 9px;
  text-align: right;
  white-space: nowrap;
}

.bwlcc-table th:first-child,
.bwlcc-table td:first-child {
  text-align: left;
}

.bwlcc-table th {
  background: var(--bwlcc-panel-2);
  color: var(--bwlcc-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 2;
}

.bwlcc-disclaimer {
  background: var(--bwlcc-panel-2);
  border: 1px solid var(--bwlcc-border);
  border-radius: 16px;
  margin: 0;
  padding: 13px 15px;
}

.bwlcc-toast {
  background: var(--bwlcc-accent-2);
  border-radius: 999px;
  bottom: 20px;
  color: var(--bwlcc-panel);
  font-weight: 850;
  left: 50%;
  opacity: 0;
  padding: 11px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 99999;
}

.bwlcc-toast.bwlcc-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 620px) {
  .bwlcc-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bwlcc-span-2,
  .bwlcc-actions {
    grid-column: 1 / -1;
  }

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

@media (min-width: 1040px) {
  .bwlcc-grid {
    align-items: start;
    grid-template-columns: minmax(0, 0.96fr) minmax(420px, 1.04fr);
  }

  .bwlcc-results {
    position: sticky;
    top: 20px;
  }
}

@media (max-width: 619px) {
  .bwlcc-header {
    display: grid;
  }

  .bwlcc-theme-toggle {
    width: 100%;
  }

  .bwlcc-actions,
  .bwlcc-mini-cards {
    grid-template-columns: 1fr;
  }

  .bwlcc-button {
    width: 100%;
  }

  .bwlcc-result-topline {
    align-items: flex-start;
  }

  .bwlcc-ring {
    flex-basis: 78px;
    height: 78px;
    width: 78px;
  }

  .bwlcc-ring span {
    font-size: 0.82rem;
  }
}

@media print {
  .bwlcc-theme-toggle,
  .bwlcc-actions,
  .bwlcc-toast {
    display: none !important;
  }

  .bwlcc-shell {
    box-shadow: none;
  }

  .bwlcc-grid {
    display: block;
  }

  .bwlcc-results {
    position: static;
  }
}
