:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e2e2dd;
  --accent: #1c1c1a;
  --accent-text: #ffffff;
  --ok: #1f7a4a;
  --ok-bg: #e7f4ec;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211;
    --surface: #1b1b19;
    --text: #efefeb;
    --muted: #9a9a93;
    --line: #2d2d2a;
    --accent: #efefeb;
    --accent-text: #121211;
    --ok: #6fcf97;
    --ok-bg: #173325;
    --danger: #ff8a80;
    --danger-bg: #3a1c1a;
  }
}
:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1b1b19;
  --text: #efefeb;
  --muted: #9a9a93;
  --line: #2d2d2a;
  --accent: #efefeb;
  --accent-text: #121211;
  --ok: #6fcf97;
  --ok-bg: #173325;
  --danger: #ff8a80;
  --danger-bg: #3a1c1a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
h1 { font-size: 1.75rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 0.25rem 0; }
code { font-size: 0.85em; word-break: break-all; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
  flex-wrap: wrap; gap: 0.5rem;
}
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.brand span { font-weight: 400; color: var(--muted); }
nav { display: flex; gap: 1rem; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
nav a:hover { color: var(--text); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.back { color: var(--muted); text-decoration: none; font-size: 0.95rem; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; overflow: hidden; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--muted); }
.card img, .ph {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  background: var(--line);
}
.ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700; color: var(--muted);
}
.ph.big { aspect-ratio: 1 / 1; font-size: 5rem; border-radius: var(--radius); }
.card .body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.cat { font-size: 0.8rem; color: var(--muted); text-transform: none; }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 0.5rem; }

.badge {
  font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }

.detail {
  display: grid; gap: 2rem; grid-template-columns: 1fr;
}
@media (min-width: 760px) { .detail { grid-template-columns: 1fr 1fr; } }
.price { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0 0.75rem; }
.desc { white-space: pre-line; color: var(--muted); margin: 1.25rem 0; }

button, .btn {
  font: inherit; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  padding: 0.6rem 1.1rem; font-weight: 600;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.danger { background: var(--danger-bg); color: var(--danger); }
button.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.form { display: grid; gap: 0.9rem; max-width: 560px; }
.form label { display: grid; gap: 0.35rem; font-size: 0.92rem; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 0.5rem; }
.form label.check input { width: auto; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; width: 100%;
}
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.25rem;
}
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
td a { color: var(--text); }
.table-wrap { overflow-x: auto; }
