:root {
  --bg: #0B0B0D;
  --surface: #131316;
  --surface-2: #1B1B20;
  --line: #26262C;
  --text: #F2F2F4;
  --muted: #8E8E99;
  --ok: #4CC38A;
  --warn: #E0A63C;
  --bad: #E2685F;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Manrope, system-ui, sans-serif; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--text); color: #0B0B0D;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.brand-text { font-weight: 600; }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 14px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11,11,13,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

/* layout */
.admin-layout {
  max-width: 1280px; margin: 0 auto; padding: 20px;
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  align-items: start;
}
.admin-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 76px; }
.navitem {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  text-align: left; padding: 9px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: all .3s var(--ease);
}
.navitem:hover { background: var(--surface-2); color: var(--text); }
.navitem.active { background: var(--surface); color: var(--text); border-color: var(--line); }
.pill {
  background: var(--surface-2); color: var(--text); border-radius: 999px;
  font-size: 12px; padding: 2px 8px; font-variant-numeric: tabular-nums;
}
.pill.alert { background: rgba(224,166,60,.16); color: var(--warn); }

.admin-main { min-width: 0; }
.view-title { font-size: 24px; letter-spacing: -0.02em; margin-bottom: 4px; }
.view-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-label { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value.warn { color: var(--warn); }

/* panels + tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-title { font-size: 16px; font-weight: 600; }

.rows { display: grid; gap: 10px; }
.row {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; font-size: 15px; }
.row-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 12px;
  font-size: 14px; font-weight: 600;
  transition: transform .3s var(--ease), background .3s var(--ease), opacity .3s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn-primary { background: var(--text); color: #0B0B0D; }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-ok { background: rgba(76,195,138,.14); color: var(--ok); border-color: rgba(76,195,138,.35); }
.btn-ok:hover { background: rgba(76,195,138,.22); }
.btn-bad { background: rgba(226,104,95,.12); color: var(--bad); border-color: rgba(226,104,95,.35); }
.btn-bad:hover { background: rgba(226,104,95,.2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* badges */
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge.pending { color: var(--warn); border-color: rgba(224,166,60,.4); }
.badge.approved, .badge.published { color: var(--ok); border-color: rgba(76,195,138,.4); }
.badge.rejected, .badge.failed { color: var(--bad); border-color: rgba(226,104,95,.4); }
.badge.active { color: var(--ok); border-color: rgba(76,195,138,.4); }
.badge.banned { color: var(--bad); border-color: rgba(226,104,95,.4); }

/* forms */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 16px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--muted); }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }
.check-label { font-size: 14px; }
.check-sub { font-size: 12px; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 10px; }
.switch input { width: 18px; height: 18px; accent-color: var(--text); }

.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.error { color: var(--bad); font-size: 14px; margin: 8px 0 0; }
.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 14px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.66); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: 100%; max-width: 720px; max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.modal-head {
  position: sticky; top: 0; background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px; }
.preview-img { width: 100%; max-width: 320px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; margin: 12px 0; }
.meta-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.meta-k { font-size: 12px; color: var(--muted); }
.meta-v { font-size: 14px; font-weight: 600; }
.menfess-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 15px; }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%,16px);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; z-index: 60; max-width: 90vw;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; }
  .navitem { white-space: nowrap; }
}
