@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,800&family=Inter:wght@400;500;600;700&display=swap');
@import url('/css/tokens.css');

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--copper); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--warm);
  padding: 0 1.5rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-size: 1.1rem;
  text-decoration: none;
  line-height: 1;
}
.topbar nav { display: flex; align-items: center; gap: 0.5rem; }
.topbar .user { color: var(--muted); font-size: 0.82rem; }

.topbar-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-size: 0.80rem;
  font-weight: 500;
  background: var(--soft);
  border: 1px solid var(--warm);
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out;
  line-height: 1;
}
.topbar-btn:hover {
  background: var(--warm);
  border-color: rgba(45, 38, 32, 0.22);
  color: var(--ink);
}

.container {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 2rem; line-height: 1.1; }
h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 1.4rem; margin-bottom: 0.4rem; }

.hint { color: var(--muted); font-size: 0.9rem; }
.status { font-size: 0.9rem; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid var(--warm);
}

button, .primary, .secondary, .link {
  font: inherit;
  cursor: pointer;
  border: 0;
  user-select: none;
}

a.primary, button.primary {
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
a.primary:hover, button.primary:hover { background: #1a1411; }
a.primary, button.primary { transition: background 150ms ease-out, transform 100ms ease-out; }
a.primary:active, button.primary:active { transform: scale(0.97); }
button.primary:disabled { opacity: 0.6; cursor: progress; }

.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--warm);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-weight: 500;
}
.secondary:hover { background: var(--soft); }

.link {
  background: transparent;
  color: var(--copper);
  text-decoration: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
}
.link.danger { color: var(--danger); }
.link:hover { text-decoration: underline; }

.logout-form { display: inline; }

/* ---------- Dashboard hero ---------- */

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stats-row {
  display: flex;
  gap: 2rem;
  margin: 1.25rem 0 1.5rem;
}
.stat { font-family: var(--font-body); }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1; color: var(--ink); }
.stat-lbl { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 0.25rem; }

.view-toggle {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--warm);
  border-radius: 8px;
  padding: 0.15rem;
  gap: 0.1rem;
}
.view-toggle button {
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
}
.view-toggle button.active { background: var(--bg); color: var(--ink); }

/* ---------- Tag list/grid ---------- */

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}
.tag-card-shell { position: relative; }
.tag-card-shell:hover .tag-card-del,
.tag-card-shell:focus-within .tag-card-del { opacity: 1; }
.tag-card-del,
.tag-row-del {
  position: absolute;
  top: 0.5rem; right: 0.5rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--warm);
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  z-index: 2;
}
.tag-card-del:hover,
.tag-row-del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.tag-card-del:focus-visible,
.tag-row-del:focus-visible { opacity: 1; outline: 2px solid var(--copper); outline-offset: 2px; }
.tag-card-del:disabled,
.tag-row-del:disabled { cursor: progress; opacity: 0.5; }

.tag-row-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--warm);
  border-radius: 10px;
}
.tag-row-shell:hover { background: var(--soft); }
.tag-row-shell:hover .tag-row-del,
.tag-row-shell:focus-within .tag-row-del { opacity: 1; }
.tag-row-del {
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
}

