:root {
  --green: #22C55E; --green-dark: #16A34A;
  --bg: #0B0F0D; --surface: #121A16; --surface-hi: #1A241F; --surface-2: #0E1512;
  --text: #E7F5EC; --muted: #A8BDB0; --danger: #F87171;
  --line: #22302a; --line-hi: #2c3c34;
  --pad-x: clamp(18px, 4vw, 56px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-card: 0 6px 20px rgba(0,0,0,.45);
  --shadow-pop: 0 18px 50px rgba(0,0,0,.6);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; overflow-x: hidden; }
img { display: block; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 5px; }
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.hero {
  position: relative; padding: 40px 0 30px;
  background:
    radial-gradient(80% 120% at 15% 0%, rgba(34,197,94,.16), transparent 60%),
    radial-gradient(70% 120% at 100% 0%, rgba(34,197,94,.08), transparent 55%),
    linear-gradient(180deg, #0E1512, var(--bg));
  border-bottom: 1px solid var(--line);
}
.hero-top { display: flex; align-items: center; gap: 14px; max-width: 1200px; margin: 0 auto; padding: 0 var(--pad-x); }
.hero-top img { width: 52px; height: 52px; }
.hero-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.hero-brand h1 b { color: var(--green); }
.hero-brand .sub { color: var(--muted); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }
.hero-top .spacer { flex: 1; }
.hero-admin { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-hi); color: var(--muted); font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); }
.hero-admin:hover { color: var(--text); border-color: var(--line-hi); }
.hero-lead { max-width: 1200px; margin: 26px auto 0; padding: 0 var(--pad-x); }
.hero-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--green); background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); padding: 6px 13px; border-radius: 999px; margin-bottom: 14px; }
.hero-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.hero-lead h2 { font-size: clamp(24px, 3.8vw, 40px); font-weight: 800; line-height: 1.08; letter-spacing: -.02em;
  background: linear-gradient(120deg, #fff, #c6e8d3); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-lead p { color: var(--muted); font-size: 15px; margin-top: 10px; max-width: 620px; line-height: 1.55; }
.hero-stats { display: flex; gap: 26px; margin-top: 20px; flex-wrap: wrap; }
.hero-stats span { color: var(--muted); font-size: 13px; }
.hero-stats b { color: var(--text); font-size: 20px; font-weight: 800; margin-right: 6px; }

/* ---------- controles (fixam no topo ao rolar) ---------- */
.controls { position: sticky; top: 0; z-index: 20; margin-top: 10px; padding: 14px var(--pad-x) 12px;
  background: rgba(11,15,13,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); }
.controls-in { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface-hi); border: 1px solid var(--line-hi); border-radius: 13px; padding: 0 16px; color: var(--muted); max-width: 520px; }
.search-box:focus-within { border-color: var(--green-dark); color: var(--text); }
.search-box input { flex: 1; background: none; border: none; color: var(--text); font-size: 15px; padding: 13px 0; outline: none; }
.dev-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-hi); color: var(--muted); font-size: 13px; font-weight: 600; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); transition: all .15s; }
.dev-chip:hover { color: var(--text); border-color: var(--line-hi); }
.dev-chip.active { background: var(--green); color: #04170B; font-weight: 800; border-color: transparent; }
.dev-chip .cnt { font-size: 11px; opacity: .7; }

/* ---------- grade de apps ---------- */
.grid-wrap { max-width: 1200px; margin: 24px auto 0; padding: 0 var(--pad-x) 70px; }
.grid-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.acard {
  position: relative; background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: 20px; padding: 20px; overflow: hidden;
  transition: transform .18s var(--ease-out), border-color .18s, box-shadow .18s;
}
.acard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent, var(--green)); opacity: .9; }
.acard::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .18s;
  background: radial-gradient(60% 40% at 50% 0%, color-mix(in srgb, var(--accent, var(--green)) 14%, transparent), transparent 70%); }
.acard:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent, var(--green)) 45%, var(--line)); box-shadow: 0 14px 34px rgba(0,0,0,.5); }
.acard:hover::after { opacity: 1; }

