:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #7a7169;
  --line: #eadfce;
  --accent: #13a538;
  --accent-ink: #ffffff;
  --warm: #e0a84f;
  --warn: #c0392b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .92rem; }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand img { width: 44px; height: 44px; }
.brand .title { font-weight: 700; font-size: 1.15rem; }
.brand .sub { color: var(--muted); font-size: .85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(80, 60, 20, .05);
}

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }

input, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { min-height: 140px; resize: vertical; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--warn); border: 1px solid var(--line); padding: 6px 10px; font-size: .85rem; }
button.full { width: 100%; margin-top: 16px; }

.error { color: var(--warn); font-size: .9rem; margin-top: 10px; min-height: 1.2em; }
.ok { color: var(--accent); font-size: .9rem; margin-top: 10px; }

.hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #fff4e0, #ffffff);
}
.hero .big { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--warm); }

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 10px 14px;
}
.people .name { font-weight: 600; }
.people .meta { color: var(--muted); font-size: .85rem; }
.people .me { background: #f3faf5; }
.people .low { border-left: 4px solid var(--warm); }
.people button { padding: 8px 14px; font-size: .9rem; }
.badge {
  display: inline-block; min-width: 28px; text-align: center;
  padding: 2px 8px; border-radius: 999px;
  background: #fff1d9; color: #8a5a10; font-weight: 700; font-size: .85rem;
}
.sent-mark { color: var(--accent); font-size: .8rem; font-weight: 600; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.topbar button { padding: 8px 12px; font-size: .85rem; }

dialog {
  border: 0; border-radius: var(--radius); padding: 20px;
  width: min(560px, calc(100vw - 32px));
  background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgba(40, 30, 10, .45); }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.counter { text-align: right; color: var(--muted); font-size: .8rem; margin-top: 4px; }

.note {
  background: #fffdf6;
  border: 1px dashed var(--warm);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.note q { font-style: italic; font-size: 1.05rem; }
.note .from { color: var(--muted); font-size: .85rem; margin-top: 6px; }

.hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; }
.stat .n { font-size: 1.8rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .8rem; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle input { width: auto; transform: scale(1.4); }

#qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 10px; }
#qr img, #qr canvas { max-width: 100%; height: auto; }
