/* ==========================================================================
   Feed reader — themes: light, dark, OLED black. Accents via data-accent.
   ========================================================================== */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 272px;
  --list-w: 410px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --accent: #e8590c;
  --accent-ink: #ffffff;
}
[data-accent="orange"] { --accent: #e8590c; }
[data-accent="indigo"] { --accent: #5b5bd6; }
[data-accent="teal"]   { --accent: #0d9488; }
[data-accent="rose"]   { --accent: #e11d48; }
[data-accent="violet"] { --accent: #8b5cf6; }
[data-accent="blue"]   { --accent: #2563eb; }
[data-accent="green"]  { --accent: #16a34a; }

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f6f3;
  --panel: #ffffff;
  --sidebar: #f1efeb;
  --raised: #ffffff;
  --text: #1c1917;
  --text-2: #44403c;
  --muted: #78716c;
  --faint: #a8a29e;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --hover: rgba(28, 25, 23, .045);
  --active: rgba(28, 25, 23, .075);
  --selected: color-mix(in srgb, var(--accent) 9%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 85%, #000);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.18);
  --code-bg: #f5f5f4;
  --scrim: rgba(28, 25, 23, .35);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161618;
  --panel: #1c1c1f;
  --sidebar: #131315;
  --raised: #242428;
  --text: #ececee;
  --text-2: #c8c8cc;
  --muted: #9b9ba1;
  --faint: #6c6c72;
  --border: #2b2b30;
  --border-strong: #3a3a40;
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(255, 255, 255, .08);
  --selected: color-mix(in srgb, var(--accent) 16%, #1c1c1f);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 70%, #fff);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --code-bg: #121214;
  --scrim: rgba(0, 0, 0, .55);
}
/* True black for OLED panels: pixels off, separation by hairlines only. */
[data-theme="oled"] {
  color-scheme: dark;
  --bg: #000000;
  --panel: #000000;
  --sidebar: #000000;
  --raised: #0c0c0c;
  --text: #e9e9e9;
  --text-2: #c4c4c4;
  --muted: #8c8c8c;
  --faint: #5c5c5c;
  --border: #1a1a1a;
  --border-strong: #2a2a2a;
  --hover: rgba(255, 255, 255, .05);
  --active: rgba(255, 255, 255, .085);
  --selected: color-mix(in srgb, var(--accent) 14%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 65%, #fff);
  --shadow: 0 0 0 1px #1f1f1f;
  --shadow-lg: 0 0 0 1px #262626, 0 24px 60px rgba(0,0,0,.9);
  --code-bg: #0a0a0a;
  --scrim: rgba(0, 0, 0, .7);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--raised); color: var(--text-2);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.grow { flex: 1; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 24px; height: 24px; border-radius: 7px; flex: none; position: relative;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 80%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-mark::before { content: ""; position: absolute; inset: 0; background: #fff; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-width='52'%3E%3Cpath d='M150 210a152 152 0 0 1 152 152'/%3E%3Cpath d='M150 112a250 250 0 0 1 250 250'/%3E%3C/g%3E%3Ccircle cx='162' cy='350' r='34'/%3E%3C/svg%3E") center / 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-width='52'%3E%3Cpath d='M150 210a152 152 0 0 1 152 152'/%3E%3Cpath d='M150 112a250 250 0 0 1 250 250'/%3E%3C/g%3E%3Ccircle cx='162' cy='350' r='34'/%3E%3C/svg%3E") center / 100% no-repeat; }
.brand.big { font-size: 22px; }
.brand.big .brand-mark { width: 34px; height: 34px; border-radius: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--raised); color: var(--text); font-weight: 560; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--hover); text-decoration: none; border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: #fff; background: #dc2626; border-color: transparent; }
.btn.block { width: 100%; height: 40px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; flex: none;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.icon-btn.on { color: var(--accent); }
.icon-btn.bordered { border-color: var(--border-strong); background: var(--raised); height: 34px; width: 34px; }
.icon-btn svg { width: 18px; height: 18px; }
.link-btn { background: none; border: 0; color: var(--accent-text); cursor: pointer; padding: 0 4px; font-size: 12px; }

/* ---------- forms ---------- */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=url], input:not([type]), select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: grid; gap: 6px; font-weight: 560; font-size: 13px; color: var(--text-2); }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 450; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 560; font-size: 13px; color: var(--text-2); margin-bottom: 8px; padding: 0; }

.alert { padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; font-size: 13.5px; border: 1px solid; }
.alert.error { background: color-mix(in srgb, #dc2626 10%, transparent); border-color: color-mix(in srgb, #dc2626 30%, transparent); color: color-mix(in srgb, #dc2626 80%, var(--text)); }
.alert.ok { background: color-mix(in srgb, #16a34a 10%, transparent); border-color: color-mix(in srgb, #16a34a 30%, transparent); color: color-mix(in srgb, #16a34a 75%, var(--text)); }
.alert.warn { background: color-mix(in srgb, #d97706 10%, transparent); border-color: color-mix(in srgb, #d97706 30%, transparent); color: color-mix(in srgb, #b45309 80%, var(--text)); }
.badge { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--active); color: var(--muted); vertical-align: middle; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; }
.badge.err { background: color-mix(in srgb, #dc2626 15%, transparent); color: #dc2626; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
body.auth { min-height: 100%; }
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px;
  background:
    radial-gradient(900px 500px at -10% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--sidebar);
  border-right: 1px solid var(--border);
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
.auth-art-inner { position: relative; z-index: 1; max-width: 440px; }
.auth-tagline { font-family: var(--font-serif); font-size: 28px; line-height: 1.25; margin: 26px 0 22px; letter-spacing: -.01em; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: var(--text-2); }
.auth-points li { display: flex; gap: 10px; align-items: baseline; }
.auth-points li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-1px); }
.auth-card { align-self: center; justify-self: center; width: min(400px, calc(100% - 40px)); display: grid; gap: 14px; padding: 36px 0; }
.auth-card h1 { margin: 18px 0 0; font-size: 26px; letter-spacing: -.02em; }
.auth-card > p.muted { margin: -6px 0 8px; }
.auth-alt { text-align: center; color: var(--muted); margin: 6px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

/* ==========================================================================
   App layout
   ========================================================================== */
body.app-body { overflow: hidden; }
.app {
  height: 100dvh; display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr);
  background: var(--panel);
}
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0;
  padding-top: env(safe-area-inset-top);
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.sb-actions { display: flex; gap: 8px; padding: 4px 14px 12px; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 2px 8px 18px; }
.sb-foot { display: flex; align-items: center; gap: 2px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.sb-user { font-size: 12px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }

.nav-section { margin-top: 18px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px 0 10px; border-radius: 8px;
  color: var(--text-2); cursor: pointer; user-select: none; position: relative; font-size: 13.5px;
}
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .ico { width: 18px; height: 18px; display: grid; place-items: center; flex: none; color: var(--muted); }
.nav-item.active .ico { color: var(--accent); }
.nav-item .ico img { width: 16px; height: 16px; border-radius: 4px; object-fit: cover; }
.nav-item .ico svg { width: 17px; height: 17px; }
.nav-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 560; min-width: 18px; text-align: right; }
.nav-item.has-unread .name { color: var(--text); }
.nav-item .err { color: #dc2626; }
.nav-item .err svg { width: 14px; height: 14px; }
.nav-item .more { opacity: 0; width: 24px; height: 24px; margin-right: -4px; }
.nav-item:hover .more, .nav-item .more:focus { opacity: 1; }
.nav-item:hover .count { display: none; }
.nav-item .caret { width: 16px; height: 16px; margin-left: -6px; margin-right: -4px; color: var(--faint); transition: transform .18s var(--ease); display: grid; place-items: center; border-radius: 4px; }
.nav-item .caret:hover { background: var(--active); }
.nav-item .caret svg { width: 13px; height: 13px; stroke-width: 2.4; }
.folder.open > .nav-item .caret { transform: rotate(90deg); }
.folder > .children { padding-left: 14px; display: none; }
.folder.open > .children { display: block; }
.nav-item.paused .name { opacity: .55; font-style: italic; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }
.drop-root { min-height: 30px; border-radius: 8px; margin-top: 6px; display: grid; place-items: center; color: var(--faint); font-size: 12px; border: 1px dashed transparent; }
.dragging .drop-root { border-color: var(--border-strong); }
.nav-empty { padding: 14px 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- list pane ---------- */
.list-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); background: var(--panel); padding-top: env(safe-area-inset-top); }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 14px 10px 8px 18px; min-height: 58px; }
.pane-title { flex: 1; min-width: 0; }
.pane-title h1 { margin: 0; font-size: 18px; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-tools { display: flex; gap: 0; }
.searchbar { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 0 4px 0 12px; height: 38px; border-radius: 10px; border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.searchbar input { border: 0 !important; box-shadow: none !important; padding: 0; height: 36px; background: transparent; }
.searchbar > svg { color: var(--muted); width: 16px; height: 16px; }
.filterbar { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px 16px; border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--active); gap: 2px; }
.seg button { height: 26px; padding: 0 11px; border-radius: 7px; border: 0; background: transparent; font-size: 12.5px; font-weight: 560; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--border); }
[data-theme="oled"] .seg button.on { background: #161616; }
.seg-icons button { padding: 0 7px; }
.seg-icons svg { width: 15px; height: 15px; }
.list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.list-foot { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.items { padding: 6px 0; position: relative; }
.item {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; cursor: pointer;
  padding: 12px 16px 12px 22px; border-bottom: 1px solid var(--border); transition: background .12s;
}
.item:hover { background: var(--hover); }

/* swipe actions (touch) */
.item.swiping { background: var(--panel); z-index: 1; will-change: transform; }
.item.swiping.selected { background: var(--panel); }
.swipe-under { position: absolute; z-index: 0; display: flex; align-items: center; padding: 0 22px; background: var(--active); color: var(--muted); font-size: 13px; transition: background .15s, color .15s; pointer-events: none; }
.swipe-under.from-right { justify-content: flex-end; }
.swipe-under .sw { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .15s var(--ease); }
.swipe-under .sw b { font-weight: 600; }
.swipe-under svg { width: 22px; height: 22px; }
.swipe-under.armed { color: #fff; }
.swipe-under.armed .sw { transform: scale(1.08); }
.swipe-under.armed.act-archive { background: #0f9d6b; }
.swipe-under.armed.act-later { background: var(--accent); }
.swipe-under.armed.act-read { background: #2563eb; }
.swipe-under.armed.act-star { background: #d97706; }
.layout-cards .swipe-under, .layout-magazine .swipe-under { border-radius: var(--radius-lg); }
.item.leaving { overflow: hidden; opacity: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0; transition: height .22s var(--ease), padding .22s var(--ease), opacity .18s; pointer-events: none; }
.item.selected { background: var(--selected); }
.item.selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.item .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; grid-column: 1 / -1; }
.item .meta img.fav { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.item .meta .src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; color: var(--text-2); max-width: 60%; }
.item .meta .time { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .meta .flags { display: inline-flex; gap: 2px; color: var(--accent); }
.item .meta .flags svg { width: 13px; height: 13px; }
.item .meta .flags .star svg { fill: currentColor; }
.item .title, .item .summary, .item .authors { grid-column: 1; }
.item:not(:has(.thumb)) { grid-template-columns: minmax(0, 1fr); }
.item .title { font-size: 14.5px; line-height: 1.35; font-weight: 600; color: var(--text); letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item .summary { font-size: 13px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.item .thumb { width: 74px; height: 74px; border-radius: 9px; object-fit: cover; background: var(--active); grid-row: 2 / span 2; grid-column: 2; align-self: start; }
.item .unread-dot { position: absolute; left: 9px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.item.read .title { font-weight: 450; color: var(--muted); }
.item.read .summary { opacity: .75; }
.item.read .thumb { opacity: .7; }
.item .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; grid-column: 1; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--active); white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }
.chip.accent { color: var(--accent-text); background: var(--accent-soft); }
.chip.merged { color: #8250df; background: color-mix(in srgb, #8250df 14%, transparent); }
.chip.release { color: #1a7f37; background: color-mix(in srgb, #1a7f37 14%, transparent); }
[data-theme="dark"] .chip.merged, [data-theme="oled"] .chip.merged { color: #b48eff; }
[data-theme="dark"] .chip.release, [data-theme="oled"] .chip.release { color: #4ade80; }
.chip.label { background: color-mix(in srgb, var(--c) 18%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--text)); }

/* cards layout (alphaXiv-like feed) */
.items.layout-cards { padding: 12px; display: grid; gap: 12px; }
.layout-cards .item { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 16px 14px 18px; background: var(--panel); grid-template-columns: minmax(0, 1fr); }
.layout-cards .item:hover { border-color: var(--border-strong); background: var(--panel); box-shadow: var(--shadow); }
.layout-cards .item.selected { border-color: var(--accent); background: var(--selected); }
.layout-cards .item.selected::before { display: none; }
.layout-cards .item .title { font-size: 16px; font-family: var(--font-serif); font-weight: 650; -webkit-line-clamp: 4; }
.layout-cards .item.read .title { font-weight: 500; }
.layout-cards .item .summary { -webkit-line-clamp: 4; font-size: 13.5px; }
.layout-cards .item .thumb { grid-row: auto; grid-column: 1; width: 100%; height: auto; aspect-ratio: 2 / 1; margin-top: 8px; order: 5; }
.layout-cards .item .unread-dot { left: auto; right: 14px; top: 14px; }
.layout-cards .item .meta .time { margin-right: 14px; }
.layout-cards .item .authors { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.layout-cards .card-actions { display: flex; gap: 2px; margin: 6px 0 -6px -8px; }
.layout-cards .card-actions .icon-btn { width: 30px; height: 30px; }
.layout-cards .card-actions .icon-btn.on svg { fill: currentColor; }
.item .card-actions { display: none; }
.layout-cards .item .card-actions { display: flex; }

/* magazine layout */
.items.layout-magazine { padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.layout-magazine .item { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--panel); }
.layout-magazine .item .thumb, .layout-magazine .item .noimg { order: -1; width: 100%; height: 108px; border-radius: 0; }
.layout-magazine .item .noimg { display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--active)); color: var(--accent-text); font-family: var(--font-serif); font-size: 32px; font-weight: 700; }
.layout-magazine .item .meta, .layout-magazine .item .title { padding: 0 12px; }
.layout-magazine .item .summary, .layout-magazine .item .chips { display: none; }
.layout-magazine .item .title { font-size: 13.5px; -webkit-line-clamp: 3; }
.layout-magazine .item .unread-dot { left: auto; right: 10px; top: 10px; box-shadow: 0 0 0 2px var(--panel); }
.layout-magazine .item.selected { outline: 2px solid var(--accent); }
.layout-magazine .item.selected::before { display: none; }
.item .noimg { display: none; }
.layout-magazine .item .noimg { display: grid; }

.empty-state { padding: 60px 30px; text-align: center; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; stroke-width: 1.3; color: var(--faint); margin-bottom: 10px; }
.empty-state h3 { margin: 4px 0 6px; color: var(--text); font-size: 16px; }
.skeleton { padding: 14px 18px 14px 22px; border-bottom: 1px solid var(--border); }
.skeleton i { display: block; height: 10px; border-radius: 5px; background: var(--active); margin: 8px 0; animation: pulse 1.4s ease-in-out infinite; }
.skeleton i:nth-child(1) { width: 35%; } .skeleton i:nth-child(2) { width: 90%; height: 13px; } .skeleton i:nth-child(3) { width: 70%; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- reader pane ---------- */
.reader-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); padding-top: env(safe-area-inset-top); }
.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.reader.empty { display: grid; place-items: center; }
.reader-empty { text-align: center; color: var(--muted); }
.reader-empty .big-icon { width: 56px; height: 56px; stroke-width: 1.2; color: var(--faint); }
.reader-bar { display: flex; align-items: center; gap: 2px; padding: 10px 14px; min-height: 58px; border-bottom: 1px solid transparent; transition: border-color .2s; }
.reader-bar.scrolled { border-bottom-color: var(--border); }
.reader-bar .icon-btn.on svg { fill: currentColor; }
.reader-bar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.reader-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.progress { position: sticky; top: 0; height: 2px; background: var(--accent); width: 0; z-index: 2; transition: width .1s linear; }
.article { --measure: 680px; max-width: calc(var(--measure) + 64px); margin: 0 auto; padding: 18px 32px 120px; }
.article.w-narrow { --measure: 580px; }
.article.w-wide { --measure: 860px; }
.article-head { margin-bottom: 26px; }
.article-src { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 560; }
.article-src img { width: 18px; height: 18px; border-radius: 4px; }
.article-src a { color: var(--text-2); }
.article h1.article-title { font-family: var(--font-serif); font-size: clamp(26px, 3.2vw, 36px); line-height: 1.16; letter-spacing: -.018em; margin: 12px 0 12px; font-weight: 700; }
.article h1.article-title a { color: var(--text); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.article-meta .dot::before { content: "·"; margin-right: 12px; }
.article-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.source-switch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--active); font-size: 12.5px; color: var(--muted); }
.source-switch .seg { background: transparent; }
.source-switch .seg button.on { box-shadow: 0 0 0 1px var(--border-strong); }
.source-switch .note { flex: 1 1 160px; }
.source-switch .note b { color: var(--text-2); }
.paper-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.content { font-size: var(--fs, 18px); line-height: 1.7; color: var(--text); overflow-wrap: break-word; }
.content.f-serif { font-family: var(--font-serif); }
.content.f-sans { font-family: var(--font-ui); line-height: 1.65; }
.content.f-mono { font-family: var(--font-mono); font-size: calc(var(--fs, 18px) * .88); }
.content > *:first-child { margin-top: 0; }
.content p, .content ul, .content ol, .content blockquote, .content pre, .content figure, .content table { margin: 0 0 1.15em; }
.content h1, .content h2, .content h3, .content h4 { font-family: var(--font-ui); line-height: 1.3; letter-spacing: -.01em; margin: 1.7em 0 .6em; }
.content h1 { font-size: 1.45em; } .content h2 { font-size: 1.3em; } .content h3 { font-size: 1.12em; } .content h4 { font-size: 1em; }
.content a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.content a:hover { text-decoration-color: var(--accent); }
.content img, .content video, .content iframe { max-width: 100%; height: auto; border-radius: 8px; }
.content iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.content figure { margin-left: 0; margin-right: 0; }
.content figcaption { font-family: var(--font-ui); font-size: 13px; color: var(--muted); margin-top: 6px; text-align: center; }
.content blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 18px; color: var(--text-2); margin-left: 0; font-style: italic; }
.content code { font-family: var(--font-mono); font-size: .84em; background: var(--code-bg); padding: .12em .38em; border-radius: 5px; border: 1px solid var(--border); }
.content pre { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.content pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.content table { border-collapse: collapse; display: block; overflow-x: auto; font-family: var(--font-ui); font-size: 14px; }
.content th, .content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.content li { margin: .3em 0; }
.content .gh-meta, .content .hn-link, .content .paper-authors { font-family: var(--font-ui); font-size: 14px; color: var(--muted); }
[data-theme="oled"] .content img { opacity: .92; }

.discussion { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 22px; font-family: var(--font-ui); }
.discussion h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.comment { padding: 10px 0 2px 14px; border-left: 2px solid var(--border); margin: 6px 0 0 0; }
.comment .c-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.comment .c-head b { color: var(--text-2); font-weight: 600; }
.comment .c-toggle { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 12px; padding: 0; }
.comment .c-body { font-size: 14.5px; line-height: 1.6; color: var(--text); margin-top: 4px; overflow-wrap: anywhere; }
.comment .c-body p { margin: 0 0 .6em; }
.comment .c-body pre { white-space: pre-wrap; font-size: 12.5px; }
.comment.collapsed > .c-body, .comment.collapsed > .c-children { display: none; }
.comment .c-children { margin-left: 4px; }
.comment:nth-child(odd) > .c-children > .comment { border-left-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }

/* ---------- popover / menus ---------- */
.popover {
  position: fixed; z-index: 60; min-width: 220px; max-width: 300px; padding: 6px; border-radius: 12px;
  background: var(--raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  animation: pop .14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.popover .mi { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text); }
.popover .mi:hover { background: var(--hover); }
.popover .mi svg { width: 16px; height: 16px; color: var(--muted); }
.popover .mi.danger { color: #dc2626; } .popover .mi.danger svg { color: #dc2626; }
.popover .mi .kbd { margin-left: auto; }
.popover .mi.checked::after { content: "✓"; margin-left: auto; color: var(--accent); font-weight: 700; }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.popover .mh { padding: 6px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; animation: fade .15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); min-width: 0; max-height: min(86dvh, 760px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg); animation: rise .2s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px 22px; }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; letter-spacing: -.01em; }
.modal-body { padding: 6px 22px 18px; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.modal-body > * { min-width: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; padding: 0 18px 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; scroll-padding-inline: 22px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13px; }
.tabs button svg { width: 15px; height: 15px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hint code { font-family: var(--font-mono); font-size: 11.5px; background: var(--active); padding: 1px 5px; border-radius: 4px; }
.cands { display: grid; gap: 8px; }
.cand { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-strong); cursor: pointer; }
.cand:hover { border-color: var(--accent); }
.cand.on { border-color: var(--accent); background: var(--accent-soft); }
.cand .ct { flex: 1; min-width: 0; }
.cand .ct b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand .ct small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; }
.shortcuts div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.shortcuts h4 { grid-column: 1 / -1; margin: 10px 0 2px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.feed-stat { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; color: var(--muted); background: var(--active); border-radius: 10px; padding: 10px 14px; }
.feed-stat b { color: var(--text-2); font-weight: 560; }
.feed-stat .err { color: #dc2626; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 80; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--text); color: var(--panel); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: rise .2s var(--ease); max-width: min(92vw, 520px); }
[data-theme="oled"] .toast { background: #1b1b1b; color: #eee; border: 1px solid #2a2a2a; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 650; cursor: pointer; padding: 2px 6px; }
.toast.error { background: #b91c1c; color: #fff; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning svg { animation: spin .9s linear infinite; }

.scrim { display: none; }
.only-mobile { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1240px) { :root { --list-w: 360px; --sidebar-w: 250px; } }
@media (min-width: 1021px) { .app[data-layout="magazine"] { grid-template-columns: var(--sidebar-w) minmax(0, 1.3fr) minmax(0, 1fr); } }
@media (max-width: 1020px) {
  .app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .app .reader-pane { position: fixed; inset: 0 0 0 var(--sidebar-w); z-index: 20; transform: translateX(100%); transition: transform .26s var(--ease); box-shadow: var(--shadow-lg); }
  .app[data-pane="reader"] .reader-pane { transform: none; }
  .reader-pane .only-narrow { display: inline-grid !important; }
}
@media (min-width: 1021px) { .only-narrow { display: none !important; } }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-grid !important; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 40; transform: translateX(-102%); transition: transform .26s var(--ease); box-shadow: var(--shadow-lg); }
  .app.sb-open .sidebar { transform: none; }
  .app.sb-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); animation: fade .2s; }
  .app .reader-pane { inset: 0; }
  .pane-head { padding-left: 8px; }
  .article { padding: 12px 20px 120px; }
  .item { padding-left: 20px; }
  .item .thumb { width: 64px; height: 64px; }
  .layout-magazine { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid2, .checks, .shortcuts { grid-template-columns: 1fr; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
  .modal-head { padding: 16px 12px 8px 18px; }
  .modal-body { padding: 6px 18px 16px; }
  .tabs { padding: 0 12px; gap: 0; }
  .tabs.more { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs button { padding: 0 9px; }
  .reader-bar { padding: 8px 8px; }
  .reader-bar .hide-sm { display: none; }
  .source-switch { padding: 8px 6px 8px 12px; }
  .source-switch .note { flex: 1 1 100%; }
  .source-switch .seg { margin-left: -6px; }
  .content { line-height: 1.62; }
}

/* ==========================================================================
   Settings / admin pages
   ========================================================================== */
body.page-body { background: var(--bg); }
.page-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: calc(10px + env(safe-area-inset-top)) 20px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.page { display: grid; grid-template-columns: 230px minmax(0, 860px); gap: 34px; max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.page-nav { position: sticky; top: 80px; align-self: start; display: grid; gap: 2px; }
.page-nav h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 12px 10px; }
.page-nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 9px; color: var(--text-2); font-weight: 520; }
.page-nav a:hover { background: var(--hover); text-decoration: none; }
.page-nav a svg { width: 16px; height: 16px; color: var(--muted); }
.page-main { display: grid; gap: 22px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px; scroll-margin-top: 80px; }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; letter-spacing: -.015em; }
.card h2 svg { color: var(--accent); }
.card h3 { font-size: 14px; margin: 24px 0 10px; }
.card > p.muted { margin: 0 0 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .span2 { grid-column: 1 / -1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.inline-form input:not([type=checkbox]):not([type=file]) { max-width: 260px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-cards legend { grid-column: 1 / -1; }
.radio-cards label { display: block; cursor: pointer; }
.radio-cards input { position: absolute; opacity: 0; }
.radio-cards span { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-strong); }
.radio-cards span small { color: var(--muted); font-weight: 450; }
.radio-cards input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.theme-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-picker legend { width: 100%; }
.theme-swatch { cursor: pointer; display: grid; gap: 6px; justify-items: center; font-weight: 520; }
.theme-swatch input { position: absolute; opacity: 0; }
.theme-swatch .sw { width: 92px; height: 60px; border-radius: 12px; border: 2px solid var(--border-strong); display: grid; grid-template-columns: 1fr 2fr; overflow: hidden; }
.theme-swatch .sw i:nth-child(1) { grid-row: span 2; }
.t-light .sw i:nth-child(1) { background: #f1efeb; } .t-light .sw i:nth-child(2) { background: #fff; } .t-light .sw i:nth-child(3) { background: #f7f6f3; }
.t-dark .sw i:nth-child(1) { background: #131315; } .t-dark .sw i:nth-child(2) { background: #1c1c1f; } .t-dark .sw i:nth-child(3) { background: #242428; }
.t-oled .sw i:nth-child(1) { background: #000; } .t-oled .sw i:nth-child(2) { background: #000; border-left: 1px solid #222; } .t-oled .sw i:nth-child(3) { background: #000; border-left: 1px solid #222; border-top: 1px solid #222; }
.t-system .sw { background: linear-gradient(135deg, #fff 50%, #000 50%); } .t-system .sw i { display: none; }
.theme-swatch input:checked + .sw { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.accent-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.accent-picker legend { width: 100%; }
.accent { cursor: pointer; }
.accent input { position: absolute; opacity: 0; }
.accent span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.accent input:checked + span { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--c); }
.a-orange { --c: #e8590c; } .a-indigo { --c: #5b5bd6; } .a-teal { --c: #0d9488; } .a-rose { --c: #e11d48; } .a-violet { --c: #8b5cf6; } .a-blue { --c: #2563eb; } .a-green { --c: #16a34a; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 4px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; }
.stat b { font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.warn b { color: #dc2626; }
.bullets { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--text-2); }
.bookmarklet { display: inline-block; padding: 3px 10px; border-radius: 7px; background: var(--accent); color: #fff !important; font-weight: 600; text-decoration: none !important; cursor: grab; }
.settings-table { display: grid; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 110px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-label { display: grid; gap: 2px; }
.setting-label small { font-size: 12px; }
.setting-src { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.settings-table .btn-row { margin-top: 16px; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); cursor: pointer; transition: background .2s; }
.switch span::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(17px); }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr.dim td { opacity: .55; }
.table td.actions { text-align: right; width: 40px; }
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: 36px; z-index: 5; min-width: 240px; background: var(--raised); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.menu-body form { display: flex; gap: 6px; }
.menu-body button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu-body button:hover { background: var(--hover); }
.menu-body button.danger { color: #dc2626; }
.menu-body form.pw input { height: 32px; }
.menu-body form.pw button { width: auto; }
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; padding: 16px 14px 60px; gap: 16px; }
  .page-nav { position: static; display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .page-nav h2 { display: none; }
  .page-nav a { white-space: nowrap; background: var(--panel); border: 1px solid var(--border); }
  .card { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .setting-row { grid-template-columns: 1fr; gap: 8px; }
  .setting-src { justify-content: flex-start; }
  .radio-cards { grid-template-columns: 1fr; }
  .page-top .brand { display: none; }
}
