/* ==========================================================================
   Shining RSS — "Adaptive Shine" design system
   Light + Dark theme (toggled via <html data-theme>), amber/gold accent.
   ========================================================================== */

/* ----- Theme tokens ----- */
:root {
  /* Light theme (default) */
  --bg: #f5f7fa;
  --bg-glow: #fef3e2;
  --panel: #ffffff;
  --panel-2: #f3f5f9;
  --panel-hover: #f8fafc;
  --border: #e5e9f0;
  --border-strong: #d5dbe6;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #6b7789;
  --link: #4f46e5;

  --brand: #3b82f6;              /* Premium Blue (default palette) */
  --brand-2: #38bdf8;
  --brand-3: #4f46e5;
  --brand-ink: #ffffff;          /* text on top of the accent */
  --brand-soft: rgba(59,130,246,.12);
  --brand-ring: rgba(59,130,246,.35);

  --danger: #e11d48;
  --danger-soft: rgba(225,29,72,.10);
  --ok: #16a34a;
  --ok-soft: rgba(22,163,74,.12);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.04);
  --shadow: 0 2px 4px rgba(15,23,42,.04), 0 12px 32px rgba(15,23,42,.08);
  --shadow-lg: 0 8px 20px rgba(15,23,42,.10), 0 24px 60px rgba(15,23,42,.14);
  --shine: linear-gradient(120deg, var(--brand-3), var(--brand), var(--brand-2));
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-glow: #1c1408;
  --panel: #121b2e;
  --panel-2: #182339;
  --panel-hover: #1b2740;
  --border: #24314c;
  --border-strong: #33405f;
  --text: #e9eef8;
  --text-soft: #c3ccdd;
  --muted: #8c9ab8;
  --link: #7dd3fc;

  --brand-ink: #ffffff;
  --brand-soft: rgba(56,189,248,.16);
  --brand-ring: rgba(56,189,248,.4);

  --danger: #fb7185;
  --danger-soft: rgba(251,113,133,.12);
  --ok: #4ade80;
  --ok-soft: rgba(74,222,128,.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 10px 30px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1100px 520px at 88% -8%, var(--bg-glow) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
::selection { background: var(--brand-ring); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 980px; }

/* ========================= Login ========================= */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 32px 18px;
}
.login-card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 30px 28px;
}
.login-logo { justify-content: center; margin-bottom: 18px; }
.login-h { font-size: 22px; margin: 6px 0 6px; letter-spacing: -.3px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.login-field { display: block; margin-bottom: 14px; }
.login-field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.login-field > span small { color: var(--muted); font-weight: 500; }
.login-field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.login-btn { width: 100%; margin-top: 6px; justify-content: center; }
.login-note { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; text-align: center; }
.acct-card { max-width: 480px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 24px 22px; }
.acct-sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ===================== Appearance / Theme panel ===================== */
.tm-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); gap: 18px; align-items: start; }
.tm-col { min-width: 0; }
.tm-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 18px 20px; margin-bottom: 16px; }
.tm-h { font-size: 15px; margin: 0 0 3px; }
.tm-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.tm-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px,1fr)); gap: 10px; }
.tm-swatch { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--panel-2); cursor: pointer; transition: border-color .15s, transform .05s; text-align: left; }
.tm-swatch:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.tm-swatch.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tm-swatch-bar { height: 34px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.tm-swatch-name { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.tm-colors { display: flex; gap: 12px; }
.tm-color { flex: 1; display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.tm-color input[type="color"] { width: 100%; height: 46px; padding: 0; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel-2); cursor: pointer; }
.tm-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.tm-color input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.tm-color span { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.tm-seg { display: flex; border: 1px solid var(--border-strong); border-radius: 11px; overflow: hidden; }
.tm-seg label { flex: 1; }
.tm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tm-seg span { display: block; text-align: center; padding: 9px 6px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.tm-seg label + label span { border-left: 1px solid var(--border); }
.tm-seg input:checked + span { background: var(--shine); color: var(--brand-ink); }
.tm-range { margin-bottom: 14px; }
.tm-range:last-child { margin-bottom: 0; }
.tm-range-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.tm-range-top label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.tm-range-top output { font-size: 12.5px; font-weight: 700; color: var(--link); }
.tm-range input[type="range"] { width: 100%; accent-color: var(--brand); cursor: pointer; }
.tm-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tm-preview-wrap { position: sticky; top: 78px; }
.tm-preview { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tm-pv-head { display: flex; align-items: center; justify-content: space-between; }
.tm-pv-logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.tm-pv-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--shine); color: var(--brand-ink); display: grid; place-items: center; font-size: 14px; box-shadow: 0 3px 9px var(--brand-ring); }
.tm-pv-grad { background: var(--shine); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tm-pv-badge { background: var(--shine); color: var(--brand-ink); font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: var(--radius-pill); box-shadow: var(--shadow-sm); }
.tm-pv-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.tm-pv-title { margin: 0 0 4px; font-weight: 700; font-size: 14px; }
.tm-pv-title::before { content: ""; }
.tm-pv-meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.tm-pv-meta a { color: var(--link); font-weight: 600; }
.tm-pv-tag { display: inline-block; margin-top: 10px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; padding: 3px 9px; border-radius: 7px; background: var(--brand-soft); color: var(--link); }
.tm-pv-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: 14px; outline: none; }
.tm-pv-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tm-pv-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tm-note { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.tm-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 7px; }
.tm-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 8px; }
.tm-font { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 11px; background: var(--panel-2); cursor: pointer; text-align: left; transition: border-color .15s; }
.tm-font:hover { border-color: var(--border-strong); }
.tm-font.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tm-font-aa { font-size: 19px; font-weight: 800; line-height: 1; color: var(--text); }
.tm-font-nm { font-size: 12px; font-weight: 600; color: var(--muted); font-family: -apple-system, "Segoe UI", sans-serif; }
.tm-logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tm-logo-preview { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: var(--shine); color: var(--brand-ink); font-size: 24px; box-shadow: 0 4px 12px var(--brand-ring); }
.tm-logo-input { width: 88px; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 18px; text-align: center; outline: none; }
.tm-logo-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tm-logo-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-logo-pick { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); cursor: pointer; font-size: 17px; transition: border-color .15s, transform .05s; }
.tm-logo-pick:hover { border-color: var(--brand); transform: translateY(-1px); }
@media (max-width: 820px) { .tm-grid { grid-template-columns: 1fr; } .tm-preview-wrap { position: static; } }
.login-foot { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0; }
.login-card code, .login-foot code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ========================= Header ========================= */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 14px; }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.3px; }
.logo:hover { text-decoration: none; }
.logo .dot {
  width: 30px; height: 30px; border-radius: 9px; background: var(--shine);
  display: grid; place-items: center; color: var(--brand-ink); font-size: 16px;
  box-shadow: 0 4px 12px var(--brand-ring);
}
.logo .name b { font-weight: 800; }
.logo .name span { background: var(--shine); -webkit-background-clip: text; background-clip: text; color: transparent; }
.header-right { display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 600; padding: 7px 12px; border-radius: 9px; }
.nav-links a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav-links a.nav-logout { color: var(--danger); }
.nav-links a.nav-logout:hover { color: var(--danger); background: var(--danger-soft); }
.nav-links a.nav-setup { color: var(--brand-3); }
.nav-links a.nav-setup:hover { color: var(--brand-3); background: var(--brand-soft); }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 16px;
  display: grid; place-items: center; transition: border-color .15s, transform .15s;
}
.theme-toggle:hover { border-color: var(--brand); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0); }

