/* ozis — mobile-first (iPhone Safari 390px). */
:root {
  --green: #16a34a;
  --green-d: #15803d;
  --ink: #111827;
  --muted: #6b7280;
  --bg: #f3f5f0;
  --line: #e2e5dd;
  --card: #ffffff;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

/* ---------- topbar (sticky) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  background: var(--green-d);
  color: #fff;
  min-height: 56px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.topbar .crumbs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 8px 4px 8px 12px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.topbar .crumbs::-webkit-scrollbar { display: none; }
.crumb { color: #d9f2e1; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.crumb a { color: #fff; text-decoration: none; font-weight: 600; }
.crumb + .crumb::before { content: "›"; margin: 0 3px; color: #a8d9b6; }
.crumb.here { color: #fff; font-weight: 600; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; }
.top-btn {
  width: 52px;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.top-btn:active { background: rgba(255,255,255,.16); }
.top-btn.is-saving { animation: pop .5s ease; }
@keyframes pop { 0%{transform:scale(1)} 35%{transform:scale(1.5) rotate(-8deg)} 100%{transform:scale(1)} }
.check-flash {
  position: absolute; inset: 0; display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:34px; opacity:0; pointer-events:none;
}
.top-btn.flash .check-flash { animation: flash .8s ease; }
@keyframes flash { 0%{opacity:0} 20%{opacity:1} 100%{opacity:0} }

/* ---------- layout ---------- */
main { padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.page-title { font-size: 21px; font-weight: 700; margin: 4px 2px 10px; word-break: break-word; }
.sub { color: var(--muted); font-size: 14px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 14px;
  margin: 10px 0;
}
.card h2 { font-size: 15px; margin: 0 0 8px; color: var(--green-d); text-transform: uppercase; letter-spacing: .02em; }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: inherit; }
.input, .textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #c9cec3;
  border-radius: 12px;
  background: #fff;
  min-height: 48px;
  -webkit-appearance: none;
}
.textarea { resize: none; overflow: hidden; line-height: 1.4; }
.field { margin: 8px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--green); color: #fff; width: 100%; }
.btn-primary:active { background: var(--green-d); }
.btn-ghost { background: #fff; border-color: #c9cec3; color: var(--ink); }
.btn-danger { background: #fff; border-color: #f2c6c6; color: var(--danger); }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; margin: 10px 0; }
.btn-row .btn { flex: 1 1 0; }
.btn-block { width: 100%; margin-top: 8px; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box .logo { font-size: 30px; margin-bottom: 6px; }
.login-box h1 { font-size: 22px; margin: 8px 0 2px; }
.login-box .hint { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* ---------- объекты / списки ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list a, .list .row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.list a:active { background: #eef2ea; }
.list .idx { color: var(--green-d); font-weight: 700; min-width: 34px; }
.list .cnt { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.list .em { color: var(--muted); font-size: 13px; }

/* ---------- поиск / автокомплит ---------- */
.searchwrap { position: relative; }
.dropdown {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 30;
  max-height: 320px;
  overflow: auto;
}
.dropdown .opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f2ec;
  font-size: 15px;
  cursor: pointer;
  min-height: 48px;
}
.dropdown .opt:active { background: #eaf4e8; }
.dropdown .opt .num { color: var(--green-d); font-weight: 700; }
.dropdown .opt .qty { color: var(--muted); font-size: 12px; }
.dropdown .empty { padding: 12px 14px; color: var(--muted); }

/* ---------- блоки ---------- */
.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
}
.block .meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; gap:8px; }
.block .author { font-weight: 600; color: #374151; }
.block .ok-flag { color: var(--green); font-weight: 700; }
.photo {
  width: 100%;
  aspect-ratio: 1/1;
  background: #eceeee;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #b9c0b4;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.block .thumb-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.block .thumb { flex: 0 0 96px; height: 96px; border-radius: 10px; overflow: hidden; background:#eceeee; }
.block .thumb img { width: 100%; height: 100%; object-fit: cover; }
.block .actions { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.block .actions .btn { flex: 1 1 30%; padding: 8px 6px; font-size: 14px; min-height: 44px; }
.geo-line { font-size: 14px; color: #1d4ed8; background:#eef4ff; padding: 8px 10px; border-radius: 10px; margin: 8px 0; word-break: break-all; }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 8px 0; }
.note-area { margin-top: 6px; }
.note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }
.composer { border: 2px dashed var(--green); border-radius: 14px; }
.composer + .composer { margin-top: 12px; }

.big-plus {
  width: 100%;
  min-height: 56px;
  margin: 6px 0 16px;
  border: 2px dashed #9fd3ae;
  border-radius: 14px;
  background: #f0faf2;
  color: var(--green-d);
  font-size: 26px;
  cursor: pointer;
}
.big-plus:active { background: #dff3e4; }

/* ---------- меню ---------- */
.menupanel {
  position: fixed;
  top: 56px; left: 0; right: 0; bottom: 0;
  background: rgba(20, 24, 17, .35);
  z-index: 45;
  display: none;
}
.menupanel.open { display: block; }
.menupanel .sheet {
  background: #fff;
  border-radius: 0 0 16px 16px;
  padding: 8px 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.menupanel .item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border: 0;
  background: none;
  font-size: 17px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  padding: 8px 6px;
}
.menupanel .item .ic { font-size: 22px; }
.menupanel .sub { font-size: 12px; color: var(--muted); }
.menupanel .close { float: right; border:0; background:none; font-size:26px; color: var(--muted); min-height:44px; min-width:44px; }

/* ---------- модалка ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.modal-mask.center { align-items: center; }
.modal {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow: auto;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
}
.modal.center { border-radius: 18px; margin: 20px; max-height: 84vh; }
.modal h3 { margin: 4px 0 10px; font-size: 18px; }
.modal-close { float: right; font-size: 26px; color: var(--muted); background:none; border:0; min-height:44px; min-width:44px; }

/* полноэкранный просмотр фото — нативный зум */
.photoview {
  position: fixed; inset: 0; z-index: 60;
  background: #000;
  display: none;
  align-items: center; justify-content: center;
}
.photoview.open { display: flex; }
.photoview img { max-width: 100%; max-height: 100%; }
.photoview .pv-close {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); right: 8px;
  background: rgba(255,255,255,.85); border: 0; border-radius: 50%;
  width: 46px; height: 46px; font-size: 22px; color:#000;
}

/* ---------- прочее ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 24px;
  font-size: 14px; z-index: 70; display: none; max-width: 88vw; text-align:center;
}
.toast.show { display: block; animation: toast 2.6s ease forwards; }
@keyframes toast { 0%{opacity:0} 10%{opacity:1} 85%{opacity:1} 100%{opacity:0} }
.muted { color: var(--muted); }
.center-txt { text-align:center; }
.plan-img { width:100%; height:auto; display:block; border-radius: 6px; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.hidden { display:none !important; }
.spin { display:inline-block; width:18px; height:18px; border:2px solid rgba(0,0,0,.25); border-top-color: var(--green); border-radius:50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
