.swb-layer {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 1.25rem;
  background: rgba(8, 22, 40, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.swb-layer[hidden] {
  display: none;
}

.swb-shell,
.swb-shell * {
  box-sizing: border-box;
}

.swb-shell {
  width: min(100%, 74rem);
  max-height: min(92vh, 58rem);
  overflow: hidden;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 1.75rem;
  background: #f8fbff;
  color: #10233e;
  box-shadow: 0 36px 100px rgba(2, 16, 35, 0.38);
}

.swb-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1.35rem 1.5rem 1.2rem;
  border-bottom: 1px solid #dbeafe;
  background:
    radial-gradient(circle at 90% 0, rgba(45, 212, 191, 0.15), transparent 38%),
    linear-gradient(135deg, #ffffff, #eff8ff);
}

.swb-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--swb-brand-primary, #087f8c);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.swb-header h2 {
  margin: 0;
  color: #0b1f3a;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 950;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.swb-subtitle {
  max-width: 52rem;
  margin: 0.55rem 0 0;
  color: #52657d;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.55;
}

.swb-close {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid #cbdcf0;
  border-radius: 0.9rem;
  background: #ffffff;
  color: #34465e;
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
}

.swb-close:hover {
  border-color: #7dd3fc;
  color: #0369a1;
}

.swb-body {
  display: grid;
  grid-template-columns: minmax(19rem, 0.85fr) minmax(23rem, 1.15fr);
  min-height: 32rem;
  max-height: calc(min(92vh, 58rem) - 8.5rem);
  overflow: auto;
}

.swb-input-panel,
.swb-result-panel {
  min-width: 0;
  padding: 1.35rem 1.5rem 1.6rem;
}

.swb-input-panel {
  border-right: 1px solid #dbeafe;
  background: #ffffff;
}

.swb-result-panel {
  background:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.82)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(14, 116, 144, 0.055) 23px,
      rgba(14, 116, 144, 0.055) 24px
    );
}

.swb-section-title {
  margin: 0 0 0.85rem;
  color: #0f4c5c;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.swb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.swb-field {
  display: grid;
  gap: 0.38rem;
}

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

.swb-field label,
.swb-label {
  color: #1d3552;
  font-size: 0.75rem;
  font-weight: 850;
}

.swb-field small,
.swb-help {
  color: #6b7f97;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.45;
}

.swb-field input,
.swb-field textarea,
.swb-field select,
.swb-search {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #c9d9eb;
  border-radius: 0.8rem;
  padding: 0.68rem 0.78rem;
  background: #fbfdff;
  color: #10233e;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  outline: none;
}

.swb-field textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.55;
}

.swb-field input:focus,
.swb-field textarea:focus,
.swb-field select:focus,
.swb-search:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.13);
}

.swb-drop {
  display: grid;
  min-height: 6.2rem;
  place-items: center;
  border: 1.5px dashed #7dd3fc;
  border-radius: 1rem;
  padding: 1rem;
  background: #f0f9ff;
  text-align: center;
}

.swb-drop input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.swb-row,
.swb-actions,
.swb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.swb-actions {
  margin-top: 1rem;
}

.swb-button {
  min-height: 2.75rem;
  border: 1px solid #b9d1e8;
  border-radius: 0.82rem;
  padding: 0.68rem 1rem;
  background: #ffffff;
  color: #12415d;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
}

