:root {
  --bg: #0b0c0f;
  --surface: #14161c;
  --surface-2: #1c1f27;
  --outline: #2a2e39;
  --text: #f2f4f8;
  --muted: #99a1b0;
  --blue: #2e90c6;
  --blue-dark: #1e6e9c;
  --danger: #d9534f;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { flex: 1; }
hr { border: none; border-top: 1px solid var(--outline); margin: 20px 0; }

/* Buttons */
.btn {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: filter .15s, background .15s;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--outline); }
.btn.ghost:hover { background: var(--outline); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: rgba(217,83,79,.12); }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--outline); border-radius: 20px;
  padding: 36px 32px; width: 100%; max-width: 360px; text-align: center;
}
.login-logo { width: 84px; height: 84px; border-radius: 20px; }
.login-card h1 { margin: 16px 0 2px; font-size: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
input, textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--outline);
  color: var(--text); border-radius: 10px; padding: 11px 12px; font-size: 14px;
  font-family: inherit;
}
select { appearance: none; cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); }
.error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--outline);
  position: sticky; top: 0; background: rgba(11,12,15,.9); backdrop-filter: blur(8px); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; }
.brand strong { display: block; font-size: 16px; }
.brand .muted { font-size: 12px; }
.topbar-actions { display: flex; gap: 10px; }

/* App list */
.content { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
.app-list { display: grid; gap: 12px; }
.app-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--outline); border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: border-color .15s, transform .05s;
}
.app-item:hover { border-color: var(--blue-dark); }
.app-item:active { transform: scale(.997); }
.app-item .thumb {
  width: 56px; height: 56px; border-radius: 14px; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
}
.app-item .info { flex: 1; min-width: 0; }
.app-item .info h3 { margin: 0 0 3px; font-size: 15px; }
.app-item .info p { margin: 0; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.badge.pub { background: rgba(46,144,198,.18); color: #7cc4ea; }
.badge.draft { background: rgba(153,161,176,.15); color: var(--muted); }
.badge.feat { background: rgba(240,180,40,.18); color: #f0c250; }
.badge.noapk { background: rgba(217,83,79,.15); color: #e88; }

/* Modal editor */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid;
  place-items: center; padding: 16px; z-index: 20; }
.modal-card {
  background: var(--surface); border: 1px solid var(--outline); border-radius: 18px;
  width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--outline); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-top: 1px solid var(--outline); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field.span2 { grid-column: 1 / -1; }
.toggles { flex-direction: row; gap: 22px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.checkbox input { width: auto; }

/* APK block (top of the editor) */
.apk-block {
  background: var(--surface-2); border: 1px solid var(--outline);
  border-radius: 12px; padding: 14px; margin-bottom: 4px;
}
.apk-block .asset-row { justify-content: space-between; }
.apk-hint { font-size: 12px; margin: 10px 0 0; }

/* Assets */
.assets { display: flex; flex-direction: column; gap: 22px; }
.asset-block h3 { margin: 0 0 10px; font-size: 14px; }
.asset-row { display: flex; align-items: center; gap: 14px; }
.icon-preview { width: 64px; height: 64px; border-radius: 16px; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--outline); }
.file-btn { display: inline-block; }
.shots { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.shot { position: relative; }
.shot img { width: 84px; height: 150px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--outline); }
.shot .rm { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7);
  color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }
.apk-info { font-size: 13px; }
.apk-info.has { color: var(--text); }
.progress-wrap { height: 6px; background: var(--surface-2); border-radius: 4px;
  margin-top: 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--blue); transition: width .15s; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--outline); color: var(--text);
  padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 50; }
.toast.err { border-color: var(--danger); color: #f2b8b6; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: 1; }
}
