/* ToqueQR — estilos */

:root {
  --bg: #f4f1ea;
  --bg-dots: #e4ded1;
  --surface: #ffffff;
  --surface-2: #f9f7f2;
  --ink: #16161d;
  --ink-2: #3a3943;
  --muted: #6b6973;
  --line: #e7e2d7;
  --line-strong: #d6cfc0;
  --accent: #ff5436;
  --accent-ink: #b5300f;
  --accent-soft: #ffe7e0;
  --ok: #0d6b4c;
  --ok-soft: #dff2ea;
  --danger: #c42b1c;
  --danger-soft: #fde7e4;

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 0 rgba(22, 22, 29, 0.04), 0 1px 3px rgba(22, 22, 29, 0.06);
  --shadow-md: 0 1px 0 rgba(22, 22, 29, 0.04), 0 12px 32px -14px rgba(22, 22, 29, 0.22);
  --shadow-lg: 0 30px 80px -20px rgba(22, 22, 29, 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --placeholder: #77747f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--ink);
}

input,
textarea {
  caret-color: var(--accent);
}

html {
  scrollbar-color: #cfc8ba transparent;
}

dialog {
  scrollbar-width: thin;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

/* ---------- Marca ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.brand-mark span {
  width: 19px;
  height: 19px;
  border: 3px solid #fff;
  border-radius: 6px;
  display: grid;
  place-items: center;
}

.brand-mark span::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.brand-name b {
  color: #e23f1e; /* laranja da marca, escurecido para contraste no fundo creme */
  font-weight: 800;
}

/* ---------- Botões ---------- */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease), background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover {
  border-color: var(--ink);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-dark {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --btn-line: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.btn-dark:hover {
  --btn-bg: #2a2a33;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-line: transparent;
}

.btn-ghost:hover {
  --btn-bg: rgba(22, 22, 29, 0.05);
  border-color: transparent;
}

.btn-danger {
  --btn-bg: transparent;
  --btn-fg: var(--danger);
  --btn-line: transparent;
}

.btn-danger:hover {
  --btn-bg: var(--danger-soft);
  border-color: transparent;
}

.btn-danger.is-armed {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13.5px;
}

.btn-lg {
  height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: rgba(22, 22, 29, 0.06);
  color: var(--ink);
}

/* ---------- Campos ---------- */

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-label small {
  font-weight: 450;
  color: var(--muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap > .i {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap > .i + .input {
  padding-left: 42px;
}

.input::placeholder {
  color: var(--placeholder);
}

.input:hover {
  border-color: #bfb7a6;
}

.input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(22, 22, 29, 0.08);
}

.input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

select.input {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2376747e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* Seletor segmentado */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  border-radius: 13px;
  background: #ece8de;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 560;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented label .i {
  width: 16px;
  height: 16px;
}

.segmented input:checked + label {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

/* Cores */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatches input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatches label {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px transparent;
  transition: box-shadow 0.15s, transform 0.15s var(--ease);
}

.swatches label:hover {
  transform: scale(1.08);
}

.swatches input:checked + label {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c);
}

.swatches input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 5px;
}

/* ---------- Topo ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.stat-chip strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- Criação ---------- */

.composer {
  position: sticky;
  top: 92px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.composer-head {
  padding: 22px 24px 0;
}

.composer-head h2 {
  font-size: 22px;
  font-weight: 700;
}

.composer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.composer form {
  padding: 20px 24px 24px;
  display: grid;
  gap: 18px;
}

.preview {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}

.preview-qr {
  width: 112px;
  height: 112px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-qr svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity 0.2s;
}

.preview-qr.is-empty svg {
  opacity: 0.12;
}

.preview-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.preview-title {
  font-weight: 650;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-content {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview:has(.preview-qr:not(.is-empty)) {
  border-style: solid;
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface-2));
}

.form-error {
  margin: -6px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.form-error:empty {
  display: none;
}

/* ---------- Biblioteca ---------- */

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.library-head h1 {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  display: flex;
  align-items: center;
  gap: 12px;
}

.count-pill {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.library-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.search {
  width: min(300px, 100%);
}

.search .input {
  height: 42px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
}

/* Estados */
.empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 64px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.empty h3 {
  font-size: 20px;
  margin-top: 12px;
}

.empty p {
  margin: 0;
  max-width: 340px;
  color: var(--muted);
}

.empty-art {
  position: relative;
  width: 120px;
  height: 92px;
}

.empty-art span {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
}

.empty-art span::before {
  content: '';
  width: 30px;
  height: 30px;
  border: 5px solid var(--ink);
  border-radius: 9px;
}

.empty-art span:nth-child(1) {
  left: 0;
  top: 14px;
  transform: rotate(-10deg);
  opacity: 0.6;
}

.empty-art span:nth-child(2) {
  right: 0;
  top: 14px;
  transform: rotate(10deg);
  opacity: 0.6;
}

.empty-art span:nth-child(3) {
  left: 24px;
  top: 0;
  z-index: 1;
}

.empty-art span:nth-child(3)::before {
  border-color: var(--accent);
}

/* ---------- Diálogo ---------- */

dialog {
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  width: min(840px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

dialog[open] {
  animation: pop 0.28s var(--ease);
}

dialog::backdrop {
  background: rgba(22, 22, 29, 0.42);
  backdrop-filter: blur(3px);
}

.detail {
  display: grid;
  grid-template-columns: 340px 1fr;
}

.detail-visual {
  padding: 28px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 16px;
}

.detail-qr {
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.detail-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.shortlink {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
}

.shortlink span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.stat dt {
  font-size: 11.5px;
  color: var(--muted);
}

.stat dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.detail-main {
  padding: 24px 28px 24px;
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-top h2 {
  font-size: 24px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.notice {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  background: #f3efe6;
  color: var(--ink-2);
}

.notice .i {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.notice-warn {
  background: #fff4dc;
  color: #7a4b00;
}

.section-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.download-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.download-row select {
  height: 42px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-actions .spacer {
  flex: 1;
}

/* ---------- Toast ---------- */

.toasts {
  position: fixed;
  inset: auto auto 24px 50%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px 11px 12px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease);
}

.toast .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
}

.toast .dot .i {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}

.toast.is-error .dot {
  background: var(--danger);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}

/* ---------- Impressão ---------- */

#print-sheet {
  display: none;
}

@page {
  margin: 16mm;
}

@media print {
  body {
    background: #fff !important;
  }

  body > *:not(#print-sheet) {
    display: none !important;
  }

  #print-sheet {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 18mm;
    color: #16161d;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #print-sheet svg {
    width: 120mm;
    height: 120mm;
  }

  #print-sheet h1 {
    margin-top: 10mm;
    font-size: 26pt;
    font-weight: 800;
  }

  #print-sheet p {
    margin: 3mm 0 0;
    font-size: 12pt;
    color: #55545c;
  }
}

/* ---------- Animações ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

@keyframes shimmer {
  to {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Login ---------- */

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.login-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-deco span {
  position: absolute;
  border-radius: 28%;
  border: 18px solid var(--ink);
  opacity: 0.06;
}

.login-deco span::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 26%;
  background: var(--ink);
}

.login-deco span:nth-child(1) {
  width: 220px;
  height: 220px;
  top: -40px;
  left: -50px;
}

.login-deco span:nth-child(2) {
  width: 180px;
  height: 180px;
  top: -30px;
  right: -40px;
}

.login-deco span:nth-child(3) {
  width: 200px;
  height: 200px;
  bottom: -50px;
  left: -40px;
  border-color: var(--accent);
  opacity: 0.18;
}

.login-deco span:nth-child(3)::after {
  background: var(--accent);
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  padding: 32px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 20px;
  animation: pop 0.4s var(--ease);
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 8px;
}

.login-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

/* ---------- Responsivo ---------- */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 20px;
  }

  .composer {
    position: static;
  }

  .detail {
    grid-template-columns: 1fr;
  }

  .detail-visual {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-qr {
    width: min(260px, 100%);
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-stats .stat-chip:first-child {
    display: none;
  }

  .library-head h1 {
    font-size: 28px;
  }

  .search {
    width: 100%;
  }

  .composer-head,
  .composer form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .detail-visual,
  .detail-main {
    padding: 20px;
  }

  .download-row {
    grid-template-columns: 1fr 1fr;
  }

  .download-row select {
    grid-column: 1 / -1;
  }

  dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 14px;
  }
}

@media (max-width: 640px) {
  .hide-sm {
    display: none;
  }
}

/* ---------- Ativar / desativar ---------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #bfe3d3;
  background: var(--ok-soft);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.switch-row[hidden] {
  display: none;
}

.switch-row.is-off {
  background: #efece6;
  border-color: var(--line-strong);
}

.switch-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.switch-text strong {
  font-size: 14.5px;
  font-weight: 650;
}

.switch-text small {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-2);
}

.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: #c9c3b6;
  cursor: pointer;
  transition: background-color 0.2s;
}

.switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s var(--ease);
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::before {
  transform: translateX(18px);
}

.switch:disabled {
  opacity: 0.6;
  cursor: progress;
}

.badge.badge-off {
  background: #e9e6df;
  color: var(--muted);
}



/* ---------- Lista de QR Codes ---------- */

.list-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.list-head,
.row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 112px 64px 56px 52px 150px;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}

.list-head {
  padding-top: 12px;
  padding-bottom: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.list-head span:nth-child(2) {
  grid-column: 1 / 3;
  grid-row: 1;
}

.list-head span:first-child {
  display: none;
}

.list-head .col-scans {
  text-align: right;
}

.list-head .col-toggle {
  text-align: center;
}

.list {
  transition: opacity 0.15s;
}

.list.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

.row {
  min-height: 78px;
  padding-top: 11px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s;
  animation: rise 0.4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}

.row:last-child {
  border-bottom: 0;
}

.row:hover {
  background: #fcfbf8;
}

.list.is-static .row {
  animation: none;
}

.row.is-new,
.list.is-static .row.is-new {
  animation: row-flash 2s var(--ease);
}

@keyframes row-flash {
  0%,
  35% {
    background: var(--accent-soft);
  }
}

.row-qr {
  width: 56px;
  height: 56px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: zoom-in;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.row-qr:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}

.row-qr svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity 0.2s, filter 0.2s;
}

.row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
  justify-items: start;
}

.row-title {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.row-title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
}

.row-url span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-url .i {
  width: 13px;
  height: 13px;
  opacity: 0;
  transition: opacity 0.15s;
}

.row-url:hover {
  color: var(--ink);
}

.row-url:hover .i {
  opacity: 1;
}

.row-meta-sm {
  display: none;
  font-size: 12px;
  color: var(--muted);
}

.row .col-scans {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.row .col-date {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.col-toggle {
  display: flex;
  justify-content: center;
}

.row-na {
  color: #bdb6a8;
  font-family: var(--font-body);
  font-weight: 400;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.row-actions .btn {
  margin-right: 4px;
}

.row.is-inactive .row-qr svg {
  opacity: 0.35;
  filter: grayscale(1);
}

.row.is-inactive .row-title {
  color: var(--muted);
}

.switch-sm {
  width: 38px;
  height: 22px;
}

.switch-sm::before {
  width: 16px;
  height: 16px;
}

.switch-sm:checked::before {
  transform: translateX(16px);
}

.row-skeleton {
  height: 78px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, #f6f3ed 30%, #fbfaf7 50%, #f6f3ed 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}

.list .empty {
  border: 0;
  border-radius: 0;
  background: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: #efebe2;
  color: var(--ink-2);
}

.badge .i {
  width: 12px;
  height: 12px;
}

.badge-dynamic {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* Paginação */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.pager:empty {
  display: none;
}

.pager-info {
  font-size: 13px;
  color: var(--muted);
}

.pager-info strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pager-pages {
  display: flex;
  align-items: center;
  gap: 2px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.15s;
}

.page-btn:hover:not(:disabled):not([aria-current]) {
  background: rgba(22, 22, 29, 0.06);
}

.page-btn[aria-current='page'] {
  background: var(--ink);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.page-gap {
  min-width: 22px;
  text-align: center;
  color: var(--muted);
}

/* Layout em uma coluna mais cedo, para a lista ter espaço */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .composer {
    position: static;
  }
}

/* Lista compacta: tipo, leituras e data viram uma linha embaixo do link */
@media (min-width: 1101px) and (max-width: 1260px), (max-width: 860px) {
  .list-head,
  .row {
    grid-template-columns: 56px minmax(0, 1fr) 52px 150px;
  }

  .col-type,
  .col-scans,
  .col-date {
    display: none;
  }

  .row-meta-sm {
    display: block;
  }
}

@media (max-width: 640px) {
  .list-head {
    display: none;
  }

  .row {
    grid-template-columns: 48px minmax(0, 1fr) 40px 72px;
    gap: 10px;
    padding: 10px 12px;
  }

  .row-qr {
    width: 48px;
    height: 48px;
  }

  .row-url {
    display: none;
  }

  .row-actions .btn {
    width: 34px;
    padding: 0;
    margin-right: 0;
  }

  .row-actions .btn-label {
    display: none;
  }

  .row-actions .btn,
  .row-actions .icon-btn {
    width: 40px;
    height: 40px;
  }

  .row {
    grid-template-columns: 48px minmax(0, 1fr) 46px 84px;
  }

  .switch-sm {
    width: 44px;
    height: 26px;
  }

  .switch-sm::before {
    width: 20px;
    height: 20px;
  }

  .switch-sm:checked::before {
    transform: translateX(18px);
  }

  .meta-date {
    display: none;
  }

  .page-btn {
    min-width: 40px;
    height: 40px;
  }

  .pager {
    justify-content: center;
  }
}
