:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --text: #111111;
  --muted: #6d6d6d;
  --line: #d7d7d7;
  --line-strong: #1a1a1a;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.08);
  --shadow-hard: 0 2px 0 #000;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, #ffffff 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, #e9e9e9 0%, transparent 40%),
    linear-gradient(150deg, #f7f7f7 0%, #ededed 100%);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.todo-card {
  width: min(100%, 760px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 1.4rem;
  /* box-shadow: var(--shadow-soft), var(--shadow-hard); */
  display: grid;
  gap: 1.2rem;
  /* transition: transform 220ms ease, box-shadow 220ms ease; */
}



.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.title-wrap {
  display: flex;
  gap: 0.9rem;
}

.complete-toggle {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.35rem;
  accent-color: #000;
  cursor: pointer;
}

h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.status {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.55rem;
  border: 1px solid #111;
  border-radius: 999px;
}

.actions {
  display: flex;
  gap: 0.45rem;
}

.icon-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.icon-btn:hover {
  background: #111;
  color: #fff;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn.danger:hover {
  background: #000;
  color: #fff;
}

.description {
  margin: 0;
  color: #2d2d2d;
  line-height: 1.55;
  font-size: 0.97rem;
}

.meta-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  background: linear-gradient(180deg, #fff 0%, #fbfbfb 100%);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.badge {
  display: inline-block;
  font-size: 0.83rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px solid #000;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

time {
  font-weight: 600;
  font-size: 0.95rem;
}

.tag-section {
  border-top: 1px dashed var(--line);
  padding-top: 0.95rem;
}

.tags {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  border: 1px solid #bbb;
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  font-size: 0.82rem;
  background: #fcfcfc;
}

.todo-card.completed h2,
.todo-card.completed .description {
  text-decoration: line-through;
  color: #7a7a7a;
}

.todo-card.completed .status {
  background: #111;
  color: #fff;
}

.priority-indicator {
  width: 0.5rem;
  height: 3rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  background: #ddd;
  transition: background-color 200ms ease;
}

.todo-card.priority-high .priority-indicator {
  background: #ff3333;
}

.todo-card.priority-medium .priority-indicator {
  background: #ffaa00;
}

.todo-card.priority-low .priority-indicator {
  background: #00aa00;
}

.status-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.status {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.55rem;
  border: 1px solid #111;
  border-radius: 999px;
  min-width: 6rem;
}

.status-control-select {
  display: none;
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #111;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.status-control-select:focus {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.description-wrapper {
  position: relative;
}

.description {
  margin: 0;
  color: #2d2d2d;
  line-height: 1.55;
  font-size: 0.97rem;
  max-height: 4.5rem;
  overflow: hidden;
  transition: max-height 300ms ease;
}

.description.expanded {
  max-height: none;
}

.expand-toggle {
  display: none;
  position: absolute;
  bottom: -1.8rem;
  left: 0;
  background: none;
  border: none;
  color: #111;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.description.truncated ~ .expand-toggle {
  display: block;
}

.time-display {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.overdue-indicator {
  display: none;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: #ff3333;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.todo-card.overdue .overdue-indicator {
  display: inline-block;
}

.todo-card.overdue .status,
.todo-card.overdue .time-remaining-wrapper {
  color: #ff3333;
}

.edit-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.2rem;
  border: 1px dashed #999;
  border-radius: 12px;
  background: #fafafa;
}

.edit-form.hidden {
  display: none;
}

.form-group {
  display: grid;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.85rem;
}

.form-input,
.form-textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem;
  border: 1px solid #999;
  border-radius: 8px;
  background: #fff;
}

.form-textarea {
  resize: vertical;
  min-height: 5rem;
}

.form-input:focus,
.form-textarea:focus {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.form-btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease;
}

.form-btn.primary {
  background: #111;
  color: #fff;
}

.form-btn.primary:hover {
  background: #333;
}

.form-btn.cancel:hover {
  background: #f0f0f0;
}

@media (max-width: 720px) {
  .todo-card {
    padding: 1.1rem;
    border-radius: 16px;
  }

  .card-header {
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .icon-btn {
    flex: 1;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-btn {
    width: 100%;
  }
}
