:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #fff;
  --ink: #17233b;
  --muted: #566578;
  --line: #dce3ed;
  --accent: #244ad8;
  --accent-light: #eef2ff;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #7990ff; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3.8vw, 2.45rem); letter-spacing: -.05em; line-height: 1.1; }
h2 { font-size: 1.03rem; letter-spacing: -.02em; }
small { font-size: .86rem; }
button, .download a {
  font: inherit; font-size: .9rem; font-weight: 650; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: .62rem .92rem; cursor: pointer; white-space: nowrap;
}
button:hover, .download a:hover { background: var(--accent-light); }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: #1938b5; border-color: #1938b5; }
.quiet { background: transparent; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner, .shell { max-width: 1240px; margin: auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }
.top-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.brand { display: inline-flex; gap: .65rem; align-items: center; text-decoration: none; color: var(--ink); font-weight: 750; letter-spacing: -.035em; font-size: 1.18rem; }
.mark { width: 31px; height: 31px; display: grid; grid-template-columns: repeat(2, 7px); grid-auto-rows: 7px; gap: 3px; place-content: center; border-radius: 8px; background: var(--accent); }
.mark i { border: 2px solid #fff; border-radius: 2px; }
.shell { padding-block: 2.15rem 3rem; }
.heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.35rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; }
.layout { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); align-items: start; gap: 1rem; }
.sidebar { padding: .7rem; }
.sidebar h2 { display: flex; align-items: center; justify-content: space-between; padding: .45rem .45rem .75rem; }
.sidebar h2 span, .sidebar small, .sidebar li a > span { color: var(--muted); font-weight: 500; font-size: .84rem; }
.sidebar ul { padding: 0; margin: 0; list-style: none; }
.sidebar li a { display: flex; justify-content: space-between; gap: .7rem; align-items: center; padding: .65rem .55rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.sidebar li a:hover, .sidebar li a[aria-current] { background: var(--accent-light); }
.sidebar strong { display: block; font-size: .93rem; overflow-wrap: anywhere; }
.sidebar small { display: block; overflow-wrap: anywhere; }
.detail { display: grid; gap: 1rem; min-width: 0; }
.link-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2rem; padding: 1.25rem; }
.link-title { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.link-title h2 { font-size: clamp(1.25rem, 3vw, 1.8rem); line-height: 1.1; overflow-wrap: anywhere; }
.status { font-size: .82rem; padding: .23rem .55rem; border-radius: 100px; color: #0c5d42; background: #e2f6ec; }
.status.paused { color: #684728; background: #faeddb; }
.target { margin: .7rem 0 1rem; overflow-wrap: anywhere; font-size: .915rem; }
.target span { font-weight: 700; margin-right: .25rem; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.copy-row input { flex: 1 1 12em; min-width: 0; background: #f6f8fc; }
.copy-result { color: var(--muted); font-size: .875rem; padding: .3rem 0; }
.edit { margin-top: .25rem; }
.qr { display: grid; justify-items: center; align-content: center; gap: .45rem; }
.qr img { background: #fff; border: 1px solid var(--line); border-radius: 9px; display: block; }
.download { display: flex; gap: .35rem; }
.download a { padding: .34rem .68rem; text-decoration: none; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.metric { padding: .9rem 1rem; min-height: 113px; }
.metric h2 { color: var(--muted); font-size: .875rem; font-weight: 650; }
.metric strong { font-variant-numeric: tabular-nums; display: block; font-size: 1.9rem; line-height: 1.3; }
.metric small, .muted, .section-title span { color: var(--muted); }
.section-title { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .25rem .65rem; margin-bottom: .85rem; }
.section-title span { font-size: .85rem; }
.report { padding: 1rem; min-width: 0; }
.reports { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart { display: flex; align-items: stretch; gap: clamp(2px, .4vw, 5px); height: 112px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 27px, #edf0f6 28px, transparent 29px); }
.bar-slot { display: flex; justify-content: center; flex: 1; min-width: 0; }
.bar-slot meter { writing-mode: vertical-lr; direction: rtl; appearance: none; width: min(100%, 20px); height: 100%; }
.bar-slot meter::-webkit-meter-bar { background: transparent; border: 0; }
.bar-slot meter::-webkit-meter-optimum-value { background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-slot meter::-moz-meter-bar { background: var(--accent); border-radius: 4px 4px 0 0; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; margin: .35rem 0 .65rem; }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: .42rem .2rem; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 650; }
th:last-child, td:last-child { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 2.5rem clamp(1rem, 4vw, 2.5rem); }
.empty h2 { font-size: 1.45rem; }
.empty p { margin: .45rem 0 1rem; color: var(--muted); }
.single { width: min(100%, 430px); margin: clamp(2rem, 9vw, 6rem) auto; padding-inline: 1rem; }
.login { padding: 1.5rem; }
.login h1 { margin-bottom: 1rem; font-size: 1.8rem; }
.login button { margin-top: 1rem; }
.notice { margin-bottom: 1rem; border-radius: 8px; padding: .55rem .8rem; background: #e2f6ec; color: #134a38; }
.notice.error { background: #ffe8e5; color: #842525; }
dialog { width: min(520px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; }
dialog::backdrop { background: #101a2d8c; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: .5rem; }
.dialog-heading h2 { font-size: 1.35rem; }
.fields { display: grid; gap: .85rem; }
.fields > button { justify-self: start; }
label { display: block; font-weight: 650; font-size: .9rem; }
label small { color: var(--muted); font-weight: 400; }
input:not([type=checkbox]) { border: 1px solid #ccd5e2; color: var(--ink); border-radius: 8px; padding: .6rem .65rem; font: inherit; font-size: 1rem; width: 100%; }
label > input:not([type=checkbox]), .prefix { margin-top: .25rem; }
.prefix { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.options { display: grid; gap: .4rem; }
.options label { display: flex; align-items: baseline; gap: .4rem; font-weight: 500; }
input[type=checkbox] { accent-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 780px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar ul { display: flex; overflow: auto; gap: .3rem; }
  .sidebar li { min-width: 130px; max-width: 190px; flex: 0 0 auto; }
}
@media (max-width: 530px) {
  .link-card, .reports { grid-template-columns: minmax(0, 1fr); }
  .qr { justify-items: start; }
  .metrics { gap: .4rem; }
  .metric { padding: .55rem; }
  .metric h2, .metric small { font-size: .82rem; overflow-wrap: anywhere; }
}

.toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.campaign-filter { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
select { border: 1px solid #ccd5e2; color: var(--ink); background: var(--panel); border-radius: 8px; padding: .56rem .65rem; font: inherit; max-width: 100%; }
select:focus-visible { outline: 3px solid #7990ff; outline-offset: 3px; }
.campaign-filter select { max-width: min(16rem, 58vw); }
.ranges { display: flex; flex-wrap: wrap; gap: .25rem; margin-left: auto; }
.ranges a { padding: .4rem .65rem; text-decoration: none; color: var(--muted); font-size: .9rem; border-radius: 8px; }
.ranges a[aria-current], .ranges a:hover { color: var(--accent); background: var(--accent-light); }
.campaign-report { margin-bottom: 1rem; }
.section-title a { font-size: .9rem; }
.table-scroll { overflow-x: auto; }
.table-scroll td:not(:first-child) { white-space: nowrap; }
.table-scroll td, .table-scroll th { padding-inline: .4rem; }
.note { font-size: .875rem; }
.campaign-report .note, .breakdown-note { margin: .55rem 0; }
.expiry { margin: -.55rem 0 .85rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.subfields { display: grid; gap: .65rem; margin-top: .55rem; padding: .7rem; border: 1px solid var(--line); border-radius: 8px; }
.subfields select { display: block; width: 100%; margin-top: .25rem; }
.chart { gap: min(.4vw, 4px); }
@media (max-width: 430px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}

.link-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.link-actions a { font-size: .9rem; }
.crumb { margin-bottom: .65rem; font-size: .9rem; }
.report-link { margin-top: .5rem; overflow-wrap: anywhere; }
.button-link { padding: .62rem .92rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-size: .9rem; font-weight: 650; text-decoration: none; }
.button-link:hover { background: var(--accent-light); }
.period-picker { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; padding: 1rem; margin-bottom: 1rem; }
.detail-metrics, .time-report { margin-bottom: 1rem; }
.heat-scroll { padding-bottom: .25rem; }
.heatmap { border-collapse: separate; border-spacing: 3px; table-layout: fixed; min-width: 786px; }
.heatmap td, .heatmap th, .heatmap td:last-child, .heatmap th:last-child { padding: .32rem .15rem; text-align: center; border: 0; border-radius: 4px; font-size: .8rem; }
.heatmap td { background: #f0f3f8; color: var(--muted); }
.heatmap .heat-1 { background: #e0e8ff; color: #17233b; }
.heatmap .heat-2 { background: #adbeff; color: #17233b; }
.heatmap .heat-3 { background: #4967d8; color: #fff; }
.heatmap .heat-4 { background: #203db3; color: #fff; }
.analytics-hint { margin-bottom: 1rem; padding: .75rem 1rem; color: var(--muted); }
.analytics-tables td { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .detail-metrics { grid-template-columns: minmax(0, 1fr); }
  .detail-metrics .metric { min-height: 0; padding: .75rem; }
}
.domain-picker { display: block; width: 100%; margin-top: .25rem; }
