:root {
  --bg: #07122b;
  --bg-soft: #0b114f;
  --panel: rgba(10, 20, 54, 0.84);
  --panel-strong: #101e4c;
  --line: rgba(110, 162, 255, 0.18);
  --line-strong: rgba(71, 195, 255, 0.28);
  --text: #f4f7ff;
  --muted: #b7c5ea;
  --accent: #47c3ff;
  --accent-strong: #7dd6ff;
  --success: #8fe3b0;
  --danger: #ff8c9d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(71, 195, 255, 0.14), transparent 30%),
    linear-gradient(160deg, #030814 0%, var(--bg) 45%, #0a1233 100%);
}

body {
  padding: 22px;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
}

.hero-card,
.modal-panel,
.link-card,
.managed-link,
.empty-state,
.form-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero-card {
  background: linear-gradient(180deg, rgba(12, 20, 61, 0.9), rgba(8, 16, 42, 0.84));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hero-topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.brand-wrap {
  display: flex;
  gap: 18px;
  align-items: center;
}

.brand-logo {
  width: 170px;
  max-width: 32vw;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.hero-copy {
  margin-bottom: 0;
  color: var(--muted);
  max-width: 560px;
  font-size: 15px;
}

.icon-btn,
.close-btn,
.ghost-btn,
.primary-btn {
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.icon-btn:hover,
.close-btn:hover,
.ghost-btn:hover,
.primary-btn:hover,
.link-card:hover,
.managed-link:hover {
  transform: translateY(-2px);
}

.icon-btn {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: rgba(71, 195, 255, 0.08);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--accent);
}

.search-row {
  margin-top: 18px;
}

.search-row input,
.stack-form input,
.stack-form select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 16px;
  outline: none;
}

.search-row input:focus,
.stack-form input:focus,
.stack-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(71, 195, 255, 0.12);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.link-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 30, 76, 0.8), rgba(7, 18, 43, 0.8));
  color: inherit;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.link-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(71, 195, 255, 0.16), transparent 60%);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(71, 195, 255, 0.22), rgba(71, 195, 255, 0.08));
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid rgba(71, 195, 255, 0.18);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.card-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.card-icon.show-fallback::after,
.card-icon.has-favicon.show-fallback::after {
  content: attr(data-fallback);
  font-size: 14px;
}

.card-text h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

.card-text p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 36px;
  background: rgba(12, 20, 61, 0.52);
  text-align: center;
}

.modal.hidden,
.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 22, 0.72);
}

.modal-panel {
  position: relative;
  max-width: 880px;
  width: calc(100% - 28px);
  max-height: calc(100vh - 28px);
  overflow: auto;
  margin: 14px auto;
  background: linear-gradient(180deg, rgba(12, 20, 61, 0.96), rgba(7, 18, 43, 0.96));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-header,
.admin-topline,
.form-actions,
.managed-links-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.close-btn,
.ghost-btn,
.primary-btn {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.close-btn {
  font-size: 24px;
  line-height: 1;
  width: 48px;
  height: 48px;
  padding: 0;
}

.primary-btn {
  background: linear-gradient(180deg, rgba(71, 195, 255, 0.28), rgba(71, 195, 255, 0.14));
  border-color: rgba(71, 195, 255, 0.38);
}

.ghost-btn {
  border-color: rgba(255, 255, 255, 0.12);
}

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

.stack-form label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

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

.small {
  font-size: 13px;
}

.form-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

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

.managed-links-wrap {
  margin-top: 22px;
}

.managed-links {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.managed-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.managed-link h4 {
  margin: 0 0 6px;
}

.managed-link p {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

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

.action-btn {
  border: 1px solid var(--line-strong);
  background: rgba(71, 195, 255, 0.08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
}

.action-btn.delete {
  border-color: rgba(255, 140, 157, 0.38);
  background: rgba(255, 140, 157, 0.1);
}

.status-message {
  min-height: 22px;
  margin-top: 18px;
  color: var(--accent-strong);
}

.status-message.error {
  color: var(--danger);
}

.status-message.success {
  color: var(--success);
}

.section-heading {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 10px 4px 2px;
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}


@media (max-width: 1180px) {
  .links-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding: 16px;
  }

  .hero-card,
  .modal-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-topbar,
  .brand-wrap,
  .modal-header,
  .admin-topline,
  .managed-link,
  .managed-links-head,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-logo {
    width: 150px;
    max-width: 100%;
  }

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

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