/* ========================= Buttons ========================= */
.btn {
  border: 1px solid transparent; border-radius: 11px; padding: 11px 18px; font-size: 14px;
  font-weight: 700; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center;
  gap: 7px; transition: transform .12s ease, filter .15s, border-color .15s, background .15s;
  font-family: inherit; text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--shine); color: var(--brand-ink); box-shadow: 0 6px 16px var(--brand-ring); }
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--brand); background: var(--panel-hover); text-decoration: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); text-decoration: none; }
.btn-sm { padding: 8px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }

/* ========================= Alerts ========================= */
.alert { border-radius: 12px; padding: 13px 16px; margin: 18px 0; font-size: 14px; border: 1px solid; display: flex; gap: 9px; align-items: flex-start; }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }

/* ========================= Hero / create (dashboard) ========================= */
.hero { padding: 52px 0 8px; text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700;
  color: var(--link); background: var(--brand-soft); border: 1px solid var(--brand-ring);
  padding: 6px 13px; border-radius: var(--radius-pill); margin-bottom: 18px;
}
.hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.12; margin: 0 0 12px; letter-spacing: -1px; font-weight: 800; }
.hero h1 .grad { background: var(--shine); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16px; margin: 0 auto 28px; max-width: 600px; }

.create-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; max-width: 760px; margin: 0 auto; text-align: left;
}
.create-row { display: flex; gap: 10px; }
.create-row input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 11px; padding: 14px 16px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.create-row input:focus, .adv input:focus, .tag-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.adv { margin-top: 10px; display: flex; gap: 10px; }
.adv input { flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 11px; padding: 11px 14px; font-size: 14px; outline: none; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
input::placeholder { color: var(--muted); opacity: .8; }

/* ========================= Section title ========================= */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 40px 0 16px; gap: 12px; }
.section-title h2 { font-size: 19px; margin: 0; letter-spacing: -.3px; }
.count-badge { color: var(--muted); font-size: 13px; background: var(--panel-2); border: 1px solid var(--border); padding: 4px 11px; border-radius: var(--radius-pill); font-weight: 600; }