/* selo do tipo de acesso */
.auth-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; margin-bottom: 8px; }
.auth-pill.up { color: #7DD3FC; background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.3); }
.auth-pill.cd { color: #86EFAC; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.32); }
.auth-pill.mac { color: #D8B4FE; background: rgba(168,85,247,.12); border: 1px solid rgba(168,85,247,.32); }
.auth-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
.auth-mini { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; }
.auth-mini.up { color: #7DD3FC; background: rgba(56,189,248,.12); }
.auth-mini.cd { color: #86EFAC; background: rgba(34,197,94,.12); }
.auth-mini.mac { color: #D8B4FE; background: rgba(168,85,247,.14); }
.auth-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 7px; }
.acard-head { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.app-logo { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #fff; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent, var(--green)), color-mix(in srgb, var(--accent, var(--green)) 55%, #000)); box-shadow: 0 6px 16px rgba(0,0,0,.4); letter-spacing: -.03em; overflow: hidden; }
.app-logo.has-img { background: var(--surface-hi); }
.app-logo.has-img img { width: 100%; height: 100%; object-fit: cover; }
.acard-head .nm { flex: 1; min-width: 0; }
.acard-head .nm b { font-size: 16.5px; font-weight: 800; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard-head .nm .note { color: var(--muted); font-size: 12px; margin-top: 2px; }

.dev-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.dev-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 7px; background: var(--surface-hi); color: var(--muted); border: 1px solid var(--line); }

.field-copy { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px 9px 13px; margin-top: 8px; }
.field-copy .fc-label { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
.field-copy .fc-val { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.field-copy.code .fc-val { font-size: 18px; letter-spacing: .06em; color: var(--green); }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--green); color: #04170B; font-weight: 800; font-size: 12.5px; padding: 8px 12px; border-radius: 9px; flex-shrink: 0; transition: background .15s; }
.copy-btn:hover { background: var(--green-dark); }
.copy-btn.ghost { background: var(--surface-hi); color: var(--text); border: 1px solid var(--line-hi); }
.copy-btn.ghost:hover { background: #24322b; }
.acard .open-link { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; background: var(--surface-hi); color: var(--text); font-weight: 700; font-size: 13.5px; padding: 11px; border-radius: 11px; border: 1px solid var(--line-hi); }
.acard .open-link:hover { border-color: var(--green-dark); color: var(--green); }

.empty { color: var(--muted); text-align: center; padding: 60px 0; font-size: 14px; }

/* ---------- admin ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 18%, #14251c, var(--bg) 62%); padding: 20px; }
.auth-card { width: 400px; max-width: 94vw; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { width: 110px; margin: 0 auto 8px; }
.auth-brand h1 { font-size: 20px; font-weight: 800; }
.auth-brand h1 b { color: var(--green); }
.auth-brand .tag { color: var(--muted); font-size: 12px; letter-spacing: .18em; margin-top: 4px; }
.auth-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface-hi); color: var(--text); border: 1px solid var(--line-hi); border-radius: 11px; padding: 12px 14px; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green-dark); }
.btn-primary { width: 100%; background: var(--green); color: #04170B; font-weight: 800; font-size: 15px; padding: 14px; border-radius: 12px; }
.btn-primary:hover { background: var(--green-dark); }
.auth-status { margin-top: 12px; font-size: 13px; text-align: center; min-height: 18px; color: var(--danger); }

.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px var(--pad-x); background: rgba(11,15,13,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.admin-bar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.admin-bar .brand img { width: 32px; height: 32px; }
.admin-bar .brand b { color: var(--green); }
.admin-bar .spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--green); color: #04170B; font-weight: 800; font-size: 13.5px; padding: 10px 16px; border-radius: 11px; }
.btn:hover { background: var(--green-dark); }
.btn.ghost { background: var(--surface-hi); color: var(--text); border: 1px solid var(--line-hi); }
.btn.ghost:hover { background: #24322b; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: rgba(248,113,113,.12); }

.admin-page { max-width: 1000px; margin: 0 auto; padding: 24px var(--pad-x) 80px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.arow { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.arow .app-logo { width: 42px; height: 42px; border-radius: 11px; font-size: 15px; }
.arow .info { flex: 1; min-width: 0; }
.arow .info b { font-size: 15px; }
.arow .info .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.arow .acts { display: flex; gap: 8px; flex-shrink: 0; }

/* modal editor */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.75); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.modal { width: 560px; max-width: 96vw; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-pop); }
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal .msub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dev-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-pick label { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-hi); color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer; }
.dev-pick label:has(input:checked) { background: var(--green); color: #04170B; border-color: transparent; }
.dev-pick input { display: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-status { margin-top: 10px; font-size: 13px; color: var(--danger); }
.logo-edit { display: flex; align-items: center; gap: 14px; }
.logo-prev { width: 64px; height: 64px; border-radius: 14px; background: var(--surface-hi); border: 1px solid var(--line-hi); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-weight: 900; font-size: 22px; color: var(--muted); }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }
.logo-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.logo-hint { color: var(--muted); font-size: 12px; width: 100%; }
.accent-row { display: flex; align-items: center; gap: 10px; }
.accent-row input[type=color] { width: 46px; height: 42px; padding: 3px; border-radius: 10px; background: var(--surface-hi); border: 1px solid var(--line-hi); }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--surface-hi); color: var(--text); border: 1px solid var(--line-hi); padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: var(--shadow-pop); max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast b { color: var(--green); }

@media (max-width: 640px) {
  .apps-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .hero-lead h2 { font-size: 22px; }
  .arow { flex-wrap: wrap; }
  .arow .acts { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
