:root {
  --bg: #0b1020;
  --surface: #141a30;
  --surface-2: #1c2440;
  --border: #262f50;
  --text: #e6e9f5;
  --muted: #8a93b3;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1f2a55 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent-hover); }

.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  font-size: 28px;
  margin: 0;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  box-shadow: var(--shadow);
}

.tagline {
  color: var(--muted);
  margin: 12px 0 0;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  box-shadow: var(--shadow);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--surface-2);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 30px;
  overflow: hidden;
  color: #fff;
  margin-bottom: 14px;
  flex: 0 0 auto;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.card-description {
  margin: 0;
  font-size: 14px;
  color: #c2cae3;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.card-arrow {
  position: absolute;
  bottom: 16px;
  right: 18px;
  font-size: 22px;
  color: var(--muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--accent-hover);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
}

.site-footer {
  position: fixed;
  bottom: 16px;
  right: 20px;
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(20, 26, 48, 0.6);
  backdrop-filter: blur(6px);
}

.site-footer a:hover { color: var(--text); border-color: var(--accent); }

/* Admin */

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.pane h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.pane-header h2 { margin: 0; }
.pane-actions { display: flex; gap: 8px; }

.form { display: grid; gap: 12px; }

.form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form input,
.form textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.form input[type="color"] {
  height: 42px;
  padding: 4px;
}

.form textarea { resize: vertical; min-height: 60px; }

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: var(--accent); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }

.card-form { margin-bottom: 24px; }

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.card-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.row-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  overflow: hidden;
}

.row-icon img { width: 100%; height: 100%; object-fit: cover; }

.row-info { min-width: 0; display: grid; gap: 2px; }
.row-info strong { font-size: 15px; }
.row-info .row-url {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-info p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

.empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  list-style: none;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

.status {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.status.success { border-color: var(--success); color: var(--success); }
.status.error { border-color: var(--danger); color: var(--danger); }