/* ========================= Dashboard feed list ========================= */
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.feed-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.feed-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.fav { width: 42px; height: 42px; border-radius: 11px; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; border: 1px solid var(--border); }
.fav img { width: 100%; height: 100%; object-fit: cover; }
.fav span { font-size: 19px; }
.feed-main { min-width: 0; flex: 1; }
.feed-main .ftitle { font-weight: 700; font-size: 15.5px; margin: 0 0 4px; }
.feed-main .ftitle a { color: var(--text); }
.feed-main .ftitle a:hover { color: var(--link); }
.feed-main .fmeta { color: var(--muted); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; }
.feed-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { font-size: 11px; padding: 4px 10px; border-radius: var(--radius-pill); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--ok-soft); color: var(--ok); }
.status-error { background: var(--danger-soft); color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel); }

/* ========================= Feed page: topbar + tabs ========================= */
.feed-topbar { display: flex; align-items: center; gap: 14px; padding: 24px 0 16px; }
.feed-topbar .fav { width: 46px; height: 46px; }
.feed-topbar .ft-info { min-width: 0; flex: 1; }
.feed-topbar h1 { font-size: 20px; margin: 0 0 2px; letter-spacing: -.3px; line-height: 1.25; }
.feed-topbar .ft-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-topbar .ft-sub a { color: var(--muted); }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); position: sticky; top: 62px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px);
  z-index: 20; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--muted);
  white-space: nowrap; border: 0; background: none; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px; transition: color .15s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--shine); animation: tabIn .22s ease;
}
@keyframes tabIn { from { transform: scaleX(.4); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.tab.is-disabled { color: color-mix(in srgb, var(--muted) 60%, transparent); cursor: not-allowed; }
.tab .mini-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); padding: 1px 6px; border-radius: var(--radius-pill); }

/* ========================= Feed page: 2-col layout ========================= */
.feed-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 26px; align-items: start; padding: 22px 0 10px; }

