:root {
  --bg: #0f1220;
  --bg-soft: #171b2e;
  --panel: #1c2138;
  --panel-2: #232946;
  --border: #2e3554;
  --text: #e8eaf2;
  --text-dim: #9aa3c0;
  --green: #22c55e;
  --green-dark: #15803d;
  --orange: #f97316;
  --red: #dc2626;
  --red-dark: #7f1d1d;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --purple: #a78bfa;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--green); }

.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: var(--text); }

.container { max-width: 1440px; margin: 0 auto; padding: 24px 20px 80px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 24px; }

/* ---- Status chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid transparent;
}
.chip::before { content: '●'; font-size: 9px; }
.chip-pending { background: rgba(245,158,11,.15); color: var(--amber); border-color: rgba(245,158,11,.4); }
.chip-approved { background: rgba(34,197,94,.15); color: var(--green); border-color: rgba(34,197,94,.4); }
.chip-rejected { background: rgba(249,115,22,.15); color: var(--orange); border-color: rgba(249,115,22,.4); }
.chip-deleted { background: rgba(220,38,38,.15); color: #f87171; border-color: rgba(220,38,38,.4); }

/* ---- Cards / lists ---- */
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.article-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.article-card .thumb {
  height: 110px; background: var(--panel-2); background-size: cover; background-position: center;
}
.article-card .body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.article-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.article-card h3 { margin: 0; font-size: 13.5px; line-height: 1.35; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--blue); text-decoration: none; }
.article-card p.desc {
  margin: 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3em;
}
.article-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.article-card .foot a { color: var(--blue); font-size: 12px; text-decoration: none; white-space: nowrap; }
.article-card .foot a:hover { text-decoration: underline; }
.article-card .desc-html p { margin: 0 0 8px; }

