:root {
  --bg: #f6f3ee; --panel: #ffffff; --ink: #1f1b16; --muted: #6f665b;
  --line: #e4ddd2; --accent: #8a5a2b; --accent-ink: #ffffff; --chip: #efe7da;
  --ok: #2f6b3a; --warn: #8a4b12;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16130f; --panel: #201c17; --ink: #efe8de; --muted: #a39887;
    --line: #342d25; --accent: #d39a5c; --accent-ink: #1a140d; --chip: #2c261f;
    --ok: #8fd19e; --warn: #f0b072; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.muted { color: var(--muted); font-weight: 400; font-size: .85em; }
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; margin: 0; white-space: nowrap; }
#q { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit; }
.menu { display: none; border: 0; background: none; color: var(--ink); font-size: 20px; cursor: pointer; }
.layout { display: grid; grid-template-columns: 230px 1fr; }
.cats { position: sticky; top: 53px; align-self: start; height: calc(100vh - 53px); overflow-y: auto;
  padding: 12px 8px; border-right: 1px solid var(--line); }
.cats button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px;
  border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cats button:hover { background: var(--chip); }
.cats button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
main { padding: 14px 16px 40px; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink); font: inherit; }
.note { background: var(--chip); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--chip); }
.card .body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { font-size: 14px; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.meta { font-size: 12px; color: var(--muted); }
.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--chip); }
.badge.ok { color: var(--ok); } .badge.nc { color: var(--warn); }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.actions a { flex: 1; text-align: center; padding: 6px; border-radius: 6px; font-size: 13px;
  text-decoration: none; border: 1px solid var(--line); color: var(--ink); }
.actions a.dl { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.more { text-align: center; padding: 20px; color: var(--muted); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.foot { margin-top: 24px; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .menu { display: block; }
  .top h1 .muted { display: none; }
  .cats { display: none; position: fixed; top: 53px; left: 0; right: 0; z-index: 4;
    background: var(--panel); height: auto; max-height: 70vh; border-bottom: 1px solid var(--line); }
  .cats.open { display: block; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