/* Feed URL bar */
.url-block { margin-bottom: 18px; }
.url-block .url-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 0 0 7px; display: flex; align-items: center; gap: 7px; }
.feed-urls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.url-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.url-row .tag { font-size: 10.5px; font-weight: 800; padding: 4px 9px; border-radius: 7px; background: var(--brand-soft); color: var(--link); width: 50px; text-align: center; flex-shrink: 0; letter-spacing: .3px; }
.url-row code { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Toolbar (sort / view) */
.feed-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.feed-toolbar .tb-left { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.select {
  background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 9px;
  padding: 8px 30px 8px 11px; font-size: 13px; font-weight: 600; cursor: pointer; outline: none;
  font-family: inherit; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7789' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { border-color: var(--brand); }
/* Custom dropdown (replaces native <select> for reliable mobile positioning) */
.dropdown { position: relative; display: inline-block; }
.select-btn { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 8px 11px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 8px; outline: none; }
.select-btn:hover, .dropdown.open .select-btn { border-color: var(--brand); }
.select-btn .caret { font-size: 10px; opacity: .6; transition: transform .15s; }
.dropdown.open .select-btn .caret { transform: rotate(180deg); }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 30; display: none; }
.dropdown.open .dropdown-menu { display: block; animation: fadeIn .12s ease; }
.dropdown-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 8px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; }
.dropdown-menu button:hover { background: var(--panel-2); }
.dropdown-menu button.is-active { color: var(--link); background: var(--brand-soft); }

.view-toggle { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.view-toggle button { border: 0; background: none; color: var(--muted); padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; display: inline-flex; align-items: center; gap: 5px; }
.view-toggle button.is-active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

/* Articles */
.articles { display: grid; gap: 14px; }
.articles.is-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.article {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.article:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.article .thumb { width: 190px; flex-shrink: 0; background: var(--panel-2); overflow: hidden; }
.article .thumb img { width: 100%; height: 100%; min-height: 130px; object-fit: cover; display: block; transition: transform .3s ease; }
.article:hover .thumb img { transform: scale(1.04); }
.article .body { padding: 15px 17px; min-width: 0; display: flex; flex-direction: column; }
.article .body h3 { margin: 0 0 7px; font-size: 16px; line-height: 1.35; letter-spacing: -.2px; }
.article .body h3 a { color: var(--text); }
.article .body h3 a:hover { color: var(--link); }
.article .body p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.article .body .ameta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.am { display: inline-flex; align-items: center; gap: 6px; }
.am .ic { width: 14px; height: 14px; flex-shrink: 0; opacity: .85; }
.am-author { font-weight: 600; color: var(--text-soft); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-author .ic { color: var(--brand); opacity: 1; }
.am-time { color: var(--muted); }
.am-time .ic { color: var(--brand); opacity: 1; }
.am-time time { font-variant-numeric: tabular-nums; }
.am-rel { color: var(--muted); opacity: .75; }
.am-dot { opacity: .4; }
.am-unknown { color: var(--muted); opacity: .7; font-style: italic; }
.am-unknown .ic { color: var(--muted); opacity: .7; }

/* Icon-only button (open in new tab) */
.btn-icon { padding: 8px; border-radius: 9px; }
.btn .ic { width: 15px; height: 15px; }
.url-row .btn { flex-shrink: 0; }

/* Grid variant: stack image on top */
.articles.is-grid .article { flex-direction: column; }
.articles.is-grid .article .thumb { width: 100%; height: 150px; }
.articles.is-grid .article .thumb img { min-height: 0; height: 100%; }

/* ========================= Sidebar ========================= */
.feed-sidebar { display: grid; gap: 16px; position: sticky; top: 120px; }
.side-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.side-card h4 { margin: 0 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-top: 1px solid var(--border); }
.side-row:first-of-type { border-top: 0; }
.side-row .k { color: var(--muted); }
.side-row .v { color: var(--text); font-weight: 600; text-align: right; }
.side-bots { display: flex; gap: 8px; flex-wrap: wrap; }
.bot-chip { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); display: grid; place-items: center; font-size: 17px; opacity: .55; }
.soon-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--link); background: var(--brand-soft); padding: 2px 8px; border-radius: var(--radius-pill); }

/* ========================= Bundler ========================= */
.src-badge { color: var(--link) !important; background: var(--brand-soft); padding: 2px 8px; border-radius: var(--radius-pill); font-weight: 600; }
.bundle-picklist { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0 -6px; padding: 0 2px; }
.pick-row { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-radius: 9px; cursor: pointer; font-size: 13.5px; transition: background .12s; }
.pick-row:hover { background: var(--panel-2); }
.pick-row input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; }
.pick-fav { width: 24px; height: 24px; border-radius: 6px; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-size: 13px; }
.pick-fav img { width: 100%; height: 100%; object-fit: cover; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pick-count { color: var(--muted); font-size: 12px; font-weight: 600; flex-shrink: 0; }

.bundle-item .fav { background: var(--brand-soft); }

/* ========================= Toast ========================= */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600; padding: 11px 18px;
  border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ========================= Loading overlay ========================= */
.loading-overlay {
  position: fixed; inset: 0; z-index: 200; display: none; place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(3px);
}
.loading-overlay.is-on { display: grid; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.loading-box { display: flex; align-items: center; gap: 13px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 24px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14.5px; color: var(--text); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================= Footer ========================= */
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 44px 0 34px; margin-top: 40px; border-top: 1px solid var(--border); }
.footer a { color: var(--link); }

/* ========================= Filter settings page ========================= */
.fcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 16px; box-shadow: var(--shadow-sm); }
.fcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.fcard strong { font-size: 15.5px; }
.fmuted { color: var(--muted); font-size: 13.5px; margin: 4px 0 14px; }
.fsep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.cbx { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; color: var(--text-soft); }
.cbx input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* toggle switch */
.switch-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch-label .toggle { display: none; }
.toggle-ui { width: 42px; height: 24px; border-radius: var(--radius-pill); background: var(--border-strong); position: relative; transition: background .18s; flex-shrink: 0; }
.toggle-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle:checked + .toggle-ui { background: var(--shine); }
.toggle:checked + .toggle-ui::after { transform: translateX(18px); }

/* tag / chip input */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { background: var(--shine); color: var(--brand-ink); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.chip b { cursor: pointer; font-weight: 800; opacity: .75; }
.chip b:hover { opacity: 1; }
.tag-input { width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 11px; padding: 12px 14px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.applyto { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.applyto-label { font-weight: 700; font-size: 13px; }

/* Filter live-preview */
.filter-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; align-items: start; padding-top: 20px; }
.filter-preview { position: sticky; top: 120px; }
.pv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pv-head h2 { font-size: 15px; margin: 0; }
.pv-count { font-size: 13px; color: var(--muted); }
.pv-count b { color: var(--ok); }
.pv-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); max-height: calc(100vh - 190px); overflow-y: auto; box-shadow: var(--shadow-sm); }
.pv-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); transition: opacity .12s, filter .12s; }
.pv-item:last-child { border-bottom: 0; }
.pv-item.is-hidden { opacity: .4; filter: grayscale(1); }
.pv-item .pv-body { min-width: 0; flex: 1; }
.pv-item h3 { font-size: 14.5px; margin: 0 0 4px; line-height: 1.35; color: var(--text); }
.pv-item h3 s { color: var(--muted); font-weight: 400; }
.pv-item p { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.pv-item .pv-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.pv-badge { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: .3px; }
.pv-badge.pass { background: var(--ok-soft); color: var(--ok); }
.pv-badge.hide { background: var(--panel-2); color: var(--muted); }
.pv-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--panel-2); flex-shrink: 0; }
.pv-reason { font-size: 11px; color: var(--danger); margin-top: 2px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; font-weight: 600; margin-top: 18px; }
.back-link:hover { color: var(--link); }

