* {
  box-sizing: border-box;
}

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #172033;
  --muted: #6b7280;
  --border: #dfe5ee;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 32%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(820px, 92%);
  margin: 48px auto;
  padding: 34px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.storage-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.storage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

form {
  margin-bottom: 8px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

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

input,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--text);
}

input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select {
  padding: 9px 11px;
}

button {
  border: 0;
  border-radius: 10px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-btn {
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  padding: 9px 12px;
  background: #eef2f7;
  color: var(--text);
}

.secondary-btn:hover {
  background: #e5eaf1;
}

.message {
  min-height: 24px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.message.success {
  color: var(--success);
}

.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 15px 16px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.summary-bar strong,
.summary-bar span {
  display: block;
}

.summary-bar strong {
  margin-bottom: 3px;
}

.summary-bar span {
  color: var(--muted);
  font-size: 0.85rem;
}

.task-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-section {
  min-height: 180px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

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

#taskList {
  padding: 0;
  margin: 0;
}

.task-item {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.task-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.task-item button {
  padding: 8px 11px;
  background: #eef2f7;
  color: var(--text);
  font-size: 0.85rem;
}

.task-item button:hover {
  background: #e4e9f0;
}

.task-item .delete-btn {
  color: var(--danger);
}

.app-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
}

.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;
}

@media (max-width: 640px) {
  .app {
    margin: 20px auto;
    padding: 22px;
    border-radius: 16px;
  }

  .app-header,
  .summary-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .storage-badge {
    width: fit-content;
  }

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

  .primary-btn {
    width: 100%;
  }

  .task-controls {
    flex-wrap: wrap;
  }

  .task-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .task-title {
    flex-basis: 100%;
    margin-bottom: 4px;
  }
}

/* Centered custom edit modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.edit-modal {
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
  animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.modal-eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.edit-modal h3 {
  margin: 0;
  font-size: 1.35rem;
}

.modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  background: #e4e9f0;
}

.edit-modal label {
  margin-bottom: 8px;
}

.edit-modal input {
  width: 100%;
  padding: 13px 14px;
}

.modal-error {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.modal-actions .primary-btn,
.modal-actions .secondary-btn {
  padding: 10px 15px;
}

@media (max-width: 480px) {
  .edit-modal {
    padding: 22px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}


/* Centered delete confirmation modal */
.confirm-modal {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
  text-align: center;
  animation: modalIn 0.18s ease-out;
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fee2e2;
  color: var(--danger);
  font-size: 1.5rem;
  font-weight: 800;
}

.confirm-content h3 {
  margin: 0 0 9px;
  font-size: 1.35rem;
}

.confirm-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.confirm-text strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.confirm-modal .modal-actions {
  justify-content: center;
  margin-top: 24px;
}

.danger-btn {
  padding: 10px 15px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
}

.danger-btn:hover {
  background: #b91c1c;
}
