@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap');

:root {
  --paper: #f5f6fb; --surface: #ffffff; --ink: #20244a; --ink-2: #3a3f6b; --muted: #5d6483; --line: #e1e4ef; --line-2: #cfd3e3;
  --hl: #ffd84d; --hl-soft: #fff3c2; --live: #0e9f74; --live-soft: #def5ec; --warn: #a76300; --warn-soft: #fff1dc;
  --bad: #c2352b; --bad-soft: #fde9e7; --info-soft: #e8eaf7;
  --btn: #20244a; --btn-ink: #ffffff;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --lift: 0 1px 0 rgba(32,36,74,.04), 0 8px 24px -12px rgba(32,36,74,.18);
  --ui: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --read: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #11132a; --surface: #191c3a; --ink: #eceefa; --ink-2: #c9cdea; --muted: #9aa0c3; --line: #2a2e55; --line-2: #3a3f6b;
  --hl: #f2c94c; --hl-soft: rgba(242,201,76,.16); --live: #34d399; --live-soft: rgba(52,211,153,.13); --warn: #f0b04a; --warn-soft: rgba(240,176,74,.13);
  --bad: #ff8278; --bad-soft: rgba(255,130,120,.13); --info-soft: #23274a;
  --btn: #eceefa; --btn-ink: #11132a; --lift: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11132a; --surface: #191c3a; --ink: #eceefa; --ink-2: #c9cdea; --muted: #9aa0c3; --line: #2a2e55; --line-2: #3a3f6b;
    --hl: #f2c94c; --hl-soft: rgba(242,201,76,.16); --live: #34d399; --live-soft: rgba(52,211,153,.13); --warn: #f0b04a; --warn-soft: rgba(240,176,74,.13);
    --bad: #ff8278; --bad-soft: rgba(255,130,120,.13); --info-soft: #23274a;
    --btn: #eceefa; --btn-ink: #11132a; --lift: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.55 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
::selection { background: var(--hl); color: #20244a; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: clamp(2.3rem, 5.4vw, 4.1rem); font-weight: 800; letter-spacing: -.035em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.12rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.read { font-family: var(--read); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
mark, .hl { background: linear-gradient(transparent 12%, var(--hl-soft) 12%, var(--hl-soft) 88%, transparent 88%); color: inherit; padding: 0 .1em; }

/* ── Top bar ── */
.top { background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.08rem; display: inline-flex; align-items: center; gap: 9px; text-decoration: none; letter-spacing: -.02em; }
.logo img { display: block; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.top nav a { padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; }
.top nav a:hover { color: var(--ink); background: var(--info-soft); }
.top nav a.active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

/* ── Buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; background: var(--btn); color: var(--btn-ink); text-decoration: none; line-height: 1.2;
  transition: transform .12s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--info-soft); }
.btn.hl { background: var(--hl); color: #20244a; }
.btn.small { padding: 6px 12px; font-size: .875rem; }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.block { width: 100%; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; color: inherit; padding: 0; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
textarea { min-height: 150px; resize: vertical; }
textarea.read { font-size: 1.06rem; line-height: 1.6; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; accent-color: var(--ink); }
.hint { font-size: .84rem; color: var(--muted); margin-top: 5px; }
kbd { font: 600 .75rem var(--ui); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); }

/* ── Surfaces ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel.flat { border-radius: var(--r); }
.panel.lift { box-shadow: var(--lift); }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 18px; }
.hidden { display: none !important; }

/* ── Notices, toasts ── */
.notice { padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: .93rem; }
.notice.ok { background: var(--live-soft); color: var(--live); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--info-soft); color: var(--ink-2); }
.toast-host { position: fixed; right: 16px; bottom: 16px; left: 16px; display: grid; justify-items: end; gap: 8px; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
  animation: toast-in .25s ease-out; }
.toast.ok { background: var(--live); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ── Status dots & pill ── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--line-2); flex: none; }
.dot.online { background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: beat 2.4s ease-out infinite; }
.dot.degraded { background: var(--warn); }
.dot.offline { background: var(--bad); }
@keyframes beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.status-pill { position: relative; }
.status-pill > button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 500 .85rem var(--ui); cursor: pointer; }
.status-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: 0 20px 40px -20px rgba(20,24,60,.35); z-index: 40;
  transform-origin: top right; animation: pop .16s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.status-pop ul { list-style: none; padding: 0; margin: 0; }
.status-pop li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.status-pop li:last-child { border-bottom: 0; }
.status-pop .d { margin-left: auto; color: var(--muted); font-size: .8rem; }
.offline-bar { background: var(--bad); color: #fff; text-align: center; padding: 8px 16px; font-weight: 600; font-size: .9rem; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--info-soft); color: var(--ink-2); white-space: nowrap; }
.badge.live { background: var(--live-soft); color: var(--live); }
.badge.pending, .badge.submitted { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.removed { background: var(--bad-soft); color: var(--bad); }
.badge.dofollow { background: var(--hl); color: #20244a; }
.badge.premium { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }

/* ── Stats ── */
.stat .label { color: var(--muted); font-size: .86rem; font-weight: 500; }
.stat .value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.meter { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .84rem; }
td.url { max-width: 360px; overflow-wrap: anywhere; }

/* ── Auth pages ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth .panel { width: 100%; max-width: 430px; padding: 30px; }
.auth .logo { margin-bottom: 20px; }

.spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--line) 0%, var(--info-soft) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Modal ── */
.modal-back { position: fixed; inset: 0; background: rgba(17,19,42,.55); display: grid; place-items: center; padding: 16px; z-index: 60; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(1060px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; animation: pop .18s ease-out; }
@keyframes fade { from { opacity: 0; } }

footer.site { padding: 36px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 56px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (max-width: 640px) {
  .status-pop { position: fixed; left: 16px; right: 16px; top: 76px; width: auto; max-height: calc(100vh - 100px); overflow: auto; }
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
