:root {
  --bg: #0B0608;
  --panel: #140C0F;
  --panel-2: #191114;
  --line: rgba(255, 255, 255, 0.12);
  --text: #F4EEE8;
  --muted: #8F8A8C;
  --red: #E8464D;
  --red-deep: #CC2229;
  --ok: #3DCF8E;
  --warn: #E8B84A;
  --font: "Segoe UI", system-ui, sans-serif;
  --display: "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --sidebar: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(232, 70, 77, 0.18), transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(255, 255, 255, 0.04), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red); }

.app { display: none; min-height: 100vh; }
.app.on { display: grid; grid-template-columns: var(--sidebar) 1fr; }

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(20, 12, 15, 0.92);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 0 10px 20px; }
.brand strong { display: block; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; }
.brand span { color: var(--muted); font-size: 13px; }
.nav-btn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav-btn.active { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.sidebar .spacer { flex: 1; }
.pub-btn, .ghost-btn, .danger-btn, .primary {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
}
.pub-btn, .primary { background: var(--red); color: #fff; }
.pub-btn:hover, .primary:hover { background: var(--red-deep); }
.pub-btn:disabled, .primary:disabled { opacity: 0.5; cursor: wait; }
.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--text); }
.danger-btn { background: transparent; border: 1px solid rgba(232,70,77,.4); color: var(--red); }

.main { padding: 32px 36px 80px; max-width: 1100px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}
.top h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; letter-spacing: 0.02em; }
.top p { margin: 0; color: var(--muted); }
.status {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
}
.status.ok { color: var(--ok); border-color: rgba(61,207,142,.35); }
.status.bad { color: var(--red); border-color: rgba(232,70,77,.35); }
.status.busy { color: var(--warn); border-color: rgba(232,184,74,.35); }

.panel {
  background: rgba(25, 17, 20, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.row { display: grid; gap: 12px; margin-bottom: 12px; }
.row.2 { grid-template-columns: 1fr 1fr; }
.row.3 { grid-template-columns: 1fr 1fr 1fr; }
.row.4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid rgba(232,70,77,.55); border-color: rgba(232,70,77,.55); }
.check { display: flex; align-items: center; gap: 10px; padding-top: 26px; color: var(--text); font-size: 14px; }
.check input { width: auto; }

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.item-head h3 { margin: 0; font-size: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.media-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.media-preview {
  aspect-ratio: 4/3;
  background: #10090B;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-card .meta { padding: 12px; display: grid; gap: 8px; }
.media-card .meta strong { font-size: 14px; }
.media-card .meta small { color: var(--muted); word-break: break-all; }
.file-btn { position: relative; overflow: hidden; display: inline-block; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: 10px;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  transform: translateY(120%);
  transition: transform .25s ease;
  z-index: 50;
}
.toast.on { transform: translateY(0); }
.toast.ok { border-color: rgba(61,207,142,.4); }
.toast.bad { border-color: rgba(232,70,77,.45); }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: rgba(25, 17, 20, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
}
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .primary { width: 100%; margin-top: 16px; }
.err { color: var(--red); font-size: 13px; min-height: 1.2em; margin-top: 10px; }

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

@media (max-width: 860px) {
  .app.on { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .row.2, .row.3, .row.4 { grid-template-columns: 1fr; }
  .main { padding: 22px 16px 60px; }
  .check { padding-top: 8px; }
}
