/* Gully Offerwall UI on Studio Light (S), the Gully Chain design system (gully-ops sites/_shared/studio-light, spec in
 * its README). The kit files under /assets/studio-light/ are byte-identical copies; this file only maps the Offerwall's
 * class names (shared by the landing, the dashboard and the widget) onto the kit tokens. White ground, Inter, one
 * accent (#0A86C2 for fills and charts, #075F8C for links), ink primary buttons, radii 8/10/12/14. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('/assets/studio-light/tokens.css');
@import url('/assets/studio-light/components.css');

:root {
  /* legacy names used by the dashboard and widget templates, pointed at Studio Light */
  --night: var(--sl-bg);
  --ink: var(--sl-bg);
  --ink-2: var(--sl-surface);
  --line: var(--sl-border);
  --line-strong: var(--sl-border-strong);
  --cyan: var(--sl-accent);
  --blue: var(--sl-link);
  --green: var(--sl-ok);
  --white: var(--sl-text);
  --muted: var(--sl-muted);
  --danger: var(--sl-danger);
  --warn: var(--sl-warn);
  --chain: var(--sl-accent);
  --radius: var(--sl-r-sm);
  --r-pill: var(--sl-r-pill);
  --font: var(--sl-font);
  --mono: var(--sl-font-mono);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sl-bg);
  color: var(--sl-text);
  font: 400 var(--sl-fs)/var(--sl-lh) var(--sl-font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-width: 0;
}
img, svg { max-width: 100%; }
a { color: var(--sl-link); text-decoration: none; }
a:hover { color: var(--sl-link-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--sl-accent);
  outline-offset: 2px;
}
h1, h2, h3 { font-weight: 800; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; color: var(--sl-text); }
h1 { font-size: var(--sl-fs-h1); line-height: 1.04; letter-spacing: -.035em; }
h2 { font-size: var(--sl-fs-h2); }
h3 { font-size: var(--sl-fs-h3); }
p { margin: 0 0 1em; }
.muted { color: var(--sl-muted); }
.label { color: var(--sl-muted); font: 600 12px/1.4 var(--sl-font); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--sl-link); margin: 0 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--sl-maxw); margin: 0 auto; padding: 0 var(--sl-gutter); }

/* ---------------------------------------------------------------- header: kit logo files + product, nav, switcher */
.hdr { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--sl-border); }
.hdr .wrap { display: flex; align-items: center; gap: 16px; min-height: var(--sl-header-h); flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.hdr .sl-wm { min-height: 44px; border-radius: var(--sl-r-sm); }
.hdr .sl-wm:hover { text-decoration: none; }
.hdr gc-switcher { flex: none; }
.hdr nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.hdr nav a, .hdr nav button.navbtn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: var(--sl-r-sm);
  color: var(--sl-text-2); font: 500 14px var(--sl-font); background: none; border: 0; cursor: pointer; white-space: nowrap;
  transition: background var(--sl-dur);
}
.hdr nav a .ico { width: 16px; height: 16px; }
.hdr nav a:hover, .hdr nav button.navbtn:hover { color: var(--sl-text); text-decoration: none; background: var(--sl-hover); }
.hdr nav a[aria-current='page'] { color: var(--sl-text); background: var(--sl-hover); font-weight: 700; }
.hdr .end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
@media (min-width: 1100px) { .hdr .wrap { flex-wrap: nowrap; } .hdr nav { flex-wrap: nowrap; } }
@media (max-width: 1099px) { .hdr nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; } }
@media (max-width: 1099px) { .hdr .wrap { gap: 8px 12px; } .hdr nav a { min-height: 44px; } }
/* 390 px: the kit tile icon carries the brand, the wordmark SVG comes back from 430 px (never a typed wordmark) */
@media (max-width: 429px) { .hdr .sl-wm .sl-wm-t { display: none; } .hdr .end .btn .lbl-long { display: none; } }

.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- buttons (kit: ink primary, white secondary) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: var(--sl-r-sm); border: 1px solid transparent;
  background: var(--sl-text); color: #FFFFFF; font: 700 14px/1 var(--sl-font);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .15s ease, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; color: #FFFFFF; background: #23262E; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }
