:root {
  --bg: #0a0a0c;
  --surface: #141418;
  --line: rgba(255,255,255,0.08);
  --text: #eee;
  --muted: #888;
  --accent: #5b8def;
  --danger: #f87171;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }

.login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; padding: 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.login-card h1 { font-size: 20px; font-weight: 800; }
.login-card > p { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-card input {
  width: 100%; margin-bottom: 10px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #0a0a0c; color: var(--text); font: inherit;
}
.login-card button[type=submit] {
  width: 100%; padding: 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
.login-msg { margin-top: 12px; font-size: 12px; color: var(--danger); min-height: 18px; }

.panel { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-brand { font-weight: 800; font-size: 13px; padding: 8px 10px; margin-bottom: 12px; }
.nav-btn {
  text-align: left; padding: 10px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  cursor: pointer;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.logout-btn {
  margin-top: auto; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: inherit; cursor: pointer;
}

.panel-main { padding: 28px 32px; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.panel-head h2 { font-size: 22px; font-weight: 800; }
.panel-head a { font-size: 12px; color: var(--muted); }
.tab { display: none; }
.tab.active { display: block; }

.toolbar { margin-bottom: 16px; }
.btn {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); color: var(--text); font: inherit;
  font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.danger { color: var(--danger); border-color: rgba(248,113,113,0.3); }

.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.list-item {
  padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; transition: border-color 0.2s;
}
.list-item:hover { border-color: rgba(255,255,255,0.15); }
.list-item.selected { border-color: var(--accent); }
.list-item h4 { font-size: 14px; margin-bottom: 4px; }
.list-item p { font-size: 12px; color: var(--muted); }

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 12px;
  line-height: 1.45;
}

.editor {
  padding: 20px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; gap: 12px;
}
.editor label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.editor input, .editor textarea, .editor select {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #0a0a0c; color: var(--text); font: inherit; font-size: 13px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  font-size: 13px !important;
  color: var(--text) !important;
}
.checkbox-label input { width: auto; margin: 0; }
.editor label code { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.admin-media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px; margin: 4px 0 8px;
}
.admin-media-item {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #0a0a0c; aspect-ratio: 1;
}
.admin-media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-media-remove {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 14px; line-height: 1;
  background: rgba(0,0,0,0.75); color: #fff;
}
.admin-media-remove:hover { background: #ef4444; }
.admin-media-empty { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

@media (max-width: 800px) {
  .panel { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .logout-btn { margin-top: 0; margin-left: auto; }
  .grid-2 { grid-template-columns: 1fr; }
}
