:root {
  --bg: #0F0F12;
  --panel: #16161A;
  --border: #252529;
  --text: #F4F1EC;
  --text-dim: #A3A3A8;
  --accent: #FF5A1F;
  --error: #E04F4F;
  --success: #2EE07F;
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
code { background: #252529; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
  color: var(--text);
  font-size: 16px;
}
.admin-sidebar__brand span { color: var(--accent); }
.admin-sidebar__logo { width: 38px; height: auto; flex-shrink: 0; }
.login-logo {
  display: block;
  width: 110px;
  height: auto;
  margin: 0 auto 14px;
  filter: drop-shadow(0 4px 14px rgba(255,90,31,0.18));
}
.admin-nav { list-style: none; display: grid; gap: 4px; }
.admin-nav a {
  display: block; padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
}
.admin-nav a:hover, .admin-nav a.is-active {
  background: var(--border);
  color: var(--text);
  text-decoration: none;
}
.admin-sidebar__footer {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim);
}
.admin-sidebar__footer a { color: var(--text-dim); }

.admin-main {
  padding: 32px 40px;
  max-width: 1100px;
}
.admin-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 24px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.admin-header h1 { font-size: 24px; font-weight: 700; }
.admin-header__actions { display: flex; gap: 8px; }

.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.admin-card h2 { font-size: 16px; margin-bottom: 12px; font-weight: 600; }
.admin-card p { color: var(--text-dim); }

.admin-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.admin-stat__num { font-size: 32px; font-weight: 700; color: var(--accent); display: block; line-height: 1; }
.admin-stat__label { color: var(--text-dim); font-size: 13px; margin-top: 6px; display: block; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="url"], .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  width: 100%;
  font-family: inherit;
}
.field textarea { font-family: inherit; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.field--checkbox { display: flex; align-items: center; gap: 10px; }
.field--checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  background: var(--border); color: var(--text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #303035; text-decoration: none; }
.btn-primary { background: var(--accent); color: #0A0A0B; }
.btn-primary:hover { background: #ff7240; color: #0A0A0B; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #d04444; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--border); }

/* Quick visibility toggle (posts/events lists) */
.visible-toggle {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: filter 120ms ease, border-color 120ms ease;
}
.visible-toggle.is-on {
  background: rgba(34, 175, 110, 0.15);
  color: #22af6e;
  border-color: rgba(34, 175, 110, 0.4);
}
.visible-toggle.is-off {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--border);
}
.visible-toggle:hover { filter: brightness(1.2); border-color: currentColor; }

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-success { background: rgba(46,224,127,0.1); border: 1px solid rgba(46,224,127,0.3); color: var(--success); }
.flash-error   { background: rgba(224,79,79,0.1); border: 1px solid rgba(224,79,79,0.3); color: var(--error); }
.flash-info    { background: rgba(255,90,31,0.08); border: 1px solid rgba(255,90,31,0.25); color: var(--accent); }

.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--bg);
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
}
.login-box h1 { font-size: 22px; margin-bottom: 8px; font-weight: 700; }
.login-box h1 span { color: var(--accent); }
.login-box .login-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 24px; }

.admin-table {
  width: 100%; border-collapse: collapse; margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
.admin-table thead th {
  background: rgba(0,0,0,0.2);
  color: var(--text-dim); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table .col-actions { text-align: right; white-space: nowrap; }
.admin-table .col-actions a { margin-left: 8px; font-size: 13px; }

@media (max-width: 720px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-main { padding: 20px; }
}
