:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --grey: #9ca3af;
  --need-bg: #fff7ed;
  --need-line: #fed7aa;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 32px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 2px; }
header.top h1 { font-size: 22px; margin: 0; }
.status { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status.ok { color: var(--green); }
.status.bad { color: var(--red); }
.totals { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.status-detail { color: var(--red); font-size: 13px; margin: -10px 0 14px; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.list { background: var(--card); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.list.need { background: var(--need-bg); border-color: var(--need-line); }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.list.need .row { border-color: var(--need-line); }
.row:first-child { border-top: 0; }
.row:active { background: rgba(0, 0, 0, .03); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.row .title .sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list.need .row .sub { color: #9a3412; white-space: normal; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.grey { background: var(--grey); }
.empty { padding: 12px 14px; color: var(--muted); font-size: 14px; }
.fold { padding: 11px 14px; color: var(--muted); font-size: 14px; cursor: pointer; }

/* Экран сделки */
.back { background: none; border: 0; color: var(--accent); font-size: 15px; padding: 4px 0; cursor: pointer; }
.deal-head { margin: 6px 0 14px; }
.deal-head .who { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.deal-head h1 { font-size: 20px; margin: 0; }
.deal-head .sum { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.deal-head .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.stages { display: flex; gap: 4px; margin: 0 0 16px; }
.stage { flex: 1; text-align: center; font-size: 11px; color: var(--grey); }
.stage .bar { height: 4px; border-radius: 2px; background: var(--line); margin-bottom: 5px; }
.stage.done { color: var(--muted); }
.stage.done .bar { background: var(--green); }
.stage.current { color: var(--text); font-weight: 600; }
.stage.current .bar { background: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note { font-size: 12px; color: var(--yellow); }

.pay { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pay:first-child { border-top: 0; }
.pay .st { color: var(--muted); }
.pay .st.pending { color: var(--yellow); font-weight: 600; }
.pay .st.completed { color: var(--green); }

.shot { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.shot:first-child { border-top: 0; }
.shot img { width: 72px; height: 128px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; cursor: zoom-in; }
.shot .read { font-size: 13px; }
.shot .verdict { font-weight: 600; margin-bottom: 2px; }

.advice { background: #eff6ff; border-color: #bfdbfe; }
.advice .item { padding: 4px 0; font-size: 14px; }
.advice .item.решение { font-weight: 600; }
.advice .item.предупреждение { color: #92400e; font-size: 13px; }
.advice .label { font-size: 12px; color: var(--muted); }

.log { font-size: 13px; }
.log .e { display: flex; gap: 10px; padding: 4px 0; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.zoom { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; z-index: 10; }
.zoom img { max-width: 100%; max-height: 100%; }
