:root {
  --bg: #F7F6F3;
  --card: #FFFFFF;
  --line: #EAE7E0;
  --line-soft: #F1EFE9;
  --border: #DDD9D1;
  --ink: #17170F;
  --ink-2: #55514A;
  --muted: #7A756B;
  --faint: #9A9488;
  --tint: #F0EEE8;
  --red: #B42318;
  --red-bg: #FEF3F2;
  --red-line: #FBD9D3;
  --amber: #B54708;
  --amber-bg: #FFFAEB;
  --green: #067647;
  --green-bg: #ECFDF3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: #000; }

input, textarea, select, button { font-family: inherit; }

/* ——— каркас ——— */

.page {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-body {
  flex-grow: 1;
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page--nav .page-body { padding-bottom: 108px; }

.top {
  padding: 24px 16px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.top-back {
  width: 44px;
  height: 44px;
  margin-left: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 6px;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex-grow: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 7px; }
.row-line { display: flex; align-items: center; gap: 10px; }

/* ——— карточки ——— */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.card-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2px 14px;
  display: flex;
  flex-direction: column;
}

.card-list > * + * { border-top: 1px solid var(--line-soft); }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  min-height: 60px;
}

.summary {
  background: var(--ink);
  color: #FFFFFF;
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary-label { font-size: 13px; color: #A8A399; }
.summary-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

.hint {
  background: var(--tint);
  border: 1px dashed #D5D0C6;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hint-text { font-size: 15px; line-height: 1.4; color: var(--ink-2); }

.status-box {
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-box-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.status-box-sub { font-size: 14px; }

.status-red { background: var(--red-bg); border: 1px solid var(--red-line); }
.status-red .status-box-title { color: var(--red); }
.status-red .status-box-sub { color: #9A5A52; }

.status-amber { background: var(--amber-bg); border: 1px solid #FDE4B8; }
.status-amber .status-box-title { color: var(--amber); }
.status-amber .status-box-sub { color: #8A6034; }

.status-green { background: var(--green-bg); border: 1px solid #C9EDD8; }
.status-green .status-box-title { color: var(--green); }
.status-green .status-box-sub { color: #3F7A5D; }

/* ——— имена, аватарки, статусы ——— */

.name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.name-sm { font-size: 16px; font-weight: 600; }
.meta { font-size: 13px; color: var(--muted); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar--lg { width: 58px; height: 58px; font-size: 22px; }
.avatar--red { background: var(--red-bg); color: var(--red); }
.avatar--amber { background: var(--amber-bg); color: var(--amber); }

.pill {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}

.pill-red { color: var(--red); background: var(--red-bg); }
.pill-amber { color: var(--amber); background: var(--amber-bg); }
.pill-green { color: var(--green); background: var(--green-bg); }
.pill-grey { color: var(--ink-2); background: var(--tint); }

.status-short { font-size: 13px; font-weight: 600; white-space: nowrap; }
.t-red { color: var(--red); }
.t-amber { color: var(--amber); }
.t-green { color: var(--green); }
.t-grey { color: var(--faint); }

.sum { font-size: 14px; font-weight: 600; }

/* ——— кнопки ——— */

.btn {
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
}

.btn:active { transform: translateY(1px); }

.btn-dark {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.btn-sm { height: 44px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 58px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; width: 100%; }
.btn-quiet { color: var(--muted); background: transparent; }
.btn-danger { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex-grow: 1; }

.fab {
  position: fixed;
  right: calc(50% - 260px + 18px);
  bottom: 110px;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: var(--ink);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 8px 22px rgba(23, 23, 15, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
}

@media (max-width: 560px) {
  .fab { right: 18px; }
}

/* ——— формы ——— */

.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 14px; font-weight: 600; color: var(--ink-2); }

.input {
  height: 56px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 17px;
  color: var(--ink);
}

.input:focus, textarea.input:focus, select.input:focus {
  outline: none;
  border-color: var(--ink);
  border-width: 1.5px;
}

textarea.input {
  height: auto;
  min-height: 132px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
}

select.input { appearance: none; background-image: none; }

.error {
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.check-row input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--ink);
  flex-shrink: 0;
}

.day-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.day {
  min-width: 52px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.day input { display: none; }
.day:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

/* ——— поиск и сортировка ——— */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  height: 50px;
  padding: 0 14px;
}

.search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  width: 100%;
  color: var(--ink);
}

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFFFF;
  font-weight: 600;
}

/* ——— нижняя навигация ——— */

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 8px calc(18px + env(safe-area-inset-bottom));
  z-index: 10;
}

.nav-inner {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  display: flex;
}

.nav-item {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 0;
}

.nav-item.is-active { color: var(--ink); font-weight: 600; }

/* ——— нижняя панель действия ——— */

.sticky-action {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  margin: 0 -16px;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page--nav .sticky-action { bottom: 84px; }

/* ——— сообщения ——— */

.flash {
  background: var(--green-bg);
  border: 1px solid #C9EDD8;
  color: #08543A;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  line-height: 1.4;
}

.flash-error {
  background: var(--red-bg);
  border-color: var(--red-line);
  color: var(--red);
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  padding: 28px 16px;
}

/* ——— «экран телефона» на витрине ——— */

.mock {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 14px 38px rgba(23, 23, 15, 0.14);
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
  user-select: none;
}

.mock-top { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 2px; }
.mock-h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.mock-date { font-size: 10px; color: var(--muted); }

.mock-sum {
  background: var(--ink);
  color: #FFFFFF;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mock-sum-label { font-size: 9px; color: #A8A399; }
.mock-sum-value { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }

.mock-section {
  font-size: 8px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 4px 0;
}

.mock-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mock-name { font-size: 12px; font-weight: 600; }
.mock-pill { font-size: 8.5px; font-weight: 600; border-radius: 999px; padding: 2px 6px; white-space: nowrap; }
.mock-money { font-size: 10px; font-weight: 600; }

.mock-btn {
  font-size: 10px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  white-space: nowrap;
}

.mock-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mock-bar-track { height: 5px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.mock-bar-fill { height: 100%; border-radius: 999px; background: var(--ink); }
