@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0a100d;
  --surface: #10201730;
  --surface-solid: #10201a;
  --surface-2: #17271f;
  --line: #24352c;
  --green-deep: #01411c;
  --green: #0e7a3f;
  --green-bright: #22b05e;
  --text: #eef4f0;
  --text-dim: #a9bdb2;
  --text-faint: #6d8577;
  --gold: #e8b84b;
  --red: #d9564a;
  --radius-icon: 20%;
  --radius-card: 18px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(14, 122, 63, 0.16), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, rgba(14, 122, 63, 0.08), transparent 55%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--green-bright); outline-offset: 2px; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------------- Header ---------------- */
header.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(10, 16, 13, 0.82);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius-icon);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.brand-mark-img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { line-height: 1.05; }
.brand-text .name { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.brand-text .tag { font-size: 11px; color: var(--text-faint); font-weight: 500; }

.nav-search {
  flex: 1; max-width: 420px; position: relative;
  display: none;
}
.nav-search input {
  width: 100%; padding: 9px 14px 9px 36px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 14px;
}
.nav-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }

.auth-area { display: flex; align-items: center; gap: 8px; }
.btn {
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 8px 16px; font-size: 14px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green-bright); color: #06170e; }
.btn-primary:hover { background: #2cc76a; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { border-color: var(--green-bright); color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(217, 86, 74, 0.5); color: var(--red); }
.btn-danger:hover { background: rgba(217, 86, 74, 0.12); }
.btn-google {
  background: #fff; color: #3c4043; border-color: #fff;
  font-weight: 700; padding: 10px 16px;
}
.btn-google:hover { background: #f4f4f5; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.btn-google .google-icon { width: 18px; height: 18px; display: inline-flex; flex-shrink: 0; }
.btn-google .google-icon svg { width: 100%; height: 100%; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 700; font-size: 14px;
}

/* ---------------- Hero ---------------- */
.hero { position: relative; overflow: hidden; padding: 56px 0 28px; }
.hero-crescent {
  position: absolute; right: -60px; top: -80px; width: 380px; height: 380px;
  opacity: 0.12; pointer-events: none;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px); line-height: 1.12; letter-spacing: -0.02em;
  max-width: 640px; margin: 0 0 12px;
}
.hero p.sub { color: var(--text-dim); font-size: 16px; max-width: 520px; margin: 0 0 26px; }

.search-big { position: relative; max-width: 560px; }
.search-big input {
  width: 100%; padding: 15px 18px 15px 46px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-solid); color: var(--text);
  font-size: 15px;
}
.search-big svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.chip {
  padding: 7px 15px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  color: var(--text-dim); font-size: 13px; font-weight: 600; background: var(--surface);
}
.chip.active { background: var(--green-bright); color: #06170e; border-color: transparent; }

/* ---------------- App grid ---------------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 38px 0 16px; }
.section-title h2 { font-size: 19px; margin: 0; }
.section-title span { color: var(--text-faint); font-size: 13px; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; padding-bottom: 50px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: rgba(34, 176, 94, 0.45); }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.icon {
  width: 56px; height: 56px; border-radius: var(--radius-icon); flex-shrink: 0;
  background: var(--surface-2); object-fit: cover; border: 1px solid var(--line);
}
.icon-fallback {
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px;
  color: var(--text-dim); background: linear-gradient(155deg, var(--surface-2), var(--surface-solid));
}
.card-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.card-cat { font-size: 12px; color: var(--text-faint); }
.card-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); }
.stars { color: var(--gold); letter-spacing: -1px; }
.star-empty { color: #3a463f; }
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state svg { width: 46px; height: 46px; margin-bottom: 14px; opacity: 0.6; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 6, 0.72); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; width: 100%; max-width: 560px; max-height: 88vh;
  overflow-y: auto; padding: 26px;
}
@media (min-width: 640px) { .modal { border-radius: 20px; } }
.modal-close { float: right; background: var(--surface-2); border: 1px solid var(--line); border-radius: 50%; width: 32px; height: 32px; color: var(--text-dim); }
.modal-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.modal-head .icon { width: 72px; height: 72px; }
.modal-head h3 { margin: 0 0 4px; font-size: 20px; }
.install-bar { display: flex; align-items: center; gap: 14px; margin: 20px 0; }
.progress-wrap { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: none; }
.progress-bar { height: 100%; width: 0%; background: var(--green-bright); transition: width .2s ease; }
.rate-row { display: flex; align-items: center; gap: 6px; margin-top: 18px; }
.rate-row .star-input { font-size: 26px; color: #3a463f; }
.rate-row .star-input.on { color: var(--gold); }
.modal-desc { color: var(--text-dim); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.stat-strip { display: flex; gap: 22px; margin: 14px 0; }
.stat-strip div { font-size: 12px; color: var(--text-faint); }
.stat-strip strong { display: block; font-size: 15px; color: var(--text); font-weight: 700; }

/* ---------------- Auth card (console gate) ---------------- */
.auth-shell { min-height: calc(100vh - 65px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px;
}
.auth-card h2 { margin: 0 0 6px; font-size: 21px; }
.auth-card p.sub { color: var(--text-faint); font-size: 13px; margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 90px; }
.field-file {
  border: 1px dashed var(--line); border-radius: 10px; padding: 14px; font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.field-file input { display: none; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.auth-toggle { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-faint); }
.auth-toggle button { background: none; border: none; color: var(--green-bright); font-weight: 700; font-size: 13px; padding: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------- Console / Admin layout ---------------- */
.dash { display: grid; grid-template-columns: 220px 1fr; gap: 0; min-height: calc(100vh - 65px); }
.sidebar { border-right: 1px solid var(--line); padding: 26px 16px; }
.side-title { font-size: 11px; text-transform: none; color: var(--text-faint); padding: 0 10px 10px; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 600; margin-bottom: 2px;
}
.side-link.active { background: var(--surface-2); color: var(--text); }
.side-link:hover { color: var(--text); }
.dash-main { padding: 30px 34px; }
@media (max-width: 760px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 4px; }
  .side-title { display: none; }
  .side-link { white-space: nowrap; }
  .dash-main { padding: 22px; }
}
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { color: var(--text-faint); font-size: 13px; margin: 4px 0 0; }

.list-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
}
.list-card .icon { width: 48px; height: 48px; }
.list-card .grow { flex: 1; min-width: 0; }
.list-card .name-row { display: flex; align-items: center; gap: 10px; }
.list-card .name-row .card-name { font-size: 14.5px; }
.list-card .meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }
.badge-pending { background: rgba(232, 184, 75, 0.15); color: var(--gold); }
.badge-approved { background: rgba(34, 176, 94, 0.15); color: var(--green-bright); }
.badge-declined { background: rgba(217, 86, 74, 0.15); color: var(--red); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 4px; margin-right: 18px; color: var(--text-faint); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-color: var(--green-bright); }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: var(--radius-pill); font-size: 13.5px; opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { border-color: rgba(217, 86, 74, 0.5); }
.toast-success { border-color: rgba(34, 176, 94, 0.5); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.lock-screen { min-height: calc(100vh - 65px); display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px; color: var(--text-faint); }

@media (min-width: 720px) { .nav-search { display: block; } }
