:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #172033;
  --mute: #667084;
  --line: #e4e7ee;
  --blue: #2f6fed;
  --blue-soft: #e8f0fe;
  --ok: #147d4e;
  --ok-soft: #e7f6ee;
  --danger: #c2413a;
  --warn: #9a6700;
  --warn-soft: #fff6e0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Golos Text", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

button,
input {
  font: inherit;
  color: inherit;
}

.sheet {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.top {
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  margin: 4px 0 0;
  color: var(--mute);
  font-size: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  background: #e4e8f0;
  border-radius: 14px;
}

.tab {
  border: 0;
  background: transparent;
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 6px;
  color: var(--mute);
  font-weight: 600;
  font-size: 14px;
}

.tab[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.08);
}

.group,
.card {
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
}

h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.count,
.hint,
.empty,
.person small,
.row small {
  color: var(--mute);
  font-size: 13px;
}

.composer,
.add-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
}

.field {
  flex: 1;
  min-width: 0;
  border: 0;
  background: var(--bg);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 12px;
}

.field.search {
  width: 100%;
  margin-bottom: 10px;
}

.btn {
  border: 0;
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 600;
}

.btn.block {
  width: calc(100% - 28px);
  margin: 4px 14px 14px;
}

.btn.ghost,
.text-btn {
  background: transparent;
  color: var(--blue);
}

.text-btn {
  border: 0;
  min-height: 44px;
  padding: 0 4px;
  font-weight: 600;
}

.text-btn.danger {
  color: var(--danger);
}

.btn.quiet {
  background: var(--bg);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.5;
}

.list {
  padding: 0 14px 6px;
}

.row,
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.row + .row,
.person + .person {
  border-top: 1px solid var(--line);
}

.person {
  padding: 10px 14px;
}

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.grow {
  flex: 1;
  min-width: 0;
}

.grow strong,
.row strong {
  display: block;
  font-weight: 600;
  word-break: break-word;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}

.status {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
}

.status.on {
  color: var(--ok);
}

.note {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--warn-soft);
  border-radius: 14px;
}

.note p {
  margin: 0;
}

.note p + p {
  margin-top: 6px;
}

.note strong {
  font-weight: 600;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  margin: 0 14px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.switch input {
  appearance: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: #d5dae3;
  position: relative;
  flex: none;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.2);
}

.switch input:checked {
  background: var(--blue);
}

.switch input:checked::after {
  transform: translateX(20px);
}

.section-label {
  margin: 14px 14px 8px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 600;
}

.chips {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 0 14px 8px;
}

.chip {
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
}

.chip.on {
  background: var(--blue);
  color: #fff;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}

.actions + .request {
  border-top: 1px solid var(--line);
}

.request p {
  margin: 4px 0 12px;
  color: var(--mute);
  font-size: 14px;
}

.back {
  margin: 12px 14px 0;
  padding: 0;
  min-height: 32px;
}

.pad {
  padding: 14px;
}

.banner {
  margin: 0 0 12px;
  color: var(--mute);
  font-size: 13px;
}

.toast {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
}

.toast.bad {
  background: #fdecec;
  color: var(--danger);
}

.empty {
  margin: 0;
  padding: 4px 0 10px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .switch input::after {
    transition: none;
  }
}
