:root {
  --bg: var(--tg-theme-bg-color, #f3f0ea);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, #fffdf8));
  --text: var(--tg-theme-text-color, #1c1916);
  --muted: var(--tg-theme-hint-color, #7c756c);
  --accent: var(--tg-theme-button-color, #2c4a40);
  --accent-text: var(--tg-theme-button-text-color, #f6f3ec);
  --danger: var(--tg-theme-destructive-text-color, #b42318);
  --line: color-mix(in srgb, var(--text) 9%, transparent);
  --mark-low: #7d8b82;
  --mark-medium: #e0b21a;
  --mark-high: #c23b2e;
  --mark-work: #d2642e;
  --mark-done: #4e7d5c;
  --safe-top: var(--tg-content-safe-area-inset-top, var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: var(--tg-safe-area-inset-bottom, 0px);
}

html[data-theme="light"] {
  --bg: #f3f0ea;
  --card: #fffdf8;
  --text: #1c1916;
  --muted: #7c756c;
  --accent: #2c4a40;
  --accent-text: #f6f3ec;
  --danger: #b42318;
  --line: color-mix(in srgb, var(--text) 9%, transparent);
}

html[data-theme="dark"] {
  --bg: #141312;
  --card: #1f1d1b;
  --text: #f3efe6;
  --muted: #9a9389;
  --accent: #8fbfa8;
  --accent-text: #101614;
  --danger: #e07068;
  --line: color-mix(in srgb, var(--text) 12%, transparent);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}

body {
  padding:
    calc(var(--safe-top) + 8px)
    20px
    calc(var(--safe-bottom) + 28px);
}

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

button {
  cursor: pointer;
}

#app {
  max-width: 480px;
  margin: 0 auto;
}

.screen.is-hidden,
.is-hidden {
  display: none !important;
}

.screen-center {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.boot-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}

.boot-text,
.lede {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 280px;
}

.denied-title {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 8px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-avatars {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.team-avatars .avatar {
  width: 26px;
  height: 26px;
  font-size: 11px;
  box-shadow: 0 0 0 2px var(--bg);
}

.team-avatars .avatar + .avatar {
  margin-left: -8px;
}

.greeting,
.editor-heading {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  position: relative;
  flex-shrink: 0;
}

.icon-btn span {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

.icon-btn span:last-child {
  transform: rotate(90deg);
}

.theme-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.theme-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 0 8px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 0;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.is-on {
  background: var(--text);
  color: var(--bg);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 72px;
}

.task-card {
  position: relative;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  padding: 16px 16px 15px 20px;
  box-shadow: 0 1px 0 var(--line);
  cursor: pointer;
}

.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
  background: var(--mark);
}

.task-card.priority-low {
  --mark: var(--mark-low);
}

.task-card.priority-medium {
  --mark: var(--mark-medium);
}

.task-card.priority-high {
  --mark: var(--mark-high);
}

.task-card.status-done .task-name {
  color: var(--muted);
}

.task-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  color: #f6f3ec;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack .avatar + .avatar {
  margin-left: -8px;
  box-shadow: 0 0 0 2px var(--card);
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.empty {
  padding: 48px 12px;
  text-align: center;
}

.empty h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.editor-top {
  padding: 12px 0 20px;
}

.btn-help-back {
  display: inline-block;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border-radius: 18px;
  padding: 12px 14px 14px;
}

.field > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  padding: 0;
  resize: none;
}

.field textarea {
  min-height: 88px;
  line-height: 1.45;
}

.field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.field-row input[type="date"] {
  width: auto;
  text-align: right;
  color-scheme: inherit;
}

.pills,
.people {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill,
.person {
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
}

.person {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 6px;
}

.person .avatar,
.people .avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.prio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prio-dot-low {
  background: var(--mark-low);
}

.prio-dot-medium {
  background: var(--mark-medium);
}

.prio-dot-high {
  background: var(--mark-high);
}

.priority-chip {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

.pill.is-on,
.person.is-on {
  background: var(--text);
  color: var(--bg);
}

.editor-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 0 24px;
}

.btn-primary,
.btn-danger {
  height: 50px;
  border: 0;
  border-radius: 16px;
  font-weight: 700;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

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

.btn-primary:disabled {
  opacity: 0.55;
}

.has-native-main .icon-btn,
.has-native-main .editor-actions .btn-primary {
  display: none;
}

.has-native-main .editor-actions {
  padding-bottom: 80px;
}

.has-native-main .task-list {
  padding-bottom: 8px;
}

.has-native-main .btn-help {
  margin-bottom: 80px;
}

.btn-help {
  display: block;
  width: 100%;
  margin: 20px 0 8px;
  padding: 14px 12px;
  border: 0;
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.help-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 28px;
}

.help-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.help-sub {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-restore {
  color: var(--accent);
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0 4px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
}

.team-row .name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.team-row .you {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.btn-kick {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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