/* ============================================================
   ADMIN.CSS — Full admin panel design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;700;900&display=swap');

:root {
  --bg:        #0a0a0a;
  --surface:   #111113;
  --surface-2: #18181b;
  --surface-3: #1f1f23;
  --border:    rgba(255,255,255,0.08);
  --border-2:  rgba(255,255,255,0.12);
  --red:       #EE3F2C;
  --red-dim:   rgba(238,63,44,0.15);
  --white:     #f0ede8;
  --muted:     rgba(255,255,255,0.45);
  --muted-2:   rgba(255,255,255,0.25);
  --success:   #22c55e;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --font:      'Rubik', sans-serif;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 240px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  outline: none;
  cursor: pointer;
}
img { display: block; max-width: 100%; }

/* ── LAYOUT ──────────────────────────────────────────────────── */

.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar__logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__logo-text {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--white);
}

.sidebar__logo-text span {
  color: var(--red);
}

.sidebar__logo-sub {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar__section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 12px 20px 6px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.2s, background 0.2s;
  position: relative;
  border-left: 2px solid transparent;
}

.sidebar__link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.sidebar__link.active {
  color: var(--white);
  background: rgba(238,63,44,0.08);
  border-left-color: var(--red);
}

.sidebar__link-icon {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__signout {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 0;
  transition: color 0.2s;
  width: 100%;
}

.sidebar__signout:hover {
  color: var(--danger);
}

/* ── MAIN CONTENT AREA ───────────────────────────────────────── */

.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ──────────────────────────────────────────────────── */

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.admin-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--white);
}

.admin-topbar__breadcrumb {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-topbar__breadcrumb a {
  color: var(--muted);
  transition: color 0.2s;
}

.admin-topbar__breadcrumb a:hover {
  color: var(--white);
}

.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── PAGE CONTENT ─────────────────────────────────────────────── */

.admin-content {
  flex: 1;
  padding: 32px 40px;
}

/* ── MOBILE TOGGLE ────────────────────────────────────────────── */

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

/* ── BUTTONS ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.98); }

.btn-red {
  background: var(--red);
  color: var(--white);
  clip-path: polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--white);
  border-color: var(--border-2);
  opacity: 1;
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
  opacity: 1;
}

.btn-success {
  background: rgba(34,197,94,0.15);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.08);
  opacity: 1;
}

/* ── FORMS ────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-input,
.form-textarea,
.form-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 300;
  border-radius: 2px;
  transition: border-color 0.2s;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-bottom-color: var(--red);
  background: var(--surface-3);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted-2);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.65;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.4)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--surface-2);
  color: var(--white);
}

.form-hint {
  font-size: 0.7rem;
  color: var(--muted-2);
  margin-top: 2px;
}

.form-error {
  font-size: 0.7rem;
  color: var(--danger);
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle__track {
  width: 40px;
  height: 22px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle input:checked + .toggle__track {
  background: rgba(238,63,44,0.3);
  border-color: var(--red);
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: left 0.2s var(--ease), background 0.2s;
}

.toggle input:checked ~ .toggle__thumb,
.toggle__track:has(input:checked) .toggle__thumb {
  left: 21px;
  background: var(--red);
}

.toggle__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

/* ── CARDS ────────────────────────────────────────────────────── */

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.admin-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.admin-card__title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white);
}

.admin-card__body {
  padding: 20px;
}

/* ── TABLE ────────────────────────────────────────────────────── */

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: rgba(255,255,255,0.85);
}

.admin-table tbody tr {
  transition: background 0.15s;
}

.admin-table tbody tr:hover {
  background: rgba(255,255,255,0.025);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table thumbnail */
.table-thumb {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.table-thumb-placeholder {
  width: 52px;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--muted-2);
}

/* Drag handle */
.drag-handle {
  color: var(--muted-2);
  cursor: grab;
  font-size: 1rem;
  padding: 0 4px;
  user-select: none;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--white);
}

tr.dragging {
  opacity: 0.4;
  background: rgba(238,63,44,0.05);
}

tr.drag-over {
  border-top: 2px solid var(--red);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 2px;
}

.badge--visible {
  background: rgba(34,197,94,0.1);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}

.badge--hidden {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge--featured {
  background: rgba(238,63,44,0.1);
  color: var(--red);
  border: 1px solid rgba(238,63,44,0.2);
}

.badge--cat {
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── MODAL ────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-top: 2px solid var(--red);
  border-radius: 4px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  transition: transform 0.25s var(--ease);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal__title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  font-size: 1rem;
  transition: color 0.2s, background 0.2s;
}

.modal__close:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
}

.modal__body {
  padding: 24px;
  flex: 1;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── TOASTS ───────────────────────────────────────────────────── */

.admin-toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.admin-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--red);
  border-radius: 2px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--white);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  max-width: 320px;
  min-width: 200px;
}

