:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel-2: #1e233b;
  --text: #e9ecf5;
  --muted: #9aa3bd;
  --accent: #7c5cff;
  --accent-2: #5a8dff;
  --ok: #35c07e;
  --danger: #ff5c7a;
  --border: #2a3050;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #2a2350, transparent),
              radial-gradient(1000px 500px at 100% 0%, #16305a, transparent),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container { width: min(1150px, 92%); margin: 0 auto; }

.header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(15, 18, 32, 0.75);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.nav { display: flex; gap: 10px; }

.btn {
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; font-size: 14px; cursor: pointer;
  transition: .15s ease; font-weight: 600;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-ok { background: var(--ok); color: #06281a; }
.btn-danger { background: var(--danger); color: #2a0511; }

.icon-btn { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }

main { padding: 24px 0 60px; }

.filters {
  display: grid;
  grid-template-columns: 1fr 200px 200px;
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 700px) {
  .filters { grid-template-columns: 1fr; }
}

.input {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  transition: .18s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-title { margin: 0; font-size: 16px; line-height: 1.35; }
.badge {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  background: rgba(124,92,255,.15); color: #c8bcff; white-space: nowrap;
  border: 1px solid rgba(124,92,255,.35);
}
.card-meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.card-desc { color: var(--muted); font-size: 13px; }

.prompt-box {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px dashed var(--border);
}
.prompt-box.expanded { max-height: none; }

.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 560px;
  padding: 22px;
  max-height: 90vh; overflow-y: auto;
}
.modal-box.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea.input { resize: vertical; min-height: 90px; font-family: inherit; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.msg { font-size: 13px; min-height: 18px; margin: 4px 0 0; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.admin-auth { display: flex; gap: 10px; margin-bottom: 12px; }
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.admin-item h3 { margin: 0 0 6px; font-size: 15px; }
.admin-item pre {
  white-space: pre-wrap; word-break: break-word;
  background: #12162a; border-radius: 8px; padding: 10px;
  font-size: 12px; max-height: 200px; overflow: auto; margin: 8px 0;
}
.admin-item .actions { display: flex; gap: 8px; margin-top: 8px; }

.hidden { display: none !important; }