:root{
  /*
   * Theme-aligned styling with SAFE fallbacks.
   * - If WI Magazine Pro variables exist, we use them.
   * - Otherwise we fall back to common theme palettes (Kadence uses --global-palette*)
   * - And finally to sane defaults so borders/backgrounds never disappear.
   */
  --il-bg:      var(--wi-bg,      var(--global-palette9, #f6f7f9));
  --il-card:    var(--wi-card,    var(--global-palette8, #ffffff));
  --il-border:  var(--wi-border,  var(--global-palette7, #e5e7eb));
  --il-text:    var(--wi-text,    var(--global-palette3, #111827));
  --il-muted:   var(--wi-muted,   var(--global-palette5, #6b7280));
  --il-nav:     var(--wi-nav,     var(--global-palette1, #111827));
  --il-nav2:    var(--wi-nav2,    var(--global-palette2, #1f2937));
  --il-accent:  var(--wi-green,   var(--global-palette4, #22c55e));
  --il-accent2: var(--wi-green-dark, var(--global-palette6, #16a34a));
  --il-radius:  var(--wi-radius,  16px);
  --il-shadow:  var(--wi-shadow,  0 1px 3px rgba(0,0,0,.08));
  --il-font:    var(--wi-font,    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
  --il-head:    var(--wi-head,    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
}

*{box-sizing:border-box}

body{
  margin:0;
  background: var(--il-bg);
  color: var(--il-text);
  font: 15px/1.55 var(--il-font);
}

header{
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--il-nav), var(--il-nav2));
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.nav{
  max-width:1100px;
  margin:0 auto;
  padding:10px 16px;
  display:flex;
  gap:14px;
  align-items:center;
  color: rgba(255,255,255,.92);
}

.brand{
  font-weight: 900;
  font-family: var(--il-head);
  display:flex;
  gap:8px;
  align-items:center;
  color:#fff;
}

.dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background: linear-gradient(135deg, var(--il-accent), var(--il-accent2));
}

.tab{
  padding:8px 10px;
  border-radius: 10px;
  color: rgba(255,255,255,.92);
  text-decoration:none;
  font-size: 13px;
  font-weight: 800;
}

.tab.active,.tab:hover{
  background: rgba(255,255,255,.12);
  color:#fff;
  text-decoration:none;
}

.sp{flex:1}

.btn{
  padding:10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.08);
  background: var(--il-accent);
  color: #052e1d;
  cursor:pointer;
  font-weight: 900;
}
.btn:hover{ background: var(--il-accent2); color:#fff; }

main{ max-width:1100px; margin:16px auto 60px; padding:0 16px }

.grid{ display:grid; gap:16px }
.cols-2{ grid-template-columns:1.2fr .8fr }

.panel{
  /* Theme-agnostic hardening: some themes (e.g. Kadence) may override borders/backgrounds.
     We keep our widget borders visible while staying subtle. */
  background: var(--il-card) !important;
  border: 1px solid var(--il-border) !important;
  border-radius: var(--il-radius);
  box-shadow: var(--il-shadow);
  overflow:hidden;
}

.panel h3{
  margin: 12px 14px 0;
  font-family: var(--il-head);
  font-weight: 900;
}

.panel .body{ padding:14px }

h1,h2{ font-family: var(--il-head); font-weight: 900; }

label{ font-size:12px; color: var(--il-muted); font-weight: 800 }

select,input{
  width:100%;
  padding:10px;
  border-radius: 10px;
  border: 1px solid var(--il-border);
  background: var(--il-card);
  color: var(--il-text);
}

.row{ display:grid; grid-template-columns:1fr 1fr; gap:10px }

.result{ font-size:24px; font-weight: 900; margin-top: 6px }
.small{ font-size:12px; color: var(--il-muted) }

.crumbs{
  font-size: 13px;
  margin: 0 0 10px;
  color: var(--il-muted);
}
.crumbs a{ color: inherit; text-decoration:none; font-weight: 800 }
.crumbs a:hover{ text-decoration:underline }

.fx-error{ color:#7a0000; font-size:12px; font-weight:800 }

table{ width:100%; border-collapse:collapse }
th,td{ padding:8px; border-bottom:1px solid var(--il-border); text-align:left }
thead th{ font-size:12px; color: var(--il-muted); font-weight: 900 }

.links a{ color: var(--il-accent2); text-decoration:none; font-weight: 800 }
.links a:hover{ text-decoration:underline }

/* Trust box + silo links (ensure readable on theme palette) */
.ilfx-trust{
  max-width:1100px;
  margin: -34px auto 60px;
  padding: 0 16px;
}
.ilfx-trust .box{
  background: var(--il-card) !important;
  border: 1px solid var(--il-border) !important;
  border-radius: var(--il-radius);
  box-shadow: var(--il-shadow);
  padding: 14px;
}
.ilfx-trust .title{ font-family: var(--il-head); font-weight: 900; margin: 0 0 6px }
.ilfx-trust p{ margin: 0 0 8px; color: var(--il-text) }

.ilfx-silo{
  max-width:1100px;
  margin: -46px auto 70px;
  padding: 0 16px;
}
.ilfx-silo .box{
  background: var(--il-card) !important;
  border: 1px solid var(--il-border) !important;
  border-radius: var(--il-radius);
  box-shadow: var(--il-shadow);
  padding: 14px;
}
.ilfx-silo .title{ font-family: var(--il-head); font-weight: 900; margin:0 0 10px }
.ilfx-silo ul{ margin: 0; padding-left: 18px }
.ilfx-silo li{ margin: 4px 0 }

/* Embedded "Explore more conversions" can appear on any page/theme.
   The global .tab style is tuned for the dark header, so we override it here
   to keep links readable on light (white) backgrounds. */
.ilfx-trust a.tab,
.ilfx-silo a.tab{
  color:#111;
  background: transparent;
  border: 1px solid var(--il-border);
  text-decoration:none;
}
.ilfx-trust a.tab:hover,
.ilfx-silo a.tab:hover{
  background: rgba(0,0,0,.04);
  color:#111;
}

@media(max-width:640px){
  .cols-2{ grid-template-columns:1fr }
  .row{ grid-template-columns:1fr }
}

/* --- Chart sizing hardening (prevents blank canvas in some themes) --- */
#chart{
  display:block;
  width:100% !important;
  height:220px !important;
}

/* --- Layout Builder tweaks: fix white-on-white tabs and remove double borders --- */
/* When these sections are placed inside a .panel, the panel already provides border/shadow. */
.panel .ilfx-trust,
.panel .ilfx-silo{
  max-width: none;
  margin: 0;
  padding: 0;
}
.panel .ilfx-trust .box,
.panel .ilfx-silo .box{
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* Make "tabs" readable on light backgrounds (match the rest of the widgets). */
.panel .ilfx-trust a.tab,
.panel .ilfx-silo a.tab{
  color: var(--il-text);
  background: transparent;
  border: 1px solid var(--il-border);
}
.panel .ilfx-trust a.tab:hover,
.panel .ilfx-silo a.tab:hover{
  background: rgba(0,0,0,.04);
  color: var(--il-text);
}

/* --- Quick Conversion Table (Flags + amounts) --- */
.ilfx-qt .box{
  background: var(--il-card);
  border: 1px solid var(--il-border);
  border-radius: 14px;
  box-shadow: var(--il-shadow);
  padding: 14px;
}
.ilfx-qt .title{
  font-weight: 800;
  margin: 0 0 12px;
}
.ilfx-qt-grid{display:grid;gap:14px}
.ilfx-qt-grid.cols-1{grid-template-columns:1fr}
.ilfx-qt-grid.cols-2{grid-template-columns:repeat(2, minmax(0,1fr))}
.ilfx-qt-grid.cols-3{grid-template-columns:repeat(3, minmax(0,1fr))}
.ilfx-qt-grid.cols-4{grid-template-columns:repeat(4, minmax(0,1fr))}
@media(max-width:640px){
  .ilfx-qt-grid.cols-2,.ilfx-qt-grid.cols-3,.ilfx-qt-grid.cols-4{grid-template-columns:1fr}
}

.ilfx-qt-card{
  border: 1px solid var(--il-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--il-card);
}
.ilfx-qt-head{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  border-bottom: 1px solid var(--il-border);
}
.ilfx-qt-side{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px;
}
.ilfx-qt-side + .ilfx-qt-side{ border-left:1px solid var(--il-border); }
.ilfx-qt-flag{
  width:44px;height:44px;
  display:flex;align-items:center;justify-content:center;
  border:1px solid var(--il-border);
  border-radius: 12px;
  background: rgba(0,0,0,.02);
  font-size: 22px;
  line-height: 1;
}
.ilfx-qt-meta{min-width:0}
.ilfx-qt-code{font-weight:800}
.ilfx-qt-name{font-size:12.5px;color:var(--il-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ilfx-qt-sel{
  width:100%;
  max-width: 160px;
  border: 1px solid var(--il-border);
  border-radius: 10px;
  padding: 6px 8px;
  background: #fff;
  color: var(--il-text);
  font: inherit;
}

.ilfx-qt-body{ padding: 10px 12px 12px; }
.ilfx-qt-table{ width:100%; border-collapse: collapse; }
.ilfx-qt-table td{
  padding: 10px 8px;
  border-bottom: 1px solid var(--il-border);
  font-size: 14px;
}
.ilfx-qt-table tr:last-child td{ border-bottom: 0; }
.ilfx-qt-left{ color: var(--il-text); }
.ilfx-qt-right{ text-align:right; font-weight: 700; color: var(--il-text); }
.ilfx-qt-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-top: 1px solid var(--il-border);
  margin-top: 10px;
  padding-top: 10px;
}
.ilfx-qt-link{
  color: var(--il-text);
  text-decoration:none;
  border-bottom:1px dotted rgba(0,0,0,.2);
}
.ilfx-qt-link:hover{ border-bottom-style:solid; }
.ilfx-qt-asof{ font-size: 12.5px; color: var(--il-muted); }
