/* ── layout ───────────────────────────────────────────────────────────────── */

.lit-page { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: var(--panel-gap); align-items: start; }
@media (max-width: 760px) {
  .lit-page { grid-template-columns: 1fr; }
  .lit-side { position: static; }
  .lit-heading { flex-basis: 100%; margin: 0; }
  .lit-search { flex-basis: 100%; max-width: none; }
  .lit-toolbar .button { flex: 1 1 auto; }
  .lit-entry-actions { flex-wrap: wrap; }
  .lit-folder-pick { flex: 1 1 100%; min-width: 0; }
}
/* touch has no hover — the per-row tools stay visible there */
@media (hover: none) { .lit-folder-actions, .lit-entry-tools { opacity: 1; } }

/* ── folder rail — the shared tree-row look, see core/base.css ───────────── */

.lit-side { position: sticky; top: 12px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-raised); }
.lit-side-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px 7px; color: var(--muted); font-size: var(--text-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.lit-folder { padding-right: 4px; min-height: var(--tap-dense); }
.lit-folder-name { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lit-folder-actions { display: flex; flex: 0 0 auto; opacity: 0; transition: opacity .12s; }
.lit-folder:hover .lit-folder-actions, .lit-folder:focus-within .lit-folder-actions { opacity: 1; }
.lit-folder .icon-button { color: inherit; }
.lit-folder .icon-button svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lit-side-foot { margin: 14px 7px 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.lit-side-foot select { min-height: 32px; font-family: var(--mono); font-size: 11.5px; }

/* ── toolbar ──────────────────────────────────────────────────────────────── */

.lit-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.lit-heading { flex: 1 1 auto; margin: 0 8px 0 0; font: 400 25px/1.2 var(--serif); letter-spacing: -.015em; }
.lit-search { display: flex; flex: 1 1 220px; align-items: center; gap: 8px; max-width: 340px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-raised); color: var(--muted); }
.lit-search:focus-within { border-color: var(--blue); }
.lit-search svg { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lit-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: var(--text-body); outline: none; }
.lit-search input::placeholder { color: var(--muted-line); }
.lit-sort select { min-height: 36px; padding: 0 28px 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-raised); color: var(--ink); font-size: var(--text-body); cursor: pointer; }
.lit-sort select:focus { border-color: var(--blue); outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── entries — set like a bibliography: serif title, authors, italic venue ─ */

.lit-entries { display: grid; gap: 8px; }
.lit-empty { margin: 0; padding: 46px 0; color: var(--muted); text-align: center; font: 400 17px/1.4 var(--serif); }

.lit-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-raised);
  transition: border-color .12s, box-shadow .12s;
}
.lit-entry:hover { box-shadow: 0 9px 28px rgba(34, 31, 25, .045); }
.lit-entry.is-open { border-color: var(--ink); }
.lit-entry-check { display: flex; align-items: flex-start; padding: 17px 0 0 14px; }
.lit-entry-check input { accent-color: var(--ink); }
.lit-entry-head { display: grid; gap: 4px; min-width: 0; padding: 13px 14px 14px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.lit-entry-title { font: 400 18px/1.25 var(--serif); letter-spacing: -.01em; }
.lit-entry-authors { color: var(--ink); font-size: var(--text-reading); }
.lit-entry-source { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: var(--text-body); }
.lit-entry-source i { font-style: italic; }
.lit-type { padding: 2px 7px 1px; border-radius: 999px; background: rgba(23, 23, 19, .07); color: var(--ink); font-size: var(--text-meta); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lit-entry-folder { padding: 2px 7px 1px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--text-meta); letter-spacing: .04em; text-transform: uppercase; }
.lit-entry-note { margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); font: italic 400 13px/1.4 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lit-entry-tools { display: flex; align-items: flex-start; gap: 2px; padding: 10px 10px 0 0; color: var(--muted); opacity: 0; transition: opacity .12s; }
.lit-entry:hover .lit-entry-tools, .lit-entry:focus-within .lit-entry-tools, .lit-entry.is-open .lit-entry-tools { opacity: 1; }
.lit-entry-tools .icon-button { color: inherit; text-decoration: none; }
.lit-entry-tools .icon-button:hover { color: var(--ink); }
.lit-entry-tools svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* the opened entry — BibTeX beside the note, the record above them stays */
.lit-entry-editor { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px 18px; padding: 14px; border-top: 1px solid var(--line); background: var(--paper); }
@media (max-width: 900px) { .lit-entry-editor { grid-template-columns: 1fr; } }
.lit-field-bibtex textarea { min-height: 190px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.lit-field-note textarea { min-height: 190px; font: 400 14px/1.5 var(--serif); }
.lit-entry-actions { grid-column: 1 / -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.lit-folder-pick { min-width: 220px; }

/* ── add dialog ───────────────────────────────────────────────────────────── */

.lit-add-dialog { width: min(var(--dialog-md), calc(100% - 24px)); }
.lit-add-dialog .editor-form { display: grid; gap: 14px; padding-bottom: 30px; }
.lit-add-dialog .editor-form .dialog-head { margin-bottom: 0; }
.lit-add-dialog .editor-form .dialog-body { margin: 0; }
.lit-add-project { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.lit-add-or { grid-column: 1 / -1; color: var(--muted); font-size: var(--text-reading); }
.lit-add-dialog textarea[data-add-source] { font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre; }