/* ========================= Responsive ========================= */
@media (max-width: 940px) {
  .feed-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .feed-sidebar { position: static; grid-template-columns: minmax(0, 1fr); }
  .filter-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-preview { position: static; }
  .pv-list { max-height: none; }
}
@media (max-width: 640px) {
  .container { padding: 0 15px; }
  .hero { padding: 34px 0 4px; }
  .create-row { flex-direction: column; }
  .adv { flex-direction: column; }
  .article { flex-direction: column; }
  .article .thumb { width: 100%; height: 180px; }
  .article .thumb img { min-height: 0; height: 100%; }
  .feed-item { flex-wrap: wrap; }
  .feed-actions { width: 100%; justify-content: flex-start; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .articles.is-grid { grid-template-columns: minmax(0, 1fr); }
  .nav-links a { padding: 7px 9px; }
  .section-title { margin-top: 30px; }
  .tabs { top: 62px; }
  .feed-sidebar { top: auto; }
}
@media (max-width: 420px) {
  .nav-links .hide-xs { display: none; }
}

/* ----- Update badge (header) ----- */
.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--shine);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  animation: updatePulse 2.4s ease-in-out infinite;
  white-space: nowrap;
}
.update-badge:hover { filter: brightness(1.05); }
@keyframes updatePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-ring); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
@media (max-width: 560px) { .update-badge { padding: 5px 9px; font-size: 12px; } }

