/* LNKS — Design System
   Black-and-white spine. Signal Green is an accent — active states and
   accent cards only, never a button. 12px radius across the board.
   Urbanist for type, JetBrains Mono for slugs and detail.
*/

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Urbanist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191,
                 U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Urbanist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/JetBrainsMono-Medium.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --bg:           #F4F3F5;     /* light grey canvas — locked 2026-05-02 */
  --surface:      #FFFFFF;
  --black:        #0A0A0B;     /* true black for headlines + dark cards */
  --ink:          #16161A;     /* primary text + ink buttons */
  --ink-2:        #2A2A2D;     /* slightly lifted ink for borders on dark */
  --slate:        #6B6B73;     /* muted body text */
  --mute:         #A8A8AC;     /* placeholder + tertiary */
  --line:         #E5E4E7;     /* hairline divider */
  --line-soft:    #EFEEF0;

  /* Accent — Signal Green. Used only as status / active / accent card.
     NEVER a button background. */
  --mint:         #75FB90;
  --mint-deep:    #2BC04A;
  --mint-soft:    #E8FEEC;
  --mint-ink:     #0a4a18;

  /* States */
  --danger:       #d83737;
  --danger-soft:  #fdecec;

  /* Tenant theme — picks up agency brand_accent on tenant pages.
     Falls back to mint. Used only on tenant-controlled UI. */
  --brand-accent: var(--mint);

  /* Layout */
  --gutter:       clamp(20px, 3.6vw, 32px);
  --max-width:    1200px;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-pill:  999px;

  /* Type */
  --font:         "Urbanist", -apple-system, BlinkMacSystemFont,
                  "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Transition timing — single curve everywhere. */
  --ease:         cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  letter-spacing: -0.005em;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--black); }

::selection { background: var(--ink); color: #fff; }

/* ── Type scale ────────────────────────────────────────────────── */

.t-display {
  font-size: clamp(40px, 6.5vw, 64px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.t-heading {
  font-size: clamp(28px, 3.6vw, 36px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.t-subhead {
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.t-body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--slate);
}
.t-caption {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--slate);
}
.t-metric {
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}
.eyebrow.on-dark { color: rgba(255, 255, 255, 0.6); }
.eyebrow.is-mint { color: var(--mint-deep); }

.mono, .slug {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* ── Buttons — 12px, never mint. Black, white, or outline. ─────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
  user-select: none;
  white-space: nowrap;
  min-height: 44px;
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: var(--black); color: #fff; }

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn-secondary:hover { border-color: var(--ink); }

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--ink); background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  padding: 12px 14px;
}
.btn-ghost:hover { color: var(--ink); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b22d2d; }

/* On-dark variants — used inside .card-dark, modal overlays. */
.btn-on-dark {
  background: #fff;
  color: var(--ink);
}
.btn-on-dark:hover { background: rgba(255,255,255,0.92); }

.btn-outline-dark {
  background: transparent;
  border-color: rgba(255,255,255,0.18);
  color: #fff;
}
.btn-outline-dark:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.04);
}

.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 15px; min-height: 52px; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.btn-xs { padding: 5px 10px; font-size: 12px; min-height: 28px; }

/* Icon button — 36x36 square, ink hover. */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn-icon:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.btn-icon-onDark {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  color: #fff;
}
.btn-icon-onDark:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}

.btn-icon-danger:hover {
  background: var(--danger); border-color: var(--danger); color: #fff;
}

/* ── Inputs — 12px, hairline border, ink focus. No mint glow. ─── */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.field .hint {
  font-size: 12px;
  color: var(--slate);
  margin-top: 2px;
}
.field .err {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
  min-height: 14px;
}

.input,
.textarea,
.select {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--mute); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--slate); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

/* Mono input variant — used for slug fields. */
.input.mono, .input-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ── Card — alternating black/white. ──────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}

