/* Additions on top of /css/styles.css for the tracking dashboard — reuses
   that file's tokens (--brand, --ink, --panel, etc.) and component classes
   (.panel, .field, .btn) rather than redefining them. */

.auth-section {
  padding: 64px 0;
}

.auth-wrap {
  max-width: 420px;
}

.auth-panel h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.auth-sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.auth-hint {
  min-height: 1.2em;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

.auth-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

#form-manage-billing-btn {
  margin-top: 8px;
}

.billing-section {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.billing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
}

.billing-bar .field-hint {
  margin: 0;
}

.billing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--brand);
}

.links-section {
  padding: 16px 0 32px;
}

.account-section {
  padding: 16px 0 64px;
  border-top: 1px solid var(--border);
}

.danger-link {
  color: #dc2626;
}

.danger-link:hover {
  color: #b91c1c;
}

.links-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.links-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  min-width: 640px;
}

.links-table th,
.links-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.links-table th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.links-table tr:last-child td {
  border-bottom: none;
}

.qr-thumb {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 4px;
}

.link-label {
  font-weight: 600;
  color: var(--ink);
}

.link-destination {
  color: var(--ink-soft);
  font-size: 0.85rem;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.download-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%234f46e5' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.82rem;
  font-family: inherit;
  padding: 6px 30px 6px 14px;
  cursor: pointer;
}

.download-select:hover {
  background-color: color-mix(in srgb, var(--brand) 10%, transparent);
}

.download-select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.link-row {
  cursor: pointer;
}

.link-row:hover td {
  background: var(--bg-alt);
}

.link-row.is-open td {
  background: var(--bg-alt);
}

.links-table td.stats-toggle-cell {
  width: 1%;
  padding-left: 4px;
  text-align: center;
  white-space: nowrap;
}

.stats-toggle-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
}

.stats-toggle-chevron svg {
  transition: transform 0.2s ease;
}

.stats-toggle-chevron:hover {
  background: var(--bg-alt);
  color: var(--brand);
}

.stats-toggle-chevron:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.stats-toggle-chevron.is-open {
  color: var(--brand);
}

.stats-toggle-chevron.is-open svg {
  transform: rotate(180deg);
}

.stats-toggle-chevron.is-loading svg {
  animation: stats-toggle-spin 0.8s linear infinite;
}

@keyframes stats-toggle-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.stats-detail-row td {
  padding-top: 0;
  padding-bottom: 0;
}

.stats-slide {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.stats-panel {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}

.stats-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.stats-panel-heading .link-btn {
  flex-shrink: 0;
}

.stats-panel-heading h3 {
  margin: 0;
  min-width: 0;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-title {
  margin-bottom: 4px;
  font-weight: 600;
}

.chart-holder {
  width: 100%;
}

.chart-holder svg {
  display: block;
}

.chart-bar {
  fill: var(--brand);
  pointer-events: none;
}

.chart-bar-hit {
  fill: transparent;
  cursor: default;
}

.chart-bar-group:hover .chart-bar-hit {
  fill: var(--border);
  opacity: 0.35;
}

.chart-bar-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.chart-bar-group:hover .chart-bar-value {
  opacity: 1;
}

.chart-axis-label {
  fill: var(--ink-soft);
  font-size: 12px;
}

.chart-baseline {
  stroke: var(--border, #d0d5dd);
  stroke-width: 1;
}

.recent-clicks-heading {
  margin-top: 12px;
  font-weight: 600;
}

.recent-clicks-table-scroll {
  overflow-x: auto;
  margin-top: 4px;
}

.recent-clicks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.recent-clicks-table th,
.recent-clicks-table td {
  text-align: left;
  padding: 4px 8px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.recent-clicks-table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

@media (max-width: 640px) {
  .billing-bar {
    padding: 12px 16px;
  }

  .stats-panel {
    padding: 12px;
  }

  .stats-panel-heading h3 {
    font-size: 0.9rem;
  }

  .chart-axis-label {
    font-size: 14px;
  }

  .chart-bar-value {
    font-size: 14px;
  }

  .recent-clicks-table {
    font-size: 0.8rem;
  }

  .recent-clicks-table th,
  .recent-clicks-table td {
    padding: 4px 6px;
  }
}