.admin-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.admin-toast.toast-success { border-left-color: var(--success); }
.admin-toast.toast-error   { border-left-color: var(--danger); }
.admin-toast.toast-info    { border-left-color: var(--red); }

/* ── STATS CARDS (dashboard) ──────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--red);
  border-radius: 4px;
  padding: 20px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--white);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── QUICK ACTIONS ────────────────────────────────────────────── */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.quick-action:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateY(-2px);
}

.quick-action__icon {
  font-size: 1.4rem;
  line-height: 1;
}

.quick-action__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
}

.quick-action__sub {
  font-size: 0.68rem;
  color: var(--muted);
}

/* ── PROJECT EDITOR SPECIFIC ──────────────────────────────────── */

.editor-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.editor-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.editor-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Block editor */
.block-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.block-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.block-card.dragging {
  opacity: 0.4;
  border-color: var(--red);
}

.block-card.drag-over {
  border-top: 2px solid var(--red);
}

.block-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: default;
}

.block-card__drag {
  color: var(--muted-2);
  cursor: grab;
  font-size: 1rem;
  user-select: none;
  flex-shrink: 0;
}

.block-card__drag:hover { color: var(--white); }

.block-type-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.block-type-badge.type-heading   { color: #60a5fa; border-color: rgba(96,165,250,0.3); }
.block-type-badge.type-paragraph { color: var(--muted); }
.block-type-badge.type-image     { color: #34d399; border-color: rgba(52,211,153,0.3); }
.block-type-badge.type-gallery   { color: #a78bfa; border-color: rgba(167,139,250,0.3); }
.block-type-badge.type-video     { color: #f472b6; border-color: rgba(244,114,182,0.3); }
.block-type-badge.type-quote     { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.block-type-badge.type-list      { color: #4ade80; border-color: rgba(74,222,128,0.3); }
.block-type-badge.type-divider   { color: var(--muted-2); }
.block-type-badge.type-file      { color: #fb923c; border-color: rgba(251,146,60,0.3); }

.block-card__preview {
  flex: 1;
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.block-card__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.block-card__editor {
  padding: 14px 14px 14px 14px;
  border-top: 1px solid var(--border);
  display: none;
}

.block-card__editor.open {
  display: block;
}

/* Tag pill input */
.tag-input-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  padding: 8px 10px;
  cursor: text;
  min-height: 44px;
  align-items: center;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--white);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  padding: 3px 8px;
  border-radius: 2px;
}

.tag-pill__remove {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}

.tag-pill__remove:hover { color: var(--danger); }

.tag-input-field {
  background: none;
  border: none;
  color: var(--white);
  font-size: 0.82rem;
  flex: 1;
  min-width: 80px;
  padding: 2px 4px;
}

/* Gallery thumbnails in editor */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.gallery-thumb {
  position: relative;
  aspect-ratio: 1;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.gallery-thumb__remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  background: rgba(0,0,0,0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--white);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-thumb:hover .gallery-thumb__remove {
  opacity: 1;
}

/* Upload progress */
.upload-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.upload-progress__bar {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width 0.2s;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.drag-active {
  border-color: var(--red);
  background: rgba(238,63,44,0.04);
}

.upload-zone__icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.upload-zone__text {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 300;
}

.upload-zone__text strong {
  color: var(--red);
  font-weight: 700;
}

/* Settings sub-nav */
.settings-subnav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
}

.settings-subnav__link {
  padding: 10px 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.settings-subnav__link:hover {
  color: var(--white);
}

.settings-subnav__link.active {
  color: var(--white);
  border-bottom-color: var(--red);
}

/* Image preview in settings/editor */
.img-preview-wrap {
  position: relative;
  display: inline-block;
}

.img-preview {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  display: block;
}

.img-preview-placeholder {
  width: 120px;
  height: 80px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted-2);
  letter-spacing: 0.1em;
}

/* Media library grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.media-item {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item__icon-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}

.media-item__type-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.media-item__name {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.media-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.media-item:hover .media-item__overlay {
  opacity: 1;
}

/* Autosave indicator */
.autosave-status {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.autosave-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.autosave-status.saving .dot {
  background: var(--warning);
  animation: pulse 1s infinite;
}

.autosave-status.saved .dot {
  background: var(--success);
}

@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── UTILITY ──────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--muted); }
.text-red { color: var(--red); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.68rem; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── RESPONSIVE ───────────────────────────────────────────────── */

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-sidebar {
    left: -260px;
    transition: left 0.3s var(--ease);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .admin-content {
    padding: 20px;
  }

  .admin-topbar {
    padding: 12px 20px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-left {
    position: static;
    max-height: none;
  }
}
