/* ═══════════════════════════════════════════════════════════════════════
   ui.css — nitter-private shared design system (E-92, Phase 3)
   One stylesheet for every gate page, generated page and proxied reader page.
   Tokens only — no imports, no remote URLs, no external fonts, no JS.
   Outer geometry = E-89 canonical: content fills the window right of the
   170px sidebar; long prose is measured INSIDE cards (72ch), never the page.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0b0e14;
  --card: #141922;
  --border: #303a49;
  --text: #d7dde6;
  --dim: #98a3b1;
  --accent: #6ea8fe;
  --ok: #4ade80;
  --bad: #f87171;
  --warn: #f59e0b;
  --like: #f5a97f;
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* shape */
  --r-card: 9px; --r-ctl: 6px;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
}
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* dark slim scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232a35; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── canonical layout (E-89) — content fills right of the sidebar ── */
body { padding-left: 0 !important; padding-right: 0 !important; }
body > div.container, body > div.site-wrap, body > div.wrap,
body div.container, body div.site-wrap, body div.wrap,
.container, .site-wrap, .wrap {
  max-width: none !important;
  margin-left: 190px !important;
  margin-right: 16px !important;
  width: auto !important;
  flex: 1 1 auto !important;
}
body > .wrap, body > .container { padding-top: 28px; }
/* nested containers/wrappers never re-offset (E-86) */
.conversation, .edit-history, .timeline-container, .profile-tabs, .overlay-panel,
.container div[class*="container"], .container div[class*="wrap"],
.site-wrap div[class*="container"], .site-wrap div[class*="wrap"],
div[class*="container"] div[class*="container"] {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
}
.video-overlay .overlay-circle { margin: 0 auto !important; }
/* nitter's own top nav stays suppressed — the sidebar is the only nav */
body > nav, .inner-nav { display: none !important; }

/* ── sidebar ──────────────────────────────────────────────────────── */
#site-nav {
  position: fixed; left: 0; top: 0; bottom: 0; width: 170px;
  background: #0d1017; border-right: 1px solid var(--border);
  padding: 14px 0; z-index: 9998; overflow-y: auto;
}
#site-nav .nv-t {
  padding: 0 16px 14px; font-weight: 600; font-size: 15px;
  color: var(--text); font-family: var(--mono);
}
#site-nav a {
  display: block; padding: 7px 16px; color: var(--dim);
  text-decoration: none; font-size: 13px; font-family: var(--sans);
  transition: color .15s, background .15s;
}
#site-nav a:hover { color: var(--accent); background: #141922; }
#site-nav a[aria-current="page"] {
  color: var(--accent); background: #141922;
  box-shadow: inset 3px 0 0 var(--accent);
}
#site-nav .nv-sep { border-top: 1px solid var(--border); margin: 8px 0; }

/* ── shared header / type ─────────────────────────────────────────── */
header {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px; margin-bottom: var(--s5);
}
h1 {
  margin: 0; font: 600 21px/1 var(--mono); letter-spacing: .5px;
  color: var(--text);
}
h1 a, h2 a {
  color: var(--dim); text-decoration: none; font-weight: 400; font-size: 14px;
}
h1 a:hover, h2 a:hover { color: var(--accent); }
h2 { font-size: 15px; color: var(--dim); margin: 26px 0 10px; }
.meta, .counts, .when {
  font: 12px var(--mono); color: var(--dim);
}
.dim { color: var(--dim); font-size: 13px; }
.empty { color: var(--dim); text-align: center; padding: var(--s6); }
footer {
  margin-top: 28px; border-top: 1px solid var(--border); padding-top: 12px;
  font: 12px var(--mono); color: var(--dim);
  display: flex; justify-content: space-between;
}

/* ── cards / items / list rows ────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 18px;
}
.item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 12px 14px; margin-bottom: 10px;
}
.item .head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.item .u {
  color: var(--accent); font-weight: 600; font-size: 14px;
  text-decoration: none; font-family: var(--mono);
}
.item .u:hover { text-decoration: underline; }
.item .txt { font-size: 14px; }
.item a.open {
  display: inline-block; margin-top: 6px; font-size: 12.5px;
  color: var(--dim); text-decoration: none;
}
.item a.open:hover { color: var(--accent); }
.item a { color: var(--accent); text-decoration: none; }
.item a:hover { text-decoration: underline; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 9px; border: 1px solid var(--border);
  color: var(--dim); margin-right: 6px;
}
.badge.like { color: var(--like); border-color: #f5a97f44; }
.text {
  font-size: 16px; line-height: 1.7; margin-bottom: 16px; white-space: pre-wrap;
}
a.xlink, a.back {
  display: inline-block; margin-top: 8px; color: var(--accent);
  text-decoration: none; font-size: 13px; font-family: var(--mono);
}
a.xlink:hover, a.back:hover { text-decoration: underline; }

/* prose measure — inside full-width cards only */
.tweet-content, .tweet-text, .item .txt, .item .text, .text {
  max-width: 72ch;
}
@media (min-width: 1400px) {
  .tweet-content, .tweet-text, .item .txt, .item .text, .text {
    font-size: 16px; line-height: 1.7;
  }
}

/* ── controls ─────────────────────────────────────────────────────── */
input[type=text], input:not([type]), select {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-ctl); color: var(--text);
  padding: 9px 12px; font-size: 14px; outline: none;
}
input[type=text]:focus, input:not([type]):focus { border-color: var(--accent); }
button {
  background: var(--accent); border: 0; border-radius: var(--r-ctl);
  color: var(--bg); padding: 9px 16px; font-weight: 700;
  font-size: 14px; cursor: pointer; font-family: var(--sans);
}
button:hover { filter: brightness(1.1); }
.bar, .search, .addbar { display: flex; gap: var(--s2); margin-bottom: 14px; }
.bar input, .search input[type=text], .addbar input { flex: 1; }
.search button, .addbar button { font-weight: 700; }

/* ── chips / account pills ────────────────────────────────────────── */
.chips, .accs, .aw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
a.chip, a.acc, .aw-chips a {
  display: inline-block; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 5px 9px; color: var(--accent); text-decoration: none;
  font-family: var(--mono); font-size: 12px;
}
a.chip:hover, a.acc:hover, .aw-chips a:hover { border-color: var(--accent); }
a.chip span, a.acc .cnt, .aw-chips a span { color: var(--dim); font-size: 10px; }
a.acc .cnt { font-size: 11px; }
.accs { gap: var(--s2); margin-bottom: 20px; }

/* ── dashboard grid ───────────────────────────────────────────────── */
.grid { display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
a.card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 14px 16px;
  text-decoration: none; color: var(--text);
  transition: border-color .15s;
}
a.card:hover { border-color: var(--accent); }
a.card h2 { text-decoration: none; }
.card h2, a.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--accent); }
.card p { margin: 0; font-size: 13px; color: var(--dim); }
.info {
  background: transparent; border: 1px dashed var(--border);
  border-radius: var(--r-card); padding: 14px 16px;
  font-size: 13px; color: var(--dim);
}
.info b { color: var(--text); font-weight: 600; }
.status {
  font: 12px var(--mono); color: var(--dim);
  display: flex; align-items: center; gap: 7px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.bad { background: #ef4444; }

/* ── wiki index (year bars, subject cards) ────────────────────────── */
.wiki-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
a.card p { font-size: 12px; }
.ybars { display: flex; gap: 3px; align-items: flex-end; height: 60px; margin-top: 8px; }
.yb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.yb i { display: block; width: 10px; background: var(--accent); opacity: .55; border-radius: 2px; }
.yb em { font: 9px var(--mono); color: var(--dim); font-style: normal; margin-top: 2px; }

/* ── reading list rows ────────────────────────────────────────────── */
ul { list-style: none; margin: 0; padding: 0; }
li {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  margin-bottom: 6px; background: var(--card);
}
li.cur { border-color: var(--ok); }
li.rm { border-color: var(--bad); background: #f8717114; }
li.rm .handle { text-decoration: line-through; color: var(--dim); }
li input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
li input.cur-cb { accent-color: var(--ok); }
li input.rm-cb { accent-color: var(--bad); }
li a { font-family: var(--mono); }
li .gone { color: var(--dim); }
li .tag { font-size: 11px; color: var(--ok); border: 1px solid var(--ok);
          border-radius: 4px; padding: 1px 5px; margin-left: auto; }
li .tag.manual { color: var(--accent); border-color: var(--accent); }
li .tag.follow { margin-left: 0; }
.lbl { font-size: 11px; color: var(--dim); cursor: pointer; user-select: none; }
.note, #flash { font-size: 12.5px; color: var(--dim); }
#flash { min-height: 1.1em; margin-bottom: 10px; }
#flash.err { color: var(--bad); }

/* ── landing / 401 share the box ──────────────────────────────────── */
.landing-body {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; padding: var(--s5);
}
.box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 36px 44px;
  text-align: center; max-width: 420px;
}
.box img { width: 96px; height: 96px; border-radius: 20px; margin-bottom: 16px; }
.box h1 { margin: 0 0 4px; font: 600 22px var(--mono); }
.box h1 span { color: var(--dim); font-weight: 400; }
.tag { color: var(--dim); font-size: 13px; margin-bottom: 26px; }
button.btn {
  display: inline-block; cursor: pointer; background: var(--accent);
  color: var(--bg); border: 0; font-weight: 700; font-size: 16px;
  padding: 13px 48px; border-radius: 8px; font-family: inherit;
}
button.btn:hover { filter: brightness(1.1); }
.code { font: 600 40px var(--mono); color: var(--accent); margin: 0 0 10px; }
#msg { margin-top: 12px; font-size: 13px; color: var(--dim); min-height: 1.2em; }
#msg.err { color: var(--bad); }

/* ── feed freshness (E-93) ────────────────────────────────────────── */
.age-stale { color: var(--warn); }
#latest-list .item .txt { font-size: 14px; }

/* ── digest ───────────────────────────────────────────────────────── */
.b { font-size: 14px; padding: 3px 0; max-width: 72ch; }

/* ── mobile: sidebar becomes a horizontal scrollable nav ─────────── */
@media (max-width: 700px) {
  body > div.container, body > div.site-wrap, body > div.wrap,
  body div.container, body div.site-wrap, body div.wrap,
  .container, .site-wrap, .wrap {
    margin-left: 10px !important;
    margin-right: 10px !important;
  }
  #site-nav {
    position: sticky; top: 0; left: 0; right: 0; bottom: auto;
    width: auto; display: flex; align-items: center;
    overflow-x: auto; overflow-y: hidden; padding: 6px 8px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  #site-nav .nv-t { padding: 0 10px 0 4px; white-space: nowrap; }
  #site-nav a { white-space: nowrap; padding: 6px 10px; }
  #site-nav .nv-sep { border-top: 0; border-left: 1px solid var(--border); margin: 0 4px; height: 22px; }
  body > .wrap, body > .container { padding-top: 16px; }
}

/* ── E-95 dashboard digest sections ───────────────────────────────── */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; }
.stat b { display: block; font: 600 24px/1.2 var(--mono); color: var(--text); }
.stat span { font-size: 12.5px; color: var(--dim); }
.dash-sec { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; margin-bottom: 14px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.sec-head h2 { margin: 0; font: 600 16px var(--mono); color: var(--text); }
.sec-head a { font-size: 12px; color: var(--dim); text-decoration: none; }
.sec-head a:hover { color: var(--accent); }
.cloud { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; justify-content: center; padding: 12px 6px; min-height: 120px; }
.cloud a { text-decoration: none; font-family: var(--mono); line-height: 1.15; }
.cloud a:hover { text-decoration: underline; color: var(--text) !important; }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.ranked { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranked li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.ranked li:last-child { border-bottom: 0; }
.ranked .rank { font: 600 12px var(--mono); color: var(--dim); width: 18px; }
.ranked a { color: var(--accent); text-decoration: none; font-family: var(--mono); font-size: 14px; }
.ranked a:hover { text-decoration: underline; }
.ranked .cnt { margin-left: auto; font: 12px var(--mono); color: var(--dim); background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 1px 8px; }
