:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e2330;
  --border: #2a3142;
  --text: #e8ecf4;
  --muted: #9aa6bd;
  --accent: #3d8bfd;
  --accent2: #2ecc71;
  --danger: #e74c3c;
  --warn: #f39c12;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  flex-shrink: 0;
}
.sidebar h2 {
  margin: 0 0 1rem 0.5rem;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}
.sidebar nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--panel2);
  text-decoration: none;
}
.content { flex: 1; padding: 1.5rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
h1 { margin: 0; font-size: 1.4rem; }
.muted { color: var(--muted); }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.card .n { font-size: 1.8rem; font-weight: 700; }
.card .l { color: var(--muted); font-size: 0.9rem; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
th, td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}
th { background: var(--panel2); color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #000;
}

.btn, button, .button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--panel2); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--accent2); }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

form label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
form input, form select, form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
form textarea { min-height: 90px; resize: vertical; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert.error { background: rgba(231,76,60,.15); color: #ff8f84; border: 1px solid rgba(231,76,60,.35); }
.alert.ok { background: rgba(46,204,113,.12); color: #7dffa8; border: 1px solid rgba(46,204,113,.35); }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, #1a2233 0%, var(--bg) 55%);
}
.auth-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}
.auth-card h1 { margin-bottom: 0.25rem; }
.auth-card button { width: 100%; margin-top: 0.5rem; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 0.75rem;
}
code { background: var(--panel2); padding: 0.1rem 0.35rem; border-radius: 4px; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .form-grid { grid-template-columns: 1fr; }
}
