/* =============================================================================
   Criative Links · Estilos de tela
   Apenas o que e especifico das paginas do app; tudo o mais vem de tokens/components/layout.
   ============================================================================= */

.flash {
  margin-bottom: var(--space-4);
}

.section-gap {
  margin-top: var(--space-6);
}

.section-gap-sm {
  margin-bottom: var(--space-4);
}

.section-head {
  margin-bottom: var(--space-3);
}

.field-gap {
  margin-top: var(--space-3);
}

.fieldset {
  border: 0;
  min-width: 0;
}

.fieldset legend {
  padding: 0;
}

.plain-list {
  margin: var(--space-4) 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted-foreground);
}

.auth-card .alert,
.auth-card .checks {
  margin-bottom: var(--space-4);
}

.auth-card .card {
  padding: var(--space-6);
}

/* ---- Listas de checagem do instalador ---- */
.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 13px;
}

.check-item .badge {
  flex: 0 0 auto;
}

/* ---- Tabelas ---- */
.identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chips .badge {
  height: 20px;
  font-size: 10px;
}

.filters-spaced {
  margin-top: var(--space-4);
}

.tabs {
  margin-top: var(--space-2);
}

@media (min-width: 1280px) {
  .table-links {
    table-layout: fixed;
  }

  .table-links th:nth-child(1) { width: 18%; }
  .table-links th:nth-child(2) { width: 15%; }
  .table-links th:nth-child(3) { width: 12%; }
  .table-links th:nth-child(4) { width: 13%; }
  .table-links th:nth-child(5) { width: 8%; }
  .table-links th:nth-child(6) { width: 8%; }
  .table-links th:nth-child(7) { width: 6%; }
  .table-links th:nth-child(8) { width: 10%; }
  .table-links th:nth-child(9) { width: 10%; }

  .table-links .row-actions {
    flex-wrap: nowrap;
  }

  .table-links td {
    overflow: hidden;
  }

  .table-links td.actions {
    overflow: visible;
  }
}

.shorturl {
  display: flex;
  min-width: 0;
  max-width: 100%;
}

.shorturl .h {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-foreground);
}

.shorturl strong {
  flex: none;
  font-weight: 600;
  color: var(--foreground);
}

.alert.form-medium {
  margin-bottom: var(--space-4);
}

/* ---- Detalhes ---- */
.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 760px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-layout {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 1000px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.kv-spaced {
  margin-top: var(--space-4);
}

.short-url {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.qr-mini {
  margin: 0;
}

.qr-mini img {
  display: block;
  width: 132px;
  height: 132px;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ---- Dashboard ---- */
.stat-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.stat-link:hover {
  text-decoration: none;
  box-shadow: 0 0 0 1px var(--muted-foreground);
}

.txn-list {
  list-style: none;
}

.txn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
}

.txn + .txn {
  border-top: 1px solid var(--border);
}

.txn .ic {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.txn .main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.txn .nm {
  font-weight: 500;
  font-size: 13px;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn .sb {
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn .date {
  flex: 0 0 auto;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 560px) {
  .txn .date {
    display: none;
  }
}

.usage {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.uitem {
  display: grid;
  grid-template-columns: 84px 1fr 32px;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 0;
  font-size: 13px;
}

.uitem .uv {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  text-align: right;
}

.stat-link .big {
  color: var(--foreground);
}

.nm-plain {
  font-weight: 400;
}

.stat .big-sm {
  font-size: 18px;
  line-height: 26px;
}

.rank .uitem {
  grid-template-columns: minmax(90px, 40%) 1fr 40px;
}

.rank a.ul {
  color: var(--foreground);
}

/* ---- QR Code ---- */
.qr-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: start;
}

@media (max-width: 1000px) {
  .qr-layout {
    grid-template-columns: 1fr;
  }
}

.qr-preview {
  margin: var(--space-4) 0 0;
}

.qr-preview img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  aspect-ratio: 1;
}

.input-color {
  height: 38px;
  padding: 3px;
  cursor: pointer;
}

/* ---- Dashboard executivo ---- */
.dash-caption {
  margin: var(--space-3) 0 var(--space-4);
  font-size: 12px;
}

.stat .delta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.stat .delta .badge {
  height: 20px;
  font-size: 11px;
}

.chart .bar-bot {
  fill: var(--muted-foreground);
  opacity: 0.55;
}

.legend-inline {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

.dot-bot {
  background: var(--muted-foreground);
  opacity: 0.55;
}

.dash-rank {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.dash-rank li {
  min-width: 0;
}

.dr-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}

.dr-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 13px;
  color: var(--foreground);
}

.dr-total {
  flex: 0 0 auto;
  font-size: 13px;
}

.dr-sub {
  color: var(--muted-foreground);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-rank .progress {
  width: 100%;
  margin: 6px 0 4px;
}

.dr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-4);
  color: var(--muted-foreground);
  font-size: 11px;
  font-family: var(--font-mono);
}

.dash-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: var(--space-2);
}

.dash-utm,
.dash-status {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dash-utm li,
.dash-status li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  min-width: 0;
}

.dash-utm .ul {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-layout-wide {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  align-items: start;
}

@media (max-width: 1000px) {
  .detail-layout-wide {
    grid-template-columns: 1fr;
  }
}

.table-flush {
  box-shadow: none;
  padding: 0;
  background: transparent;
}

/* ---- Analytics consolidado ---- */
.filters-card {
  padding: var(--space-4);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-3);
}

.more-filters > summary {
  cursor: pointer;
  margin-top: var(--space-3);
  font-size: 13px;
  color: var(--muted-foreground);
}

.rank .uitem.uitem-pct {
  grid-template-columns: minmax(56px, 30%) minmax(0, 1fr) auto;
}

.uitem-pct .uprog {
  width: 100%;
  min-width: 0;
}

.uitem-pct .uv {
  white-space: nowrap;
}

.table-links .nm,
.table .nm {
  display: inline-block;
  max-width: 100%;
}

.table th a {
  color: inherit;
  text-decoration: none;
}

.table th a:hover {
  color: var(--foreground);
  text-decoration: underline;
}

.table th a[aria-current="true"] {
  color: var(--foreground);
  font-weight: 600;
}

/* Itens de grade com tabelas nunca alargam a pagina no celular. */
.grid > * {
  min-width: 0;
}

.table-flush {
  overflow-x: clip;
}

/* Cabecalho das tabelas empilhadas: continua para leitores de tela, mas sem contribuir com a largura da pagina. */
@media (max-width: 1279px) {
  .table-stack-wide thead {
    display: block;
    overflow: hidden;
  }
}

/* ---- Construtor de UTM (formulario de link) ---- */
.utm-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--card);
}

.utm-box > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.utm-box > summary::-webkit-details-marker {
  display: none;
}

.utm-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.utm-body {
  display: grid;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}

.utm-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.utm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.utm-final {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md, 8px);
  background: var(--muted);
}

.utm-final-url {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 13px;
}

.utm-suggest {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 640px) {
  .utm-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- QR Code: perfis fixos ---- */
.qr-profiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}


/* ---- Relatorio compartilhado (publico, sem painel) ---- */
.public-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.public-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) 0;
}

.public-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) var(--space-6);
}

.public-head h1 {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  margin: 0 0 4px;
}

.public-foot {
  color: var(--muted-foreground);
  font-size: 12px;
  text-align: center;
  padding: 0 var(--space-6) var(--space-6);
}

@media (max-width: 767px) {
  .public-top { padding: var(--space-3) var(--space-4) 0; }
  .public-content { padding: var(--space-3) var(--space-4) var(--space-5); }
}