.tag-card {
  background: var(--card);
  border: 1px solid var(--warm);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 180ms cubic-bezier(0.23,1,0.32,1), box-shadow 180ms cubic-bezier(0.23,1,0.32,1);
}
@media (hover: hover) and (pointer: fine) {
  .tag-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(45,38,32,0.1); }
}
.tag-card:active { transform: scale(0.98); }
.tag-card-photo {
  aspect-ratio: 5/3;
  background: var(--warm);
  position: relative;
  overflow: hidden;
}
.tag-card-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.tag-card-pad { padding: 0.85rem 1rem 1rem; }
.tag-card-cat { font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--copper); font-weight: 700; }
.tag-card-name { font-family: var(--font-display); font-weight: 800; color: var(--ink); font-size: 1.15rem; letter-spacing: -0.01em; margin-top: 0.15rem; display: flex; align-items: center; gap: 0.4rem; }
.tag-card-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.tag-card-lost { background: var(--danger); color: #fff; font-size: 0.55rem; padding: 0.1rem 0.4rem; border-radius: 3px; font-weight: 700; letter-spacing: 0.1em; }
.tag-card-hidden { background: #888; color: #fff; font-size: 0.55rem; padding: 0.1rem 0.4rem; border-radius: 3px; font-weight: 700; letter-spacing: 0.1em; }

.tag-row-photos { font-size: 0.72rem; color: var(--copper); font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer; }
.tag-row-photos:hover { text-decoration: underline; }
.photo-icon { font-size: 0.85rem; }
.tag-row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 2.5rem 0.75rem 0.5rem;
  flex-shrink: 0;
}
.tag-row-scans { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; color: var(--copper); font-weight: 600; white-space: nowrap; text-decoration: none; }
.tag-row-scans:hover { text-decoration: underline; }
.tag-card-mini.scans { color: var(--copper); }
.tag-row-leads { font-size: 0.72rem; color: var(--copper); font-weight: 600; white-space: nowrap; text-decoration: none; }
.tag-row-leads:hover { text-decoration: underline; }
.tag-card-mini.leads { color: var(--copper); }

.tag-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tag-list .tag-row {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
}
.tag-row-thumb {
  width: 56px; height: 56px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--warm);
  position: relative;
  overflow: hidden;
}
.tag-row-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.tag-row-main { flex: 1; min-width: 0; }
.tag-row-name { font-family: var(--font-display); font-weight: 800; color: var(--ink); font-size: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.tag-row-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.tag-row-stat { text-align: right; }
.tag-row-num { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.tag-row-lbl { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Theme picker modal (sidebar + photo cards) ---------- */

.tp-backdrop {
  position: fixed; inset: 0;
  background: rgba(45, 38, 32, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 1rem;
}
.tp-modal {
  background: var(--card);
  border-radius: 16px;
  max-width: 56rem;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 1fr;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  font-family: var(--font-body);
  color: var(--ink);
}

/* Left sidebar */
.tp-side {
  background: linear-gradient(to bottom, var(--soft) 0%, #F5EFE3 100%);
  border-right: 1px solid var(--warm);
  padding: 1.4rem 0.85rem 1.2rem;
  overflow-y: auto;
  max-height: 85vh;
}
.tp-side-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper);
  padding: 0 0.65rem 0.8rem;
}
.tp-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #5C5040;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 0.1rem;
  transition: background 0.12s, color 0.12s;
}
.tp-cat:hover { background: rgba(232,219,196,0.5); color: var(--ink); }
.tp-cat.active { background: var(--ink); color: var(--bg); }
.tp-cat-count { font-size: 0.65rem; color: var(--muted); font-weight: 500; }
.tp-cat.active .tp-cat-count { color: var(--warm); }

/* Main area */
.tp-main { padding: 1.4rem 1.6rem 1.6rem; overflow-y: auto; max-height: 85vh; }
.tp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
.tp-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
}
.tp-cancel { font-size: 0.85rem; color: var(--copper); text-decoration: none; }
.tp-cancel:hover { text-decoration: underline; }
.tp-hint { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.2rem; }
.tp-hint b { color: var(--ink); font-weight: 600; }

/* Theme cards */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.tp-card {
  background: var(--soft);
  border: 1px solid var(--warm);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(45,38,32,0.09);
  border-color: var(--copper);
}
.tp-card-photo {
  aspect-ratio: 3/2;
  background-size: cover;
  background-position: center;
  position: relative;
  border-bottom: 1px solid var(--warm);
}
.tp-card-photo::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(45,38,32,0.4));
  pointer-events: none;
}
.tp-card-cat {
  position: absolute;
  left: 0.85rem; bottom: 0.7rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 700;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.tp-card-body {
  padding: 0.9rem 1.1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tp-card-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.tp-card-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.45;
}
.tp-card-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid #F0E6D2;
}
.tp-trait {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copper);
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  background: rgba(182,108,69,0.08);
  border-radius: 999px;
}
.tp-card-cta {
  margin-top: auto;
  padding-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--copper);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
}
.tp-card:hover .tp-card-cta { opacity: 1; }

