/* WorldIndex Gateway v3.1 contrast/accessibility layer
   Explicit semantic colors prevent white-on-white / inherited-text failures. */
:root{
  --wi-bg:#07111e;
  --wi-surface-dark:#0b1b2b;
  --wi-surface-dark-2:#102438;
  --wi-text-on-dark:#f8fafc;
  --wi-muted-on-dark:#d7e2f0;
  --wi-surface-light:#ffffff;
  --wi-surface-light-2:#f7f9fc;
  --wi-text-on-light:#101828;
  --wi-muted-on-light:#475467;
  --wi-border-dark:#3b5066;
  --wi-border-light:#c7d0dc;
  --wi-link-dark:#9dccff;
  --wi-link-light:#0057b8;
  --wi-action:#0057b8;
  --wi-action-hover:#00458f;
  --wi-focus:#ffbf47;
  --wi-success:#08783e;
  --wi-warning:#8a5300;
  --wi-danger:#b42318;
}
html{color-scheme:dark}
body{background:var(--wi-bg)!important;color:var(--wi-text-on-dark)!important}
header,.hero,.live,.cards,footer{color:var(--wi-text-on-dark)!important}
.hero p,.eyebrow,.live span,footer,footer *{color:var(--wi-muted-on-dark)!important}
header a,.brand,footer a,footer button{color:var(--wi-link-dark)!important}
.card{
  background:var(--wi-surface-dark)!important;
  color:var(--wi-text-on-dark)!important;
  border-color:var(--wi-border-dark)!important;
}
.card b,.card em,.card .icon{color:var(--wi-text-on-dark)!important}
.card small{color:var(--wi-muted-on-dark)!important}
.how article,.optin,.sheet,.help,.fallback{
  background:var(--wi-surface-light)!important;
  color:var(--wi-text-on-light)!important;
}
.how article b,.optin b,.sheet h1,.sheet h2,.sheet h3,.help b{color:var(--wi-text-on-light)!important}
.how article p,.optin small,.optin label,.sheet small,.fallback p{color:var(--wi-muted-on-light)!important}
.sheet a,.help a,.fallback a{color:var(--wi-link-light)!important}
input,select,textarea{
  background:#fff!important;
  color:#111827!important;
  border:1px solid #98a2b3!important;
  caret-color:#111827!important;
}
input::placeholder,textarea::placeholder{color:#596779!important;opacity:1!important}
button,.cta .primary,#search button,.optin button{
  background:var(--wi-action)!important;color:#fff!important;border-color:var(--wi-action)!important
}
button:hover,.cta .primary:hover,#search button:hover,.optin button:hover{background:var(--wi-action-hover)!important}
button:disabled{background:#667085!important;color:#fff!important;cursor:not-allowed!important}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:3px solid var(--wi-focus)!important;outline-offset:3px!important
}
.status-ok{color:var(--wi-success)!important}.status-warn{color:var(--wi-warning)!important}.status-bad{color:var(--wi-danger)!important}
.status-ok::before{content:"✓ "}.status-warn::before{content:"⚠ "}.status-bad::before{content:"✕ "}

/* Admin builder must always be light, regardless of inherited/site styles. */
body.wi-admin-v310{color-scheme:light;background:#f5f7fa!important;color:var(--wi-text-on-light)!important}
body.wi-admin-v310 .card,
body.wi-admin-v310 section,
body.wi-admin-v310 .wi310-panel{
  color:var(--wi-text-on-light)!important;
}
body.wi-admin-v310 .card{background:#fff!important;border-color:var(--wi-border-light)!important}
body.wi-admin-v310 h1,body.wi-admin-v310 h2,body.wi-admin-v310 h3,
body.wi-admin-v310 label,body.wi-admin-v310 p,body.wi-admin-v310 span,
body.wi-admin-v310 div{color:inherit}
body.wi-admin-v310 small,body.wi-admin-v310 .muted{color:var(--wi-muted-on-light)!important}
body.wi-admin-v310 a{color:var(--wi-link-light)!important}
body.wi-admin-v310 header a{background:#111827!important;color:#fff!important}
body.wi-admin-v310 button{background:#111827!important;color:#fff!important}
body.wi-admin-v310 button.primary,body.wi-admin-v310 .wi310-primary{background:var(--wi-action)!important;color:#fff!important}
body.wi-admin-v310 .note{background:#fff4ce!important;color:#5f4400!important}
body.wi-admin-v310 .P0,body.wi-admin-v310 .P1{color:var(--wi-danger)!important}
body.wi-admin-v310 .P2{color:var(--wi-warning)!important}
body.wi-admin-v310 .P3{color:var(--wi-muted-on-light)!important}

/* v3.1 public UX */
.wi310-public-tools{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:9px 0 18px}
.wi310-public-tools button,.wi310-public-tools a{min-height:42px;border-radius:999px;padding:8px 13px;text-decoration:none;font:800 12px system-ui}
.wi310-trends{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:8px 0 18px}
.wi310-trends article{background:var(--wi-surface-dark);border:1px solid var(--wi-border-dark);border-radius:13px;padding:10px;color:var(--wi-text-on-dark)}
.wi310-trends b{display:block;font-size:18px;color:var(--wi-text-on-dark)}.wi310-trends span{font-size:10px;color:var(--wi-muted-on-dark)}
.wi310-panel{background:#fff;border:1px solid var(--wi-border-light);border-radius:14px;padding:14px;margin:10px 0;color:var(--wi-text-on-light)}
.wi310-panel h2{margin-top:0}.wi310-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.wi310-test{border:1px solid var(--wi-border-light);border-radius:10px;padding:10px;background:#fff;color:var(--wi-text-on-light)}
.wi310-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}
.wi310-file{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:end}.wi310-file button{min-height:40px}
.wi310-log-tools{display:grid;grid-template-columns:1fr 140px auto;gap:7px;margin-bottom:8px}
.wi310-log-row{border-top:1px solid #e4e7ec;padding:8px 0;color:var(--wi-text-on-light)}
.wi310-drag-handle{cursor:grab;background:#eef2f7!important;color:#344054!important;border:1px solid #d0d5dd!important}
.wi310-order-actions{display:flex;gap:4px}
.wi310-order-actions button{min-width:38px;min-height:38px}
.wi310-emergency{border:2px solid #f3b3ae!important;background:#fff8f7!important}
@media(max-width:800px){.wi310-trends{grid-template-columns:repeat(2,1fr)}.wi310-grid{grid-template-columns:1fr}.wi310-log-tools{grid-template-columns:1fr}.wi310-file{grid-template-columns:1fr}}
@media(forced-colors:active){
  *{forced-color-adjust:auto}
  .card,.live,.how article,.optin,.sheet,.wi310-panel,.wi310-test{border:1px solid CanvasText!important}
  a,button,input,select,textarea{outline-color:Highlight!important}
}
