:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --text: #f8fbff;
  --muted: #a7b2c8;
  --accent: #7c5cff;
  --accent-2: #23d5ab;
  --danger: #ff647c;
  --border: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.32), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(35, 213, 171, 0.22), transparent 28rem),
    var(--bg);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
.button-link {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  color: white;
  background: linear-gradient(135deg, var(--accent), #5d8cff);
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(124, 92, 255, 0.28);
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(124, 92, 255, 0.34);
}

.button-link {
  display: inline-flex;
  text-decoration: none;
}

.secondary {
  background: var(--panel-strong);
  box-shadow: none;
}

.danger {
  background: rgba(255, 100, 124, 0.14);
  color: #ffb8c5;
  box-shadow: none;
}

.shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4rem 0;
}

.centered {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.hero {
  max-width: 760px;
  margin-bottom: 2rem;
}

.admin-hero {
  display: flex;
  max-width: none;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: 1.3rem;
}

.subtitle {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.muted span {
  color: #d9e1f2;
}

.card,
.toolbar article {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.card {
  border-radius: 28px;
  padding: clamp(1.2rem, 4vw, 2rem);
}

.form-card {
  display: grid;
  gap: 1.25rem;
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr) auto;
  gap: 1rem;
  align-items: end;
}

label {
  display: grid;
  gap: 0.45rem;
  color: #dfe7f6;
  font-weight: 800;
}

small {
  color: var(--muted);
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #c8d0e1 50%) calc(100% - 20px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, #c8d0e1 50%, transparent 50%) calc(100% - 15px) 50% / 7px 7px no-repeat,
    rgba(255, 255, 255, 0.08);
}

input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent-2);
}

input:focus,
select:focus {
  border-color: rgba(35, 213, 171, 0.7);
  box-shadow: 0 0 0 4px rgba(35, 213, 171, 0.12);
}

.advanced-options {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.2rem 1rem;
  background: rgba(255, 255, 255, 0.05);
}

.advanced-options summary,
.link-settings summary {
  min-height: 44px;
  color: #dfe7f6;
  cursor: pointer;
  font-weight: 900;
  line-height: 44px;
}

.advanced-options summary span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.protection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 0.25rem 0 1rem;
}

.check-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.check-row span {
  display: grid;
  gap: 0.25rem;
}

.check-row small {
  line-height: 1.45;
}

.message {
  min-height: 1.5rem;
  margin-bottom: 0;
  color: var(--muted);
}

.message[data-type="success"] {
  color: #71f1ce;
}

.message[data-type="error"] {
  color: #ff9daf;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.toolbar article {
  border-radius: 22px;
  padding: 1.2rem;
}

.toolbar span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.list-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 1.4rem;
  color: var(--muted);
  text-align: center;
}

.links-list {
  display: grid;
  gap: 0.85rem;
}

.link-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.06);
}

.link-main {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.short-url {
  color: #88f7d6;
  font-size: 1.05rem;
  font-weight: 900;
  text-decoration: none;
}

.target-url,
.meta {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-url {
  max-width: 680px;
}

.meta {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.bot-target {
  overflow: hidden;
  margin-bottom: 0;
  color: #c8d0e1;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.badge-on {
  border-color: rgba(35, 213, 171, 0.32);
  color: #86f8d7;
  background: rgba(35, 213, 171, 0.12);
}

.link-settings {
  margin-top: 0.4rem;
}

.link-settings summary {
  color: #d9e1f2;
  font-size: 0.92rem;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.12);
}

.settings-form button {
  justify-self: start;
}

.compact {
  align-items: center;
  min-height: 44px;
}

.actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
}

.not-found {
  max-width: 560px;
  text-align: center;
}

.login-card,
.maintenance-card {
  width: min(560px, 100%);
}

.login-card h1,
.maintenance-card h1 {
  font-size: clamp(2.25rem, 8vw, 4rem);
}

.login-form {
  grid-template-columns: 1fr;
  margin-top: 1.5rem;
}

.login-hint {
  margin: 1rem 0 0;
  line-height: 1.6;
}

@media (max-width: 820px) {
  .shell {
    padding: 2rem 0;
  }

  form,
  .protection-grid,
  .settings-form,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .link-item,
  .list-header,
  .admin-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }
}