.card-dark {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}
.card-dark a { color: #fff; }
.card-dark .t-display, .card-dark .t-heading, .card-dark .t-subhead { color: #fff; }
.card-dark .t-body, .card-dark .t-caption { color: rgba(255,255,255,0.72); }
.card-dark .eyebrow { color: rgba(255,255,255,0.6); }

/* Black accent card — uses true black + mint accent text.
   For the one "premium" emphasis card per surface. */
.card-accent {
  background: var(--black);
  color: #fff;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}
.card-accent .eyebrow { color: var(--mint); }
.card-accent a { color: #fff; }

/* ── Toggle — single component. Off = grey. On = ink. On-green = mint. */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  vertical-align: middle;
  background: #d4d4d8;
  border-radius: 999px;
  transition: background-color 0.18s var(--ease);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s var(--ease);
}
.toggle.on { background: var(--ink); }
.toggle.on::after { transform: translateX(18px); }
.toggle.on-green { background: var(--mint); }
.toggle.on-green::after { transform: translateX(18px); background: var(--ink); }
.toggle.is-disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Checkbox + Radio — 18x18. ─────────────────────────────────── */
.checkbox {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: 1.5px solid #c4c4c8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.checkbox:hover { border-color: var(--ink); }
.checkbox.on, .checkbox:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
}
.checkbox.on svg, .checkbox svg { color: #fff; width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.checkbox input { display: none; }

.radio {
  display: inline-block;
  width: 18px; height: 18px;
  border: 1.5px solid #c4c4c8;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: border-color 0.14s var(--ease);
}
.radio:hover { border-color: var(--ink); }
.radio.on { border-color: var(--ink); border-width: 5px; }

/* Native form controls in our pages get the same look. */
.app-shell input[type="checkbox"]:not([data-raw]),
form input[type="checkbox"]:not([data-raw]) {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid #c4c4c8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.app-shell input[type="checkbox"]:not([data-raw]):hover,
form input[type="checkbox"]:not([data-raw]):hover { border-color: var(--ink); }
.app-shell input[type="checkbox"]:not([data-raw]):checked,
form input[type="checkbox"]:not([data-raw]):checked {
  background: var(--ink);
  border-color: var(--ink);
}
.app-shell input[type="checkbox"]:not([data-raw]):checked::after,
form input[type="checkbox"]:not([data-raw]):checked::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: 0; border-left: 0;
  transform: rotate(45deg);
}

.app-shell input[type="radio"]:not([data-raw]),
form input[type="radio"]:not([data-raw]) {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid #c4c4c8;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.14s var(--ease), border-width 0.14s var(--ease);
}
.app-shell input[type="radio"]:not([data-raw]):hover,
form input[type="radio"]:not([data-raw]):hover { border-color: var(--ink); }
.app-shell input[type="radio"]:not([data-raw]):checked,
form input[type="radio"]:not([data-raw]):checked {
  border-color: var(--ink);
  border-width: 5px;
}

/* ── Badges — 11/600, 12px radius (not pill). ──────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--line);
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.3;
}
.badge-light    { background: var(--line); color: var(--ink); }
.badge-ink      { background: var(--ink); color: #fff; }
.badge-mint     { background: var(--mint); color: var(--ink); }
.badge-mint-soft{ background: var(--mint-soft); color: var(--mint-ink); }
.badge-danger   { background: var(--danger); color: #fff; }
.badge-mono     { font-family: var(--font-mono); text-transform: none; letter-spacing: 0.02em; }
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Status dot — flat, no pulse. */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mint);
  vertical-align: middle;
  margin-right: 6px;
}

/* ── LNKS branded mark — italic Georgia "L" in mint on a black
   rounded square. Used as the inline brand chip. */
.lnks-mark {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--black);
  width: 32px; height: 32px;
  border-radius: 7px;
  color: var(--mint);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}
.lnks-mark::before { content: "L"; transform: translateY(2px); }
.lnks-mark.is-sm { width: 24px; height: 24px; border-radius: 5px; font-size: 18px; }
.lnks-mark.is-lg { width: 56px; height: 56px; border-radius: 12px; font-size: 40px; }
.lnks-mark.is-xl { width: 96px; height: 96px; border-radius: 18px; font-size: 72px; }

/* Inline pill — black box with white "LNKS" text. Kept for badge use. */
.lnks-pill {
  display: inline-flex; align-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ── Avatar — round initial circle. ──────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Segmented control. ─────────────────────────────────────── */
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.is-active {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

/* ── Slider — input range styled. ──────────────────────────── */
.slider {
  position: relative;
  height: 22px;
  display: flex; align-items: center;
}
.slider .track {
  position: relative;
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
}
.slider .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  border-radius: 4px;
}
.slider .thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--ink);
}

