/* RSSApp admin — dark professional theme */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --bg-3: #111827;
  --bg-4: #1e293b;
  --line: #1f2937;
  --line-2: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --accent-soft: rgba(34,197,94,0.12);
  --info: #38bdf8;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  background: radial-gradient(1200px 600px at 100% -10%, rgba(34,197,94,0.12), transparent 60%),
              radial-gradient(800px 500px at -10% 110%, rgba(56,189,248,0.10), transparent 60%),
              var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { color: #bfdbfe; }

/* ======= LAYOUT ======= */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar {
  background: linear-gradient(180deg, #0b1324 0%, #0a101c 100%);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh;
}
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); }
.brand-mark { font-size: 22px; }
.brand strong { font-size: 16px; }
.brand small { display: block; color: var(--text-faint); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500;
}
.nav-item .ico { width: 22px; text-align: center; }
.nav-item:hover { background: rgba(148,163,184,0.08); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #d1fae5; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #052e16; display: grid; place-items: center; font-weight: 700; }
.user strong { display: block; font-size: 13px; }
.user small { color: var(--text-faint); font-size: 11px; }
.logout {
  display: block; text-align: center; margin-top: 8px;
  padding: 8px; border-radius: var(--radius-sm);
  background: var(--bg-4); color: var(--text-dim); font-size: 12px;
}
.logout:hover { background: #243046; color: var(--text); }

.main { padding: 28px; max-width: 100%; overflow-x: auto; }

/* ======= HEADERS ======= */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ======= COMPONENTS ======= */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--text-faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.stat .value { font-size: 28px; font-weight: 700; margin: 4px 0 0; }
.stat .trend { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat.accent .value { color: #86efac; }

/* ======= BUTTONS ======= */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--bg-4); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 600; font-size: 13px;
  transition: filter .15s ease, transform .04s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #052e16; border-color: transparent; }
.btn-primary:hover { background: #4ade80; }
.btn-info { background: #0ea5e9; color: #082f49; border-color: transparent; }
.btn-warn { background: #f59e0b; color: #422006; border-color: transparent; }
.btn-danger { background: #ef4444; color: #450a0a; border-color: transparent; }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ======= FORMS ======= */
.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; font-weight: 600; }
.field .hint { color: var(--text-faint); font-size: 12px; margin-top: 4px; }
.input, select, textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
textarea { font-family: var(--mono); font-size: 13px; min-height: 90px; resize: vertical; }
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.row-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.row-3 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

/* ======= TABLE ======= */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); background: var(--bg-3); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(148,163,184,0.04); }
.tbl .small { color: var(--text-faint); font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--bg-4); color: var(--text-dim);
}
.badge.ok { background: rgba(34,197,94,0.15); color: #86efac; }
.badge.warn { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge.err { background: rgba(239,68,68,0.18); color: #fca5a5; }
.badge.info { background: rgba(56,189,248,0.18); color: #7dd3fc; }
.badge.muted { background: var(--bg-4); color: var(--text-dim); }

.kbd { font-family: var(--mono); font-size: 12px; background: var(--bg-3); border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 4px; color: var(--text-dim); }

.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--line-2); }
.flash-ok { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.4); color: #bbf7d0; }
.flash-err { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.4); color: #fecaca; }
.flash-info { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.4); color: #bae6fd; }

/* ======= LOGIN ======= */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card .brand { border: 0; padding: 0 0 18px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card p { margin: 0 0 16px; color: var(--text-dim); font-size: 13px; }

/* ======= MODE PICKER ======= */
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .mode-picker { grid-template-columns: 1fr; } }
.mode-card { display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 22px; cursor: pointer; transition: border-color .15s ease, transform .12s ease; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mode-card .ico { font-size: 30px; }
.mode-card h3 { margin: 8px 0 6px; }
.mode-card p { color: var(--text-dim); margin: 0; font-size: 13px; }
.mode-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13px; }

/* ======= FEED PREVIEW (builder) ======= */
.preview-list { display: grid; gap: 10px; }
.preview-item { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 10px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; }
.preview-item img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--bg-4); }
.preview-item h4 { margin: 0; font-size: 14px; }
.preview-item small { color: var(--text-faint); font-size: 12px; }

/* ======= CODE VIEW ======= */
pre.code { background: var(--bg-3); color: #cbd5e1; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; max-height: 60vh; }

/* responsive helpers */
.hide-sm { }
@media (max-width: 720px) { .hide-sm { display: none !important; } }

/* Switch Toggle Component */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-4);
  border: 1px solid var(--line-2);
  transition: .2s ease;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-dim);
  transition: .2s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-soft);
  border-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: var(--accent);
}

.switch.loading {
  opacity: 0.5;
  pointer-events: none;
}
