:root {
  --bg: #0f0f11;
  --panel: #17171b;
  --panel-2: #1f1f25;
  --border: #2a2a31;
  --text: #f2f2f4;
  --muted: #9a9aa5;
  --gold: #e8d5a8;
  --gold-2: #c8a96e;
  --danger: #e0556b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--gold); }

/* ---------- login ---------- */
.login-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.login-card h1 { font-size: 1.25rem; margin: 0; }
.login-sub { color: var(--muted); margin: 0 0 0.5rem; font-size: 0.9rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.login-error { color: var(--danger); font-size: 0.85rem; display: none; margin: 0; }

input, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold-2); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--gold-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--gold); color: #1a1306; border-color: var(--gold); font-weight: 600; }
.btn--primary:hover { background: var(--gold-2); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); border-color: transparent; }
.btn--danger:hover { border-color: var(--danger); }
.btn--sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.link { background: none; border: none; color: var(--gold); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
button[type="submit"].btn, .login-card button[type="submit"] {
  background: var(--gold); color: #1a1306; border: none; padding: 0.65rem;
  border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.95rem; margin-top: 0.5rem;
}

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--panel);
}
.topbar__brand { font-weight: 600; }
.topbar__actions { display: flex; align-items: center; gap: 0.5rem; }
.topbar__user { color: var(--muted); font-size: 0.85rem; margin-right: 0.5rem; }

.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar { width: 320px; border-right: 1px solid var(--border); padding: 1.25rem; flex-shrink: 0; }
.sidebar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sidebar__head h2 { font-size: 1rem; margin: 0; }

.pres-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.pres-list li {
  padding: 0.75rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.pres-list li:hover { border-color: var(--gold-2); }
.pres-list li.is-active { background: var(--panel-2); border-color: var(--gold-2); }
.pres-list li .pl-title { font-weight: 500; }
.pres-list li .pl-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

.editor { flex: 1; padding: 1.5rem 2rem; min-width: 0; }
.editor__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.editor__title { font-size: 1.3rem; font-weight: 600; background: transparent; border: 1px solid transparent; padding: 0.25rem 0.4rem; }
.editor__title:hover { border-color: var(--border); }
.editor__meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; padding-left: 0.4rem; }
.editor__head-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.uploader {
  border: 2px dashed var(--border); border-radius: 12px; padding: 1.5rem; text-align: center;
  color: var(--muted); transition: border-color 0.15s, background 0.15s; margin-bottom: 1rem;
}
.uploader.is-drag { border-color: var(--gold); background: rgba(232,213,168,0.06); }
.uploader p { margin: 0.25rem 0; }
.uploader__hint { font-size: 0.8rem; }
.uploader__progress { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.75rem; }
.uploader__bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 6px; overflow: hidden; position: relative; }
.uploader__bar::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); background: var(--gold); transition: width 0.2s; }

.reorder-hint { color: var(--muted); font-size: 0.8rem; margin: 0 0 0.75rem; }

.slides-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem;
}
.slide-card {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); position: relative; cursor: grab;
}
.slide-card.dragging { opacity: 0.4; }
.slide-card.drop-target { border-color: var(--gold); }
.slide-card__media { aspect-ratio: 16/10; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slide-card__media img, .slide-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-card__badge {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.7rem; padding: 0.15rem 0.45rem; border-radius: 6px; backdrop-filter: blur(4px);
}
.slide-card__num { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.6); color: var(--gold);
  font-size: 0.7rem; padding: 0.15rem 0.45rem; border-radius: 6px; font-variant-numeric: tabular-nums; }
.slide-card__body { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.5rem; }
.slide-card__opts { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.slide-card__opts label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.slide-card__actions { display: flex; justify-content: flex-end; }
.slide-card__del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.8rem; }
.slide-card input[type="text"] { font-size: 0.8rem; padding: 0.35rem 0.5rem; }

.empty-msg { color: var(--muted); text-align: center; padding: 3rem 1rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal__dialog {
  position: relative; z-index: 1; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto;
}
.modal__close { position: absolute; top: 0.75rem; right: 0.9rem; background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; }
.modal h3 { margin: 0 0 1rem; }
.modal .field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; font-size: 0.85rem; color: var(--muted); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.modal .user-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 0.7rem 1.1rem; border-radius: 10px; z-index: 600; font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.toast[hidden] { display: none; }
.toast.is-error { border-color: var(--danger); color: #ffd7dd; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
}
