:root {
  --bg: #f5f3ef;
  --bg-2: #e8eef5;
  --ink: #1f2a33;
  --muted: #6b7780;
  --accent: #ff7a3d;
  --accent-2: #00a3a3;
  --card: #ffffff;
  --border: rgba(31, 42, 51, 0.12);
  --shadow: 0 30px 80px rgba(19, 26, 32, 0.14);
}

* {
  box-sizing: border-box;
}

body.theme-modern {
  min-height: 100vh;
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 122, 61, 0.18), transparent 45%),
    radial-gradient(circle at 90% 15%, rgba(0, 163, 163, 0.18), transparent 40%),
    linear-gradient(130deg, var(--bg), var(--bg-2));
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.backdrop .blob {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  opacity: 0.9;
  mix-blend-mode: multiply;
}

.backdrop .blob-one {
  background: rgba(255, 122, 61, 0.18);
  top: -120px;
  right: -140px;
}

.backdrop .blob-two {
  background: rgba(0, 163, 163, 0.18);
  bottom: -160px;
  left: -120px;
}

.backdrop .grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(31, 42, 51, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 42, 51, 0.06) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.3;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 48px;
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  padding: 16px 0 8px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.logo img {
  width: 180px;
  height: auto;
}

.statline {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.statline .count {
  color: var(--accent-2);
  font-weight: 600;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pill-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(31, 42, 51, 0.12);
}

.site-main {
  margin-top: 4px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
  align-items: center;
}

.hero-copy,
.hero-card {
  animation: riseIn 0.8s ease both;
}

.hero-card {
  animation-delay: 0.08s;
}

.hero-badges {
  animation: fadeIn 0.8s ease both;
  animation-delay: 0.2s;
}

.hero-copy h1 {
  font-size: 48px;
  line-height: 1.05;
  margin: 0 0 16px;
}

.hero-copy .eyebrow {
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.hero-copy .lede {
  font-size: 19px;
  color: var(--muted);
  margin: 0 0 24px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 163, 163, 0.12);
  color: var(--accent-2);
  font-weight: 600;
  font-size: 13px;
}

.hero-card {
  background: var(--card);
  border-radius: 24px;
  padding: 30px;
  border: 1px solid rgba(255, 122, 61, 0.2);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 122, 61, 0.08), transparent 40%);
  pointer-events: none;
}

.alert {
  min-height: 22px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 500;
}

.alert-info {
  color: var(--accent-2);
}

.alert-success {
  color: #0f7b55;
}

.alert-danger {
  color: #b0452d;
}

.shorten-form .form-row {
  display: grid;
  gap: 16px;
}

.shorten-form.no-key .form-row {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.shorten-form.is-locked {
  opacity: 0.6;
}

.lock-note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.shorten-form.with-key .form-row {
  grid-template-columns: 1.5fr 1fr auto;
  align-items: end;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 14px;
  height: 52px;
  font-size: 15px;
  background: rgba(247, 248, 250, 0.8);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(0, 163, 163, 0.15);
  background: #ffffff;
}

#shorten {
  height: 52px;
  padding: 0 28px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #ffb084);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#shorten:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 122, 61, 0.25);
}

.result {
  margin-top: 24px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 163, 163, 0.12);
  text-align: center;
}

.result-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--muted);
}

.result-value {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0;
  cursor: pointer;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.result-hint {
  font-size: 12px;
  color: var(--muted);
}

.site-footer {
  margin-top: auto;
  padding: 16px 24px 24px;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.footer-link {
  color: var(--muted);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 80px 16px;
}

.empty-state h2 {
  font-size: 32px;
  margin-bottom: 12px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
}

.panel {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 42, 51, 0.08);
}

.auth-panel {
  max-width: 360px;
  width: 100%;
  margin: 24px auto 0;
  padding: 28px;
}

.auth-panel .panel-head h2 {
  font-size: 28px;
}

.auth-panel .panel-head p {
  font-size: 14px;
}

.admin-search-form {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-search-form .form-control {
  flex: 1;
}

.admin-panel {
  display: grid;
  gap: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.admin-card {
  background: rgba(247, 248, 250, 0.8);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(31, 42, 51, 0.08);
}

.admin-card h3 {
  margin-top: 0;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(31, 42, 51, 0.08);
  box-shadow: 0 12px 24px rgba(19, 26, 32, 0.08);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-alert {
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 600;
  background: rgba(255, 122, 61, 0.12);
  color: #b0452d;
}

.admin-alert.error {
  background: rgba(255, 122, 61, 0.12);
  color: #b0452d;
}

.admin-alert.success {
  background: rgba(0, 163, 163, 0.12);
  color: #007a7a;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: rgba(31, 42, 51, 0.08);
  color: var(--ink);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(31, 42, 51, 0.12);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #ffb084);
  color: #fff;
}

.button-ghost {
  background: transparent;
  border-color: var(--border);
}

.button-danger {
  background: rgba(176, 69, 45, 0.12);
  color: #b0452d;
  border-color: rgba(176, 69, 45, 0.2);
}

.button-small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.table-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-actions form {
  margin: 0;
}

.panel-head h2 {
  margin: 0 0 8px;
}

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

.table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 12px;
}

.admin-table {
  width: 100%;
}

.admin-links-table th:nth-child(1) {
  width: 48px;
}

.admin-links-table th:nth-child(2) {
  width: 150px;
}

.admin-links-table th:nth-child(3) {
  width: 420px;
}

.admin-links-table th:nth-child(4) {
  width: 220px;
}

.admin-links-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.admin-links-table th:first-child,
.admin-links-table td:first-child {
  text-align: center;
}

.table thead th {
  border: none;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.table tbody tr {
  background: rgba(247, 248, 250, 0.8);
}

.table tbody td {
  border: none;
  padding: 14px 16px;
  vertical-align: middle;
}

.table tbody tr td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.table tbody tr td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

#popup {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 24, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

#popup .pucontact {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  color: var(--ink);
}

#popup .closeX {
  position: absolute;
  top: 24px;
  right: 24px;
  border: none;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.loginTable {
  width: 100%;
  margin: 20px auto 0;
}

.termsDiv {
  color: var(--muted);
  line-height: 1.5;
}

/* Confirm Modal */
#confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#confirm-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 20, 24, 0.5);
}

#confirm-modal .modal-content {
  position: relative;
  z-index: 9999;
  background: #ffffff;
  border-radius: 20px;
  padding: 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 42, 51, 0.1);
}

#confirm-modal .modal-content h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

#confirm-modal .modal-content > p {
  margin: 10px 0 10px;
  color: var(--muted);
}

#confirm-modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

#confirm-modal .modal-hint {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

#confirm-modal kbd {
  background: rgba(31, 42, 51, 0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 11px;
  color: #000000;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination-info {
  color: var(--muted);
  font-size: 14px;
}

@media all and (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .shorten-form.no-key .form-row,
  .shorten-form.with-key .form-row {
    grid-template-columns: 1fr;
  }

  #shorten {
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
  }

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

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy,
  .hero-card,
  .hero-badges {
    animation: none;
  }
}