/* ── Keyboard chip. ────────────────────────────────────────── */
.kbd {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  line-height: 1.4;
}

/* ── Row list — for Links / Domains / Users. ────────────────── */
.row-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.row-list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.row-list-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.row-list-head .sub {
  font-size: 13px;
  color: var(--slate);
  margin-top: 2px;
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  transition: background-color 0.16s var(--ease);
}
.row:first-of-type { border-top: 0; }
.row:hover { background: rgba(10, 10, 11, 0.02); }
.row-main { min-width: 0; }
.row-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 3px;
}
.row-slug {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--slate);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-side {
  display: flex; align-items: center; gap: 14px;
}
.row-actions {
  display: flex; gap: 6px;
  opacity: 0.7;
  transition: opacity 0.16s var(--ease);
}
.row:hover .row-actions { opacity: 1; }
@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; padding: 14px 18px; }
  .row-list-head { padding: 16px 18px; }
  .row-side { justify-content: space-between; }
  .row-actions { opacity: 1; }
}

/* Inline metric — small number + tiny label. Used in row stats. */
.metric-inline {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.metric-inline .n {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.metric-inline .l {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}
.metric-inline.is-zero .n { color: var(--mute); }

/* ── Stat tile — heroic number block. ─────────────────────── */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-tile .label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}
.stat-tile .value {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.stat-tile .sub {
  font-size: 13px;
  color: var(--slate);
}
.stat-tile-dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.stat-tile-dark .label { color: rgba(255,255,255,0.6); }
.stat-tile-dark .value { color: #fff; }
.stat-tile-dark .sub { color: rgba(255,255,255,0.72); }

/* Mint trend pill — used inline next to a stat. */
.trend {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--ink);
}
.trend.is-down { background: var(--danger); color: #fff; }
.trend.is-flat { background: var(--line); color: var(--slate); }

/* ── KPI bar — slim mint-cap progress. ───────────────────── */
.kpi-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(10,10,11,0.06);
  overflow: hidden;
  margin-top: 10px;
}
.kpi-bar-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 3px;
  transition: width 0.45s var(--ease);
  position: relative;
}
.kpi-bar-fill::after {
  content: "";
  position: absolute;
  right: 0; top: 0;
  width: 4px; height: 100%;
  background: var(--mint);
}
.kpi-bar-fill.is-warn { background: var(--ink); }
.kpi-bar-fill.is-warn::after { background: #FFD747; }
.kpi-bar-fill.is-over { background: var(--danger); }
.kpi-bar-fill.is-over::after { background: var(--danger); }
.kpi-bar.on-dark { background: rgba(255,255,255,0.12); }
.kpi-bar.on-dark .kpi-bar-fill { background: #fff; }
.kpi-bar.on-dark .kpi-bar-fill::after { background: var(--mint); }

/* ── Empty state. ─────────────────────────────────────────── */
.empty {
  padding: clamp(48px, 8vw, 80px) 22px clamp(40px, 6vw, 64px);
  text-align: center;
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  margin: 0 auto 20px;
}
.empty-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-title {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 10px;
}
.empty-sub {
  color: var(--slate);
  font-size: 15px;
  line-height: 1.55;
  max-width: 46ch;
  margin: 0 auto 22px;
}

/* ── Page chrome ─────────────────────────────────────────── */
.page-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
  background: var(--bg);
}
.site-header .actions { display: flex; gap: 8px; align-items: center; }

.site-footer {
  padding: 32px var(--gutter);
  color: var(--slate);
  font-size: 13px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-footer a { color: var(--slate); }
.site-footer a:hover { color: var(--ink); }

/* Brand wordmark. */
.brand {
  display: inline-flex; align-items: center;
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
}
.brand:hover { color: var(--ink); }
.brand img { display: block; height: 28px; max-width: 160px; object-fit: contain; }

/* ── Modals — shared chrome. 12px radius, no blur, no shadow. ─ */

.lnks-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  padding: 24px;
  animation: lnks-fade .14s ease both;
}
.lnks-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 22px;
  max-width: 460px;
  width: 100%;
  animation: lnks-rise .18s var(--ease) both;
}
.lnks-modal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 8px;
}
.lnks-modal-body {
  font-size: 15px;
  color: var(--slate);
  line-height: 1.55;
  margin-bottom: 22px;
}
.lnks-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

