:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6c6c70;
  --line: #e0e0e5;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --danger: #c62828;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #1c1c1f;
    --text: #f2f2f5;
    --muted: #9a9aa2;
    --line: #2c2c31;
    --accent: #5b8cff;
    --accent-text: #0b0b0d;
    --danger: #ff6b6b;
  }
}

* {
  box-sizing: border-box;
}

html,
body,
a,
button,
input,
label,
summary {
  touch-action: manipulation;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

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

.logo {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.logo a {
  color: inherit;
  text-decoration: none;
}

.logo span {
  color: var(--accent);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.link {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
}

.add {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.add input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.add input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field input {
  position: relative;
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  outline: none;
}

.field input:focus {
  outline: none;
}

.ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
}

.ghost-typed {
  visibility: hidden;
}

.ghost-rest {
  color: var(--muted);
  opacity: 0.7;
}

.add .accept {
  position: relative;
  flex: none;
  padding: 0 14px;
  align-self: stretch;
  background: inherit;
  color: var(--accent, #2f6fed);
  font-size: 15px;
  font-weight: 600;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add button,
.button {
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.add button:disabled {
  opacity: 0.4;
  cursor: default;
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.items:empty {
  display: none;
}

.items li {
  position: relative;
  overflow: hidden;
  max-height: 240px;
  border-bottom: 1px solid var(--line);
  transition: max-height 0.2s ease, opacity 0.2s ease;
}

.items li.leaving {
  max-height: 0;
  opacity: 0;
  border-bottom-width: 0;
}

.items li:last-child {
  border-bottom: 0;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transition: transform 0.18s ease;
}

.row.dragging {
  transition: none;
  cursor: grabbing;
}

.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.text {
  min-width: 0;
  font-size: 19px;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0% 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: color 0.2s ease, background-size 0.22s ease;
}

.items li.done .text {
  color: var(--muted);
  background-size: 100% 2px;
}

.row:active:not(.dragging) {
  background: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  .text,
  .row,
  .items li {
    transition: none;
  }
}

.reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  color: #fff;
  font-size: 20px;
}

.reveal.left {
  background: var(--danger);
}

.reveal-trash {
  visibility: hidden;
}

.reveal.left .reveal-trash {
  visibility: visible;
}
.fine {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

body.plain main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
}

nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

nav a.link {
  text-decoration: none;
}

.title {
  position: relative;
  flex: 0 1 auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin: 0 auto 0 8px;
}

.title .muted {
  flex: none;
  font-size: 14px;
}

.title-input {
  box-sizing: border-box;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.title-input::placeholder {
  color: inherit;
  opacity: 1;
}

.title-input:focus {
  border-color: var(--line);
  background: var(--surface);
  outline: none;
}
.menu-list {
  justify-content: space-between;
  gap: 12px;
}

.menu-list .muted {
  font-size: 15px;
}

.new-list {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.new-list:active {
  transform: scale(0.97);
}

.new-list:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.profile {
  position: relative;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  cursor: pointer;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
}

.menu-email {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--bg);
}

.muted {
  color: var(--muted);
}

.empty-art {
  display: flex;
  justify-content: center;
  padding: 72px 0;
  color: var(--accent);
  opacity: 0.2;
  pointer-events: none;
  animation: empty-in 0.4s ease-out;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes empty-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .empty-art {
    animation: none;
  }
}

.stepper {
  display: flex;
  flex: none;
  align-items: center;
  margin-left: auto;
  padding-left: 8px;
}

.stepper button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.stepper button[aria-disabled='true'] {
  opacity: 0.3;
  cursor: default;
}

.qty {
  min-width: 24px;
  color: var(--muted);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

body.plain main.doc {
  width: min(640px, 100%);
  padding: 28px 24px;
  align-items: stretch;
  text-align: left;
}

body.plain main.doc p {
  color: var(--text);
  line-height: 1.5;
}

.share-panel {
  margin: 0 16px 12px;
  padding: 12px;
  border: 1px solid var(--line, #2a2f3a);
  border-radius: 12px;
  display: grid;
  gap: 8px;
}

.share-panel .share-link {
  width: 100%;
  min-height: 40px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-panel button {
  min-height: 40px;
}

.share-panel .member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.shared-icon {
  margin-left: 6px;
  opacity: 0.6;
  vertical-align: -2px;
}

.new-list,
.avatar {
  flex-shrink: 0;
}

.logo {
  flex-shrink: 0;
}

.menu-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 12px 2px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.6;
}

.switcher > div + div {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.chevron {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}

header {
  position: relative;
}

.switcher {
  left: -8px;
  right: auto;
  top: calc(100% + 4px);
  min-width: 240px;
  max-width: calc(100vw - 32px);
}

.menu-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .title .muted {
    display: none;
  }
}
