:root {
  --cal: #F3EFEC; --paper: #FBF9F7; --line: #E3DBD5; --ink: #2B201E; --muted: #7A6A65;
  --tez: #3B2A28; --brass: #A8834F; --ok: #4F7A5A; --warn: #B07A2A; --bad: #A2493E;
  --r: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cal); color: var(--ink);
  font: 16px/1.45 "Albert Sans", system-ui, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: Marcellus, Georgia, serif; font-weight: 400; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* Верх */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--tez); color: #F3EFEC;
}
.top img { width: 34px; height: auto; filter: brightness(0) invert(1); opacity: .9; }
.top h1 { font-size: 20px; flex: 1; }
.top .ghost { color: #F3EFEC; border-color: rgba(243,239,236,.3); }

.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.head h2 { font-size: 26px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* Нижнее меню */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; background: none; padding: 10px 4px 12px; font-size: 13px; color: var(--muted);
  display: grid; justify-items: center; gap: 3px; cursor: pointer;
}
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-current="page"] { color: var(--tez); font-weight: 600; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: 58px; bottom: auto; max-width: 760px; margin: 16px auto 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
  .tabs button { grid-auto-flow: column; gap: 8px; align-items: center; justify-content: center; font-size: 15px; padding: 12px; }
}

/* Кнопки */
.btn, .ghost, .danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap;
}
.btn { background: var(--tez); color: #F3EFEC; }
.btn:disabled { opacity: .5; cursor: wait; }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.danger { background: transparent; border-color: #E2C3BD; color: var(--bad); }
.btn-wide { width: 100%; }

/* Карточки объявлений */
.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 14px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--tez); border-color: var(--tez); color: #F3EFEC; }
.list { display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; padding: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-align: left; width: 100%;
}
.card img, .card .noimg { width: 92px; height: 92px; border-radius: 10px; object-fit: cover; background: var(--line); display: block; }
.card .noimg { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.card b { display: block; font-weight: 500; line-height: 1.3; }
.card small { color: var(--muted); display: block; margin-top: 3px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; margin-top: 6px; background: var(--line); }
.badge.active { background: #DCE8DE; color: var(--ok); }
.badge.reserved { background: #F1E3CC; color: var(--warn); }
.badge.sold { background: #EAD9D6; color: var(--bad); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* Формы */
.section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 16px; margin-bottom: 14px; }
.section h3 { font-size: 19px; margin-bottom: 2px; }
.section > .hint { margin-bottom: 14px; }
.field { display: grid; gap: 6px; margin-top: 14px; }
.field:first-of-type { margin-top: 0; }
.section > .hint + .field { margin-top: 0; }
.field > span { font-size: 14px; font-weight: 500; }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 200px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row .field, .row3 .field { margin-top: 14px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg label { position: relative; text-align: center; padding: 12px 4px; font-size: 14px; cursor: pointer; border-left: 1px solid var(--line); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--tez); color: #F3EFEC; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: -2px; }
.check { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--tez); }

/* Фото */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ph { position: relative; border-radius: 10px; overflow: hidden; background: var(--line); }
.ph img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.ph .cover { position: absolute; left: 6px; top: 6px; background: var(--tez); color: #F3EFEC; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.ph .tools { display: flex; justify-content: space-between; padding: 4px; background: var(--paper); }
.ph .tools button { border: 0; background: none; width: 38px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 17px; }
.ph .tools button:hover { background: var(--cal); }
.ph .tools button:disabled { opacity: .25; cursor: default; }
.ph input { border: 0; border-top: 1px solid var(--line); border-radius: 0; min-height: 40px; font-size: 14px; }
.ph.pending img { opacity: .5; }
.add {
  display: grid; place-items: center; gap: 4px; aspect-ratio: 4/3; border: 1.5px dashed #CBBFB7; border-radius: 10px;
  color: var(--muted); cursor: pointer; text-align: center; font-size: 14px; background: #fff;
}
.add input { display: none; }
.add b { font-size: 28px; font-weight: 400; line-height: 1; }
.single { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; }
.single img { width: 120px; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; background: var(--line); }

/* Нижняя панель сохранения */
.savebar {
  position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 10px; flex-wrap: wrap;
  padding: 12px; margin: 18px -4px 0; background: rgba(243,239,236,.94); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r);
}
.savebar .btn { flex: 1; }
@media (min-width: 900px) { .savebar { bottom: 12px; } }
.dirty-note { width: 100%; font-size: 13px; color: var(--warn); margin: 0; }

/* Вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--tez); margin-bottom: calc(-76px - env(safe-area-inset-bottom)); }
.login form { width: 100%; max-width: 380px; background: var(--paper); border-radius: 20px; padding: 28px 22px; }
.login img { display: block; width: 64px; margin: 0 auto 10px; }
.login h1 { text-align: center; font-size: 26px; }
.login p { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.login .btn { margin-top: 20px; }
.err { color: var(--bad); font-size: 14px; margin: 12px 0 0; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 20;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
.back { border: 0; background: none; padding: 6px 0; color: var(--muted); cursor: pointer; font-size: 15px; margin-bottom: 8px; }
.spin { padding: 60px 0; text-align: center; color: var(--muted); }
