:root {
  color-scheme: dark;
  --bg: #111111;
  --surface: #181818;
  --surface-raised: #222222;
  --line: #2b2b2b;
  --line-strong: #3c3c3c;
  --text: #f3f3f3;
  --muted: #9b9b9b;
  --faint: #696969;
  --danger: #ff6b6b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(32px, env(safe-area-inset-bottom));
}

.lock-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.pin-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(260px, 100%);
}

.lock-icon {
  position: relative;
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.lock-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -12px;
  width: 14px;
  height: 15px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.pin-card input,
.pin-card button {
  width: 100%;
  min-height: 44px;
  border-radius: 7px;
}

.pin-card input {
  border: 1px solid var(--line);
  outline: 0;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
}

.pin-card input:focus {
  border-color: var(--line-strong);
}

.pin-card button {
  border: 0;
  background: #f2f2f2;
  color: #151515;
  font-weight: 650;
}

.pin-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 0 0 10px;
  background: rgba(17, 17, 17, 0.94);
  backdrop-filter: blur(14px);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.05rem, 4.5vw, 1.35rem);
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
}

.add-trigger {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0 0 2px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f2f2f2;
  color: #121212;
  font-size: 1.25rem;
  line-height: 1;
}

.add-trigger:active {
  transform: scale(0.97);
}

.filter-trigger {
  display: grid;
  place-items: center;
  gap: 3px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
}

.filter-trigger:hover,
.filter-trigger.active {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

.filter-trigger span {
  display: block;
  width: 14px;
  height: 1px;
  background: currentColor;
}

.filter-trigger span:nth-child(2) {
  width: 10px;
}

.filter-trigger span:nth-child(3) {
  width: 6px;
}

.filter-menu,
.assignee-menu {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181818;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.3);
}

.filter-menu {
  top: max(54px, env(safe-area-inset-top));
  right: 56px;
}

.filter-menu button,
.assignee-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.filter-menu button:hover,
.filter-menu button.active,
.assignee-menu button:hover {
  background: rgba(95, 179, 255, 0.09);
  color: var(--text);
}

.avatar,
.assignee {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  overflow: hidden;
  border-radius: 50%;
  color: #151515;
  font-size: 0.68rem;
  font-weight: 800;
}

.items {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 4px 8px 4px 0;
  border-radius: 7px;
  transition: background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.item.mine {
  background: rgba(95, 179, 255, 0.075);
}

.item.mine.done {
  background: rgba(95, 179, 255, 0.045);
}

.item.done .item-title {
  color: var(--faint);
  text-decoration: line-through;
}

.item.done .custom-check {
  animation: check-pop 260ms ease-out;
}

.check-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.item-check {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.custom-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #151515;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.item-check:checked + .custom-check {
  border-color: transparent;
  background: var(--accent, #78d381);
}

.item-check:checked + .custom-check::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px auto 0;
  border-bottom: 2px solid #111111;
  border-left: 2px solid #111111;
  transform: rotate(-45deg);
  animation: tick-in 180ms ease-out both;
}

.item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.item-title {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.25;
}

.parenthetical {
  color: var(--faint);
}

.edit-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
}

.edit-input:focus {
  border-color: var(--line-strong);
}

.price-button {
  justify-self: start;
  min-height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1;
}

.price-button.has-price {
  color: var(--muted);
}

.assignee,
.delete,
.sheet-close {
  border: 0;
  background: transparent;
}

.assignee {
  color: #151515;
}

.assignee.empty {
  border: 1px solid var(--line-strong);
  background: transparent;
}

.avatar-choice {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  color: #151515;
  font-size: 0.64rem;
  font-weight: 800;
}

.avatar-choice.empty {
  border: 1px solid var(--line-strong);
}

.delete {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--faint);
  font-size: 1.05rem;
}

.delete:hover {
  color: var(--danger);
}

.empty-state {
  display: none;
  max-width: 300px;
  margin: 22vh auto 0;
  color: var(--muted);
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #78d381;
  background: #151515;
  font-size: 1.3rem;
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1.1rem;
}

.empty-state p {
  margin-bottom: 0;
  line-height: 1.5;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.44);
}

.composer-sheet,
.price-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 21;
  padding: 10px 14px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  transform: translateY(105%);
  transition: transform 180ms ease;
}

.composer-sheet.open,
.price-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #3a3a3a;
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 860px;
  margin: 0 auto 12px;
}

.sheet-top h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.5rem;
}

.composer,
.price-form {
  display: grid;
  gap: 9px;
  max-width: 860px;
  margin: 0 auto;
}

.composer input,
.composer select,
.composer button,
.price-form input,
.price-form button {
  width: 100%;
  min-height: 48px;
  border-radius: 7px;
}

.composer input,
.composer select,
.price-form input {
  border: 1px solid var(--line);
  outline: 0;
  background: var(--surface-raised);
  color: var(--text);
}

.composer input,
.price-form input {
  padding: 0 14px;
}

.composer input::placeholder,
.price-form input::placeholder {
  color: #696969;
}

.composer select {
  padding: 0 10px;
}

.composer input:focus,
.composer select:focus,
.price-form input:focus {
  border-color: var(--line-strong);
}

.composer button,
.price-form button {
  border: 0;
  background: #f2f2f2;
  color: #151515;
  font-weight: 650;
}

@media (min-width: 720px) {
  .app {
    padding-right: 28px;
    padding-left: 28px;
  }

  .topbar {
    min-height: 54px;
  }

  .composer-sheet,
  .price-sheet {
    top: 90px;
    right: max(28px, calc((100vw - 860px) / 2 + 28px));
    bottom: auto;
    left: auto;
    width: min(380px, calc(100vw - 56px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
  }

  .composer-sheet.open,
  .price-sheet.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .sheet-handle {
    display: none;
  }
}

@keyframes check-pop {
  0% {
    transform: scale(0.84);
  }

  55% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes tick-in {
  from {
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
  }

  to {
    opacity: 1;
    transform: rotate(-45deg) scale(1);
  }
}
