:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --accent: #0969da;
  --soft: #f6f8fa;
  --green: #1a7f37;
  --red: #cf222e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --fg: #f0f6fc;
    --muted: #a8b3bf;
    --border: #3d444d;
    --accent: #79c0ff;
    --soft: #151b23;
    --green: #56d364;
    --red: #ff7b72;
  }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #0d1117; --fg: #f0f6fc; --muted: #a8b3bf; --border: #3d444d; --accent: #79c0ff; --soft: #151b23; --green: #56d364; --red: #ff7b72; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
input, select, textarea { min-width: 0; }
select { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
button, a, summary { touch-action: manipulation; }
button, .button, .text-button { cursor: pointer; }
button, .button { color: var(--fg); background: var(--soft); border: 1px solid var(--border); padding: 9px 13px; border-radius: 7px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-weight: 600; }
button:hover, .button:hover { background: color-mix(in srgb, var(--fg) 10%, var(--bg)); }
button:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { background: #1f883d; color: #fff; border-color: #1f883d; }
.primary:hover { background: #1a7f37; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
.text-button { background: none; border: 0; color: var(--accent); padding: 6px 0; text-decoration: none; font-size: 12px; }
.text-button:hover { background: none; text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; overflow-wrap: anywhere; scroll-margin-top: 16px; }
h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.2; letter-spacing: -.8px; font-weight: 650; }
h2 { font-size: 20px; letter-spacing: -.4px; line-height: 1.35; }
h3 { font-size: 15px; margin-bottom: 8px; }
p { margin: 6px 0 12px; }
.shell { max-width: 1300px; padding: 30px max(24px, env(safe-area-inset-right)) 20px max(24px, env(safe-area-inset-left)); margin: auto; }
header, .brand, .section-heading, .dialog-heading, .label-row, .toolbar, .button-row, footer { display: flex; align-items: center; gap: 12px; }
header, .section-heading, .dialog-heading, .label-row, footer { justify-content: space-between; }
.brand-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 13px; font-size: 30px; text-align: center; background: var(--fg); color: var(--bg); }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.badge { border: 1px solid var(--border); color: var(--muted); border-radius: 20px; padding: 3px 9px; font-size: 11px; white-space: nowrap; }
.intro { color: var(--muted); margin: 16px 0; }
.storage-notice { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 12px; margin-bottom: 12px; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin: 22px 0 24px; overflow: auto; padding: 4px; }
.tab { border: 0; background: none; padding: 12px 0; border-radius: 0; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.selected { border-bottom-color: #fd8c73; color: var(--fg); }
.tab:hover { background: none; color: var(--fg); }
#nav-count { background: var(--soft); border-radius: 15px; font-size: 11px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.section-heading { margin-bottom: 20px; }
.section-heading p, .muted, .hint, small { color: var(--muted); }
.section-heading p { font-size: 12px; margin-bottom: 0; }
.guide { max-width: 900px; overflow-wrap: anywhere; }
.guide .card { margin-top: 20px; }
.guide-steps { padding-left: 24px; margin: 12px 0; }
.guide-steps li { padding-left: 6px; margin-bottom: 16px; }
.guide-steps li::marker { color: var(--accent); font-weight: 700; }
.guide-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 16px 0; }
.guide dt { font-weight: 600; }
.guide dd { margin: 4px 0 0; }
.guide-example-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; margin: 16px 0; }
.guide-example-fields dd { margin: 0; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.card { padding: 22px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); min-width: 0; }
.subtle { background: var(--soft); font-size: 12px; margin-top: 16px; }
.subtle p { margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field { margin-bottom: 18px; }
.field, .three-col > *, .four-col > * { min-width: 0; }
label, .field-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
label span { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }
input:not([type="checkbox"]), select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); padding: 9px 10px; min-height: 42px; font-size: 14px; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
small { display: block; font-size: 12px; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.three-col, .four-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.four-col { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.studio-card { margin-top: 20px; }
.drop-zone { border: 2px dashed var(--border); padding: 18px; border-radius: 8px; margin: 16px 0; }
.custom-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin: 10px 0; }
.danger { color: var(--red); margin-top: 16px; }
.qr-thumbnail { float: right; width: 96px; margin: 8px; font-size: 11px; }
.qr-thumbnail img { width: 96px; height: 96px; }
#qr-quality, #qr-status { overflow-wrap: anywhere; }
#action-fields label { margin: 14px 0; }
input[type="color"] { padding: 3px; cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 20px; font-size: 12px; padding: 7px 12px; font-weight: 500; }
.chip.active { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); color: var(--accent); border-color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-bottom: 14px; }
details:not([open]) > :not(summary) { display: none; }
.studio-card p { overflow-wrap: anywhere; }
.hint { font-size: 12px; margin: 12px 0 16px; }
.wide { width: 100%; }
.preview-card h3 { font-size: 20px; margin: 10px 0; }
.preview-card p { color: var(--muted); font-size: 12px; }
.url-box { display: block; background: var(--soft); border: 1px solid var(--border); border-radius: 7px; padding: 15px; margin: 16px 0; overflow-wrap: anywhere; white-space: pre-wrap; font: 12px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: text; }
.preview-card .success-text { color: var(--green); }
.button-row { flex-wrap: wrap; gap: 8px; }
.toolbar { flex-wrap: wrap; padding: 14px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; }
.toolbar label { margin: 0; font-weight: 400; min-width: 0; }
.search-label { flex: 1; min-width: 200px !important; }
.check { display: flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 40px; }
#link-form .check { white-space: normal; }
#link-form .check input { flex-shrink: 0; }
.compact { margin: 14px 0; font-size: 12px; }
.compact button { font-size: 12px; padding: 7px 10px; }
.links-list { display: grid; gap: 12px; }
.link-card { padding: 17px 20px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.link-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.link-card h3 { margin: 0; }
.link-card .meta { color: var(--muted); font-size: 12px; margin: 6px 0 12px; overflow-wrap: anywhere; }
.link-card .url-box { margin: 10px 0; padding: 8px 12px; max-height: 110px; overflow: auto; }
.link-card button { font-size: 12px; padding: 7px 10px; }
.link-note { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.empty { border: 1px dashed var(--border); border-radius: 10px; padding: 42px 22px; text-align: center; }
.empty p { color: var(--muted); font-size: 12px; }
#load-more { margin-top: 16px; }
.initiative-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.initiative-grid .card, .bar-row { content-visibility: auto; contain-intrinsic-size: auto 150px; }
.initiative-grid code { font-size: 12px; color: var(--accent); overflow-wrap: anywhere; }
.initiative-grid .card p { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.initiative-grid .button-row { margin-top: 16px; }
.initiative-grid button { font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 18px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.stat-value { display: block; font-size: 28px; font-weight: 600; margin: 6px 0; letter-spacing: -.7px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label, .stat-detail { color: var(--muted); font-size: 12px; }
.bar-row { margin-top: 16px; contain-intrinsic-size: auto 50px; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 6px; overflow-wrap: anywhere; }
.bar-label span { min-width: 0; }
.bar-label strong { font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 9px; border: 0; border-radius: 10px; background: var(--soft); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--soft); border-radius: 10px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
.tracking-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; background: var(--soft); }
.tracking-card h3 { margin: 12px 0 6px; }
.tracking-card p { font-size: 12px; color: var(--muted); max-width: 600px; margin: 0; }
.tracking-card button { font-size: 12px; }
footer { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 18px; font-size: 12px; color: var(--muted); }
footer strong, footer span { display: block; }
footer strong { font-weight: 600; }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 14px; }
.error, .notice { border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin: 12px 0; font-size: 13px; overflow-wrap: anywhere; }
.error { border-color: var(--red); color: var(--red); }
.notice { border-color: var(--green); }
dialog { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 12px; width: min(560px, calc(100% - 32px)); max-height: 90vh; overflow: auto; overscroll-behavior: contain; padding: 24px; box-shadow: 0 20px 80px #0004; }
dialog::backdrop { background: #0007; }
.dialog-heading { margin-bottom: 14px; }
.dialog-heading button { border: none; font-size: 21px; padding: 0; min-width: 40px; min-height: 40px; }
dialog > p, dialog form > p { font-size: 13px; color: var(--muted); }
dialog h3 { margin-top: 22px; }
.qr-image { display: flex; justify-content: center; background: #fff; margin: 16px 0; border-radius: 6px; }
.qr-image img { display: block; width: 100%; max-width: 340px; height: auto; aspect-ratio: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -80px; left: 16px; z-index: 1; padding: 12px; background: var(--bg); }
.skip-link:focus { top: 8px; }
@media (max-width: 820px) {
  .shell { padding: 22px max(18px, env(safe-area-inset-right)) 22px max(18px, env(safe-area-inset-left)); }
  .builder-grid { grid-template-columns: 1fr; }
  .subtle { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tracking-card { display: block; }
  .tracking-card button { margin-top: 15px; }
}
@media (max-width: 480px) {
  header { align-items: start; flex-wrap: wrap; }
  header .badge { display: none; }
  .tabs { gap: 19px; }
  .tab { font-size: 12px; }
  .two-col, .three-col, .four-col { grid-template-columns: 1fr; gap: 0; }
  .custom-row { grid-template-columns: 1fr; }
  header .button-row { max-width: 150px; }
  .guide-channels, .guide-example-fields { grid-template-columns: 1fr; }
  .guide-example-fields { gap: 4px; }
  .guide-example-fields dd { margin-bottom: 8px; }
  .dashboard-charts { gap: 14px; }
  .section-heading { align-items: start; flex-wrap: wrap; }
  .card { padding: 17px; }
  .toolbar > label { width: 100%; }
  input:not([type="checkbox"]), select, textarea { font-size: 16px; }
  footer { align-items: start; flex-direction: column; }
}
