@font-face {
  font-family: 'Falafel Grotesque';
  src: url('../../FalafelGrotesque.eot');
  src: url('../../FalafelGrotesque.eot?#iefix') format('embedded-opentype'),
       url('../../FalafelGrotesque.woff2') format('woff2'),
       url('../../FalafelGrotesque.woff') format('woff'),
       url('../../FalafelGrotesque.ttf') format('truetype'),
       url('../../FalafelGrotesque.svg#FalafelGrotesque') format('svg');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ececec;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e2e2e0;
  --accent: #111111;
  --accent-contrast: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --ok: #1b7a3d;
  --radius: 6px;
  --radius-card: 20px;
  --radius-row: 14px;
  --pill: 999px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Falafel Grotesque', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--ink); }

/* ─── Outer shell (no outer frame — full-bleed) ─── */
.admin-frame {
  min-height: 100vh;
}
.admin-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: var(--panel);
}

/* ─── Sidebar ─── */
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #000;
  color: #f4f4f2;
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
}
.admin-sidebar .brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 10px 20px;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 14px;
}
.admin-sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #d8d8d8;
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--pill);
}
.admin-sidebar nav a .nav-icon { font-size: 12px; opacity: 0.7; width: 14px; text-align: center; }
.admin-sidebar nav a:hover { background: #1e1e1e; color: #fff; }
.admin-sidebar nav a.active {
  background: #ffffff;
  color: #000;
}
.admin-sidebar nav a.active .nav-icon { opacity: 1; }
.admin-sidebar .sidebar-footer {
  margin-top: 16px;
  padding: 14px 14px 0;
  border-top: 1px solid #2a2a2a;
  font-size: 12px;
}
.admin-sidebar .sidebar-user { color: #fff; margin-bottom: 8px; }
.admin-sidebar .sidebar-user span { color: #9a9a9a; text-transform: capitalize; }
.admin-sidebar .sidebar-footer > a { color: #d8d8d8; text-decoration: none; }
.admin-sidebar .sidebar-footer > a:hover { color: #fff; text-decoration: underline; }

/* ─── Main content ─── */
.admin-main { flex: 1; padding: 32px 40px; min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
.admin-topbar h1 { font-size: 46px; letter-spacing: -0.02em; margin: 0; }
.top-pill { white-space: nowrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 24px;
}
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--ink);
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Card-row lists (replaces plain tables for Works / Blog / Studio Activities) ─── */
.list-rows { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border-radius: var(--radius-row);
  padding: 10px 16px;
  cursor: grab;
}
.list-row.dragging { opacity: 0.4; }
.list-row-handle { color: var(--muted); font-size: 14px; flex-shrink: 0; }
.list-row-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #ddd; flex-shrink: 0; }
.list-row-thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 700; font-size: 15px; }
.list-row-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row-status { flex-shrink: 0; }
.list-row-actions { display: flex; gap: 12px; flex-shrink: 0; }
.list-row-actions a { font-size: 12px; text-decoration: underline; white-space: nowrap; }
.list-row-actions a:hover { text-decoration: none; }
.list-empty { padding: 24px; text-align: center; color: var(--muted); background: var(--bg); border-radius: var(--radius-row); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }
.thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; background: #eee; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.tag.published { background: #e7f5ec; color: var(--ok); }
.tag.draft { background: #f1f1ef; color: var(--muted); }
.tag.role-admin { background: #111; color: #fff; }
.tag.role-editor { background: #eee; color: #333; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-row .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 26px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 18px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  min-height: 120px;
  resize: vertical;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.repeatable-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; position: relative; }
.repeatable-item[draggable="true"] { cursor: grab; padding-left: 30px; }
.repeatable-item.dragging { opacity: 0.4; }
.repeatable-item .drag-handle { position: absolute; top: 12px; left: 8px; color: var(--muted); font-size: 13px; }
.repeatable-item .remove-row { position: absolute; top: 8px; right: 8px; font-size: 12px; color: var(--danger); cursor: pointer; background: none; border: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.current-image { max-width: 200px; display: block; margin-bottom: 8px; border-radius: 4px; border: 1px solid var(--line); }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; }
.flash.success { background: #e7f5ec; color: var(--ok); }
.flash.error { background: var(--danger-bg); color: var(--danger); }
.login-wrap { max-width: 360px; margin: 10vh auto; }
.login-wrap .panel { padding: 32px; border-radius: var(--radius-card); }
.login-wrap h1 { font-size: 18px; margin-top: 0; }
.actions-cell { white-space: nowrap; display: flex; gap: 10px; }
.actions-cell a, .actions-cell button { font-size: 12px; }

/* ─── Dashboard stat cards, with a black "hero" first card ─── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px 20px; }
.stat-card .num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.stat-grid .stat-card:first-child { background: #000; border-color: #000; color: #fff; }
.stat-grid .stat-card:first-child .label { color: #b5b5b5; }

/* ─── Status radio group (Published / Draft) ─── */
.radio-row { display: flex; gap: 18px; align-items: center; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: normal; font-size: 13px; }
.radio-row input { width: auto; }

/* ─── Tag chip input ─── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 8px; background: #fff;
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #000; color: #fff; border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px;
}
.tag-chip-remove {
  border: none; background: none; cursor: pointer; color: #fff; opacity: 0.7;
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.tag-chip-remove:hover { opacity: 1; }
.tag-input-field {
  flex: 1 1 120px; min-width: 120px; border: none; padding: 4px; font-size: 26px;
}
.tag-input-field:focus { outline: none; }

/* ─── Rich text (contenteditable) body editor ─── */
.rte-wrap { border: 1.5px solid #000; border-radius: var(--radius); overflow: hidden; }
.rte-toolbar {
  display: flex; gap: 4px; padding: 6px; background: #fafafa; border-bottom: 1px solid var(--line);
}
.rte-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 4px;
  padding: 4px 10px; font-size: 13px; cursor: pointer;
}
.rte-btn:hover { background: #f1f1ef; }
.rte-editor {
  min-height: 180px; padding: 12px 14px; font-size: 18px; line-height: 1.5;
  font-family: 'Falafel Grotesque', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
.rte-editor:focus { outline: none; }
.rte-editor.rte-drag-over { background: #f4f4f2; box-shadow: inset 0 0 0 3px #000; }
.rte-editor p { margin: 0 0 1em; font-family: inherit; }
.rte-editor p:last-child { margin-bottom: 0; }
.rte-editor p.quote {
  font-size: 1.6em; font-weight: 400; letter-spacing: -0.02em; line-height: 1.15;
  margin: 0.6em 0;
}
.rte-editor img.imgcontent, .rte-editor img.imgwide, .rte-editor video.imgcontent, .rte-editor video.imgwide {
  display: block; height: auto; margin: 0.5em auto; cursor: pointer;
}
.rte-editor img.imgcontent:hover, .rte-editor img.imgwide:hover, .rte-editor video.imgcontent:hover, .rte-editor video.imgwide:hover { outline: 2px dashed var(--muted); outline-offset: 2px; }
.rte-editor img.imgcontent, .rte-editor video.imgcontent { max-width: 60%; }
.rte-editor img.imgwide, .rte-editor video.imgwide { max-width: 100%; }
.rte-editor small.caption {
  display: block; text-align: center; color: var(--muted); font-size: 0.75em; margin: -0.3em 0 0.8em;
}
.rte-hint { padding: 6px 14px; font-size: 12px; color: var(--muted); background: #fafafa; border-top: 1px solid var(--line); }

/* ─── Sortable / drag-drop gallery manager ─── */
.gallery-sortable { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; min-height: 10px; }
.gallery-tile {
  position: relative; width: 72px; height: 54px; flex: 0 0 auto; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--line); cursor: grab;
}
.gallery-tile.dragging { opacity: 0.4; }
.gallery-tile img, .gallery-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gallery-tile-remove {
  position: absolute; top: 2px; right: 2px; width: 17px; height: 17px; line-height: 15px;
  text-align: center; border-radius: 50%; border: none; background: rgba(0,0,0,0.7); color: #fff;
  font-size: 11px; cursor: pointer; padding: 0;
}
.gallery-tile-remove:hover { background: var(--danger); }
.gallery-dropzone {
  border: 2px dashed #000; border-radius: var(--radius); padding: 28px 18px;
  text-align: center; cursor: pointer; background: #fafafa;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.gallery-dropzone .dz-icon { font-size: 28px; line-height: 1; }
.gallery-dropzone .dz-main { font-size: 15px; font-weight: 700; color: var(--ink); }
.gallery-dropzone .dz-sub { font-size: 12px; color: var(--muted); }
.gallery-dropzone.drag-over { background: #eaeaea; border-color: #000; box-shadow: inset 0 0 0 2px #000; }
.gallery-new-files { margin-top: 6px; font-size: 12px; color: var(--muted); }
.gallery-new-file { padding: 3px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gallery-new-file-remove {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.gallery-new-file-remove:hover { color: var(--danger); }

@media screen and (max-width: 900px) {
  .admin-frame { padding: 0; }
  .admin-shell { min-height: 100vh; flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; }
  .admin-sidebar .brand { border-bottom: none; padding: 0 10px; margin-bottom: 0; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .admin-sidebar .sidebar-footer { display: none; }
  .admin-main { padding: 20px; }
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