@keyframes lnks-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lnks-rise {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: none;            opacity: 1; }
}

.lnks-toast-stack {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.lnks-toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  animation: lnks-rise .18s var(--ease) both;
  pointer-events: auto;
  max-width: min(420px, 92vw);
  text-align: center;
}

/* Delete-confirm modal (legacy class names, restyled to match). */
.del-back {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.del-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 460px;
  width: 100%;
  padding: 26px 28px 22px;
}
.del-h {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--ink);
}
.del-body {
  color: var(--slate);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.del-body p { margin: 0; }
.del-body strong { color: var(--ink); font-weight: 700; }
.del-future {
  background: var(--mint-soft);
  border: 1px solid var(--mint-deep);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--mint-ink);
  margin-top: 12px;
}
.del-check {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.del-check input { margin-top: 2px; flex-shrink: 0; }
.del-check span { font-size: 13px; color: var(--slate); }
.del-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap;
}

/* ── QR download dropdown ─ kept compatible. */
.lnks-dl-wrap { position: relative; display: inline-block; }
.lnks-dl-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.lnks-dl-btn:hover { border-color: var(--ink); color: var(--ink); }
.lnks-dl-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-width: 100px;
  z-index: 50;
  display: flex; flex-direction: column;
}
.lnks-dl-menu button {
  background: transparent; border: 0;
  padding: 7px 12px; text-align: left;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--slate); cursor: pointer;
  border-radius: 6px;
}
.lnks-dl-menu button:hover { background: var(--bg); color: var(--ink); }

