:root {
  --bg: #06161b;
  --bg-soft: #0e2430;
  --panel: rgba(11, 29, 38, 0.9);
  --panel-light: rgba(255, 255, 255, 0.06);
  --card: #fff;
  --card-muted: #edf8ff;
  --text: #eaf9ff;
  --text-dark: #133446;
  --muted: #9ac2d5;
  --primary: #0ea5e9;
  --primary-2: #22c55e;
  --accent: #a78bfa;
  --success: #25c38f;
  --warning: #fbbf24;
  --danger: #ff5a5f;
  --shadow: 0 24px 60px rgba(6, 22, 27, 0.45);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top, rgba(124, 58, 237, 0.28), transparent 34%), 
    linear-gradient(180deg, #081121 0%, #0d172a 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(8, 17, 33, 0.8);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-inner,
.page-shell,
.form-shell,
.detail-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 30px rgba(14, 165, 233, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--text);
  opacity: 0.8;
  transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.primary {
  background: rgba(124, 58, 237, 0.14);
  border: 1px solid rgba(124, 58, 237, 0.3);
  opacity: 1;
}

.page-shell {
  padding-top: 36px;
  padding-bottom: 60px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  align-items: center;
  gap: 28px;
  padding: 34px 24px 26px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(124,58,237,0.22), rgba(91,140,255,0.12));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 12px;
  border-radius: 999px;
  color: #dfe8ff;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.hero p {
  margin: 0 0 24px;
  color: #dfe7ff;
  font-size: 1.05rem;
  line-height: 1.7;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.button,
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover,
.btn:hover {
  transform: translateY(-2px);
}

.button.primary,
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 16px 30px rgba(124,58,237,0.35);
}

.button.secondary,
.btn.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
}

.hero-card {
  background: rgba(11, 18, 32, 0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 26px;
  padding: 18px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 16px;
}

.stat-box {
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.06);
}

.stat-box strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-box span {
  color: var(--muted);
}

.toolbar {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 15px 18px 15px 48px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.search-box::before {
  content: "🔎";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.75;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
}

.filter-chip.active {
  background: rgba(124,58,237,0.22);
  border-color: rgba(124,58,237,0.4);
}

.store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 34px;
  margin-bottom: 18px;
}

.store-header h2 {
  margin: 0;
  font-size: 2rem;
}

.results-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 22px;
}

.app-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,255,0.94));
  color: var(--text-dark);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

.app-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  margin-bottom: 14px;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.28);
}

.app-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.app-category {
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-card h3 {
  margin: 0 0 8px;
  font-size: 1.42rem;
}

.app-card p {
  margin: 0 0 16px;
  color: #4b5563;
  line-height: 1.6;
  min-height: 72px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stars {
  color: #f59e0b;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.install-button {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  min-width: 122px;
  text-align: center;
}

.install-button.mini {
  min-width: 110px;
  padding: 10px 12px;
  font-size: 0.8rem;
}

.form-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding-top: 42px;
  padding-bottom: 60px;
}

.form-panel {
  width: min(100%, 560px);
  background: rgba(255,255,255,0.97);
  color: var(--text-dark);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 36px 28px;
}

.form-panel h1,
.form-panel h2 {
  margin: 0 0 10px;
  color: var(--text-dark);
}

.form-subtext {
  color: #68778d;
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-group label {
  font-weight: 700;
  color: #334155;
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  border: 1px solid #dde6f5;
  background: #f7faff;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--text-dark);
}

.input-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.inline-note {
  margin-top: 18px;
  color: #52617a;
  font-size: 0.92rem;
}

.inline-note a {
  color: var(--primary);
  font-weight: 700;
}

.alert {
  display: none;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.alert.show {
  display: block;
}

.alert.error {
  background: rgba(255,90,95,0.12);
  color: #b42318;
}

.alert.success {
  background: rgba(37,195,143,0.12);
  color: #0b7a58;
}

.detail-shell {
  padding-top: 34px;
  padding-bottom: 64px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
}

.detail-hero,
.detail-side {
  background: rgba(255,255,255,0.96);
  color: var(--text-dark);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.detail-icon {
  width: 92px;
  height: 92px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-size: 3rem;
  color: white;
}

.detail-header h1 {
  margin: 0;
  font-size: clamp(2rem, 2vw, 2.6rem);
  color: var(--text-dark);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: #4a5568;
}

.detail-body {
  line-height: 1.8;
  color: #334155;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.code-panel {
  background: #0f172a;
  color: #dfe8ff;
  border-radius: 18px;
  padding: 18px;
  margin-top: 26px;
}

.code-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.7;
}

.detail-side .panel-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e7edf6;
}

.detail-side .panel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.summary-label {
  display: block;
  color: #4b5563;
  font-weight: 700;
  margin-bottom: 8px;
}

.summary-box {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-dark);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255,255,255,0.96);
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
}

.admin-table th {
  background: #eef3ff;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-btn {
  border: none;
  cursor: pointer;
  border-radius: 991px;
  padding: 8px 12px;
  font-weight: 700;
}

.small-btn.delete {
  background: rgba(255,90,95,0.12);
  color: #b42318;
}

.small-btn.hide {
  background: #eef2ff;
  color: #4338ca;
}

.empty-state {
  text-align: center;
  padding: 36px 24px;
  border-radius: 24px;
  background: rgba(255,255,255,0.95);
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

@media (max-width: 880px) {
  .hero,
  .detail-layout,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-wrap: wrap;
    justify-content: center;
    padding: 14px 0;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 22px 16px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .page-shell,
  .detail-shell {
    padding-left: 14px;
    padding-right: 14px;
  }
}
