*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Login overlay ── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #4f46e5;
}

.login-sub {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 4px;
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}

.login-box input:focus { border-color: #4f46e5; }

.login-error {
  font-size: 0.8125rem;
  color: #e74c3c;
  min-height: 1.2em;
}

.login-primary-btn {
  width: 100%;
  padding: 12px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.login-primary-btn:hover { background: #4338ca; }

.login-secondary-btn {
  width: 100%;
  padding: 12px;
  background: none;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: border-color 0.15s;
}

.login-secondary-btn:hover { border-color: #9ca3af; }

/* ── App header row ── */
.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.todo-logout-btn {
  font-size: 0.75rem;
  color: #9ca3af;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.todo-logout-btn:hover { color: #e74c3c; border-color: #e74c3c; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  display: flex;
  justify-content: center;
  overflow: hidden;
  color: #1a1a2e;
}

.container {
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.top-pane {
  flex-shrink: 0;
  padding: 40px 16px 16px;
  background: #f0f2f5;
  border-bottom: 2px solid #e2e8f0;
}

.bottom-pane {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 24px;
  color: #4f46e5;
}

/* Due banner */
#due-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.due-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.due-table th {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0 8px 6px 0;
  border-bottom: 1px solid #e2e8f0;
}

.due-table td {
  padding: 5px 8px 5px 0;
  color: #1e40af;
  font-weight: 500;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
}

.due-table tr:last-child td {
  border-bottom: none;
}

.due-table td.time-soon {
  color: #c2410c;
  font-weight: 700;
}

.due-table td.time-overdue {
  color: #b91c1c;
  font-weight: 700;
}

/* Overdue banner */
#overdue-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#overdue-banner-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c2410c;
  margin-bottom: 2px;
}

.overdue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.overdue-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.overdue-task {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overdue-list-name {
  font-size: 0.75rem;
  color: #94a3b8;
}

.snooze-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.snooze-btn {
  padding: 3px 8px;
  background: #fff;
  border: 1.5px solid #fdba74;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c2410c;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.snooze-btn:hover {
  background: #ffedd5;
  border-color: #f97316;
}

/* Notification banner */
.notif-banner {
  font-size: 0.8125rem;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.notif-warn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.notif-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}


/* List tabs */
.add-to-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

#list-tabs-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

#list-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.list-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.list-tab:hover {
  color: #4f46e5;
}

.list-tab.active {
  background: #ede9fe;
  color: #4f46e5;
  border-color: #c4b5fd;
}

.list-tab-name {
  cursor: pointer;
}

.list-tab-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
  transition: color 0.15s;
}

.list-tab-del:hover {
  color: #ef4444;
}

#add-list-btn {
  padding: 6px 12px;
  background: transparent;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

#add-list-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

/* New Task button */
#new-task-btn {
  display: block;
  width: 100%;
  padding: 10px 20px;
  margin-bottom: 12px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}

#new-task-btn:hover {
  background: #4338ca;
}

/* Collapsible task form wrapper — state managed entirely by JS inline styles */
#task-form-wrapper {
  overflow: hidden;
}

/* Form */
#todo-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-row {
  align-items: center;
}

.date-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

#todo-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}

#todo-input:focus {
  border-color: #4f46e5;
}

#todo-date {
  width: 38px;
  flex: none;
  padding: 6px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
  cursor: pointer;
  color: transparent;
  overflow: hidden;
}

#todo-date:focus {
  border-color: #4f46e5;
}

#todo-priority {
  padding: 6px 8px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

#todo-priority:focus {
  border-color: #4f46e5;
}

#todo-date::-webkit-calendar-picker-indicator,
.edit-date-input::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.5;
  filter: invert(31%) sepia(72%) saturate(3000%) hue-rotate(233deg);
  margin: 0;
  transition: opacity 0.15s;
}

#todo-date.has-value::-webkit-calendar-picker-indicator,
.edit-date-input.has-value::-webkit-calendar-picker-indicator {
  opacity: 1;
}

#todo-time.has-value,
.edit-time-input.has-value {
  border-color: #4f46e5;
  color: #4f46e5;
  font-weight: 600;
}

#todo-time,
.edit-time-input {
  width: 140px;
  flex: none;
  padding: 6px 8px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.8125rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

#todo-time:focus,
.edit-time-input:focus {
  border-color: #4f46e5;
}

#todo-form button {
  padding: 12px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#todo-form button:hover {
  background: #4338ca;
}

/* Filters */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 6px 14px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
}

.filter-btn:hover {
  color: #4f46e5;
}

.filter-btn.active {
  background: #ede9fe;
  color: #4f46e5;
  border-color: #c4b5fd;
}

/* Today button */
#today-btn {
  padding: 6px 14px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
}

#today-btn:hover {
  color: #4f46e5;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a2e;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #1a1a2e;
}

.modal-body {
  overflow-y: auto;
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-empty {
  color: #94a3b8;
  font-size: 0.9375rem;
  text-align: center;
  padding: 24px 0;
}

.modal-list-label {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding-left: 32px;
  margin-top: 2px;
  display: block;
}

/* Layout toggle */
.layout-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
  padding: 2px;
}

