:root {
  --brand: #C9A227;
  --brand-bright: #E8B923;
  --ink: #1A1A1A;
  --text-dark: #2D2D2D;
  --muted: #6B6B6B;
  --line: rgba(0, 0, 0, 0.06);
  --bg: #FDF8F3;
  --bg-alt: #F9F5F0;
  --panel: #FFFBF7;
  --sidebar: #1A1A1A;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-gold: 0 4px 20px rgba(201, 162, 39, 0.25);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
  background: var(--bg);
  font-size: 15px;
}
a { color: #9b7818; text-decoration: none; font-weight: 600; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #fff; padding: 24px; }
.brand { font-size: 20px; font-weight: 600; margin-bottom: 28px; }
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-bright) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
}
.logo-icon svg { width: 24px; height: 24px; color: white; }
.logo-text { display: flex; flex-direction: column; }
.logo-text-main { color: #fff; font-size: 15px; line-height: 1.1; font-weight: 600; }
.logo-text-sub { color: #c9c9c9; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.nav a, .nav button {
  display: block;
  width: 100%;
  padding: 10px 0;
  color: #d1d5db;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.nav a:hover, .nav button:hover { color: #fff; }
.main { padding: 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { font-size: 28px; font-weight: 600; color: var(--ink); }
.muted { color: var(--muted); }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; background: #E4F4EC; color: #24663d; }
.error { background: #fef2f2; color: #991b1b; }
label { display: block; font-weight: 600; margin: 14px 0 6px; color: var(--ink); }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
textarea { min-height: 130px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--brand);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-bright) 100%);
  color: #1A1A1A;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-gold);
}
.button.secondary { background: var(--panel); color: #8a6614; box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--ink); font-weight: 600; font-size: 13px; }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: 0; }
.media-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.media-option {
  display: grid;
  grid-template-columns: 18px 48px 1fr;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.media-thumb {
  width: 48px;
  height: 40px;
  border-radius: 6px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 11px;
  color: var(--muted);
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-name {
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: #E4F4EC; color: #24663d; }
.badge.bad { background: #FFEBEE; color: #9f1d1d; }
.auth {
  max-width: 440px;
  margin: 8vh auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
