:root {
  --ink: #17211d;
  --paper: #f4f3ed;
  --panel: #fffefa;
  --line: #d9ddd6;
  --accent: #c8f04a;
  --muted: #64716b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: grid; place-items: center; background: var(--accent); border: 2px solid var(--ink); border-radius: 12px; width: 42px; height: 42px; font-weight: 900; }
small { display: block; color: var(--muted); font-size: .75rem; }
.refresh { margin-left: auto; }
main { max-width: 1100px; margin: auto; padding: 22px 18px 110px; }
h1 { font-size: 1.8rem; letter-spacing: -.04em; }
h2 { font-size: 1rem; margin: 4px 0; overflow-wrap: anywhere; }
h3 { margin: 8px 0; font-size: 1rem; }
.entries { padding-left: 26px; display: grid; gap: 12px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.entry::marker { font-weight: 800; }
.entry:target { outline: 3px solid #27667b; }
.model-link { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.entry .model-link { grid-column: 1; grid-row: 1 / 3; }
.model-link > span:last-child { min-width: 0; }
.model-link h2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thumbnail { display: grid; place-items: center; flex-shrink: 0; width: 64px; height: 64px; background: #dce8df; border-radius: 12px; font-size: 2rem; overflow: hidden; }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.complete-form, .remove-form { grid-column: 2; margin: 0; }
.complete-form { grid-row: 1; }
.remove-form { grid-row: 2; }
.complete-form button, .remove-form button { width: 100%; padding: 10px 3px; }
.input-row { display: flex; gap: 8px; }
input { min-width: 0; width: 100%; border: 1px solid #9ba89e; border-radius: 12px; padding: 12px; font: inherit; }
label { display: block; margin-bottom: 8px; font-weight: 700; }
button, .button { display: inline-grid; place-items: center; min-height: 44px; border: 1px solid var(--ink); border-radius: 12px; padding: 10px 14px; background: var(--accent); color: var(--ink); font: 700 .85rem system-ui; cursor: pointer; text-decoration: none; flex-shrink: 0; }
button:disabled { opacity: .55; cursor: default; }
.secondary { background: white; }
.danger { color: #a83f32; background: #fff5f2; border-color: #c29d94; }
.login { max-width: 400px; padding-top: 15vh; }
.login button { width: 100%; margin-top: 14px; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--panel); border-top: 1px solid var(--line); z-index: 5; }
nav a { flex: 1; text-align: center; padding: 10px; color: var(--muted); text-decoration: none; font-size: 1.1rem; }
nav span { display: block; font-size: .75rem; font-weight: 700; }
nav a[aria-current] { background: #f1f6dd; color: var(--ink); }
:focus-visible { outline: 3px solid #27667b; outline-offset: 3px; }
.empty { list-style: none; color: var(--muted); }
#status:not(:empty) { position: fixed; bottom: 86px; left: 16px; right: 16px; padding: 12px; background: #20302a; color: white; border-radius: 12px; z-index: 6; }
.drag-handle { grid-column: 2; grid-row: 1 / 3; touch-action: none; width: 48px; height: 64px; background: #e8ede3; }
.reordering .model-link { pointer-events: none; }
.reordering .remove-form, .reordering .complete-form, .reordering .next-print { display: none; }
.next-print { color: var(--ink); font-weight: 700; }
.reordering .entry { touch-action: pan-y; }
.dragging { opacity: .6; }
.reorder-tools { display: flex; gap: 8px; align-items: center; }
.reorder-tools p { margin: 0; color: var(--muted); font-size: .8rem; }
.history-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: start; }
.history-actions summary { cursor: pointer; padding: 10px; min-height: 44px; color: #a83f32; }
#search-results { display: grid; gap: 16px; margin: 24px 0; }
.source-group { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 16px; }
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.result { min-width: 0; background: #f3f5ed; padding: 10px; border-radius: 12px; }
.result .model-link { display: block; }
.result img { display: block; width: 100%; height: 110px; object-fit: cover; border-radius: 8px; background: #dce8df; }
.result h3 { overflow-wrap: anywhere; }
.result button { width: 100%; margin-top: 10px; }
.show-more { margin-top: 14px; }
@media (min-width: 900px) {
  main { padding-left: 160px; }
  .login { padding-left: 18px; }
  nav { top: 75px; bottom: 0; right: auto; width: 126px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); }
  nav a { flex: none; padding: 16px; }
  #search-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .results { grid-template-columns: 1fr; }
}
@media (max-width: 359px) {
  .thumbnail { width: 48px; height: 48px; }
  .entry { gap: 6px; padding: 8px; }
  .input-row { flex-direction: column; }
}