.swb-button:hover {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.swb-button-primary {
  border-color: var(--swb-brand-primary, #087f8c);
  background: linear-gradient(
    135deg,
    var(--swb-brand-primary, #0f8f8f),
    var(--swb-brand-accent, #087f8c)
  );
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(8, 127, 140, 0.2);
}

.swb-button-primary:hover {
  border-color: var(--swb-brand-primary, #0f766e);
  background: color-mix(
    in srgb,
    var(--swb-brand-primary, #0f766e) 88%,
    #08182a
  );
}

.swb-button-danger {
  border-color: #fecaca;
  color: #b42318;
}

.swb-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.swb-status {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  color: #52657d;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.5;
}

.swb-status[data-kind="error"] {
  color: #b42318;
}

.swb-status[data-kind="success"] {
  color: #087f5b;
}

.swb-privacy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  margin-top: 1rem;
  border: 1px solid #bbf7d0;
  border-radius: 0.9rem;
  padding: 0.75rem 0.8rem;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.45;
}

.swb-privacy span {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border-radius: 999px;
  background: #16a34a;
  color: #ffffff;
  font-size: 0.65rem;
}

.swb-result-empty {
  display: grid;
  min-height: 21rem;
  place-items: center;
  border: 1px dashed #bcd5eb;
  border-radius: 1.2rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.72);
  color: #647991;
  text-align: center;
}

.swb-result-empty b {
  display: block;
  margin-bottom: 0.4rem;
  color: #153b57;
  font-size: 1rem;
}

.swb-result-card {
  border: 1px solid #cfe0f0;
  border-radius: 1.2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(30, 64, 95, 0.08);
}

.swb-result-card h3 {
  margin: 0;
  color: #0b3450;
  font-size: 1rem;
  font-weight: 900;
}

.swb-result-card > p {
  margin: 0.4rem 0 0.8rem;
  color: #60748a;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.5;
}

.swb-output {
  max-height: 24rem;
  overflow: auto;
  margin: 0;
  border: 1px solid #dbe8f4;
  border-radius: 0.85rem;
  padding: 0.9rem;
  background: #f8fbfe;
  color: #1c3048;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.swb-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

.swb-metric {
  border: 1px solid #d5e5f2;
  border-radius: 0.9rem;
  padding: 0.75rem;
  background: #ffffff;
}

.swb-metric b {
  display: block;
  color: #0c4761;
  font-size: 1.05rem;
  font-weight: 950;
}

.swb-metric span {
  display: block;
  margin-top: 0.2rem;
  color: #708297;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.swb-table-wrap {
  max-height: 19rem;
  overflow: auto;
  margin-top: 0.8rem;
  border: 1px solid #d5e5f2;
  border-radius: 0.9rem;
  background: #ffffff;
}

.swb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.swb-table th,
.swb-table td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid #e6eef6;
  color: #324b65;
  text-align: left;
  vertical-align: top;
}

.swb-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eff7fd;
  color: #174461;
  font-size: 0.6rem;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.swb-table td:last-child,
.swb-table th:last-child {
  text-align: right;
}

.swb-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.59rem;
  font-weight: 900;
}

.swb-preview-frame {
  overflow: hidden;
  border: 1px solid #cbddeb;
  border-radius: 1rem;
  background: #ffffff;
}

.swb-preview-frame iframe {
  width: 100%;
  min-height: 26rem;
  border: 0;
  background: #ffffff;
}

.swb-chart {
  width: 100%;
  height: 220px;
  margin-top: 0.8rem;
  border: 1px solid #d8e6f2;
  border-radius: 0.9rem;
  background: #ffffff;
}

.swb-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.6rem;
  border: 1px solid
    color-mix(in srgb, var(--swb-brand-accent, #2563eb) 38%, white);
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--swb-brand-primary, #0f8f8f) 10%, white),
    color-mix(in srgb, var(--swb-brand-accent, #2563eb) 10%, white)
  );
  color: var(--swb-brand-primary, #0f8f8f);
  box-shadow: 0 8px 24px
    color-mix(in srgb, var(--swb-brand-accent, #2563eb) 14%, transparent);
  font-size: 0.62rem;
  font-weight: 900;
}

.swb-brand-pill img {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 0.35rem;
  object-fit: contain;
}

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

@media (max-width: 820px) {
  .swb-layer {
    align-items: end;
    padding: 0.55rem;
  }

  .swb-shell {
    max-height: 96vh;
    border-radius: 1.35rem;
  }

  .swb-header {
    padding: 1rem;
  }

  .swb-body {
    grid-template-columns: 1fr;
    max-height: calc(96vh - 7.5rem);
  }

  .swb-input-panel {
    border-right: 0;
    border-bottom: 1px solid #dbeafe;
  }

  .swb-input-panel,
  .swb-result-panel {
    padding: 1rem;
  }

  .swb-grid,
  .swb-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .swb-header h2 {
    font-size: 1.35rem;
  }

  .swb-subtitle {
    font-size: 0.78rem;
  }

  .swb-button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swb-layer {
    scroll-behavior: auto;
  }
}
