:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --border: #e2e8f0;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}
.sidebar h1 {
  font-size: 1rem;
  margin: 0 0 1.5rem;
  color: #fff;
  font-weight: 700;
}
.sidebar nav a {
  display: block;
  color: #cbd5e1;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  text-decoration: none;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.main { flex: 1; padding: 2rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat h3 { margin: 0; font-size: 1.75rem; }
.stat p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.875rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }

.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="color"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 560px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
textarea { min-height: 160px; font-family: ui-monospace, monospace; font-size: 0.875rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
}
.auth-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.auth-card p { color: var(--muted); margin: 0 0 1.5rem; }
.api-key {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  background: #f1f5f9;
  padding: 0.5rem;
  border-radius: 6px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
.media-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
