:root {
  --ren-red: #e30613;
  --orange-hot: #ff5c1a;
  --orange-satin: #ff8f3c;
  --orange-glow: #ffc46b;
  --black: #0a0604;
  --black-glass: rgba(8, 5, 3, 0.72);
  --black-glass-light: rgba(12, 8, 5, 0.55);
  --text: #fff8f2;
  --muted: rgba(255, 240, 220, 0.72);
  --border: rgba(255, 120, 40, 0.35);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Montserrat", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.45;
  background: var(--black);
  position: relative;
  overflow-x: hidden;
}

/* Перламутровый сатиновый оранжевый фон */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 90% 70% at 15% 20%, rgba(255, 210, 140, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 85% 15%, rgba(255, 160, 60, 0.9) 0%, transparent 50%),
    radial-gradient(ellipse 100% 80% at 50% 75%, rgba(255, 90, 20, 0.85) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 70% 55%, rgba(255, 230, 180, 0.5) 0%, transparent 45%),
    linear-gradient(155deg, #1a0800 0%, #c43a00 28%, #ff6b1a 48%, #ffb04a 62%, #5c1800 88%, #0a0604 100%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.08) 48%, transparent 56%),
    radial-gradient(circle at 30% 40%, rgba(0, 0, 0, 0.35), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.5), transparent 45%);
  mix-blend-mode: overlay;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
}

.top {
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--black-glass) 0%, transparent 100%);
  backdrop-filter: blur(8px);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: 1;
}

.top .wrap.top-inner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-logout {
  margin-left: auto;
  flex-shrink: 0;
}

.logo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.top-text h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.panel {
  background: var(--black-glass);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  margin-top: 1.25rem;
}

.search-panel {
  padding: 1.1rem 1.2rem 0.9rem;
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.filter-video {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.filter-video input {
  accent-color: var(--orange-hot);
  width: 1rem;
  height: 1rem;
}

.search-box input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.search-box input::placeholder { color: var(--muted); }

.search-box input:focus {
  outline: 2px solid var(--orange-satin);
  outline-offset: 1px;
  border-color: var(--orange-hot);
}

.btn-primary,
.btn-ghost {
  padding: 0.85rem 1.25rem;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  transition: transform 0.12s, filter 0.12s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ren-red) 0%, var(--orange-hot) 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(227, 6, 19, 0.45);
}

.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.55);
  border-color: var(--orange-satin);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0.55rem 0 0;
  font-weight: 500;
}

.status {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.status.error { color: #ffb4b4; }

.table-panel { padding: 0; overflow: hidden; }

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--black-glass-light);
}

.table-toolbar h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  max-height: min(68vh, 720px);
}

.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.archive-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(6, 4, 2, 0.92);
}

.archive-table th {
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--orange-glow);
  border-bottom: 1px solid var(--border);
}

.archive-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 120, 40, 0.12);
  vertical-align: top;
}

.archive-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.archive-table tbody tr:hover {
  background: rgba(255, 100, 30, 0.12);
}

.col-date { width: 108px; white-space: nowrap; color: var(--muted); font-weight: 600; }
.col-title { min-width: 160px; max-width: 280px; font-weight: 600; }

.badges {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.badge-new {
  background: #16a34a;
  color: #ecfdf5;
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.55);
}

.badge-video {
  background: rgba(0, 0, 0, 0.55);
  color: var(--orange-glow);
  border: 1px solid var(--orange-hot);
}

.badge-rss {
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  border: 1px solid var(--border);
}

.hint .badge { margin: 0 0.15rem; vertical-align: baseline; }
.col-text {
  min-width: 220px;
  max-width: 420px;
  color: rgba(255, 245, 230, 0.88);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
}
.snippet-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.no-text { color: var(--muted); font-size: 0.78rem; }
.col-rubric { width: 100px; color: var(--muted); font-size: 0.8rem; }
.col-src { width: 90px; color: var(--muted); font-size: 0.78rem; }
.col-link { width: 44px; text-align: center; }

.archive-table a.ext {
  color: var(--orange-glow);
  text-decoration: none;
  font-weight: 700;
}

.archive-table a.ext:hover { color: #fff; }

.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem !important;
}

#article-dialog {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--black-glass);
  color: var(--text);
  max-width: min(920px, 96vw);
  width: 96vw;
  padding: 0;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  overflow: visible;
}

.dlg-close-form {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 100;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  pointer-events: auto;
}

#article-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

#article-dialog article {
  position: relative;
  padding: 1.35rem 2.75rem 1.35rem 1.5rem;
  max-height: 92vh;
  overflow: auto;
}

.dlg-close {
  position: static;
  z-index: 100;
  pointer-events: auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.dlg-close:hover {
  background: rgba(227, 6, 19, 0.85);
  border-color: var(--ren-red);
  color: #fff;
}

.dlg-header { margin-bottom: 0.5rem; padding-right: 0.25rem; }

.dlg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.65rem;
}

.dlg-section {
  margin: 1rem 0 0;
}

.dlg-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--orange-glow);
}

.dlg-fields {
  margin: 0;
  display: grid;
  gap: 0.55rem;
  font-size: 0.8rem;
}

.field-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid rgba(255, 120, 40, 0.15);
}

.field-row dt {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}

.field-row dd {
  margin: 0;
  word-break: break-word;
}

.field-pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.78rem;
  max-height: 12rem;
  overflow: auto;
}

#article-dialog h2 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.dlg-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 0.6rem;
}

.dlg-link {
  color: var(--orange-glow);
  font-weight: 700;
  font-size: 0.85rem;
}

.dlg-note {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--orange-glow);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.dlg-note.hidden { display: none; }

.dlg-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  max-height: 55vh;
  overflow: auto;
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: 10px;
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--border);
  line-height: 1.5;
}

#article-dialog article > form { text-align: right; }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.login-page {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.login-page-card {
  padding: 2rem 1.75rem;
  text-align: center;
}

.login-page-logo {
  display: block;
  margin: 0 auto 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.login-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.login-page-subtitle {
  margin: 0.35rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-page-form {
  display: grid;
  gap: 1rem;
  text-align: left;
}

.login-page-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.login-page-input {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}

.login-page-input:focus {
  outline: 2px solid var(--orange-hot);
  border-color: var(--orange-hot);
}

.login-page-error {
  margin: 0;
  color: #ffb4b4;
  font-size: 0.85rem;
}

.login-page-error.hidden { display: none; }

.login-page-submit { width: 100%; margin-top: 0.25rem; }

@media (max-width: 720px) {
  .col-rubric { display: none; }
  .col-text { max-width: 180px; }
  .top-inner { flex-direction: column; text-align: center; }
}