.layout-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 1rem;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
  line-height: 1;
}

.layout-btn.active {
  background: #ede9fe;
  color: #4f46e5;
}

.layout-btn:hover:not(.active) {
  color: #4f46e5;
}

/* All-lists container */
#todo-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.container.sidebyside {
  max-width: 100%;
}

.container.sidebyside .top-pane {
  max-width: 480px;
  margin: 0 auto;
}

.container.sidebyside .bottom-pane {
  padding: 24px;
}

#todo-list.sidebyside {
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
}

#todo-list.sidebyside .list-section {
  flex: 1;
  min-width: 280px;
}

/* Per-list section */
.list-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.list-section-header:hover .list-section-name {
  color: #4f46e5;
}

.list-section-chevron {
  font-size: 1rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  display: inline-block;
  margin-right: 6px;
  user-select: none;
}

.list-section-chevron.collapsed {
  transform: rotate(-90deg);
}

.list-section-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #94a3b8;
}

.list-section-name.is-active {
  color: #4f46e5;
}

.list-section-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 16px;
}

.list-section-empty {
  font-size: 0.875rem;
  color: #cbd5e1;
  padding: 8px 0;
}

.list-section-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.875rem;
  color: #64748b;
  padding: 0 4px;
  padding-left: 20px;
}

.list-section-footer button {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.list-section-footer button:hover {
  color: #ef4444;
}

.todo-item {
  display: flex;
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
  background: #fff;
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1.5px solid #000;
  animation: slide-in 0.15s ease;
  flex-wrap: wrap;
}

.todo-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.todo-date {
  width: 100%;
  padding-left: 32px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6d6afe;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.date-bump {
  margin-left: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #f97316;
  background: #ffedd5;
  border-radius: 4px;
  padding: 3px 8px;
}

.todo-date::before {
  content: "\1F4C5"; /* calendar emoji */
  font-size: 0.7rem;
}

.todo-item.priority-critical {
  background: #fff0f0;
}

.todo-item.priority-critical .todo-text {
  font-weight: 700;
}

.todo-item.priority-high {
  background: #fefce8;
}

.todo-item.completed .todo-date {
  color: #94a3b8;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.todo-item input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
}

.todo-item input[type="checkbox"]:checked {
  background: #4f46e5;
  border-color: #4f46e5;
}

.todo-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.todo-text {
  flex: 1;
  font-size: 1rem;
  transition: all 0.15s;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: #94a3b8;
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.delete-btn:hover {
  color: #ef4444;
}

/* Edit button */
.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.edit-btn:hover {
  color: #4f46e5;
}

/* Inline edit form */
.todo-item.editing {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.edit-text-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #4f46e5;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
}

.edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.edit-date-input {
  width: 38px;
  flex: none;
  padding: 6px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  outline: none;
  cursor: pointer;
  color: transparent;
  overflow: hidden;
  transition: border-color 0.15s;
}

.edit-date-input:focus {
  border-color: #4f46e5;
}

.edit-date-input::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.5;
  filter: invert(31%) sepia(72%) saturate(3000%) hue-rotate(233deg);
  margin: 0;
}


.edit-save-btn {
  padding: 6px 14px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.edit-save-btn:hover {
  background: #4338ca;
}

.edit-cancel-btn {
  padding: 6px 14px;
  background: transparent;
  color: #64748b;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}

.edit-cancel-btn:hover {
  border-color: #94a3b8;
}

/* Recurrence badge */
.recurrence-badge {
  width: 100%;
  padding-left: 32px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #7c3aed;
  display: block;
  line-height: 1;
}

.todo-item.completed .recurrence-badge {
  color: #94a3b8;
}

/* Recurrence selects */
#todo-recurrence,
.edit-recurrence-input {
  padding: 6px 8px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

#todo-recurrence:focus,
.edit-recurrence-input:focus {
  border-color: #4f46e5;
}

.edit-list-input {
  padding: 6px 8px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.edit-list-input:focus {
  border-color: #4f46e5;
}

/* Priority badge */
.priority-badge {
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
  letter-spacing: 0.03em;
}

.priority-badge:hover {
  opacity: 0.7;
}

.priority-picker {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 1000;
}

.priority-picker-opt {
  border: none;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s;
}

.priority-picker-opt:hover {
  opacity: 0.75;
}

.priority-picker-opt.selected {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.priority-picker-opt.p0 { background: #fee2e2; color: #dc2626; }
.priority-picker-opt.p1 { background: #ffedd5; color: #ea580c; }
.priority-picker-opt.p2 { background: #dbeafe; color: #2563eb; }
.priority-picker-opt.p3 { background: #f1f5f9; color: #94a3b8; }

.priority-badge.p0 { background: #fee2e2; color: #000; }
.priority-badge.p1 { background: #ffedd5; color: #000; }
.priority-badge.p2 { background: #dbeafe; color: #000; }
.priority-badge.p3 { background: #f1f5f9; color: #000; }

.todo-item.completed .priority-badge {
  opacity: 0.4;
}