/* ============ Theme options (attribute-driven: header, density, shadow, button, glow) ============ */
/* --- Header styles --- */
html[data-header="solid"] .site-header { background: var(--panel); backdrop-filter: none; }
html[data-header="bordered"] .site-header { background: transparent; backdrop-filter: none; }
html[data-header="accent"] .site-header { background: var(--panel); backdrop-filter: none; border-bottom: 0; box-shadow: inset 0 -3px 0 0 transparent, 0 3px 0 -1px transparent; position: sticky; }
html[data-header="accent"] .site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--shine); }
.site-header { position: sticky; }

/* --- Background accent glow --- */
html[data-glow="off"] body { background: var(--bg); }

/* --- Shadow depth --- */
html[data-shadow="flat"] { --shadow-sm: 0 1px 1px rgba(15,23,42,.04); --shadow: 0 1px 2px rgba(15,23,42,.05); --shadow-lg: 0 2px 8px rgba(15,23,42,.07); }
html[data-shadow="flat"][data-theme="dark"] { --shadow-sm: 0 1px 1px rgba(0,0,0,.3); --shadow: 0 1px 3px rgba(0,0,0,.35); --shadow-lg: 0 4px 12px rgba(0,0,0,.4); }
html[data-shadow="elevated"] { --shadow-sm: 0 2px 4px rgba(15,23,42,.08); --shadow: 0 6px 20px rgba(15,23,42,.13); --shadow-lg: 0 20px 55px rgba(15,23,42,.22); }
html[data-shadow="elevated"][data-theme="dark"] { --shadow: 0 14px 40px rgba(0,0,0,.55); --shadow-lg: 0 28px 70px rgba(0,0,0,.65); }

/* --- Button styles --- */
html[data-btn="solid"] .btn-primary { background: var(--brand); }
html[data-btn="outline"] .btn-primary { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); box-shadow: none; }
html[data-btn="outline"] .btn-primary:hover { background: var(--brand-soft); filter: none; }

/* --- Density (compact tightens vertical rhythm & control padding) --- */
html[data-density="compact"] main.container { padding-top: 0; }
html[data-density="compact"] .hero { padding: 26px 0 18px; }
html[data-density="compact"] .section-title { margin: 20px 0 12px; }
html[data-density="compact"] .feed-item { padding: 11px 14px; }
html[data-density="compact"] .create-card { padding: 16px; }
html[data-density="compact"] .btn { padding: 8px 14px; }
html[data-density="compact"] .btn-lg { padding: 10px 18px; }
html[data-density="compact"] .article { padding: 14px 0; }
