:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d1d1f; --muted: #667085; --line: #e4e7ec;
  --accent: #0b57d0; --accent-ink: #fff; --ok: #0a7d33; --warn: #b54708; --err: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --card: #1a1e24; --text: #e6e8eb; --muted: #98a2b3; --line: #2c323b;
          --accent: #7aa7ff; --accent-ink: #0b1220; --ok: #4ade80; --warn: #fbbf24; --err: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .in { max-width: 1200px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 14px;
                 align-items: center; flex-wrap: wrap; }
header.top .brand { font-weight: 700; color: var(--text); margin-right: 8px; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--text); }
header.top nav a.on { background: var(--bg); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.flash { background: #e8f1ff; color: #0b3a8c; border: 1px solid #b6cdfb; padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.warn { background: #fff4e5; color: #7a3e00; border: 1px solid #f5c98b; padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) {
  .flash { background: #13233f; color: #c7dafc; border-color: #2a4778; }
  .warn { background: #3a2a10; color: #fcd9a0; border-color: #6b4a14; }
}
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--bg);
       border: 1px solid var(--line); margin: 1px 2px 1px 0; white-space: nowrap; }
.tag.ok { color: var(--ok); } .tag.err { color: var(--err); } .tag.warn { color: var(--warn); }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; font-size: 13px; }
.items { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.item img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; background: var(--bg); }
.item .body { min-width: 0; flex: 1; }
.item .title { font-weight: 600; word-break: break-word; }
.item .price { font-weight: 700; white-space: nowrap; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 160px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 3px; }
input, select, textarea, button { font: inherit; color: var(--text); background: var(--card);
       border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; }
textarea { min-height: 90px; }
input[type=checkbox] { width: auto; display: inline; margin-right: 6px; }
label.check { color: var(--text); display: flex; align-items: center; }
button, .btn { cursor: pointer; background: var(--accent); color: var(--accent-ink); border: 0; padding: 8px 14px;
               border-radius: 7px; display: inline-block; font-weight: 500; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.danger { background: var(--err); color: #fff; }
button.small, .btn.small { padding: 4px 9px; font-size: 13px; }
form.inline { display: inline; }
.bar { height: 10px; background: var(--accent); border-radius: 3px; opacity: .75; }
.tree ul { list-style: none; padding-left: 16px; margin: 4px 0; }
.tree > ul { padding-left: 0; }
pre.log { font-size: 12px; overflow-x: auto; max-height: 360px; background: var(--bg); padding: 8px; border-radius: 6px; }
details > summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.htmx-indicator { display: none; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
@media (max-width: 640px) {
  main { padding: 12px; }
  .item img { width: 76px; height: 60px; }
  table.t.stack thead { display: none; }
  table.t.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.t.stack td { display: block; border: 0; padding: 2px 4px; }
}
