:root { color-scheme: dark; --bg: #0f0e0c; --panel: #1b1916; --field: #26231f; --text: #f7f2e9; --muted: #bdb5a7; --line: rgba(255,255,255,.16); --accent: #e8c98f; --on-accent: #1b1409; --ok: #7fd19b; --warn: #e8c98f; --bad: #ff9c8f; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, sans-serif; }
h1, h2, p { margin: 0; }
a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
button { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 12px; background: transparent; cursor: pointer; }
button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 700; }
button.danger { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: .55; cursor: default; }
:is(a, button, input, textarea, summary):focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
label { display: block; margin: 14px 0 6px; font-size: .9rem; font-weight: 600; }
input:not([type=checkbox]), textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
textarea { resize: vertical; }
.muted, .hint { color: var(--muted); }
.hint { margin-top: 5px; font-size: .84rem; overflow-wrap: anywhere; }
.hint:empty { display: none; }
.error { margin-top: 12px; color: var(--bad); font-size: .92rem; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; }
.check input { width: 20px; height: 20px; }

.login { width: min(100%, 440px); margin: 0 auto; padding: 48px 16px; }
.login h1 { font-size: 1.7rem; margin-bottom: 6px; }
.login form { margin: 12px 0 24px; }
.login button { width: 100%; margin-top: 12px; }
.login details { color: var(--muted); font-size: .92rem; }
.login summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--text); }
.login ol { padding-left: 20px; }

.app { width: min(100%, 1040px); margin: 0 auto; padding: 16px 16px 48px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.topbar h1 { font-size: 1.5rem; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 16px 0 24px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); }
.status[data-state=ok] .dot { background: var(--ok); }
.status[data-state=busy] .dot { background: var(--warn); }
.status[data-state=bad] .dot { background: var(--bad); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar h2 { font-size: 1.1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 155px), 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.card img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: var(--field); }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 12px; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; overflow-wrap: anywhere; }
.card-price { flex: none; color: var(--accent); }
.card-desc { flex: 1; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.card button { width: 100%; margin-top: 8px; }
.empty { grid-column: 1 / -1; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }

dialog { width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); padding: 20px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h2 { font-size: 1.25rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.actions .primary { flex: 1 1 100%; order: -1; }
.spacer { flex: 1; }