/* ---------- Connection link-pill (shared across dashboard + editor) ---------- */

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  background: rgba(176, 56, 42, 0.1);
  color: var(--danger);
}
.link-pill.nfc { background: rgba(43, 89, 148, 0.1); color: #2B5994; }
.link-pill.qr { background: rgba(74, 106, 65, 0.12); color: #4A6A41; }
.link-pill.both { background: rgba(217, 160, 102, 0.18); color: #A05F0F; }
.link-pill.none::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  animation: link-pill-pulse 1.6s ease-in-out infinite;
}
@keyframes link-pill-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .link-pill.none::before { animation: none; }
}

/* Position the pill in the corner of grid cards */
.tag-card-photo .link-pill {
  position: absolute;
  top: 0.7rem;
  left: 0.75rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
}
.tag-card-photo .link-pill.nfc { background: rgba(255, 255, 255, 0.95); color: #2B5994; }
.tag-card-photo .link-pill.qr { background: rgba(255, 255, 255, 0.95); color: #4A6A41; }
.tag-card-photo .link-pill.both { background: rgba(255, 255, 255, 0.95); color: #A05F0F; }
.tag-card-photo .link-pill.none { background: rgba(255, 255, 255, 0.95); color: var(--danger); }

/* Inline in list rows */
.tag-row-end .link-pill {
  flex-shrink: 0;
}

/* ── Hamburger / nav dropdown ── */
.nav-dd { position: relative; }
.nav-dd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--warm);
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  padding: 0;
}
.nav-dd-btn::-webkit-details-marker { display: none; }
.nav-dd-btn:hover { background: var(--warm); }
.nav-dd-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--warm);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  min-width: 160px;
  z-index: 200;
  padding: 0.3rem;
}
.nav-dd-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  background: none;
  border: none;
  font-family: var(--font-body);
  text-align: left;
  line-height: 1;
}
.nav-dd-item:hover { background: var(--soft); }
.nav-dd-item--danger { color: #dc2626; }
.nav-dd-item--danger:hover { background: #fef2f2; }
.nav-dd-sep { height: 1px; background: var(--warm); margin: 0.3rem 0; }
.nav-dd-logout { margin: 0; }

/* Locale switcher pill in the topbar */
.topbar-locale {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  user-select: none;
}
.topbar-locale-opt {
  background: none;
  border: 1px solid transparent;
  color: var(--muted, #888);
  cursor: pointer;
  font: inherit;
  padding: 2px 6px;
  border-radius: 4px;
  user-select: none;
}
.topbar-locale-opt:hover {
  color: var(--text, #222);
  border-color: var(--border, #ddd);
}
.topbar-locale-opt.active {
  color: var(--accent, #b87333);
  font-weight: 600;
  cursor: default;
  user-select: none;
}
.topbar-locale-sep {
  color: var(--muted, #888);
  user-select: none;
  cursor: default;
}

.tag-card-actions {
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.tag-card-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  height: 30px;
  box-sizing: border-box;
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--warm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.tag-card-mini:hover {
  background: var(--soft);
  border-color: var(--copper);
}
.tag-card-mini.connect {
  border-style: dashed;
  border-color: var(--copper);
  color: var(--copper);
}
.tag-card-link-btn {
  padding: 0.3rem;
  width: 30px;
  height: 30px;
  justify-content: center;
}
.tag-card-link-btn.linked {
  border-style: solid;
  border-color: #4a6a41;
  color: #4a6a41;
}
.tag-card-mini.photos {
  text-decoration: none;
  color: var(--muted);
}

/* Template picker — mobile */
@media (max-width: 640px) {
  .tp-backdrop {
    padding: 0;
    position: static;
    background: none;
    display: block;
    min-height: 100vh;
    background: var(--bg);
  }
  .tp-modal {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-height: none;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    overflow: visible;
  }
  .tp-side {
    border-right: none;
    border-bottom: 1px solid var(--warm);
    max-height: none;
    padding: 0.75rem 1rem 0.6rem;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 10;
  }
  .tp-side-title { padding-bottom: 0.45rem; font-size: 0.62rem; }
  .tp-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .tp-cat {
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--warm);
    margin-bottom: 0;
    font-size: 0.78rem;
  }
  .tp-cat.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .tp-cat-count { display: none; }
  .tp-main { max-height: none; padding: 1rem; overflow: visible; }
  .tp-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .tp-card-cta { opacity: 1; }
  .tp-head-actions { gap: 0.5rem; }
}

@media (max-width: 640px) {
  .topbar { padding: 0.6rem 1rem; }
  .topbar .user { display: none; }
  .topbar nav { gap: 0.6rem; }

  .tag-list .tag-row { gap: 0.6rem; padding: 0.65rem 0.5rem 0.65rem 0.75rem; }
  .tag-row-end { padding: 0.65rem 2.5rem 0.65rem 0.4rem; }
  .tag-row-stat { display: none; }
  .tag-row-photos { display: none; }
  .tag-row-end .link-pill { font-size: 0.55rem; padding: 0.15rem 0.4rem; letter-spacing: 0.1em; }
}

/* ── Stagger entrance for tag cards ── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tag-card-shell {
  opacity: 0;
  animation: card-in 320ms cubic-bezier(0.23,1,0.32,1) forwards;
}
.tag-card-shell:nth-child(1) { animation-delay:  40ms; }
.tag-card-shell:nth-child(2) { animation-delay:  90ms; }
.tag-card-shell:nth-child(3) { animation-delay: 140ms; }
.tag-card-shell:nth-child(4) { animation-delay: 190ms; }
.tag-card-shell:nth-child(5) { animation-delay: 240ms; }
.tag-card-shell:nth-child(6) { animation-delay: 290ms; }
.tag-card-shell:nth-child(7) { animation-delay: 340ms; }
.tag-card-shell:nth-child(8) { animation-delay: 390ms; }
.tag-card-shell:nth-child(n+9) { animation-delay: 440ms; }

/* same for list rows */
@keyframes row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.tag-row-shell {
  opacity: 0;
  animation: row-in 280ms cubic-bezier(0.23,1,0.32,1) forwards;
}
.tag-row-shell:nth-child(1) { animation-delay:  30ms; }
.tag-row-shell:nth-child(2) { animation-delay:  70ms; }
.tag-row-shell:nth-child(3) { animation-delay: 110ms; }
.tag-row-shell:nth-child(4) { animation-delay: 150ms; }
.tag-row-shell:nth-child(5) { animation-delay: 190ms; }
.tag-row-shell:nth-child(6) { animation-delay: 230ms; }
.tag-row-shell:nth-child(n+7) { animation-delay: 270ms; }

/* ── prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .tag-card-shell, .tag-row-shell { animation: none; opacity: 1; }
  .tag-card { transition: none; }
  a.primary, button.primary { transition: none; }
  .link-pill.none::before { animation: none; }
}

/* ── Plan badge ── */
.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
.plan-badge:hover { opacity: 0.75; }
.plan-badge--free { background: var(--warm); color: var(--muted); border-color: var(--warm); }
.plan-badge--starter { background: #FFF3E6; color: var(--copper); border-color: #F5C99A; }
.plan-badge--pro { background: #F0F4FF; color: #4A6FA5; border-color: #B8CCEE; }

/* ── Plan limit modal ── */
.plm-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(45,38,32,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: plm-in 200ms ease-out;
}
@keyframes plm-in { from { opacity: 0; } to { opacity: 1; } }
.plm-box {
  background: var(--card);
  border: 1px solid var(--warm);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.75rem;
  max-width: 400px; width: 100%;
  position: relative;
  text-align: center;
  animation: plm-box-in 220ms cubic-bezier(0.23,1,0.32,1);
}
@keyframes plm-box-in { from { transform: translateY(12px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.plm-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--muted); line-height: 1;
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
}
.plm-close:hover { background: var(--warm); color: var(--ink); }
.plm-icon { margin-bottom: 0.75rem; color: var(--copper); }
.plm-title {
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 800;
  letter-spacing: -0.02em; color: var(--ink); margin-bottom: 0.6rem;
}
.plm-body { font-size: 0.9rem; color: var(--muted); line-height: 1.55; margin-bottom: 1.5rem; }
.plm-body strong { color: var(--ink); }
.plm-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.plm-btn-primary {
  display: block; background: var(--copper); color: #fff;
  border: none; border-radius: 10px; padding: 0.75rem 1rem;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  text-decoration: none; text-align: center;
  transition: background 150ms ease-out;
}
.plm-btn-primary:hover { background: #C87A50; }
.plm-btn-ghost {
  background: none; border: 1px solid var(--warm); border-radius: 10px;
  padding: 0.65rem 1rem; font-size: 0.88rem; color: var(--muted);
  cursor: pointer; transition: border-color 150ms ease-out, color 150ms ease-out;
}
.plm-btn-ghost:hover { border-color: var(--copper); color: var(--ink); }

@keyframes logo-wobble{0%,100%{transform:rotate(0deg)}15%{transform:rotate(-12deg)}30%{transform:rotate(10deg)}45%{transform:rotate(-8deg)}60%{transform:rotate(6deg)}75%{transform:rotate(-3deg)}90%{transform:rotate(2deg)}}
.brand-logo { width: 24px; height: 24px; display: inline-block; vertical-align: middle; margin-right: 0.15rem; flex-shrink: 0; animation: logo-wobble 2.8s ease-in-out infinite; transform-origin: center; }
.brand-logo--lg { width: 36px; height: 36px; margin-right: 0.3rem; }
.brand { display: inline-flex; align-items: center; }

/* ── Shared sub-page layout ─────────────────────────────────────────────── */
.page-head { margin-bottom: 1.5rem; }
.breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.6rem; }
.breadcrumb a { color: var(--copper); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.page-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.page-count { font-size: 0.8rem; color: var(--muted); margin-left: 0.5rem; font-weight: 400; font-family: var(--font-body); }
.data-card { background: var(--card); border: 1px solid var(--warm); border-radius: 10px; padding: 1rem 1.25rem; }
.data-card-row { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.88rem; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-state-icon { margin-bottom: 0.75rem; color: var(--muted); }
.empty-state-text { font-size: 0.95rem; }
