/* Admin panel extras */
.admin-body { background: #0b0c10; }
.admin-header .logo { color: #ffd166; }
.who { color: var(--muted); font-size: .9rem; }

.login-box { max-width: 420px; margin: 70px auto; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login-box h1 { margin-top: 0; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 34px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; }
.stat span { font-size: 1.6rem; font-weight: 800; display: block; }
.stat label { color: var(--muted); font-size: .85rem; }
.stat.ok span { color: var(--ok); }
.stat.warn span { color: var(--warn); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }

.table { width: 100%; border-collapse: collapse; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: .92rem; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.table tr:last-child td { border-bottom: none; }
.table td.actions { white-space: nowrap; }
.table td.actions form { display: inline; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.badge-ok { background: #14351f; color: #7ddea3; }
.badge-draft { background: #3a3218; color: #e8d27d; }
.tag { background: #232637; color: var(--muted); border-radius: 6px; padding: 2px 7px; font-size: .75rem; margin-left: 6px; }

/* Forms */
.article-form { max-width: 820px; }
.article-form label { display: block; font-weight: 700; margin: 18px 0 6px; }
.article-form input[type="text"], .article-form input[type="url"],
.article-form textarea, .article-form select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: .95rem;
  font-family: inherit;
}
.article-form textarea { resize: vertical; line-height: 1.5; }
.article-form input:focus, .article-form textarea:focus, .article-form select:focus {
  outline: 2px solid var(--accent-2); outline-offset: 0; border-color: transparent;
}
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.form-foot { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 0 !important; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.flash { padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.flash-ok { background: #14351f; color: #7ddea3; }
.flash-error { background: #3a1518; color: #ff8a8a; }

.login-box label { display: block; font-weight: 700; margin-bottom: 6px; }
.login-box input { width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  margin-bottom: 14px; font-size: 1rem; }

@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }

/* --- Admin passwords (permanent, one-time reveal) --- */
.code-block { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: .85rem; }
.password-once { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.password-once code { flex: 1; background: #14351f; color: #7ddea3;
  border-radius: 10px; padding: 12px 14px; font-size: 1.05rem;
  letter-spacing: .06em; word-break: break-all; user-select: all; }

/* --- Article editor: image uploads (paste / file picker) --- */
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.upload-status { min-height: 1.2em; }
.upload-status.upload-error { color: #ff8a8a; font-weight: 600; }
.cover-row { display: flex; gap: 10px; align-items: stretch; }
.cover-row input[type="text"] { flex: 1; }
.cover-preview { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.cover-preview img { max-width: 320px; max-height: 190px; border-radius: 10px;
  border: 1px solid var(--border); object-fit: cover; }
.editor-toolbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.btn-mini { padding: 6px 12px; font-size: .85rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  cursor: pointer; }
.btn-mini:hover { border-color: var(--accent); }
.hidden { display: none !important; }

/* Превью картинок, вставленных в текст статьи */
.body-images { margin-top: 10px; }
.body-images-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.body-image-item { position: relative; margin: 0; width: 160px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--bg-card); }
.body-image-item img { display: block; width: 100%; height: 110px;
  object-fit: cover; }
.body-image-item figcaption { padding: 4px 8px; font-size: .75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.body-image-remove { position: absolute; top: 4px; right: 4px;
  padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.65);
  color: #fff; border: none; cursor: pointer; line-height: 1.4; }
.body-image-remove:hover { background: rgba(200,40,40,.85); }

/* --- Панель форматирования текста (как Word, для markdown) --- */
.editor-toolbar { flex-wrap: wrap; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); }
.tb-group { display: inline-flex; align-items: center; gap: 4px; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tb-btn { min-width: 34px; text-align: center; }
.tb-hint { font-size: .75rem; color: var(--muted); margin-left: auto; }

/* --- Живой предпросмотр статьи в редакторе --- */
.live-preview { margin-top: 14px; border: 1px dashed var(--border);
  border-radius: 12px; padding: 10px 16px 16px; background: rgba(255,255,255,.02); }
.live-preview-title { margin-top: 4px; }
.live-preview-body { max-width: 720px; margin: 0 auto; }
.live-preview-body p { margin: .8em 0; line-height: 1.65; }
.live-preview-body img { display: block; max-width: 100%; height: auto;
  border-radius: 10px; border: 1px solid var(--border); }
.live-preview-body figure { margin: 20px auto; max-width: 640px; text-align: center; }
.live-preview-body figcaption { font-size: .8rem; opacity: .7; margin-top: 6px; }
.live-preview-body hr.article-sep { border: none; border-top: 2px solid var(--border);
  margin: 26px auto; max-width: 320px; }
.live-preview-body blockquote { margin: 1em 0; padding: 6px 16px;
  border-left: 3px solid var(--accent); font-style: italic; opacity: .9; }
.live-preview-body h3.article-subhead { margin: 1.2em 0 .5em; }
.live-preview-body ul.article-list, .live-preview-body ol.article-list {
  margin: .8em 0; padding-left: 1.6em; }