.btn.accent { background: var(--sl-accent); color: var(--sl-on-accent); font-weight: 800; }
.btn.accent:hover { background: #0877AD; }
.btn.secondary, .btn.ghost { background: var(--sl-bg); color: var(--sl-text); border-color: var(--sl-border-strong); }
.btn.secondary:hover, .btn.ghost:hover { background: var(--sl-hover); color: var(--sl-text); }
.btn.danger { background: var(--sl-bg); color: var(--sl-danger); border-color: #F1B5AF; }
.btn.danger:hover { background: var(--sl-danger-bg); color: var(--sl-danger); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { min-height: 46px; padding: 0 20px; border-radius: var(--sl-r); font-size: 15px; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------- cards, tiles, forms */
.card { background: var(--sl-bg); border: 1px solid var(--sl-border); border-radius: var(--sl-r-lg); padding: 16px; min-width: 0; }
a.card, button.card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
a.card:hover, button.card:hover { transform: translateY(-2px); box-shadow: var(--sl-shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.tile { background: var(--sl-bg); border: 1px solid var(--sl-border); border-radius: var(--sl-r-md); padding: 14px; min-width: 0; transition: border-color var(--sl-dur); }
.tile:hover { border-color: var(--sl-accent); }
.tile .v { font-size: 22px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .k { color: var(--sl-muted); font: 500 12px/1.4 var(--sl-font); }
.tile .s { display: block; width: 100%; height: 28px; margin-top: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--sl-r-pill); font: 700 12px/1 var(--sl-font); background: var(--sl-surface); color: var(--sl-text-2); white-space: nowrap; border: 0; }
.pill.live { background: var(--sl-ok-bg); color: var(--sl-ok); }
.pill.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #16A34A; animation: sl-pulse 1.4s ease-in-out infinite; }
.pill.warn { background: var(--sl-warn-bg); color: var(--sl-warn); }
.pill.bad { background: var(--sl-danger-bg); color: var(--sl-danger); }
.pill.info { background: var(--sl-info-bg); color: var(--sl-info); }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; align-content: start; }
.field label { font-size: 13px; color: var(--sl-text-2); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--sl-muted); }
input, select, textarea {
  width: 100%; min-width: 0; background: var(--sl-bg); color: var(--sl-text); border: 1px solid var(--sl-border-strong); border-radius: var(--sl-r-sm);
  padding: 9px 12px; font: 400 14px var(--sl-font);
}
input:focus, select:focus, textarea:focus { border-color: var(--sl-accent); }
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.split { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--sl-divider); vertical-align: top; }
th { color: var(--sl-muted); font: 600 12px var(--sl-font); background: var(--sl-surface); border-bottom-color: var(--sl-border); white-space: nowrap; }
tbody tr:hover td { background: var(--sl-surface); }
td.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--sl-border); border-radius: var(--sl-r-md); }
.table-wrap table tr:last-child td { border-bottom: 0; }
code, .mono { font-family: var(--sl-font-mono); font-size: 13px; word-break: break-all; }
code { background: var(--sl-surface); border-radius: 5px; padding: 1px 5px; }
pre { background: var(--sl-surface); border: 1px solid var(--sl-border); border-radius: var(--sl-r); padding: 12px; overflow-x: auto; max-width: 100%; }
pre code { background: none; padding: 0; }

/* ---------------------------------------------------------------- stepper */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; counter-reset: s; }
.stepper li {
  counter-increment: s; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: var(--sl-r-md);
  border: 1px solid var(--sl-border); color: var(--sl-text-2); font-size: 13px; font-weight: 600;
}
.stepper li::before {
  content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--sl-surface); color: var(--sl-text); font: 800 12px var(--sl-font);
}
.stepper li.active { color: var(--sl-text); border-color: var(--sl-accent); }
.stepper li.active::before { background: var(--sl-accent); color: #fff; }
.stepper li.done { color: var(--sl-text); }
.stepper li.done::before { content: '\2713'; background: var(--sl-ok-bg); color: var(--sl-ok); }

/* ---------------------------------------------------------------- toasts (bottom-right, kit look) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  position: relative; overflow: hidden; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px 12px;
  background: var(--sl-bg); color: var(--sl-text); border: 1px solid var(--sl-border); border-left: 3px solid var(--sl-accent);
  border-radius: var(--sl-r); box-shadow: var(--sl-shadow-pop); animation: sl-rise .25s ease-out both;
}
.toast .ico { color: var(--sl-accent); margin-top: 1px; width: 18px; height: 18px; }
.toast.ok { border-left-color: #16A34A; } .toast.ok .ico { color: #16A34A; }
.toast.err { border-left-color: var(--sl-danger); } .toast.err .ico { color: var(--sl-danger); }
.toast b { display: block; font-size: 13px; }
.toast span { color: var(--sl-muted); font-size: 13px; }
.toast i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--sl-accent); animation: toast-bar linear forwards; }
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }

/* ---------------------------------------------------------------- charts (ui.js LiveChart on canvas) */
.chart { position: relative; min-width: 0; }
.chart canvas { display: block; width: 100%; height: 150px; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--sl-text); color: #fff; border-radius: 6px;
  padding: 4px 8px; font: 600 12px var(--sl-font); white-space: nowrap; transform: translate(-50%, -120%); display: none; z-index: 2;
}
.chart .tip .muted { color: #C9CDD4; font-weight: 500; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-head h2, .chart-head .label { margin: 0; font-size: 14px; font-weight: 800; color: var(--sl-text); }
details.table-view summary { cursor: pointer; color: var(--sl-muted); font-size: 12px; margin-top: 6px; }

/* ---------------------------------------------------------------- footer + badges */
.ftr { border-top: 1px solid var(--sl-border); margin-top: 40px; font-size: 13px; color: var(--sl-muted); }
.ftr .wrap { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.ftr .links { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: 13px; flex: 1 1 320px; }
.ftr .links a { color: var(--sl-text-2); font-weight: 500; }
@media (max-width: 760px) { .ftr .links a { display: inline-flex; align-items: center; min-height: 44px; } .ftr .links { gap: 0 18px; } }
.ftr .bottom { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--sl-muted); font-size: 13px; }
.badge-link { display: inline-flex; line-height: 0; border-radius: 6px; }
.badge-link img { height: 32px; width: auto; display: block; }
.ext::after {
  content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 4px; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.badge-link.ext::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .btn:hover, a.card:hover, button.card:hover { transform: none; }
}

/* ---------------------------------------------------------------- touch: 44 px targets on phones */
@media (max-width: 760px), (pointer: coarse) {
  .btn, .btn.sm { min-height: 44px; }
  input, select { min-height: 44px; }
  details.table-view summary { min-height: 44px; display: flex; align-items: center; }
}
.sl-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--sl-text); color: #fff; padding: 8px 12px; border-radius: var(--sl-r-sm); }
.sl-skip:focus { left: 8px; color: #fff; }

/* ---------------------------------------------------------------- 404 */
.nf { padding: 72px 0 40px; max-width: 640px; }
.nf .code { font: 700 13px var(--sl-font); color: var(--sl-link); }