.badge {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}
.badge-news { background: rgba(59,130,246,.18); color: #93c5fd; }
.badge-breach { background: rgba(220,38,38,.18); color: #fca5a5; }
.badge-ransomware { background: rgba(220,38,38,.28); color: #fecaca; }
.badge-zero-day { background: rgba(167,139,250,.18); color: #c4b5fd; }
.badge-research { background: rgba(34,197,94,.18); color: #86efac; }
.sev-critical { background: rgba(220,38,38,.3); color: #fecaca; }
.sev-high { background: rgba(249,115,22,.25); color: #fed7aa; }
.sev-medium { background: rgba(245,158,11,.2); color: #fde68a; }
.sev-low { background: rgba(34,197,94,.18); color: #bbf7d0; }
.badge-kev { background: rgba(168,85,247,.2); color: #d8b4fe; }
.badge-rans { background: rgba(220,38,38,.3); color: #fecaca; }

/* ---- Admin table ---- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-soft); }
.admin-table tr:hover td { background: rgba(59,130,246,.05); }
.admin-row.selected td { background: rgba(34,197,94,.08); }
.admin-row .t-title { font-weight: 600; color: var(--text); }
.admin-row .t-desc { color: var(--text-dim); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
.admin-row .t-thumb { width: 64px; height: 48px; border-radius: 6px; background: var(--panel-2); background-size: cover; background-position: center; display: block; }
.muted { color: var(--text-dim); font-size: 12px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button, .actions a {
  border: none; cursor: pointer; border-radius: 6px;
  padding: 5px 10px; font-size: 12px; font-weight: 700; color: #fff;
  display: inline-flex; align-items: center; gap: 5px;
  text-decoration: none;
}
.actions button:hover, .actions a:hover { filter: brightness(1.15); text-decoration: none; }
.btn-approve { background: var(--green); }
.btn-approve:hover { background: var(--green-dark); }
.btn-reject { background: var(--orange); }
.btn-delete { background: var(--red-dark); }
.btn-permanent { background: #450a0a; }
.btn-edit { background: var(--blue); }
.btn-restore { background: #16a34a; }
.btn-view { background: #475569; }
.btn-neutral { background: #475569; }
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { background: var(--panel-2); }

/* ---- Buttons (generic) ---- */
.btn {
  border: none; cursor: pointer; border-radius: 8px; padding: 8px 16px;
  font-size: 14px; font-weight: 700; color: #fff; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--blue); }
.btn-success { background: var(--green); }
.btn-warning { background: var(--orange); }
.btn-danger { background: var(--red-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Stat cards ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: block; color: var(--text);
}
.stat:hover { border-color: var(--blue); text-decoration: none; }
.stat .num { font-size: 30px; font-weight: 800; }
.stat .label { color: var(--text-dim); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-pending .num { color: var(--amber); }
.stat-approved .num { color: var(--green); }
.stat-rejected .num { color: var(--orange); }
.stat-deleted .num { color: #f87171; }

/* ---- Forms ---- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--text-dim); }
.form-row input[type=text], .form-row input[type=url], .form-row input[type=password], .form-row input[type=search], .form-row select, .form-row textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.form-row textarea { min-height: 160px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { outline: 2px solid var(--blue); border-color: transparent; }
.form-row .hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 16px; height: 16px; }

.login-wrap { max-width: 380px; margin: 80px auto; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.error-banner { background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.4); color: #fecaca; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }

/* ---- Filters ---- */
.filters { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; }
.filters form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { display: flex; flex-direction: column; gap: 4px; }
.filters .field label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.filters input, .filters select {
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 6px 10px; font-size: 13px;
}

/* ---- Source data vs local edit ---- */
.original-box {
  background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.35);
  border-radius: 8px; padding: 12px; margin-bottom: 14px;
}
.original-box h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #93c5fd; }
.authoritative-box {
  background: rgba(167,139,250,.07); border: 1px solid rgba(167,139,250,.35);
  border-radius: 8px; padding: 12px; margin-bottom: 14px;
}
.authoritative-box h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #c4b5fd; }
.authoritative-box .ro { color: var(--text-dim); }
.readonly input { background: #1a2033; color: var(--text-dim); cursor: not-allowed; }

/* ---- Preview ---- */
.preview-shell { border: 1px dashed var(--border); border-radius: var(--radius); padding: 18px; background: rgba(15,18,32,.6); }
.preview-shell .preview-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  max-width: 460px; width: 92%; padding: 20px;
}
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--text-dim); margin: 0 0 14px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal input, .modal select, .modal textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-bottom: 10px; font-family: inherit;
}

/* ---- Toasts ---- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--green);
  color: var(--text); border-radius: 8px; padding: 10px 16px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slideIn .2s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- Bulk bar ---- */
.bulkbar {
  display: none; align-items: center; gap: 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
  position: sticky; top: 60px; z-index: 40;
}
.bulkbar.open { display: flex; flex-wrap: wrap; }
.bulkbar .count { font-weight: 700; }

/* ---- Misc ---- */
.empty { text-align: center; color: var(--text-dim); padding: 60px 20px; border: 1px dashed var(--border); border-radius: var(--radius); }
.rev-list { list-style: none; padding: 0; margin: 0; }
.rev-list li { border-bottom: 1px solid var(--border); padding: 12px 0; }
.rev-list li:last-child { border-bottom: none; }
.cve-block { display: flex; gap: 8px; flex-wrap: wrap; }
.mono { font-family: Consolas, monospace; }
.article-full { max-width: 1120px; }
.article-full h1 { font-size: 28px; line-height: 1.3; }
.article-full .hero-img { max-width: 100%; width: 480px; height: auto; border-radius: var(--radius); margin: 16px 0; }
.article-full .content { color: var(--text); font-size: 15.5px; line-height: 1.7; }
.article-full .content p { margin: 0 0 14px; }
.article-full .content img { max-width: 100%; border-radius: 8px; }
.article-full .content a { color: var(--blue); }
.editor-note { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.35); border-radius: 8px; padding: 12px; }
.editor-note h4 { margin: 0 0 6px; color: var(--amber); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
footer { color: var(--text-dim); font-size: 12px; text-align: center; padding: 20px; border-top: 1px solid var(--border); margin-top: 40px; }
.kbd { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-family: Consolas, monospace; }
.img-preview { max-height: 120px; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }

@media (max-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }
