/* Oui. — dispatch desk
   Palette: paper #F6F6F2 · ink #14181F · bleu de travail #2743C7 · red #C6363C · amber #D99A26
   Type: Avenir Next (UI) · Charter (reading) · SF Mono (datelines, counts) */

:root {
  --paper: #F6F6F2;
  --card: #FFFFFF;
  --ink: #14181F;
  --muted: #6A7280;
  --line: #E2E3DC;
  --blue: #2743C7;
  --blue-soft: #EDF0FF;
  --red: #C6363C;
  --amber: #D99A26;

  --font-ui: "Avenir Next", Avenir, Futura, "Segoe UI", system-ui, sans-serif;
  --font-read: Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

/* ── Wordmark & tricolore ─────────────────────────────── */
.wordmark {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.wordmark-dot { color: var(--blue); }
.wordmark-small { font-size: 22px; }
.wordmark-ghost { font-size: 44px; color: var(--line); }
.tricolore { display: flex; height: 3px; width: 72px; gap: 4px; margin: 10px 0 0; }
.tricolore i { flex: 1; }
.tricolore i:nth-child(1) { background: var(--blue); }
.tricolore i:nth-child(2) { background: var(--line); }
.tricolore i:nth-child(3) { background: var(--red); }
.tricolore-rule { width: auto; margin: 0; gap: 0; height: 2px; }
.tricolore-rule i:nth-child(1) { flex: 0 0 96px; }
.tricolore-rule i:nth-child(2) { flex: 1; background: var(--line); }
.tricolore-rule i:nth-child(3) { flex: 0 0 96px; }

/* ── Buttons, fields, small parts ─────────────────────── */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1E36A8; }
.btn-quiet { color: var(--ink); background: transparent; border: 1px solid var(--line); background: var(--card); }
.btn-quiet:hover { border-color: var(--muted); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, white); }
.btn-block { width: 100%; text-align: center; padding: 10px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--muted); border: 1px solid transparent;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line); background: var(--card); }

.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.field input, .field select, .search input, .row-form input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}
.field input:focus, .search input:focus { border-color: var(--blue); outline: none; }

.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 8px;
}
.form-error { color: var(--red); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.kbd-hint { color: var(--muted); font-size: 12.5px; }
kbd {
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  padding: 1px 5px; background: var(--card);
}

/* ── Login ────────────────────────────────────────────── */
.login-stage { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 32px 30px;
  box-shadow: 0 1px 2px rgba(20,24,31,.04), 0 12px 32px rgba(20,24,31,.06);
}
.login-card .wordmark { font-size: 40px; }
.login-tagline { color: var(--muted); margin: 14px 0 26px; font-size: 14.5px; }
.login-card .btn-block { margin-top: 6px; }

/* ── App shell ────────────────────────────────────────── */
.app { height: 100vh; display: flex; flex-direction: column; }
.masthead {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--card);
}
.masthead-nav-toggle { display: none; }
.search { flex: 1; max-width: 420px; margin-left: 12px; }
.search input { padding: 7px 12px; border-radius: 999px; background: var(--paper); }
.masthead-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.panes { flex: 1; display: flex; min-height: 0; }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 248px; flex: none;
  overflow-y: auto;
  padding: 6px 12px 24px;
  border-right: 1px solid var(--line);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar-head .eyebrow { margin-bottom: 0; }
.sidebar-head .icon-btn { margin-top: 12px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 6px;
  font-size: 14px; color: var(--ink);
}
.nav-item:hover { background: var(--card); }
.nav-item.is-active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 400;
  color: var(--muted);
}
.nav-item .count-accent:not(:empty) { color: var(--blue); font-weight: 600; }
.nav-item .feed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .health-flag { color: var(--red); font-size: 11px; flex: none; }
.folder-label {
  display: flex; align-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 10px 3px;
}

/* ── Article list ─────────────────────────────────────── */
.list-pane {
  width: 384px; flex: none;
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.list-title { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.article-list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; }
.article-card {
  display: block; width: 100%; text-align: left;
  padding: 12px 12px 12px 26px;
  border-radius: 8px;
  position: relative;
  border: 1px solid transparent;
}
.article-card:hover { background: var(--card); border-color: var(--line); }
.article-card.is-selected { background: var(--card); border-color: var(--blue); }
.article-card .dot {
  position: absolute; left: 10px; top: 19px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue);
}
.article-card.is-read .dot { background: transparent; }
.article-card .a-meta {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--muted);
  display: flex; gap: 8px; align-items: baseline;
}
.article-card .a-meta span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 0 1 auto;
}
.article-card .a-meta span:nth-child(2) { margin-left: auto; flex: none; }
.article-card .a-star { color: var(--amber); font-size: 12px; }
.article-card .a-title {
  font-family: var(--font-read);
  font-size: 15.5px; line-height: 1.3; font-weight: 700;
  margin: 3px 0 4px;
}
.article-card.is-read .a-title { font-weight: 400; color: color-mix(in srgb, var(--ink) 72%, var(--muted)); }
.article-card .a-summary {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0;
}
.list-foot { padding: 10px 16px 16px; text-align: center; }
.empty { color: var(--muted); font-size: 13.5px; padding: 24px 8px; }

/* ── Reading pane ─────────────────────────────────────── */
.read-pane { flex: 1; overflow-y: auto; background: var(--card); }
.read-placeholder {
  height: 100%; display: grid; place-content: center; text-align: center;
  color: var(--muted); line-height: 1.7;
}
#read-content { max-width: 680px; margin: 0 auto; padding: 36px 40px 80px; }
.read-back { display: none; margin-bottom: 16px; }
.dateline {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--blue);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px; margin: 0 0 18px;
}
.read-title {
  font-family: var(--font-read);
  font-size: 30px; line-height: 1.15; letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.read-actions { display: flex; gap: 8px; margin-bottom: 26px; }
.read-body {
  font-family: var(--font-read);
  font-size: 17px; line-height: 1.65;
}
.read-body img { max-width: 100%; height: auto; border-radius: 6px; }
.read-body a { color: var(--blue); }
.read-body pre { font-family: var(--font-mono); font-size: 13px; overflow-x: auto; background: var(--paper); padding: 12px; border-radius: 8px; }
.read-body blockquote { margin: 0; padding-left: 16px; border-left: 3px solid var(--line); color: var(--muted); }

/* ── Modals ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20,24,31,.38);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  width: 100%; max-width: 720px; max-height: 86vh;
  background: var(--card); border-radius: 12px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(20,24,31,.25);
}
.modal-narrow { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px;
}
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.modal-body { padding: 18px 22px 26px; overflow-y: auto; }
.row-form { display: flex; gap: 8px; align-items: center; }
.row-form input[type="text"] { flex: 1; }

.settings-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.settings-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.settings-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings-table td.actions { text-align: right; white-space: nowrap; }
.settings-table .mono { font-family: var(--font-mono); font-size: 12px; }
.settings-table select, .settings-table input { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--card); }
.feed-error { color: var(--red); font-size: 11.5px; }
.key-reveal {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--blue-soft); color: var(--blue);
  padding: 10px 12px; border-radius: 8px; margin: 12px 0;
  word-break: break-all;
  user-select: all;
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 9px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 60;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 980px) {
  .masthead-nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0;
    background: var(--paper);
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 40px rgba(20,24,31,.2);
    padding-top: 16px;
  }
  .app.nav-open .sidebar { transform: none; }
  .list-pane { width: auto; flex: 1; }
  .read-pane { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .read-pane { display: block; }
  .read-back { display: inline-block; }
  #read-content { padding: 20px 20px 60px; }
  .search { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
