:root {
  /* тёмно-зелёная тема */
  --bg: #0c1f17; --surface: #13291f; --surface-2: #1a3528; --text: #e7f0ea; --muted: #8fa99a; --line: #24412f;
  --accent: #3fb27f; --accent-text: #06140d; --good: #6fd69b; --warn: #e2b54f; --bad: #ef7d6d;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 18px rgba(0,0,0,.18);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }
h1 { font-size: 26px; line-height: 1.25; margin: 8px 0 12px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 10px; }

.top { background: rgba(12,31,23,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { display: flex; gap: 8px; align-items: center; }
main { padding: 24px 16px 40px; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 32px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }

.flash { background: var(--surface); border-left: 4px solid var(--good); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; box-shadow: var(--shadow); }
.flash.warn { border-left-color: var(--warn); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 999px; font: inherit;
  font-size: 14px; text-decoration: none; cursor: pointer; color: var(--text); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.summary { margin: 8px 0 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none;
  overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card.done { opacity: .6; }
.thumb { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumb > span:first-child { font-size: 56px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card .title { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.price { font-weight: 700; font-size: 17px; }
.prio { position: absolute; left: 8px; top: 8px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.65); color: #fff; }
.detail .prio { position: static; }
.prio.p1 { background: var(--accent); color: var(--accent-text); }
.badge.lock { position: absolute; right: 8px; top: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.tag.good { color: var(--good); border-color: currentColor; }
.tag.warn { color: var(--warn); border-color: currentColor; }
.tag.bad { color: var(--bad); border-color: currentColor; }
.good-text { color: var(--good); } .bad-text { color: var(--bad); }
.empty { text-align: center; padding: 60px 0; }

.detail { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; margin-bottom: 20px; }
.detail-img { background: var(--surface-2); border-radius: var(--radius); aspect-ratio: 1/1; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.detail-img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.detail-img span { font-size: 90px; }
.bigprice { font-size: 32px; font-weight: 800; }
.note { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; align-items: center; }
.actions.owner { padding-top: 12px; border-top: 1px dashed var(--line); }
.reserve { display: flex; gap: 8px; flex-wrap: wrap; }
.reserve input { min-width: 0; flex: 1 1 160px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; box-shadow: var(--shadow); }
.chart { width: 100%; height: auto; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--accent); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 4 4; }
.chart .lbl { fill: var(--muted); font-size: 14px; }
.foot { margin-top: 24px; }

.alts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.alt { display: flex; gap: 12px; text-decoration: none; padding: 8px; border-radius: 10px; border: 1px solid var(--line); align-items: center; }
.alt:hover { border-color: var(--muted); }
.alt img, .alt .noimg { width: 64px; height: 64px; object-fit: contain; background: var(--surface-2); border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 30px; }
.alt .title { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alt .price { font-size: 15px; display: flex; gap: 8px; align-items: baseline; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form.narrow { max-width: 380px; margin: 40px auto; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; }
.row-input { display: flex; gap: 8px; flex-wrap: wrap; }
.row-input input { flex: 1 1 240px; }

@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; gap: 16px; }
  .detail-img { max-height: 360px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  h1 { font-size: 22px; }
  .bigprice { font-size: 26px; }
  .top .btn { padding: 6px 10px; font-size: 14px; }
}

.pic-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; align-items: start; }
.pic-preview { width: 140px; height: 140px; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 48px; }
.pic-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pic-fields { display: flex; flex-direction: column; gap: 10px; }
input[type=file] { padding: 7px; }
@media (max-width: 520px) { .pic-row { grid-template-columns: 1fr; } }
