:root {
  --black: #0a0a0a;
  --white: #f0ede8;
  --red: #cc1122;
  --line: rgba(255,255,255,.12);
  --muted: rgba(240,237,232,.55);
  --panel: #131313;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--black);
  color: var(--white);
}

.screen { min-height: 100vh; }

/* ---------- Login ---------- */

#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { font-size: 24px; margin: 0 0 12px; }
.login-box label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.login-box input {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--white);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 15px;
}
.login-box button {
  margin-top: 12px;
  padding: 12px;
  background: var(--red);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--black);
  z-index: 10;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.save-status { font-size: 13px; color: var(--muted); margin-right: 8px; }

.btn-primary, .btn-ghost {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
}
.btn-primary { background: var(--red); border-color: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--white); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }

/* ---------- Article list ---------- */

.article-list { padding: 20px 28px; max-width: 900px; margin: 0 auto; }
.article-row {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.article-row:hover { background: rgba(255,255,255,.04); }
.ar-title { font-weight: 700; font-size: 16px; }
.ar-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge { padding: 3px 8px; border-radius: 4px; font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: .06em; }
.badge-published { background: rgba(80,200,120,.18); color: #6fd68a; }
.badge-draft { background: rgba(255,255,255,.1); color: var(--muted); }
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Editor layout ---------- */

.editor-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 65px);
}

.editor-sidebar {
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.editor-sidebar label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 14px;
}
.editor-sidebar input,
.editor-sidebar textarea,
.editor-sidebar select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--white);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.editor-sidebar input[type="file"] { border: none; padding: 6px 0; font-size: 12px; }

.image-preview img { width: 100%; border-radius: 6px; border: 1px solid var(--line); margin-top: 4px; }

.editor-main {
  padding: 48px 60px;
  overflow-y: auto;
  background: var(--white);
  color: #111;
}

#editorjs { max-width: 720px; margin: 0 auto; font-size: 18px; line-height: 1.65; }
#editorjs h2 { font-size: 32px; font-weight: 900; letter-spacing: -.02em; }
#editorjs h3 { font-size: 24px; font-weight: 800; }
#editorjs blockquote { border-left: 3px solid var(--red); padding-left: 16px; font-style: italic; }

@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .editor-main { padding: 28px 20px; }
}
