:root {
  --green: #002212;
  --green-2: #0f3322;
  --gold: #ce9a43;
  --bg: #f5f2ea;
  --card: #ffffff;
  --line: #e5dfd2;
  --soft: #efebe2;
  --text: #002212;
  --muted: #4f5b55;
  --ok-bg: #e3eee7;
  --ok: #1c4a31;
  --warn-bg: #fbe9dc;
  --warn: #7a3410;
  --danger: #a12a1a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Montserrat, system-ui, sans-serif; font-size: 15px; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }
.loading { padding: 40px 20px; color: var(--muted); }

/* Шапка */
.top { background: var(--green); color: #fff; padding: calc(env(safe-area-inset-top) + 20px) 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-size: 11px; font-weight: 600; letter-spacing: 2px; color: var(--gold); }
.top h1 { margin: 2px 0 0; font-family: "Playfair Display", serif; font-size: 26px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; min-height: 44px; background: none; border: 0; padding: 0; cursor: pointer; }
.round { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--gold); color: var(--green); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }

.search { display: flex; align-items: center; gap: 10px; background: var(--green-2); border-radius: 12px; padding: 0 14px; height: 44px; }
.search input { flex: 1; border: 0; background: transparent; color: #fff; outline: none; min-width: 0; }
.search input::placeholder { color: #a9b9b0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid #3a5a49; background: transparent; color: #e6ece8; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--green); font-weight: 600; }

/* Список */
.list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.alert { display: flex; align-items: center; gap: 10px; background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 600; }
.obj { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.thumb { width: 84px; height: 84px; border-radius: 12px; background: #d9d2c3; flex-shrink: 0; display: grid; place-items: center; color: #5e584c; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.obj-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.obj-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.obj-addr { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 8px; background: var(--soft); color: #3d4743; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; line-height: 1.6; }

/* Форма */
.form { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.section h2 { margin: 0; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid #c9c1b0; border-radius: 10px; padding: 10px 12px; background: #fff; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid #c9c1b0; background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; padding: 0 6px; }
.seg button.on { background: var(--green); border-color: var(--green); color: #fff; }

.btn { min-height: 52px; border-radius: 14px; border: 0; font-weight: 700; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; }
.btn.main { background: var(--gold); color: var(--green); }
.btn.dark { background: var(--green); color: #fff; }
.btn.line { background: #fff; border: 1px solid #c9c1b0; color: var(--green); }
.btn.danger { background: transparent; color: var(--danger); }
.btn:disabled { opacity: .6; }

/* Картка */
.hero { height: 220px; background: #d9d2c3; display: grid; place-items: center; color: #5e584c; }
.card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0; font-family: "Playfair Display", serif; font-size: 24px; }
.price { font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.pre { white-space: pre-wrap; line-height: 1.55; font-size: 14px; margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: #e2dccf; overflow: hidden; }
.bar div { height: 100%; background: var(--gold); }
.small-btn { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #c9c1b0; background: #fff; color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Вхід */
.login { min-height: 100vh; background: var(--green); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; gap: 18px; }
.login h1 { margin: 0; font-family: "Playfair Display", serif; font-size: 30px; }
.login input { height: 52px; border-radius: 12px; border: 0; padding: 0 16px; background: var(--green-2); color: #fff; outline: none; }
.err { color: #ffb4a8; font-size: 14px; min-height: 20px; }

/* Нижнє меню */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px); z-index: 5; }
.nav a { min-width: 88px; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: #5e6964; font-weight: 500; }
.nav a.on { color: var(--green); font-weight: 700; }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--green); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; max-width: 90vw; }
#toast.show { opacity: 1; }
