:root {
  --bg: #0b1020;
  --bg-elev: #111832;
  --panel: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --primary-ink: #052e13;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 25px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, var(--bg) 0%, #0c1226 100%);
  color: var(--text);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 12px 16px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.app-header h1 { font-size: 20px; margin: 8px 0; }
.header-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.app-main { padding: 16px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar .select { max-width: 180px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; }

.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  outline: none;
}

.input:focus { border-color: rgba(34,197,94,0.6); box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }

.button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.button.primary { background: var(--primary); color: #052e13; border-color: rgba(0,0,0,0.2); font-weight: 600; }
.button.danger { background: var(--danger); color: #2b0a0a; border-color: rgba(0,0,0,0.25); font-weight: 600; }
.button.subtle { background: transparent; border-color: rgba(255,255,255,0.12); color: var(--muted); }
.button:disabled { opacity: .6; cursor: not-allowed; }

/* Header pill/ghost variants */
.button.pill { border-radius: 999px; padding: 10px 16px; }
.button.ghost { background: transparent; border-color: rgba(255,255,255,0.16); }
.button.ghost:hover { background: rgba(255,255,255,0.06); }
.button .icon { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; }

.icon-button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.list-section { min-height: 40vh; }
.card-list { display: grid; grid-template-columns: 1fr; gap: 12px; }

@media (min-width: 720px) {
  .card-list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .card-list { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-media { position: relative; aspect-ratio: 16/9; background: #0b1225; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; padding: 8px 12px 0; align-items: center; }
.thumb { width: 100%; aspect-ratio: 1; border-radius: 999px; overflow: hidden; background: #0b1225; border: 1px solid rgba(255,255,255,0.08); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 12px; }
.card-title { font-weight: 600; margin: 0 0 6px; }
.card-sub { margin: 0; color: var(--muted); font-size: 14px; }

.card-actions { display: flex; padding: 10px 12px; gap: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.spacer { flex: 1; }

.empty-state { display: grid; place-items: center; min-height: 40vh; }
.empty-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); padding: 24px; border-radius: var(--radius); text-align: center; }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 28px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.98);
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }

.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 12px; padding: 12px 16px 0; }
.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: 14px; }

.upload { display: grid; gap: 10px; }
.file-input { display: block; width: 100%; }
.preview { display: grid; gap: 8px; }
.preview img { width: 100%; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); }

.modal-actions { display: flex; align-items: center; gap: 8px; padding: 0 16px 16px; }

.detail-content { display: grid; gap: 12px; padding: 12px 16px 16px; }
.detail-media-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.thumb-lg { aspect-ratio: 1; border-radius: 999px; overflow: hidden; background: #0b1225; border: 1px solid rgba(255,255,255,0.08); }
.thumb-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .modal, .modal-overlay { transition: none; }
}


