:root {
  --bg: #05070b;
  --panel: #030912;
  --panel2: #06111d;
  --line: rgba(110, 190, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #eef5ff;
  --muted: #92a3b7;
  --cyan: #00d9ff;
  --cyan-soft: rgba(0, 217, 255, 0.18);
  --input: #182534;
  --input-line: #507090;
  --green: #00ff57;
  --green-bg: rgba(0, 255, 87, 0.12);
  --red: #ff2b2b;
  --red-bg: rgba(255, 43, 43, 0.12);
  --amber: #ffb100;
  --amber-bg: rgba(255, 177, 0, 0.12);
  --purple: #9a7cff;
  --purple-bg: rgba(154, 124, 255, 0.10);
  --blue-soft: #d8ecff;
  --blue-plain: #7fc7ff;
  --gray-card-top: rgba(42, 46, 54, 0.98);
  --gray-card-bottom: rgba(28, 31, 37, 0.98);
  --radius: 12px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.if-wrap,
.if-wrap * {
  box-sizing: border-box;
}

.if-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px 10px;
}

.if-shell {
  width: min(100%, 340px);
}

.if-card {
  background: linear-gradient(180deg, rgba(0, 12, 22, 0.98), rgba(0, 7, 14, 0.98));
  border: 1px solid rgba(90, 140, 190, 0.18);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 16px 14px 14px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.if-card-gray {
  background: linear-gradient(180deg, var(--gray-card-top), var(--gray-card-bottom));
  border: 1px solid rgba(165, 175, 190, 0.18);
}

.if-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.if-title {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.if-divider {
  border-top: 1px solid rgba(130, 190, 255, 0.18);
  margin: 8px 0 14px;
}

.if-settingGrid {
  display: grid;
  grid-template-columns: 1fr auto 142px;
  column-gap: 10px;
  row-gap: 12px;
  align-items: center;
}

.if-sLabel {
  min-width: 0;
  color: #d9e8f6;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

.if-sBadge,
.if-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 8.5px;
  line-height: 1;
  text-transform: lowercase;
  flex: 0 0 auto;
}

.if-sField,
.if-fieldwrap {
  min-width: 0;
}

.if-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d9e8f6;
  font-size: 11px;
  line-height: 1.1;
}

.if-label .txt {
  white-space: nowrap;
}

.if-control {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 142px;
}

.if-card input.if-input,
.if-card select.if-select {
  width: 100%;
  height: 22px;
  padding: 0 10px;
  border-radius: 7px !important;
  border: 1px solid var(--input-line) !important;
  background: var(--input) !important;
  background-image: none !important;
  color: #f6fbff !important;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  text-align: center !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}

.if-select {
  background-image:
    linear-gradient(45deg, transparent 50%, #dfefff 50%),
    linear-gradient(135deg, #dfefff 50%, transparent 50%) !important;
  background-position:
    calc(100% - 12px) 8px,
    calc(100% - 8px) 8px !important;
  background-size: 4px 4px !important;
  background-repeat: no-repeat !important;
  padding-right: 20px;
}

.if-routing {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(120, 180, 235, 0.16);
  display: flex;
  justify-content: flex-start;
}

.if-routing-pill {
  border: 1px dashed rgba(140, 210, 255, 0.45);
  background: rgba(60, 120, 170, 0.16);
  color: #bdefff;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 10px;
  font-family: var(--mono);
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.if-routing-pill b {
  color: #ffffff;
  font-weight: 700;
}

.if-hidden {
  display: none !important;
}

.if-scenario-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.if-scenario-head .if-title {
  margin: 0;
  font-size: 14px;
}

.if-scenario-head-a {
  align-items: flex-start;
}

.if-topline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.if-topline .if-control {
  min-width: 140px;
}

.if-dashed-center {
  border-top: 1px dashed rgba(120, 180, 235, 0.16);
  margin: 12px 0;
}

.if-grid-2,
.if-footer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.if-footer-row {
  margin-top: 12px;
}

.if-pillbox {
  border-radius: 8px;
  min-height: 34px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px dashed transparent;
  line-height: 1.05;
}

.if-pillbox .k {
  font-size: 8.8px;
  opacity: 0.95;
  margin-bottom: 3px;
}

.if-pillbox .v {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.green {
  color: var(--green);
  background: var(--green-bg);
  border-color: rgba(0, 255, 87, 0.55);
}

.red {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(255, 43, 43, 0.55);
}

.amber {
  color: var(--purple);
  background: var(--purple-bg);
  border-color: rgba(154, 124, 255, 0.45);
}

/* blocchi senza cella */
.if-stat-plain {
  min-height: 34px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1.05;
  background: transparent;
  border: none;
  box-shadow: none;
}

.if-stat-plain .k {
  font-size: 8.8px;
  margin-bottom: 3px;
  font-weight: 600;
}

.if-stat-plain .v {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.stat-green .k,
.stat-green .v {
  color: var(--green);
}

.stat-purple .k,
.stat-purple .v {
  color: var(--purple);
}

.stat-blue .k,
.stat-blue .v {
  color: var(--blue-plain);
}

.if-profit-top-plain {
  min-width: 112px;
}

.if-middle-row-a {
  margin: 10px 0;
}

.if-footer-row-open {
  align-items: start;
}

/* ===== FIX WORDPRESS SELECT ===== */

.if-card select.if-select {
  color: #ffffff !important;
  background-color: #182534 !important;
}

.if-card select.if-select option {
  color: #ffffff !important;
  background-color: #182534 !important;
}

.if-card select.if-select option:checked {
  color: #ffffff !important;
  background-color: #2a5d94 !important;
}

@media (max-width: 420px) {
  .if-shell {
    width: 100%;
  }
}

/* ===== DESKTOP SCALING ===== */

@media (min-width: 992px) {
  .if-shell {
    width: min(100%, 520px);
  }

  .if-card {
    padding: 24px 20px 22px;
    margin-bottom: 16px;
  }

  .if-title {
    font-size: 24px;
    margin-bottom: 16px;
  }

  .if-scenario-head .if-title {
    font-size: 23px;
  }

  .if-divider {
    margin: 12px 0 18px;
  }

  .if-settingGrid {
    grid-template-columns: 1fr auto 160px;
    column-gap: 14px;
    row-gap: 16px;
  }

  .if-sLabel,
  .if-label {
    font-size: 16px;
  }

  .if-sBadge,
  .if-badge {
    width: 42px;
    height: 22px;
    font-size: 11px;
  }

  .if-control {
    min-width: 160px;
  }

  .if-topline .if-control {
    min-width: 160px;
  }

  .if-card input.if-input,
  .if-card select.if-select {
    height: 38px;
    padding: 0 14px;
    font-size: 17px !important;
    border-radius: 10px !important;
  }

  .if-select {
    background-position:
      calc(100% - 16px) 15px,
      calc(100% - 11px) 15px !important;
    background-size: 5px 5px !important;
    padding-right: 30px;
  }

  .if-routing {
    margin-top: 16px;
    padding-top: 14px;
  }

  .if-routing-pill {
    padding: 7px 14px;
    font-size: 14px;
  }

  .if-grid-2,
  .if-footer-row {
    gap: 14px;
  }

  .if-topline {
    gap: 16px;
    margin-bottom: 16px;
  }

  .if-pillbox {
    min-height: 62px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .if-pillbox .k,
  .if-stat-plain .k {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .if-pillbox .v,
  .if-stat-plain .v {
    font-size: 18px;
  }

  .if-profit-top-plain {
    min-width: 180px;
  }

  .if-stat-plain {
    min-height: 56px;
    padding: 8px 2px;
  }

  .if-middle-row-a {
    margin: 14px 0;
  }
}