:root {
  --bg: #0a0a0f;
  --panel: #14141c;
  --panel2: #1b1b26;
  --line: #2a2a38;
  --text: #e8e8ef;
  --muted: #8a8a9a;
  --primary: #c41e1e;
  --primary2: #e23b3b;
  --ok: #28a745;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
h1, h2, h3 { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
input, textarea, select {
  width: 100%;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary2); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; }
button { cursor: pointer; font-family: inherit; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px; width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card button {
  background: var(--primary); color: #fff; border: 0; padding: 11px; border-radius: 8px;
  font-weight: 600;
}
.login-card button:hover { background: var(--primary2); }
.login-err { color: #ff6b6b; font-size: 13px; min-height: 16px; }

/* Layout */
.panel { display: flex; min-height: 100vh; }
.side {
  width: 220px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.side-brand { font-weight: 800; font-size: 16px; padding: 6px 8px 16px; }
.tabs { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tab {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.tab:hover { background: var(--panel2); color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.side-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 8px; border-radius: 8px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.content { flex: 1; padding: 26px 30px; max-width: 880px; }
.view h2 { margin: 0 0 4px; }
.view > .muted { margin-bottom: 20px; }

/* Forms / cards */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.row-actions { display: flex; gap: 10px; margin-top: 6px; }
.btn {
  background: var(--primary); color: #fff; border: 0; padding: 9px 16px;
  border-radius: 8px; font-weight: 600;
}
.btn:hover { background: var(--primary2); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-del { background: #3a1414; color: #ff8585; }
.btn-del:hover { background: #501818; }
.btn-add { background: var(--panel2); border: 1px dashed var(--line); color: var(--text); }
.btn-add:hover { border-color: var(--primary2); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head strong { font-size: 15px; }

.inline { display: flex; align-items: center; gap: 8px; }
.checkbox { width: auto; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 38px; padding: 2px; }
.thumb { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--panel2); }
.upload-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.upload-row input[type=file] { display: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }

.toast {
  position: fixed; top: 16px; right: 16px; background: var(--ok); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-weight: 600; opacity: 0;
  transform: translateY(-8px); transition: .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #c0392b; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ── CDN folders ─────────────────────────────────────────────────────────── */
.folderbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 12px 0; padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #2a2a2e);
}
.chip {
  border: 1px solid var(--line, #2a2a2e);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit; font-size: 13px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent, #c41e1e); }
/* The selected folder is inverted rather than tinted, so it reads as selected
   at a glance instead of "slightly different". */
.chip-on { background: var(--accent, #c41e1e); border-color: var(--accent, #c41e1e); color: #fff; }
.chip-add { border-style: dashed; opacity: .8; }
.chip-del { margin-left: auto; border-color: #7a2e2e; color: #e08b8b; }
.uploadrow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.uploadrow input { flex: 0 1 260px; }
select[data-move] { max-width: 140px; }

/* Author + URL sit on one line under the filename. The author is the editable
   one, so it gets the narrower, visually-active field and the URL stays a wide
   read-only strip. */
.authorrow { display: flex; gap: 8px; margin-top: 4px; }
.authorrow input[data-author] { flex: 0 0 200px; }
.authorrow input[readonly] { flex: 1 1 auto; opacity: .75; }
@media (max-width: 720px) {
  .authorrow { flex-direction: column; }
  .authorrow input[data-author] { flex: 1 1 auto; }
}
