:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a20;
  --panel-2: #20242c;
  --text: #f6f1e8;
  --muted: #a8adb7;
  --line: #323743;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --green: #2aa876;
  --red: #de5b49;
  --yellow: #e9b44c;
  --blue: #4f8cc9;
  --violet: #8b6fd8;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px 16px 92px;
  max-width: 980px;
  margin: 0 auto;
}

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

.auth-card,
.panel,
.modal-card {
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-card {
  width: min(420px, 100%);
  padding: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark,
.avatar,
.nav-icon,
.check {
  display: grid;
  place-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.35rem;
}

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

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #101217;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.primary,
.secondary,
.icon-button,
.danger {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 800;
}

.secondary,
.icon-button {
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.danger {
  background: color-mix(in srgb, var(--red) 28%, var(--panel));
}

.topbar,
.section-head,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 20px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.36), transparent 32%),
    linear-gradient(135deg, var(--avatar, var(--accent)), color-mix(in srgb, var(--avatar, var(--accent)) 72%, black));
  color: white;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 8px 18px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

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

.hero {
  display: grid;
  gap: 18px;
  padding: 22px 0 12px;
}

.stats-grid,
.list-grid,
.profile-grid {
  display: grid;
  gap: 12px;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat,
.list-card,
.task-card,
.achievement {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat,
.list-card,
.achievement {
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 2rem;
}

.list-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.list-card {
  display: grid;
  gap: 12px;
  text-align: left;
  color: var(--text);
}

.list-icon {
  font-size: 1.7rem;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
}

.task-card.completed {
  opacity: 0.5;
}

.task-card.completed .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.check {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #101217;
  color: transparent;
}

.completed .check {
  background: var(--green);
  color: #06110c;
}

.task-body {
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 0;
  color: inherit;
  font: inherit;
  min-width: 0;
}

.task-body:active,
.list-card:active,
.day:active,
.check:active {
  opacity: 0.65;
}

.days-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.day-toggle.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.task-title {
  font-weight: 800;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.78rem;
}

.badge.alta {
  background: color-mix(in srgb, var(--red) 28%, var(--panel));
  color: #ffd8d2;
}

.badge.media {
  background: color-mix(in srgb, var(--yellow) 28%, var(--panel));
  color: #ffe8ae;
}

.badge.baja {
  background: color-mix(in srgb, var(--green) 24%, var(--panel));
  color: #c8f2df;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px;
  background: #181a20e8;
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(18px);
}

.nav-item {
  min-height: 50px;
  display: grid;
  place-items: center;
  gap: 3px;
  color: var(--muted);
  background: transparent;
  border-radius: 14px;
  font-size: 0.73rem;
}

.nav-item.active {
  background: var(--panel-2);
  color: var(--text);
}

.fab {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: #0008;
  overflow: hidden;
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segmented button,
.profile-button,
.assignee-button {
  min-height: 44px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.segmented .selected,
.profile-button.selected,
.assignee-button.selected {
  outline: 2px solid var(--accent);
}

.assignee-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.assignee-button {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 10px 6px;
  min-width: 0;
}

.assignee-button .avatar {
  width: 34px;
  height: 34px;
}

.assignee-button span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day {
  min-height: 56px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 8px;
  text-align: left;
}

.day.today {
  border-color: var(--accent);
}

.day.selected {
  background: color-mix(in srgb, var(--accent) 20%, var(--panel));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.dots {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.ranking-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.rank-avatar {
  position: relative;
  width: 38px;
  height: 38px;
}

.rank-avatar > span:last-child {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  border: 2px solid var(--panel);
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
  margin-top: 7px;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 28px;
  }

  .hero {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: end;
  }

  .profile-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
