/* สิ่งที่ต้องทำ — full-screen app, notepad layout.
   Colors follow the active theme (--card/--text/--sub/--accent/--hairline) — only the
   ruled-paper layout (lines + left margin) is the widget's fixed "flavor" shape. */

.todo-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 20px calc(var(--safe-bottom) + 20px);
}

.todo-widget {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 16px 16px 12px 26px;
  box-shadow: var(--shadow-lg);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 32px,
    var(--hairline) 33px
  );
  background-position: 0 96px;
}

.todo-widget::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 15px;
  width: 1.5px;
  background: var(--accent);
}

.todo-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.todo-widget-ro .todo-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.todo-edit-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.todo-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.todo-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  border-bottom: 1.5px dashed var(--sub);
  color: var(--text);
  padding: 6px 2px;
  font-size: 14.5px;
}

.todo-input::placeholder {
  color: var(--sub);
  font-style: italic;
}

.todo-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.todo-add-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-optional-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.todo-optional-input {
  flex: 1;
  min-width: 0;
  background: var(--card-hi);
  border: 1px solid var(--sub);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 12.5px;
}

.todo-optional-input::placeholder {
  color: var(--sub);
}

.todo-list {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  min-height: 32px;
  border-radius: 6px;
}

.todo-item.todo-due-soon {
  background: rgba(240, 173, 46, 0.16);
  box-shadow: inset 3px 0 0 0 #f0ad2e;
}

.todo-item.todo-due-urgent {
  background: rgba(255, 69, 58, 0.16);
  box-shadow: inset 3px 0 0 0 var(--red);
}

.todo-check {
  flex-shrink: 0;
  margin-top: 1px;
  min-width: 18px;
  height: 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--sub);
  background: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.todo-check.done {
  min-width: auto;
  padding: 0 10px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

/* Home preview card: sizes to its content instead of stretching flex:1 (inherited from
   .todo-widget) down the whole remaining home-screen height — that looked like a mostly-
   empty notepad when there are few items. Its own .todo-list still scrolls internally
   past max-height if there are many. */
.todo-widget-ro {
  flex: none;
  max-height: min(50vh, 360px);
  cursor: default;
}

.todo-check-ro {
  flex-shrink: 0;
  margin-top: 4px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--sub);
}

.todo-check-ro.done {
  border-color: var(--green);
  background: var(--green);
}

.todo-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.todo-text {
  font-size: 14.5px;
  word-break: break-word;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--sub);
}

.todo-meta {
  font-size: 11.5px;
  color: var(--sub);
}

.todo-item.done .todo-meta {
  color: var(--sub);
  opacity: 0.7;
}

.todo-del {
  flex-shrink: 0;
  margin-top: 1px;
  background: none;
  border: none;
  color: var(--sub);
  font-size: 16px;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.todo-empty {
  color: var(--sub);
  font-size: 13px;
  text-align: center;
  padding: 16px 0 6px;
  font-style: italic;
}

.todo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px dashed var(--hairline);
}

.todo-count {
  color: var(--sub);
  font-size: 12px;
}

.todo-footer .reset-btn {
  color: var(--accent);
  font-size: 12px;
  padding: 4px 8px;
}
