:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaef;
  --dim: #9aa2b1;
  --accent: #6ea8fe;
  --bad: #ff6b6b;
  --good: #63d19e;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
button, .open, select, input, textarea { font: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.top .row { display: flex; gap: 8px; }
.back { color: var(--dim); }

button, .open {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
button:hover, .open:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.ghost { background: transparent; }
.danger { color: var(--bad); border-color: #46292f; }

/* login */
.login { max-width: 340px; margin: 18vh auto; text-align: center; }
.login h1 { font-size: 28px; margin-bottom: 20px; }
.login input {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; color: var(--text);
}
.login button { width: 100%; border-radius: 10px; padding: 12px; }
.error { color: var(--bad); }

/* pending / failed */
.pending { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pill {
  display: flex; align-items: center; gap: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
  color: var(--dim); font-size: 14px;
}
.pill.bad { border-color: #46292f; color: #ffb4b4; justify-content: space-between; }
.spinner {
  width: 13px; height: 13px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* tabs + filters */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs a {
  padding: 7px 13px; border-radius: 999px; color: var(--dim);
  border: 1px solid transparent; white-space: nowrap;
}
.tabs a.on { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.tabs .count { color: var(--dim); font-size: 12px; margin-left: 4px; }

.filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input[type=search], .filters select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; color: var(--text);
}
.filters input[type=search] { flex: 1; min-width: 180px; }

.empty { color: var(--dim); text-align: center; padding: 40px 0; }

/* cards */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.shot { position: relative; display: block; background: #0b0d11; }
.shot img { width: 100%; height: 190px; object-fit: cover; object-position: top; display: block; }
.noshot { height: 190px; }
.badge {
  position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.72);
  border-radius: 6px; padding: 3px 7px; font-size: 11px; letter-spacing: .02em;
}
.badge.n { left: auto; right: 8px; }
.body { padding: 12px 13px 4px; flex: 1; }
.title { font-weight: 600; display: block; line-height: 1.35; }
.creator { color: var(--dim); font-size: 13px; margin: 3px 0 0; }
.idea {
  color: var(--dim); font-size: 13px; margin: 8px 0 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip {
  font-size: 12px; color: var(--dim); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.chip.on { color: var(--text); border-color: var(--accent); }
.flag { font-size: 11px; border-radius: 999px; padding: 2px 9px; }
.flag.dupe { background: #2b2415; color: #f0c674; }
.flag.low { background: #2a1f26; color: #d79bbd; }
.flag.big { display: block; padding: 10px 12px; font-size: 13px; border-radius: 10px; }
.flag.big a { text-decoration: underline; }
.actions { display: flex; gap: 7px; padding: 12px 13px; flex-wrap: wrap; }
.actions button, .actions .open { font-size: 13px; padding: 6px 12px; }

/* detail */
.detail { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .detail { grid-template-columns: 340px minmax(0, 1fr); } }
.shots { display: flex; flex-direction: column; gap: 10px; }
.shots img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.fields { display: flex; flex-direction: column; gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); }
.fields input, .fields textarea, .fields select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--text); font-size: 15px; resize: vertical;
}
.fields input:focus, .fields textarea:focus { outline: none; border-color: var(--accent); }
.states { display: flex; gap: 7px; }
.states .state { text-transform: capitalize; }
.states .state.on { border-color: var(--accent); color: var(--accent); }
.save-state { font-size: 13px; min-height: 18px; margin: 0; color: var(--good); }
.save-state.bad { color: var(--bad); }
.raw { border-top: 1px solid var(--line); padding-top: 12px; color: var(--dim); font-size: 13px; }
.raw summary { cursor: pointer; }
.raw dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0; }
.raw dt { color: var(--dim); }
.raw dd { margin: 0; color: var(--text); }
.raw .ocr { white-space: pre-wrap; background: var(--panel); padding: 10px 12px; border-radius: 10px; }
