/* widgats.com — admin panel v1.0.0 */

:root {
  --ink: #0f1216;
  --panel: #171b21;
  --panel-2: #1d222a;
  --border: #262c35;
  --text: #e8eaed;
  --muted: #8b93a1;
  --accent: #ffb224;
  --accent-ink: #1a1305;
  --ok: #3ddc97;
  --danger: #ff5c5c;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 58px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand a { text-decoration: none; }
.brand .w {
  font-family: var(--mono); font-weight: 700; font-size: 20px;
  color: var(--accent); letter-spacing: -1px;
}
.brand .ver { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.topbar nav { display: flex; gap: 4px; align-items: center; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 7px 14px; border-radius: 7px;
}
.topbar nav a:hover { color: var(--text); background: var(--panel-2); }
.topbar nav a.active { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.topbar nav a.logout { margin-left: 12px; border: 1px solid var(--border); }

/* ---- Layout ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 28px 80px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; font-weight: 650; }
.page-head .count {
  font-family: var(--mono); font-size: 14px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 12px; vertical-align: middle;
}
.ver-chip {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 14px; font-size: 13px; color: var(--muted);
}

/* ---- Stats ---- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px;
}
.stat-num { display: block; font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- Panels ---- */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 24px; margin-bottom: 22px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.panel-head h2 { font-size: 16px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; }
.empty p { margin-bottom: 14px; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  border-radius: 6px; padding: 3px 9px;
}
.badge.on { background: rgba(61, 220, 151, .12); color: var(--ok); }
.badge.off { background: rgba(139, 147, 161, .12); color: var(--muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-block; border: none; border-radius: 8px;
  padding: 10px 18px; font: 600 14px/1 inherit; cursor: pointer;
  text-decoration: none; text-align: center; color: var(--text);
}
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,92,92,.35); }
.btn-danger:hover { background: rgba(255,92,92,.1); }

/* ---- Forms ---- */
label { display: block; margin-bottom: 15px; font-size: 13px; color: var(--muted); }
label small { display: block; margin-top: 4px; font-size: 12px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px;
  background: var(--ink); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 13px; color: var(--text); font: inherit; resize: vertical;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.actions { margin-top: 20px; display: flex; gap: 12px; }

/* ---- Notices ---- */
.notice { border-radius: 8px; padding: 12px 15px; font-size: 14px; }
.notice.error { background: rgba(255,92,92,.1); border: 1px solid rgba(255,92,92,.35); color: #ffb3b3; margin-bottom: 14px; }
.notice.warn { background: rgba(255,178,36,.08); border: 1px solid rgba(255,178,36,.3); color: #ffd58a; }
.notice code {
  font-family: var(--mono); background: var(--ink);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px;
}

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 38px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(255,178,36,.04); }
.dropzone p { margin-bottom: 6px; }
.dropzone code {
  font-family: var(--mono); background: var(--ink);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px;
}
.upload-progress { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.upload-progress .bar {
  flex: 1; height: 8px; background: var(--ink);
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.upload-progress .fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }
.manifest-help { margin-top: 18px; font-size: 13px; color: var(--muted); }
.manifest-help summary { cursor: pointer; }
.manifest-help pre {
  background: var(--ink); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin: 12px 0; overflow-x: auto; font-size: 13px; line-height: 1.7;
}

/* ---- App grid ---- */
.app-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.app-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; display: grid;
  grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center;
}
.app-icon {
  width: 56px; height: 56px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon span { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.app-info h3 { font-size: 16px; font-weight: 600; }
.app-info .app-desc { font-size: 13px; color: var(--muted); margin-top: 3px; }
.app-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 380px; padding: 36px;
}
.brand.center { justify-content: center; margin-bottom: 26px; }

/* ---- Toasts ---- */
#toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 18px; font-size: 14px; max-width: 380px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
  animation: toast-in .25s ease;
  border-left: 3px solid var(--muted);
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 15, .72);
  display: flex; align-items: center; justify-content: center;
  z-index: 150; padding: 24px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 440px; padding: 28px 30px;
  animation: toast-in .2s ease;
}
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal p { color: var(--muted); margin-bottom: 6px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; }

@media (max-width: 720px) {
  .topbar { padding: 0 14px; }
  .topbar nav a { padding: 7px 9px; font-size: 13px; }
  .wrap { padding: 22px 14px 60px; }
  .app-card { grid-template-columns: 44px 1fr; }
  .app-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
