:root {
    --bg: #f6f7f8;
    --card: #fff;
    --text: #1b1f23;
    --muted: #6b7280;
    --line: #e2e5e9;
    --accent: #1f6f8b;
    --ok: #16a34a;
    --warn: #d97706;
    --bad: #dc2626;
    --radius: 10px;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #111417; --card: #1b1f24; --text: #e6e8eb; --muted: #9aa3ad; --line: #2b313a; --accent: #4fb3d9; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
main { max-width: 760px; margin: 0 auto; padding: 12px 12px 80px; }
header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--accent); color: #fff; }
header.top a { color: #fff; }
header.top .brand { font-weight: 700; font-size: 18px; }
header.top nav a { font-size: 22px; margin-left: 14px; }
h1 { font-size: 20px; margin: 8px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.flash { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 10px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* formuláře */
input, select, textarea, button { font: inherit; }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=email], input[type=date], input[type=url], select, textarea {
    width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
}
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
button, .btn { padding: 12px 16px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; cursor: pointer; }
button.secondary, .btn.secondary { background: var(--line); color: var(--text); }
button.danger { background: var(--bad); }

/* hledání */
.search { position: sticky; top: 52px; z-index: 4; background: var(--bg); padding: 6px 0 8px; }
.search input { font-size: 18px; }
.filters { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* výsledky */
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 4px; }
.item-head .name { font-weight: 600; font-size: 17px; }
.item-head .attrs { font-size: 13px; color: var(--muted); }
.stock { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.stock .where { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock .qty { font-weight: 700; min-width: 64px; text-align: right; }
.stock .qty.empty { color: var(--bad); }
.stock .qty.low { color: var(--warn); }
.stock .actions { display: flex; gap: 6px; }
.stock .actions button { width: 44px; height: 44px; padding: 0; font-size: 20px; border-radius: 10px; }
.stock .actions button.out { width: auto; padding: 0 10px; font-size: 14px; background: var(--bad); }
.stock.consumed { opacity: .55; }
.htmx-request .stock .actions button { opacity: .5; }

/* seznamy */
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.tree ul { list-style: none; padding-left: 18px; }
.movement { display: flex; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.movement .when { color: var(--muted); min-width: 92px; }
.movement .delta { font-weight: 600; min-width: 48px; text-align: right; }
.fab { position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
details summary { cursor: pointer; color: var(--accent); margin: 6px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }

/* fotky */
.item-head .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; margin-right: 10px; flex: none; }
.item-head { align-items: center; }
.item-head .name { flex: 1; }
.photo-preview { max-width: 100%; max-height: 240px; border-radius: var(--radius); }
.item-detail { display: flex; gap: 12px; align-items: flex-start; }
.photo-detail { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius); flex: none; }
.photo-box { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.photo-box input[type=file] { width: 100%; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