/* ── Unified QR/link picker modal — kept compatible. ───────── */
.lnks-pick-back {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.lnks-pick-back.is-open { opacity: 1; }
.lnks-pick-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 880px;
  max-height: 92dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.lnks-pick-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.lnks-pick-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.lnks-pick-close {
  background: transparent; border: 0;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 18px; line-height: 1;
  color: var(--slate); cursor: pointer;
}
.lnks-pick-close:hover { background: var(--bg); color: var(--ink); }
.lnks-pick-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 280px;
  border-bottom: 1px solid var(--line);
}
.lnks-pick-col { display: flex; flex-direction: column; min-height: 0; padding: 14px 18px; }
.lnks-pick-col + .lnks-pick-col { border-left: 1px solid var(--line); }
.lnks-pick-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--slate);
  margin-bottom: 8px;
}
.lnks-pick-newbtn {
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 4px 10px;
  font: inherit; font-size: 11px; font-weight: 600;
  color: var(--slate); cursor: pointer;
  text-transform: none; letter-spacing: normal;
}
.lnks-pick-newbtn:hover { border-color: var(--ink); color: var(--ink); }
.lnks-pick-search {
  margin-bottom: 8px;
  font-size: 13px;
  padding: 8px 10px;
}
.lnks-pick-list {
  overflow-y: auto;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding-right: 2px;
}
.lnks-pick-empty { padding: 18px; color: var(--slate); font-size: 13px; text-align: center; }
.lnks-pick-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.lnks-pick-item:hover { border-color: var(--ink); background: var(--bg); }
.lnks-pick-item.is-selected { border-color: var(--ink); background: var(--bg); }
.lnks-pick-item-design {
  display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center;
}
.lnks-pick-thumb {
  width: 44px; height: 44px; border-radius: 6px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lnks-pick-thumb svg { width: 100%; height: 100%; }
.lnks-pick-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnks-pick-item-link .lnks-pick-link-host {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--ink);
  letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lnks-pick-item-link .lnks-pick-link-name { font-size: 12px; color: var(--slate); margin-top: 2px; }
.lnks-pick-newform { padding: 4px 0; }
.lnks-pick-preview {
  display: flex; gap: 16px; align-items: center;
  padding: 16px 22px;
  background: var(--bg);
  flex-wrap: wrap;
}
.lnks-pick-preview-thumb {
  width: 88px; height: 88px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.lnks-pick-preview-thumb svg { width: 100%; height: 100%; }
.lnks-pick-preview-meta { flex: 1; min-width: 0; }
.lnks-pick-preview-msg { font-size: 13px; color: var(--slate); margin-bottom: 8px; }
.lnks-pick-preview-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
@media (max-width: 720px) {
  .lnks-pick-cols { grid-template-columns: 1fr; }
  .lnks-pick-col + .lnks-pick-col { border-left: 0; border-top: 1px solid var(--line); }
}
.lnks-pick-toolbar {
  display: flex; gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.lnks-pick-toolbar .lnks-pick-search {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 0;
}
.lnks-pick-newbtn-big { white-space: nowrap; }
.lnks-pick-body {
  flex: 1; min-height: 220px; max-height: 60dvh; overflow-y: auto;
  padding: 14px 18px;
}
.lnks-pick-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.lnks-pick-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.12s;
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  font: inherit;
  color: inherit;
}
.lnks-pick-card:hover { border-color: var(--ink); }
.lnks-pick-card-thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lnks-pick-card-thumb svg { width: 100%; height: 100%; }
.lnks-pick-card-name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnks-pick-card-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lnks-pick-row-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--ink);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.lnks-pick-rows { display: flex; flex-direction: column; gap: 4px; }
.lnks-pick-row {
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
  color: inherit;
}
.lnks-pick-row:hover { border-color: var(--ink); background: var(--bg); }
.lnks-pick-row-host { font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnks-pick-row-name { font-size: 12px; color: var(--slate); margin-top: 2px; }

/* ── Tag-pill input ─────────────────────────────────────── */
.tag-input {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 6px;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
  min-height: 40px;
  transition: border-color 0.12s;
}
.tag-input:focus-within { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tag-input-pills { display: contents; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 10px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: capitalize;
}
.tag-suggest-item span:first-child,
.tag-recent-chip { text-transform: capitalize; }
.tag-pill-x {
  background: transparent; border: 0;
  padding: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  font: inherit; font-size: 14px; line-height: 1;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: color 0.12s, background-color 0.12s;
}
.tag-pill-x:hover { color: #fff; background: rgba(255,255,255,0.18); }
.tag-input-field {
  flex: 1; min-width: 100px;
  border: 0; outline: none;
  font: inherit; font-size: 14px;
  background: transparent;
  padding: 4px 6px;
  color: var(--ink);
}
.tag-input-suggest {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  z-index: 30;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.tag-suggest-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: transparent; border: 0;
  padding: 7px 10px;
  border-radius: 6px;
  font: inherit; font-size: 13px;
  color: var(--slate);
  cursor: pointer;
  text-align: left;
}
.tag-suggest-item:hover, .tag-suggest-item.is-active { background: var(--bg); color: var(--ink); }
.tag-suggest-count { font-size: 11px; color: var(--slate); font-variant-numeric: tabular-nums; }
.tag-input-recent {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--slate);
}
.tag-recent-label { color: var(--slate); }
.tag-recent-chip {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font: inherit; font-size: 12px;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.tag-recent-chip:hover { border-color: var(--ink); color: var(--ink); }

/* ── Auto-save status pill (fixed bottom-right). ────────── */
/* Black-everywhere — only the dot color changes per state. Keeps the
   pill from competing visually with the form content. */
.autosave-pill {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  border: 1px solid var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  pointer-events: none;
  transition: opacity 0.18s ease;
  box-shadow: 0 4px 14px rgba(10,10,11,0.18);
}
.autosave-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
}
.autosave-pill.is-saving .autosave-dot {
  background: #fff;
  animation: autosave-spin 1s linear infinite;
}
@keyframes autosave-spin { to { transform: rotate(360deg); } }
.autosave-pill.is-saved .autosave-dot { background: var(--mint, #75FB90); }
.autosave-pill.is-failed .autosave-dot { background: var(--danger); }
@media (max-width: 720px) {
  .autosave-pill { bottom: 10px; right: 10px; padding: 7px 12px; font-size: 12px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.muted { color: var(--slate); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.center { text-align: center; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }

/* Page-enter animation. */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: page-enter 0.4s var(--ease) both; }
.stagger-2 { animation-delay: 0.06s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.18s; }
.stagger-5 { animation-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) {
  .page-enter, .row, .btn { animation: none; transition: none; }
}
